@managesome/eposmatic-toolkit 0.2.341 → 0.2.342-beta.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.
Files changed (40) hide show
  1. package/lib/constants/ENUMS.d.ts +35 -0
  2. package/lib/constants/ENUMS.js +48 -3
  3. package/lib/helpers/store/common-purchase-order-actions.d.ts +2 -2
  4. package/lib/helpers/store/purchase-orders-cart-actions.d.ts +7 -6
  5. package/lib/helpers/utils/index.d.ts +0 -1
  6. package/lib/helpers/utils/index.js +0 -1
  7. package/lib/helpers/utils/offer-apply-helpers.d.ts +1 -63
  8. package/lib/helpers/utils/offer-apply-helpers.js +3 -61
  9. package/lib/helpers/utils/offers-helpers.d.ts +4 -22
  10. package/lib/helpers/utils/offers-helpers.js +98 -254
  11. package/lib/schemas/models/index.d.ts +3 -0
  12. package/lib/schemas/models/index.js +3 -0
  13. package/lib/schemas/models/purchase_order_receipts.d.ts +165 -0
  14. package/lib/schemas/models/purchase_order_receipts.js +151 -0
  15. package/lib/schemas/models/purchase_order_rfq.d.ts +1938 -0
  16. package/lib/schemas/models/purchase_order_rfq.js +309 -0
  17. package/lib/schemas/models/purchase_order_vendor_returns.d.ts +234 -0
  18. package/lib/schemas/models/purchase_order_vendor_returns.js +188 -0
  19. package/lib/schemas/models/purchase_orders.d.ts +3 -0
  20. package/lib/schemas/models/purchase_orders.js +10 -1
  21. package/lib/schemas/models/void_purchase_order_items.js +2 -1
  22. package/lib/schemas/models/warehouse.d.ts +7 -1
  23. package/lib/schemas/models/warehouse.js +9 -0
  24. package/lib/schemas/models/warehouse_items.d.ts +19 -0
  25. package/lib/schemas/models/warehouse_items.js +29 -0
  26. package/lib/schemas/models/warehouse_vendors.d.ts +3 -3
  27. package/lib/schemas/types/index.d.ts +4 -0
  28. package/lib/schemas/types/index.js +4 -0
  29. package/lib/schemas/types/purchase_order_common.d.ts +39 -0
  30. package/lib/schemas/types/purchase_order_common.js +2 -0
  31. package/lib/schemas/types/purchase_order_receipts.d.ts +33 -0
  32. package/lib/schemas/types/purchase_order_receipts.js +2 -0
  33. package/lib/schemas/types/purchase_order_rfq.d.ts +25 -0
  34. package/lib/schemas/types/purchase_order_rfq.js +2 -0
  35. package/lib/schemas/types/purchase_order_vendor_returns.d.ts +42 -0
  36. package/lib/schemas/types/purchase_order_vendor_returns.js +2 -0
  37. package/lib/schemas/types/purchase_orders.d.ts +7 -43
  38. package/lib/schemas/types/warehouse.d.ts +3 -1
  39. package/lib/schemas/types/warehouse_items.d.ts +7 -1
  40. package/package.json +2 -2
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PURCHASE_ORDER_VENDOR_RETURNS_COLLECTION_NAME = exports.PurchaseOrderVendorReturnsSchema = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const constants_1 = require("../../constants");
6
+ const purchase_orders_1 = require("./purchase_orders");
7
+ const warehouse_items_1 = require("./warehouse_items");
8
+ const warehouse_1 = require("./warehouse");
9
+ const warehouse_vendors_1 = require("./warehouse_vendors");
10
+ const PurchaseOrderVendorReturnActorSchema = new mongoose_1.Schema({
11
+ _id: {
12
+ type: String,
13
+ required: true,
14
+ },
15
+ name: {
16
+ type: String,
17
+ required: true,
18
+ default: '',
19
+ },
20
+ }, { _id: false, minimize: false });
21
+ const PurchaseOrderVendorReturnItemsSchema = new mongoose_1.Schema({
22
+ _id: {
23
+ type: mongoose_1.Schema.Types.ObjectId,
24
+ required: true,
25
+ immutable: true,
26
+ },
27
+ item_id: {
28
+ type: mongoose_1.Schema.Types.ObjectId,
29
+ required: true,
30
+ immutable: true,
31
+ ref: warehouse_items_1.WAREHOUSE_ITEMS_COLLECTION_NAME,
32
+ },
33
+ name: {
34
+ type: String,
35
+ required: true,
36
+ },
37
+ ordered_quantity: {
38
+ type: Number,
39
+ min: 0,
40
+ required: true,
41
+ },
42
+ return_quantity: {
43
+ type: Number,
44
+ min: 0,
45
+ required: true,
46
+ },
47
+ price: {
48
+ type: Number,
49
+ min: 0,
50
+ required: true,
51
+ },
52
+ subtotal: {
53
+ type: Number,
54
+ min: 0,
55
+ required: true,
56
+ },
57
+ reason: {
58
+ type: String,
59
+ required: false,
60
+ },
61
+ }, {
62
+ _id: false,
63
+ minimize: false,
64
+ });
65
+ exports.PurchaseOrderVendorReturnsSchema = new mongoose_1.Schema({
66
+ _id: {
67
+ type: mongoose_1.Schema.Types.ObjectId,
68
+ required: true,
69
+ immutable: true,
70
+ },
71
+ warehouse_id: {
72
+ type: String,
73
+ required: true,
74
+ ref: warehouse_1.WAREHOUSE_SETTINGS_COLLECTION_NAME,
75
+ },
76
+ purchase_order_id: {
77
+ type: mongoose_1.Schema.Types.ObjectId,
78
+ required: true,
79
+ ref: purchase_orders_1.PURCHASE_ORDER_COLLECTION_NAME,
80
+ },
81
+ vendor_id: {
82
+ type: mongoose_1.Schema.Types.ObjectId,
83
+ required: true,
84
+ ref: warehouse_vendors_1.WAREHOUSE_VENDORS_COLLECTION_NAME,
85
+ },
86
+ vendor_name: {
87
+ type: String,
88
+ default: '',
89
+ },
90
+ return_status: {
91
+ type: String,
92
+ enum: constants_1.ALL_PURCHASE_ORDER_VENDOR_RETURN_STATUS_NAMES,
93
+ required: true,
94
+ default: constants_1.PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM.CREATED,
95
+ },
96
+ inventory_consumed: {
97
+ type: Boolean,
98
+ required: true,
99
+ default: false,
100
+ },
101
+ items: {
102
+ type: [PurchaseOrderVendorReturnItemsSchema],
103
+ required: true,
104
+ default: [],
105
+ },
106
+ total_return_amount: {
107
+ type: Number,
108
+ min: 0,
109
+ required: true,
110
+ },
111
+ notes: {
112
+ type: String,
113
+ required: false,
114
+ },
115
+ created_by: {
116
+ type: PurchaseOrderVendorReturnActorSchema,
117
+ required: false,
118
+ },
119
+ approved_by: {
120
+ type: PurchaseOrderVendorReturnActorSchema,
121
+ required: false,
122
+ },
123
+ dispatched_by: {
124
+ type: PurchaseOrderVendorReturnActorSchema,
125
+ required: false,
126
+ },
127
+ vendor_confirmed_by: {
128
+ type: PurchaseOrderVendorReturnActorSchema,
129
+ required: false,
130
+ },
131
+ completed_by: {
132
+ type: PurchaseOrderVendorReturnActorSchema,
133
+ required: false,
134
+ },
135
+ cancelled_by: {
136
+ type: PurchaseOrderVendorReturnActorSchema,
137
+ required: false,
138
+ },
139
+ approved_at: {
140
+ type: mongoose_1.Schema.Types.Date,
141
+ required: false,
142
+ },
143
+ dispatched_at: {
144
+ type: mongoose_1.Schema.Types.Date,
145
+ required: false,
146
+ },
147
+ vendor_confirmed_at: {
148
+ type: mongoose_1.Schema.Types.Date,
149
+ required: false,
150
+ },
151
+ completed_at: {
152
+ type: mongoose_1.Schema.Types.Date,
153
+ required: false,
154
+ },
155
+ cancelled_at: {
156
+ type: mongoose_1.Schema.Types.Date,
157
+ required: false,
158
+ },
159
+ cancel_reason: {
160
+ type: String,
161
+ required: false,
162
+ },
163
+ createdAt_mins: {
164
+ type: Number,
165
+ required: true,
166
+ immutable: true,
167
+ default: () => {
168
+ const date = new Date();
169
+ return Math.floor(date.getHours() * 60 + date.getMinutes());
170
+ },
171
+ },
172
+ createdAt: {
173
+ type: mongoose_1.Schema.Types.Date,
174
+ required: true,
175
+ default: () => new Date(),
176
+ immutable: true,
177
+ },
178
+ updatedAt: {
179
+ type: mongoose_1.Schema.Types.Date,
180
+ required: true,
181
+ default: () => new Date(),
182
+ },
183
+ }, {
184
+ timestamps: true,
185
+ versionKey: false,
186
+ minimize: false,
187
+ });
188
+ exports.PURCHASE_ORDER_VENDOR_RETURNS_COLLECTION_NAME = 'vendor_returns';
@@ -891,6 +891,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
891
891
  gst?: number | null | undefined;
892
892
  gst_amount?: number | null | undefined;
893
893
  is_gst_inclusive?: boolean | null | undefined;
894
+ rfq_id?: import("mongoose").Types.ObjectId | null | undefined;
894
895
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
895
896
  createdAt: NativeDate;
896
897
  updatedAt: NativeDate;
@@ -1779,6 +1780,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
1779
1780
  gst?: number | null | undefined;
1780
1781
  gst_amount?: number | null | undefined;
1781
1782
  is_gst_inclusive?: boolean | null | undefined;
1783
+ rfq_id?: import("mongoose").Types.ObjectId | null | undefined;
1782
1784
  }>> & import("mongoose").FlatRecord<{
1783
1785
  createdAt: NativeDate;
1784
1786
  updatedAt: NativeDate;
@@ -2667,6 +2669,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
2667
2669
  gst?: number | null | undefined;
2668
2670
  gst_amount?: number | null | undefined;
2669
2671
  is_gst_inclusive?: boolean | null | undefined;
2672
+ rfq_id?: import("mongoose").Types.ObjectId | null | undefined;
2670
2673
  }> & Required<{
2671
2674
  _id: import("mongoose").Types.ObjectId;
2672
2675
  }> & {
@@ -4,6 +4,9 @@ exports.PURCHASE_ORDER_COLLECTION_NAME = exports.PurchaseOrderSchema = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const constants_1 = require("../../constants");
6
6
  const common_models_1 = require("./common-models");
7
+ const purchase_order_rfq_1 = require("./purchase_order_rfq");
8
+ const warehouse_categories_1 = require("./warehouse_categories");
9
+ const warehouse_items_1 = require("./warehouse_items");
7
10
  const warehouse_1 = require("./warehouse");
8
11
  const warehouse_vendors_1 = require("./warehouse_vendors");
9
12
  const StaffDetailsSchema = new mongoose_1.Schema({
@@ -34,6 +37,7 @@ const ItemsModal = new mongoose_1.Schema({
34
37
  type: mongoose_1.Schema.Types.ObjectId,
35
38
  required: true,
36
39
  immutable: true,
40
+ ref: warehouse_items_1.WAREHOUSE_ITEMS_COLLECTION_NAME,
37
41
  },
38
42
  is_ready: {
39
43
  type: Boolean,
@@ -92,7 +96,7 @@ const CatergoriesSchema = new mongoose_1.Schema({
92
96
  type: mongoose_1.Schema.Types.ObjectId,
93
97
  required: true,
94
98
  immutable: true,
95
- ref: 'warehouse_categories',
99
+ ref: warehouse_categories_1.WAREHOUSE_CATEGORY_COLLECTION_NAME,
96
100
  },
97
101
  name: {
98
102
  type: String,
@@ -190,6 +194,11 @@ exports.PurchaseOrderSchema = new mongoose_1.Schema({
190
194
  type: String,
191
195
  default: '',
192
196
  },
197
+ rfq_id: {
198
+ type: mongoose_1.Schema.Types.ObjectId,
199
+ required: false,
200
+ ref: purchase_order_rfq_1.PURCHASE_ORDER_RFQ_COLLECTION_NAME,
201
+ },
193
202
  categories: {
194
203
  type: [CatergoriesSchema],
195
204
  default: [],
@@ -4,6 +4,7 @@ exports.VOID_PURCHASE_ORDER_ITEMS_COLLECTION_NAME = exports.VoidPurchaseOrderIte
4
4
  const mongoose_1 = require("mongoose");
5
5
  const constants_1 = require("../../constants");
6
6
  const purchase_orders_1 = require("./purchase_orders");
7
+ const warehouse_items_1 = require("./warehouse_items");
7
8
  const warehouse_1 = require("./warehouse");
8
9
  const warehouse_vendors_1 = require("./warehouse_vendors");
9
10
  const VoidPurchaseOrderItemAdjustmentSchema = new mongoose_1.Schema({
@@ -75,7 +76,7 @@ exports.VoidPurchaseOrderItemSchema = new mongoose_1.Schema({
75
76
  type: mongoose_1.Schema.Types.ObjectId,
76
77
  required: true,
77
78
  immutable: true,
78
- ref: 'items',
79
+ ref: warehouse_items_1.WAREHOUSE_ITEMS_COLLECTION_NAME,
79
80
  },
80
81
  order_item_id: {
81
82
  type: mongoose_1.Schema.Types.ObjectId,
@@ -1,5 +1,5 @@
1
1
  import { Schema } from 'mongoose';
2
- import { COUNTRY_ALPHA_2_ENUM, COUNTRY_ALPHA_3_ENUM, COUNTRY_CODE_ENUM, COUNTRY_FLAG_ENUM, COUNTRY_NAME_ENUM, CURRENCY_CODE_ENUM, CURRENCY_NAME_ENUM, CURRENCY_SYMBOL_ENUM, GST_TYPE_ENUM, TRACK_ORDER_NUMBER_ENUM } from '../../constants';
2
+ import { COUNTRY_ALPHA_2_ENUM, COUNTRY_ALPHA_3_ENUM, COUNTRY_CODE_ENUM, COUNTRY_FLAG_ENUM, COUNTRY_NAME_ENUM, CURRENCY_CODE_ENUM, CURRENCY_NAME_ENUM, CURRENCY_SYMBOL_ENUM, GST_TYPE_ENUM, REMOVAL_STRATEGY_ENUM, TRACK_ORDER_NUMBER_ENUM } from '../../constants';
3
3
  export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
4
4
  timestamps: true;
5
5
  versionKey: false;
@@ -44,6 +44,8 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
44
44
  alert_phone_numbers: string[];
45
45
  alert_email_addresses: string[];
46
46
  alert_when: string[];
47
+ enable_lot_serial_tracking: boolean;
48
+ default_removal_strategy: REMOVAL_STRATEGY_ENUM;
47
49
  po_custom_payment_types: string[];
48
50
  invoice_custom_payment_types: string[];
49
51
  exclude_discount_from_gst?: boolean | null | undefined;
@@ -92,6 +94,8 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
92
94
  alert_phone_numbers: string[];
93
95
  alert_email_addresses: string[];
94
96
  alert_when: string[];
97
+ enable_lot_serial_tracking: boolean;
98
+ default_removal_strategy: REMOVAL_STRATEGY_ENUM;
95
99
  po_custom_payment_types: string[];
96
100
  invoice_custom_payment_types: string[];
97
101
  exclude_discount_from_gst?: boolean | null | undefined;
@@ -140,6 +144,8 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
140
144
  alert_phone_numbers: string[];
141
145
  alert_email_addresses: string[];
142
146
  alert_when: string[];
147
+ enable_lot_serial_tracking: boolean;
148
+ default_removal_strategy: REMOVAL_STRATEGY_ENUM;
143
149
  po_custom_payment_types: string[];
144
150
  invoice_custom_payment_types: string[];
145
151
  exclude_discount_from_gst?: boolean | null | undefined;
@@ -186,6 +186,15 @@ exports.WarehouseSchema = new mongoose_1.Schema({
186
186
  type: [String],
187
187
  default: [],
188
188
  },
189
+ enable_lot_serial_tracking: {
190
+ type: Boolean,
191
+ default: false,
192
+ },
193
+ default_removal_strategy: {
194
+ type: String,
195
+ enum: constants_1.ALL_REMOVAL_STRATEGY_TYPES,
196
+ default: constants_1.REMOVAL_STRATEGY_ENUM.FIFO,
197
+ },
189
198
  po_custom_payment_types: {
190
199
  type: [String],
191
200
  default: [],
@@ -1,4 +1,5 @@
1
1
  import { Schema } from 'mongoose';
2
+ import { TRACKING_MODE_ENUM } from '../../constants';
2
3
  export declare const WarehouseItemSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
3
4
  timestamps: true;
4
5
  versionKey: false;
@@ -43,6 +44,12 @@ export declare const WarehouseItemSchema: Schema<any, import("mongoose").Model<a
43
44
  purchase_price: {
44
45
  BASE_PRICE: number;
45
46
  };
47
+ tracking_mode: TRACKING_MODE_ENUM;
48
+ expiry_tracked: boolean;
49
+ expiration_days: number;
50
+ best_before_days: number;
51
+ removal_days: number;
52
+ alert_days: number;
46
53
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
47
54
  createdAt: NativeDate;
48
55
  updatedAt: NativeDate;
@@ -83,6 +90,12 @@ export declare const WarehouseItemSchema: Schema<any, import("mongoose").Model<a
83
90
  purchase_price: {
84
91
  BASE_PRICE: number;
85
92
  };
93
+ tracking_mode: TRACKING_MODE_ENUM;
94
+ expiry_tracked: boolean;
95
+ expiration_days: number;
96
+ best_before_days: number;
97
+ removal_days: number;
98
+ alert_days: number;
86
99
  }>> & import("mongoose").FlatRecord<{
87
100
  createdAt: NativeDate;
88
101
  updatedAt: NativeDate;
@@ -123,6 +136,12 @@ export declare const WarehouseItemSchema: Schema<any, import("mongoose").Model<a
123
136
  purchase_price: {
124
137
  BASE_PRICE: number;
125
138
  };
139
+ tracking_mode: TRACKING_MODE_ENUM;
140
+ expiry_tracked: boolean;
141
+ expiration_days: number;
142
+ best_before_days: number;
143
+ removal_days: number;
144
+ alert_days: number;
126
145
  }> & Required<{
127
146
  _id: import("mongoose").Types.ObjectId;
128
147
  }> & {
@@ -108,6 +108,35 @@ exports.WarehouseItemSchema = new mongoose_1.Schema({
108
108
  type: String,
109
109
  default: null,
110
110
  },
111
+ tracking_mode: {
112
+ type: String,
113
+ enum: constants_1.ALL_TRACKING_MODES,
114
+ default: constants_1.TRACKING_MODE_ENUM.NONE,
115
+ },
116
+ expiry_tracked: {
117
+ type: Boolean,
118
+ default: false,
119
+ },
120
+ expiration_days: {
121
+ type: Number,
122
+ default: 0,
123
+ min: 0,
124
+ },
125
+ best_before_days: {
126
+ type: Number,
127
+ default: 0,
128
+ min: 0,
129
+ },
130
+ removal_days: {
131
+ type: Number,
132
+ default: 0,
133
+ min: 0,
134
+ },
135
+ alert_days: {
136
+ type: Number,
137
+ default: 0,
138
+ min: 0,
139
+ },
111
140
  createdAt: {
112
141
  type: mongoose_1.Schema.Types.Date,
113
142
  required: true,
@@ -27,8 +27,8 @@ export declare const WarehouseVendorsSchema: Schema<any, import("mongoose").Mode
27
27
  phone_number: string;
28
28
  uid: string;
29
29
  email: string;
30
- tax_business_number: string;
31
30
  warehouse_id: string;
31
+ tax_business_number: string;
32
32
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
33
33
  createdAt: NativeDate;
34
34
  updatedAt: NativeDate;
@@ -53,8 +53,8 @@ export declare const WarehouseVendorsSchema: Schema<any, import("mongoose").Mode
53
53
  phone_number: string;
54
54
  uid: string;
55
55
  email: string;
56
- tax_business_number: string;
57
56
  warehouse_id: string;
57
+ tax_business_number: string;
58
58
  }>> & import("mongoose").FlatRecord<{
59
59
  createdAt: NativeDate;
60
60
  updatedAt: NativeDate;
@@ -79,8 +79,8 @@ export declare const WarehouseVendorsSchema: Schema<any, import("mongoose").Mode
79
79
  phone_number: string;
80
80
  uid: string;
81
81
  email: string;
82
- tax_business_number: string;
83
82
  warehouse_id: string;
83
+ tax_business_number: string;
84
84
  }> & Required<{
85
85
  _id: import("mongoose").Types.ObjectId;
86
86
  }> & {
@@ -41,6 +41,10 @@ export * from './operational_roles';
41
41
  export * from './order';
42
42
  export * from './printer_settings';
43
43
  export * from './public_holidays';
44
+ export * from './purchase_order_common';
45
+ export * from './purchase_order_receipts';
46
+ export * from './purchase_order_rfq';
47
+ export * from './purchase_order_vendor_returns';
44
48
  export * from './purchase_orders';
45
49
  export * from './reservations';
46
50
  export * from './reviews';
@@ -57,6 +57,10 @@ __exportStar(require("./operational_roles"), exports);
57
57
  __exportStar(require("./order"), exports);
58
58
  __exportStar(require("./printer_settings"), exports);
59
59
  __exportStar(require("./public_holidays"), exports);
60
+ __exportStar(require("./purchase_order_common"), exports);
61
+ __exportStar(require("./purchase_order_receipts"), exports);
62
+ __exportStar(require("./purchase_order_rfq"), exports);
63
+ __exportStar(require("./purchase_order_vendor_returns"), exports);
60
64
  __exportStar(require("./purchase_orders"), exports);
61
65
  __exportStar(require("./reservations"), exports);
62
66
  __exportStar(require("./reviews"), exports);
@@ -0,0 +1,39 @@
1
+ import { IStaffDetails } from './order';
2
+ export interface IPurchaseOrderCommonItem {
3
+ _id: string;
4
+ item_id: string;
5
+ is_ready?: boolean;
6
+ void_reason?: string | null;
7
+ name: string;
8
+ price: number;
9
+ subtotal: number;
10
+ quantity: number;
11
+ _net_amount: number;
12
+ _gross_amount: number;
13
+ _gst_amount: number;
14
+ _discount_amount: number;
15
+ special_instructions: string;
16
+ }
17
+ export interface IPurchaseOrderCommonCategoryByCategoryId {
18
+ name: string;
19
+ category_id: string;
20
+ items: IPurchaseOrderCommonItem[];
21
+ }
22
+ export interface IPurchaseOrderCommonCategoryById {
23
+ _id: string;
24
+ name: string;
25
+ items: IPurchaseOrderCommonItem[];
26
+ }
27
+ export interface IPurchaseOrderCommonIterationBase<TCategory, TStatus> {
28
+ categories: TCategory[];
29
+ staff_details: IStaffDetails;
30
+ is_gst_inclusive?: boolean;
31
+ gst?: number | null;
32
+ gst_amount?: number | null;
33
+ special_instructions: string;
34
+ price: number;
35
+ amount_earned: number;
36
+ grand_total: number;
37
+ order_status: TStatus;
38
+ updatedAt: Date;
39
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,33 @@
1
+ import { PURCHASE_ORDER_RECEIPT_STATUS_ENUM } from '../../constants';
2
+ export interface IPurchaseOrderReceiptItem {
3
+ _id: string;
4
+ item_id: string;
5
+ name: string;
6
+ ordered_quantity: number;
7
+ received_quantity: number;
8
+ price: number;
9
+ subtotal: number;
10
+ }
11
+ export interface IPurchaseOrderReceiptActor {
12
+ _id: string;
13
+ name: string;
14
+ }
15
+ export interface IPurchaseOrderReceipt {
16
+ _id: string;
17
+ warehouse_id: string;
18
+ purchase_order_id: string;
19
+ vendor_id: string;
20
+ vendor_name: string;
21
+ receipt_status: PURCHASE_ORDER_RECEIPT_STATUS_ENUM;
22
+ items: IPurchaseOrderReceiptItem[];
23
+ total_received_amount: number;
24
+ notes?: string | null;
25
+ created_by?: IPurchaseOrderReceiptActor | null;
26
+ validated_by?: IPurchaseOrderReceiptActor | null;
27
+ validated_at?: Date | null;
28
+ cancelled_at?: Date | null;
29
+ cancel_reason?: string | null;
30
+ createdAt_mins: number;
31
+ createdAt: Date;
32
+ updatedAt: Date;
33
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,25 @@
1
+ import { PURCHASE_ORDER_RFQ_STATUS_ENUM } from '../../constants';
2
+ import { IPurchaseOrderCommonCategoryByCategoryId, IPurchaseOrderCommonItem, IPurchaseOrderCommonIterationBase } from './purchase_order_common';
3
+ export type IPurchaseOrderRFQItem = IPurchaseOrderCommonItem;
4
+ export type IPurchaseOrderRFQCategory = IPurchaseOrderCommonCategoryByCategoryId;
5
+ export interface IPurchaseOrderRFQIteration extends IPurchaseOrderCommonIterationBase<IPurchaseOrderRFQCategory, PURCHASE_ORDER_RFQ_STATUS_ENUM | string> {
6
+ tax_number: string;
7
+ }
8
+ export interface IPurchaseOrderRFQ extends IPurchaseOrderRFQIteration {
9
+ _id: string;
10
+ warehouse_id: string;
11
+ vendor_id: string;
12
+ vendor_name: string;
13
+ iterations: IPurchaseOrderRFQIteration[];
14
+ order_number: number | null;
15
+ expected_deadline: string;
16
+ payment_terms: number;
17
+ delete_reason?: string | null;
18
+ cancel_reason?: string | null;
19
+ is_deleted: boolean;
20
+ order_status_updated_at: Date;
21
+ special_instructions: string;
22
+ is_reopened?: boolean;
23
+ createdAt_mins: number;
24
+ createdAt: Date;
25
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,42 @@
1
+ import { PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM } from '../../constants';
2
+ export interface IPurchaseOrderVendorReturnItem {
3
+ _id: string;
4
+ item_id: string;
5
+ name: string;
6
+ ordered_quantity: number;
7
+ return_quantity: number;
8
+ price: number;
9
+ subtotal: number;
10
+ reason?: string | null;
11
+ }
12
+ export interface IPurchaseOrderVendorReturnActor {
13
+ _id: string;
14
+ name: string;
15
+ }
16
+ export interface IPurchaseOrderVendorReturn {
17
+ _id: string;
18
+ warehouse_id: string;
19
+ purchase_order_id: string;
20
+ vendor_id: string;
21
+ vendor_name: string;
22
+ return_status: PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM;
23
+ inventory_consumed: boolean;
24
+ items: IPurchaseOrderVendorReturnItem[];
25
+ total_return_amount: number;
26
+ notes?: string | null;
27
+ created_by?: IPurchaseOrderVendorReturnActor | null;
28
+ approved_by?: IPurchaseOrderVendorReturnActor | null;
29
+ dispatched_by?: IPurchaseOrderVendorReturnActor | null;
30
+ vendor_confirmed_by?: IPurchaseOrderVendorReturnActor | null;
31
+ completed_by?: IPurchaseOrderVendorReturnActor | null;
32
+ cancelled_by?: IPurchaseOrderVendorReturnActor | null;
33
+ approved_at?: Date | null;
34
+ dispatched_at?: Date | null;
35
+ vendor_confirmed_at?: Date | null;
36
+ completed_at?: Date | null;
37
+ cancelled_at?: Date | null;
38
+ cancel_reason?: string | null;
39
+ createdAt_mins: number;
40
+ createdAt: Date;
41
+ updatedAt: Date;
42
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,55 +1,19 @@
1
1
  import { PURCHASE_ORDER_STATUS_ENUM } from '../../constants';
2
- import { IOrderPayment, IStaffDetails } from './order';
3
- export interface IPurchaseOrderItem {
4
- _id: string;
5
- item_id: string;
6
- is_ready?: boolean;
7
- void_reason?: string;
8
- name: string;
9
- price: number;
10
- subtotal: number;
11
- quantity: number;
12
- _net_amount: number;
13
- _gross_amount: number;
14
- _gst_amount: number;
15
- _discount_amount: number;
16
- special_instructions: string;
17
- }
18
- export interface IPurchaseOrderCategory {
19
- name: string;
20
- category_id: string;
21
- items: IPurchaseOrderItem[];
22
- }
23
- export interface IPurchaseOrderIteration {
24
- categories: IPurchaseOrderCategory[];
2
+ import { IOrderPayment } from './order';
3
+ import { IPurchaseOrderCommonCategoryByCategoryId, IPurchaseOrderCommonItem, IPurchaseOrderCommonIterationBase } from './purchase_order_common';
4
+ export type IPurchaseOrderItem = IPurchaseOrderCommonItem;
5
+ export type IPurchaseOrderCategory = IPurchaseOrderCommonCategoryByCategoryId;
6
+ export interface IPurchaseOrderIteration extends IPurchaseOrderCommonIterationBase<IPurchaseOrderCategory, PURCHASE_ORDER_STATUS_ENUM> {
25
7
  payments: IOrderPayment[];
26
- staff_details: IStaffDetails;
27
- is_gst_inclusive?: boolean;
28
- gst?: number;
29
- gst_amount?: number;
30
- special_instructions: string;
31
- order_status: PURCHASE_ORDER_STATUS_ENUM;
32
- /**
33
- * price is the total price of the all items in the order
34
- * without any discounts
35
- */
36
- price: number;
37
- /**
38
- * amount_earned is the total amount amount_earned by the store
39
- */
40
- amount_earned: number;
41
- /**
42
- * grand_total is the final amount of the order including all taxes and discounts
43
- */
44
- grand_total: number;
45
8
  tax_number: string;
46
- updatedAt: Date;
47
9
  }
48
10
  export interface IPurchaseOrder extends IPurchaseOrderIteration {
49
11
  _id: string;
50
12
  warehouse_id: string;
51
13
  vendor_id: string;
52
14
  vendor_name: string;
15
+ /** Source RFQ reference when this PO is converted from an RFQ. */
16
+ rfq_id?: string | null;
53
17
  iterations: IPurchaseOrderIteration[];
54
18
  /**
55
19
  * amount_collected is the total amount collected from the consumer