@managesome/eposmatic-toolkit 0.2.453 → 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.
@@ -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
+ }
@@ -0,0 +1,16 @@
1
+ import { IWarehouseSaleOrderFinancialLine, IWarehouseSaleOrderInvoice } from '../../schemas';
2
+ /**
3
+ * Convert unit_price on every financial line (invoice items).
4
+ */
5
+ export declare function getWarehouseSaleOrderInvoiceLinesWithPrice(lines: IWarehouseSaleOrderFinancialLine[] | undefined, convertToPrice: (price: number) => number): IWarehouseSaleOrderFinancialLine[];
6
+ /**
7
+ * Convert payments on a sale-order invoice.
8
+ */
9
+ export declare function getWarehouseSaleOrderInvoicePaymentsWithPrice(payments: IWarehouseSaleOrderInvoice['payments'] | undefined, convertToPrice: (price: number) => number): IWarehouseSaleOrderInvoice['payments'];
10
+ /**
11
+ * Convert all monetary fields on a sale-order invoice / credit note.
12
+ *
13
+ * - `writeable = true` → decimal → cents (before sending to backend)
14
+ * - `writeable = false` → cents → decimal (after receiving from backend)
15
+ */
16
+ export declare function getWarehouseSaleOrderInvoiceWithPrice<T extends Partial<IWarehouseSaleOrderInvoice> | IWarehouseSaleOrderInvoice>(order: T, writeable?: boolean): T;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWarehouseSaleOrderInvoiceLinesWithPrice = getWarehouseSaleOrderInvoiceLinesWithPrice;
4
+ exports.getWarehouseSaleOrderInvoicePaymentsWithPrice = getWarehouseSaleOrderInvoicePaymentsWithPrice;
5
+ exports.getWarehouseSaleOrderInvoiceWithPrice = getWarehouseSaleOrderInvoiceWithPrice;
6
+ const utils_1 = require("../utils");
7
+ const common_order_actions_1 = require("./common-order-actions");
8
+ /**
9
+ * Convert unit_price on every financial line (invoice items).
10
+ */
11
+ function getWarehouseSaleOrderInvoiceLinesWithPrice(lines, convertToPrice) {
12
+ if (!lines)
13
+ return [];
14
+ return lines.map((line) => ({
15
+ ...line,
16
+ unit_price: convertToPrice(line.unit_price),
17
+ }));
18
+ }
19
+ /**
20
+ * Convert payments on a sale-order invoice.
21
+ */
22
+ function getWarehouseSaleOrderInvoicePaymentsWithPrice(payments, convertToPrice) {
23
+ if (!payments)
24
+ return [];
25
+ return payments.map((payment) => ({
26
+ ...payment,
27
+ card_details: (0, common_order_actions_1.getOrderPaymentsCardDetailsWithPrice)(payment.card_details, convertToPrice),
28
+ amount_paid: convertToPrice(payment.amount_paid),
29
+ amount_due: convertToPrice(payment.amount_due),
30
+ amount_refunded: convertToPrice(payment.amount_refunded),
31
+ }));
32
+ }
33
+ /**
34
+ * Convert all monetary fields on a sale-order invoice / credit note.
35
+ *
36
+ * - `writeable = true` → decimal → cents (before sending to backend)
37
+ * - `writeable = false` → cents → decimal (after receiving from backend)
38
+ */
39
+ function getWarehouseSaleOrderInvoiceWithPrice(order, writeable) {
40
+ const convertToPrice = writeable ? utils_1.convertDecimalToInt : utils_1.convertIntToDecimal;
41
+ return {
42
+ ...order,
43
+ ...(order.items != null
44
+ ? {
45
+ items: getWarehouseSaleOrderInvoiceLinesWithPrice(order.items, convertToPrice),
46
+ }
47
+ : {}),
48
+ ...(order.payments != null
49
+ ? {
50
+ payments: getWarehouseSaleOrderInvoicePaymentsWithPrice(order.payments, convertToPrice),
51
+ }
52
+ : {}),
53
+ ...(order.amount != null ? { amount: convertToPrice(order.amount) } : {}),
54
+ ...(order.amount_paid != null ? { amount_paid: convertToPrice(order.amount_paid) } : {}),
55
+ ...(order.down_payment_value != null ? { down_payment_value: convertToPrice(order.down_payment_value) } : {}),
56
+ ...(order.gst != null ? { gst: convertToPrice(order.gst) } : {}),
57
+ ...(order.gst_amount != null ? { gst_amount: convertToPrice(order.gst_amount) } : {}),
58
+ };
59
+ }
@@ -9,10 +9,13 @@ 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';
18
+ export * from './common-warehouse-sale-order-invoice-actions';
16
19
  export * from './common-warehouse-sale-order-rfq-actions';
17
20
  export * from './offline-ordering';
18
21
  export * from './tenant-purchase-orders-cart-actions';
@@ -25,10 +25,13 @@ __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);
34
+ __exportStar(require("./common-warehouse-sale-order-invoice-actions"), exports);
32
35
  __exportStar(require("./common-warehouse-sale-order-rfq-actions"), exports);
33
36
  __exportStar(require("./offline-ordering"), exports);
34
37
  __exportStar(require("./tenant-purchase-orders-cart-actions"), exports);
@@ -22,9 +22,9 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
22
22
  subtotal: number;
23
23
  payment_terms: string;
24
24
  notes: string;
25
+ invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
25
26
  customer_id: import("mongoose").Types.ObjectId;
26
27
  invoice_number: string;
27
- invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
28
28
  hardware: string[];
29
29
  currency: import("../../constants").CURRENCY_CODE_ENUM;
30
30
  dqrc: string;
@@ -50,9 +50,9 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
50
50
  subtotal: number;
51
51
  payment_terms: string;
52
52
  notes: string;
53
+ invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
53
54
  customer_id: import("mongoose").Types.ObjectId;
54
55
  invoice_number: string;
55
- invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
56
56
  hardware: string[];
57
57
  currency: import("../../constants").CURRENCY_CODE_ENUM;
58
58
  dqrc: string;
@@ -78,9 +78,9 @@ export declare const InternalInvoiceSchema: Schema<any, import("mongoose").Model
78
78
  subtotal: number;
79
79
  payment_terms: string;
80
80
  notes: string;
81
+ invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
81
82
  customer_id: import("mongoose").Types.ObjectId;
82
83
  invoice_number: string;
83
- invoice_type: import("../../constants").INTERNAL_INVOICE_TYPE_ENUM;
84
84
  hardware: string[];
85
85
  currency: import("../../constants").CURRENCY_CODE_ENUM;
86
86
  dqrc: 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;
@@ -36,9 +36,9 @@ export declare const WarehouseSaleOrderInvoiceSchema: Schema<any, import("mongoo
36
36
  payments: any[];
37
37
  warehouse_id: string;
38
38
  doc_number: number;
39
- invoice_type: import("../../constants").WAREHOUSE_SALE_ORDER_INVOICE_TYPE_ENUM;
40
39
  doc_kind: import("../../constants").WAREHOUSE_SALE_ORDER_FIN_DOC_KIND_ENUM;
41
40
  sale_order_id: import("mongoose").Types.ObjectId;
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;
44
44
  is_gst_inclusive?: boolean | null | undefined;
@@ -108,9 +108,9 @@ export declare const WarehouseSaleOrderInvoiceSchema: Schema<any, import("mongoo
108
108
  payments: any[];
109
109
  warehouse_id: string;
110
110
  doc_number: number;
111
- invoice_type: import("../../constants").WAREHOUSE_SALE_ORDER_INVOICE_TYPE_ENUM;
112
111
  doc_kind: import("../../constants").WAREHOUSE_SALE_ORDER_FIN_DOC_KIND_ENUM;
113
112
  sale_order_id: import("mongoose").Types.ObjectId;
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;
116
116
  is_gst_inclusive?: boolean | null | undefined;
@@ -180,9 +180,9 @@ export declare const WarehouseSaleOrderInvoiceSchema: Schema<any, import("mongoo
180
180
  payments: any[];
181
181
  warehouse_id: string;
182
182
  doc_number: number;
183
- invoice_type: import("../../constants").WAREHOUSE_SALE_ORDER_INVOICE_TYPE_ENUM;
184
183
  doc_kind: import("../../constants").WAREHOUSE_SALE_ORDER_FIN_DOC_KIND_ENUM;
185
184
  sale_order_id: import("mongoose").Types.ObjectId;
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;
188
188
  is_gst_inclusive?: boolean | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.2.453",
3
+ "version": "0.2.455",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",