@managesome/eposmatic-toolkit 0.2.454 → 0.2.455
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/helpers/store/common-warehouse-internal-movement-actions.d.ts +12 -0
- package/lib/helpers/store/common-warehouse-internal-movement-actions.js +33 -0
- package/lib/helpers/store/common-warehouse-purchase-order-receipt-actions.d.ts +12 -0
- package/lib/helpers/store/common-warehouse-purchase-order-receipt-actions.js +37 -0
- package/lib/helpers/store/index.d.ts +2 -0
- package/lib/helpers/store/index.js +2 -0
- package/lib/schemas/models/warehouse_internal_movements.d.ts +3 -3
- package/lib/schemas/models/warehouse_inventory_lot_serial_numbers.d.ts +3 -3
- package/lib/schemas/models/warehouse_sale_deliveries.d.ts +3 -3
- package/lib/schemas/models/warehouse_sale_invoices.d.ts +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IWarehouseInternalMovement, IWarehouseInternalMovementItem } from '../../schemas';
|
|
2
|
+
/**
|
|
3
|
+
* Convert unit_price on every internal movement item.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getWarehouseInternalMovementItemsWithPrice(items: IWarehouseInternalMovementItem[] | undefined, convertToPrice: (price: number) => number): IWarehouseInternalMovementItem[];
|
|
6
|
+
/**
|
|
7
|
+
* Convert all monetary fields on an internal movement.
|
|
8
|
+
*
|
|
9
|
+
* - `writeable = true` → decimal → cents (before sending to backend)
|
|
10
|
+
* - `writeable = false` → cents → decimal (after receiving from backend)
|
|
11
|
+
*/
|
|
12
|
+
export declare function getWarehouseInternalMovementWithPrice<T extends Partial<IWarehouseInternalMovement> | IWarehouseInternalMovement>(order: T, writeable?: boolean): T;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWarehouseInternalMovementItemsWithPrice = getWarehouseInternalMovementItemsWithPrice;
|
|
4
|
+
exports.getWarehouseInternalMovementWithPrice = getWarehouseInternalMovementWithPrice;
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
/**
|
|
7
|
+
* Convert unit_price on every internal movement item.
|
|
8
|
+
*/
|
|
9
|
+
function getWarehouseInternalMovementItemsWithPrice(items, convertToPrice) {
|
|
10
|
+
if (!items)
|
|
11
|
+
return [];
|
|
12
|
+
return items.map((item) => ({
|
|
13
|
+
...item,
|
|
14
|
+
unit_price: item.unit_price != null ? convertToPrice(item.unit_price) : undefined,
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Convert all monetary fields on an internal movement.
|
|
19
|
+
*
|
|
20
|
+
* - `writeable = true` → decimal → cents (before sending to backend)
|
|
21
|
+
* - `writeable = false` → cents → decimal (after receiving from backend)
|
|
22
|
+
*/
|
|
23
|
+
function getWarehouseInternalMovementWithPrice(order, writeable) {
|
|
24
|
+
const convertToPrice = writeable ? utils_1.convertDecimalToInt : utils_1.convertIntToDecimal;
|
|
25
|
+
return {
|
|
26
|
+
...order,
|
|
27
|
+
...(order.items != null
|
|
28
|
+
? {
|
|
29
|
+
items: getWarehouseInternalMovementItemsWithPrice(order.items, convertToPrice),
|
|
30
|
+
}
|
|
31
|
+
: {}),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IWarehousePurchaseOrderReceipt, IWarehousePurchaseOrderReceiptItem } from '../../schemas';
|
|
2
|
+
/**
|
|
3
|
+
* Convert price, subtotal on every receipt item.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getWarehousePurchaseOrderReceiptItemsWithPrice(items: IWarehousePurchaseOrderReceiptItem[] | undefined, convertToPrice: (price: number) => number): IWarehousePurchaseOrderReceiptItem[];
|
|
6
|
+
/**
|
|
7
|
+
* Convert all monetary fields on a purchase order receipt.
|
|
8
|
+
*
|
|
9
|
+
* - `writeable = true` → decimal → cents (before sending to backend)
|
|
10
|
+
* - `writeable = false` → cents → decimal (after receiving from backend)
|
|
11
|
+
*/
|
|
12
|
+
export declare function getWarehousePurchaseOrderReceiptWithPrice<T extends Partial<IWarehousePurchaseOrderReceipt> | IWarehousePurchaseOrderReceipt>(order: T, writeable?: boolean): T;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWarehousePurchaseOrderReceiptItemsWithPrice = getWarehousePurchaseOrderReceiptItemsWithPrice;
|
|
4
|
+
exports.getWarehousePurchaseOrderReceiptWithPrice = getWarehousePurchaseOrderReceiptWithPrice;
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
/**
|
|
7
|
+
* Convert price, subtotal on every receipt item.
|
|
8
|
+
*/
|
|
9
|
+
function getWarehousePurchaseOrderReceiptItemsWithPrice(items, convertToPrice) {
|
|
10
|
+
if (!items)
|
|
11
|
+
return [];
|
|
12
|
+
return items.map((item) => ({
|
|
13
|
+
...item,
|
|
14
|
+
price: convertToPrice(item.price),
|
|
15
|
+
subtotal: convertToPrice(item.subtotal),
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Convert all monetary fields on a purchase order receipt.
|
|
20
|
+
*
|
|
21
|
+
* - `writeable = true` → decimal → cents (before sending to backend)
|
|
22
|
+
* - `writeable = false` → cents → decimal (after receiving from backend)
|
|
23
|
+
*/
|
|
24
|
+
function getWarehousePurchaseOrderReceiptWithPrice(order, writeable) {
|
|
25
|
+
const convertToPrice = writeable ? utils_1.convertDecimalToInt : utils_1.convertIntToDecimal;
|
|
26
|
+
return {
|
|
27
|
+
...order,
|
|
28
|
+
...(order.items != null
|
|
29
|
+
? {
|
|
30
|
+
items: getWarehousePurchaseOrderReceiptItemsWithPrice(order.items, convertToPrice),
|
|
31
|
+
}
|
|
32
|
+
: {}),
|
|
33
|
+
...(order.total_received_amount != null
|
|
34
|
+
? { total_received_amount: convertToPrice(order.total_received_amount) }
|
|
35
|
+
: {}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -9,7 +9,9 @@ export * from './catalog-actions';
|
|
|
9
9
|
export * from './common-order-actions';
|
|
10
10
|
export * from './common-tenant-purchase-order-actions';
|
|
11
11
|
export * from './common-warehouse-invoice-actions';
|
|
12
|
+
export * from './common-warehouse-internal-movement-actions';
|
|
12
13
|
export * from './common-warehouse-purchase-order-actions';
|
|
14
|
+
export * from './common-warehouse-purchase-order-receipt-actions';
|
|
13
15
|
export * from './common-warehouse-purchase-order-rfq-actions';
|
|
14
16
|
export * from './common-warehouse-purchase-order-vendor-return-actions';
|
|
15
17
|
export * from './common-warehouse-sale-order-actions';
|
|
@@ -25,7 +25,9 @@ __exportStar(require("./catalog-actions"), exports);
|
|
|
25
25
|
__exportStar(require("./common-order-actions"), exports);
|
|
26
26
|
__exportStar(require("./common-tenant-purchase-order-actions"), exports);
|
|
27
27
|
__exportStar(require("./common-warehouse-invoice-actions"), exports);
|
|
28
|
+
__exportStar(require("./common-warehouse-internal-movement-actions"), exports);
|
|
28
29
|
__exportStar(require("./common-warehouse-purchase-order-actions"), exports);
|
|
30
|
+
__exportStar(require("./common-warehouse-purchase-order-receipt-actions"), exports);
|
|
29
31
|
__exportStar(require("./common-warehouse-purchase-order-rfq-actions"), exports);
|
|
30
32
|
__exportStar(require("./common-warehouse-purchase-order-vendor-return-actions"), exports);
|
|
31
33
|
__exportStar(require("./common-warehouse-sale-order-actions"), exports);
|
|
@@ -46,8 +46,8 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
46
46
|
name: string;
|
|
47
47
|
uid: string;
|
|
48
48
|
};
|
|
49
|
-
doc_number: string;
|
|
50
49
|
ref_type: import("../../constants").WAREHOUSE_REF_TYPE_ENUM;
|
|
50
|
+
doc_number: string;
|
|
51
51
|
record_type: import("../../constants").WAREHOUSE_INTERNAL_MOVEMENT_RECORD_TYPE_ENUM;
|
|
52
52
|
flow: import("../../constants").WAREHOUSE_INTERNAL_MOVEMENT_FLOW_ENUM;
|
|
53
53
|
source_id: string;
|
|
@@ -164,8 +164,8 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
164
164
|
name: string;
|
|
165
165
|
uid: string;
|
|
166
166
|
};
|
|
167
|
-
doc_number: string;
|
|
168
167
|
ref_type: import("../../constants").WAREHOUSE_REF_TYPE_ENUM;
|
|
168
|
+
doc_number: string;
|
|
169
169
|
record_type: import("../../constants").WAREHOUSE_INTERNAL_MOVEMENT_RECORD_TYPE_ENUM;
|
|
170
170
|
flow: import("../../constants").WAREHOUSE_INTERNAL_MOVEMENT_FLOW_ENUM;
|
|
171
171
|
source_id: string;
|
|
@@ -282,8 +282,8 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
282
282
|
name: string;
|
|
283
283
|
uid: string;
|
|
284
284
|
};
|
|
285
|
-
doc_number: string;
|
|
286
285
|
ref_type: import("../../constants").WAREHOUSE_REF_TYPE_ENUM;
|
|
286
|
+
doc_number: string;
|
|
287
287
|
record_type: import("../../constants").WAREHOUSE_INTERNAL_MOVEMENT_RECORD_TYPE_ENUM;
|
|
288
288
|
flow: import("../../constants").WAREHOUSE_INTERNAL_MOVEMENT_FLOW_ENUM;
|
|
289
289
|
source_id: string;
|
|
@@ -13,8 +13,8 @@ export declare const WarehouseInventoryLotSerialNumberSchema: Schema<any, import
|
|
|
13
13
|
updatedAt: NativeDate;
|
|
14
14
|
inventory_code: string;
|
|
15
15
|
ref_id: string;
|
|
16
|
-
tracking_mode: WAREHOUSE_TRACKING_MODE_ENUM;
|
|
17
16
|
ref_type: string;
|
|
17
|
+
tracking_mode: WAREHOUSE_TRACKING_MODE_ENUM;
|
|
18
18
|
doc_type: WAREHOUSE_LOT_SERIAL_DOC_TYPE_ENUM;
|
|
19
19
|
source?: import("../../constants").WAREHOUSE_LOT_SERIAL_MOVEMENT_SOURCE_ENUM | null | undefined;
|
|
20
20
|
quantity?: number | null | undefined;
|
|
@@ -60,8 +60,8 @@ export declare const WarehouseInventoryLotSerialNumberSchema: Schema<any, import
|
|
|
60
60
|
updatedAt: NativeDate;
|
|
61
61
|
inventory_code: string;
|
|
62
62
|
ref_id: string;
|
|
63
|
-
tracking_mode: WAREHOUSE_TRACKING_MODE_ENUM;
|
|
64
63
|
ref_type: string;
|
|
64
|
+
tracking_mode: WAREHOUSE_TRACKING_MODE_ENUM;
|
|
65
65
|
doc_type: WAREHOUSE_LOT_SERIAL_DOC_TYPE_ENUM;
|
|
66
66
|
source?: import("../../constants").WAREHOUSE_LOT_SERIAL_MOVEMENT_SOURCE_ENUM | null | undefined;
|
|
67
67
|
quantity?: number | null | undefined;
|
|
@@ -107,8 +107,8 @@ export declare const WarehouseInventoryLotSerialNumberSchema: Schema<any, import
|
|
|
107
107
|
updatedAt: NativeDate;
|
|
108
108
|
inventory_code: string;
|
|
109
109
|
ref_id: string;
|
|
110
|
-
tracking_mode: WAREHOUSE_TRACKING_MODE_ENUM;
|
|
111
110
|
ref_type: string;
|
|
111
|
+
tracking_mode: WAREHOUSE_TRACKING_MODE_ENUM;
|
|
112
112
|
doc_type: WAREHOUSE_LOT_SERIAL_DOC_TYPE_ENUM;
|
|
113
113
|
source?: import("../../constants").WAREHOUSE_LOT_SERIAL_MOVEMENT_SOURCE_ENUM | null | undefined;
|
|
114
114
|
quantity?: number | null | undefined;
|
|
@@ -44,12 +44,12 @@ export declare const SaleOrderDeliveriesSchema: Schema<any, import("mongoose").M
|
|
|
44
44
|
name: string;
|
|
45
45
|
} | null | undefined;
|
|
46
46
|
cancelled_at?: NativeDate | null | undefined;
|
|
47
|
-
applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
48
47
|
delivered_at?: NativeDate | null | undefined;
|
|
49
48
|
delivered_by?: {
|
|
50
49
|
_id: string;
|
|
51
50
|
name: string;
|
|
52
51
|
} | null | undefined;
|
|
52
|
+
applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
53
53
|
inventory_restocked?: boolean | null | undefined;
|
|
54
54
|
returned_by?: {
|
|
55
55
|
_id: string;
|
|
@@ -96,12 +96,12 @@ export declare const SaleOrderDeliveriesSchema: Schema<any, import("mongoose").M
|
|
|
96
96
|
name: string;
|
|
97
97
|
} | null | undefined;
|
|
98
98
|
cancelled_at?: NativeDate | null | undefined;
|
|
99
|
-
applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
100
99
|
delivered_at?: NativeDate | null | undefined;
|
|
101
100
|
delivered_by?: {
|
|
102
101
|
_id: string;
|
|
103
102
|
name: string;
|
|
104
103
|
} | null | undefined;
|
|
104
|
+
applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
105
105
|
inventory_restocked?: boolean | null | undefined;
|
|
106
106
|
returned_by?: {
|
|
107
107
|
_id: string;
|
|
@@ -148,12 +148,12 @@ export declare const SaleOrderDeliveriesSchema: Schema<any, import("mongoose").M
|
|
|
148
148
|
name: string;
|
|
149
149
|
} | null | undefined;
|
|
150
150
|
cancelled_at?: NativeDate | null | undefined;
|
|
151
|
-
applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
152
151
|
delivered_at?: NativeDate | null | undefined;
|
|
153
152
|
delivered_by?: {
|
|
154
153
|
_id: string;
|
|
155
154
|
name: string;
|
|
156
155
|
} | null | undefined;
|
|
156
|
+
applied_to_doc_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
157
157
|
inventory_restocked?: boolean | null | undefined;
|
|
158
158
|
returned_by?: {
|
|
159
159
|
_id: string;
|
|
@@ -35,9 +35,9 @@ export declare const WarehouseSaleOrderInvoiceSchema: Schema<any, import("mongoo
|
|
|
35
35
|
amount: number;
|
|
36
36
|
payments: any[];
|
|
37
37
|
warehouse_id: string;
|
|
38
|
+
doc_number: number;
|
|
38
39
|
doc_kind: import("../../constants").WAREHOUSE_SALE_ORDER_FIN_DOC_KIND_ENUM;
|
|
39
40
|
sale_order_id: import("mongoose").Types.ObjectId;
|
|
40
|
-
doc_number: number;
|
|
41
41
|
invoice_type: import("../../constants").WAREHOUSE_SALE_ORDER_INVOICE_TYPE_ENUM;
|
|
42
42
|
amount_paid?: number | null | undefined;
|
|
43
43
|
cancel_reason?: string | null | undefined;
|
|
@@ -107,9 +107,9 @@ export declare const WarehouseSaleOrderInvoiceSchema: Schema<any, import("mongoo
|
|
|
107
107
|
amount: number;
|
|
108
108
|
payments: any[];
|
|
109
109
|
warehouse_id: string;
|
|
110
|
+
doc_number: number;
|
|
110
111
|
doc_kind: import("../../constants").WAREHOUSE_SALE_ORDER_FIN_DOC_KIND_ENUM;
|
|
111
112
|
sale_order_id: import("mongoose").Types.ObjectId;
|
|
112
|
-
doc_number: number;
|
|
113
113
|
invoice_type: import("../../constants").WAREHOUSE_SALE_ORDER_INVOICE_TYPE_ENUM;
|
|
114
114
|
amount_paid?: number | null | undefined;
|
|
115
115
|
cancel_reason?: string | null | undefined;
|
|
@@ -179,9 +179,9 @@ export declare const WarehouseSaleOrderInvoiceSchema: Schema<any, import("mongoo
|
|
|
179
179
|
amount: number;
|
|
180
180
|
payments: any[];
|
|
181
181
|
warehouse_id: string;
|
|
182
|
+
doc_number: number;
|
|
182
183
|
doc_kind: import("../../constants").WAREHOUSE_SALE_ORDER_FIN_DOC_KIND_ENUM;
|
|
183
184
|
sale_order_id: import("mongoose").Types.ObjectId;
|
|
184
|
-
doc_number: number;
|
|
185
185
|
invoice_type: import("../../constants").WAREHOUSE_SALE_ORDER_INVOICE_TYPE_ENUM;
|
|
186
186
|
amount_paid?: number | null | undefined;
|
|
187
187
|
cancel_reason?: string | null | undefined;
|