@managesome/eposmatic-toolkit 0.2.438 → 0.2.440

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 (27) hide show
  1. package/lib/constants/TENANT_ENUMS.d.ts +17 -0
  2. package/lib/constants/TENANT_ENUMS.js +24 -0
  3. package/lib/constants/TENANT_PURCHASE_ORDER.d.ts +16 -0
  4. package/lib/constants/TENANT_PURCHASE_ORDER.js +94 -0
  5. package/lib/constants/index.d.ts +3 -1
  6. package/lib/constants/index.js +3 -1
  7. package/lib/helpers/store/common-warehouse-purchase-order-actions.d.ts +2 -2
  8. package/lib/helpers/store/warehouse-purchase-orders-cart-actions.d.ts +4 -4
  9. package/lib/schemas/models/index.d.ts +2 -0
  10. package/lib/schemas/models/index.js +2 -0
  11. package/lib/schemas/models/tenant_purchase_order_vendor_returns.d.ts +219 -0
  12. package/lib/schemas/models/tenant_purchase_order_vendor_returns.js +83 -0
  13. package/lib/schemas/models/tenant_purchase_orders.d.ts +2783 -0
  14. package/lib/schemas/models/tenant_purchase_orders.js +138 -0
  15. package/lib/schemas/models/warehouse_purchase_order_receipts.d.ts +9 -9
  16. package/lib/schemas/models/warehouse_purchase_order_vendor_returns.d.ts +12 -12
  17. package/lib/schemas/models/warehouse_purchase_orders.d.ts +13 -12
  18. package/lib/schemas/models/warehouse_purchase_orders.js +2 -2
  19. package/lib/schemas/types/index.d.ts +2 -1
  20. package/lib/schemas/types/index.js +2 -1
  21. package/lib/schemas/types/tenant_purchase_order_vendor_returns.d.ts +46 -0
  22. package/lib/schemas/types/tenant_purchase_order_vendor_returns.js +2 -0
  23. package/lib/schemas/types/tenant_purchase_orders.d.ts +61 -0
  24. package/lib/schemas/types/tenant_purchase_orders.js +2 -0
  25. package/lib/schemas/types/warehouse_purchase_order_rfqs.d.ts +33 -4
  26. package/lib/schemas/types/warehouse_purchase_orders.d.ts +33 -5
  27. package/package.json +1 -1
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TENANT_PURCHASE_ORDER_COLLECTION_NAME = exports.TenantPurchaseOrderSchema = void 0;
4
+ const mongoose_1 = require("mongoose");
5
+ const constants_1 = require("../../constants");
6
+ const common_models_1 = require("./common-models");
7
+ const warehouse_categories_1 = require("./warehouse_categories");
8
+ const warehouse_items_1 = require("./warehouse_items");
9
+ const warehouse_vendors_1 = require("./warehouse_vendors");
10
+ const StaffDetailsSchema = new mongoose_1.Schema({
11
+ staff_id: { type: String, required: true },
12
+ staff_name: { type: String, default: '' },
13
+ staff_mobile: { type: String, default: null },
14
+ staff_email: { type: String, default: null },
15
+ }, { _id: false, minimize: false });
16
+ const ItemsSchema = new mongoose_1.Schema({
17
+ _id: { type: mongoose_1.Schema.Types.ObjectId, required: true, immutable: true },
18
+ item_id: {
19
+ type: mongoose_1.Schema.Types.ObjectId,
20
+ required: true,
21
+ immutable: true,
22
+ ref: warehouse_items_1.WAREHOUSE_ITEMS_COLLECTION_NAME,
23
+ },
24
+ is_ready: { type: Boolean, required: false },
25
+ void_reason: { type: String, required: false },
26
+ name: { type: String, required: true },
27
+ price: { type: Number, min: 0, required: true },
28
+ subtotal: { type: Number, min: 0, required: true },
29
+ quantity: { type: Number, min: 0, required: true },
30
+ received_quantity: { type: Number, min: 0, default: 0 },
31
+ _gst_amount: { type: Number, min: 0, required: true },
32
+ _net_amount: { type: Number, min: 0, required: true },
33
+ _gross_amount: { type: Number, min: 0, required: true },
34
+ _discount_amount: { type: Number, min: 0, required: true },
35
+ special_instructions: { type: String, default: '' },
36
+ });
37
+ const CategoriesSchema = new mongoose_1.Schema({
38
+ category_id: {
39
+ type: mongoose_1.Schema.Types.ObjectId,
40
+ required: true,
41
+ immutable: true,
42
+ ref: warehouse_categories_1.WAREHOUSE_CATEGORY_COLLECTION_NAME,
43
+ },
44
+ name: { type: String, required: true },
45
+ items: { type: [ItemsSchema], default: [] },
46
+ }, { _id: false, minimize: false });
47
+ const IterationsOrderSchema = new mongoose_1.Schema({
48
+ categories: { type: [CategoriesSchema], required: true },
49
+ special_instructions: { type: String, default: '' },
50
+ payments: { type: [common_models_1.PaymentsSchema], required: true },
51
+ order_status: {
52
+ type: String,
53
+ enum: constants_1.ALL_TENANT_PURCHASE_ORDER_STATUS_NAMES,
54
+ required: true,
55
+ },
56
+ price: { type: Number, min: 0, required: true },
57
+ amount_earned: { type: Number, min: 0, required: true },
58
+ grand_total: { type: Number, min: 0, required: true },
59
+ staff_details: { type: StaffDetailsSchema, required: false },
60
+ gst: { type: Number, min: 0, required: false },
61
+ gst_amount: { type: Number, min: 0, required: false },
62
+ is_gst_inclusive: { type: Boolean, required: false },
63
+ tax_number: { type: String, default: '' },
64
+ updatedAt: { type: mongoose_1.Schema.Types.Date, required: true },
65
+ }, { _id: false, timestamps: false, versionKey: false });
66
+ exports.TenantPurchaseOrderSchema = new mongoose_1.Schema({
67
+ _id: { type: mongoose_1.Schema.Types.ObjectId, required: true, immutable: true },
68
+ tenant_id: { type: String, required: true, ref: 'tenants' },
69
+ vendor_id: {
70
+ type: mongoose_1.Schema.Types.ObjectId,
71
+ required: true,
72
+ ref: warehouse_vendors_1.WAREHOUSE_VENDORS_COLLECTION_NAME,
73
+ },
74
+ vendor_name: { type: String, default: '' },
75
+ categories: { type: [CategoriesSchema], default: [] },
76
+ iterations: { type: [IterationsOrderSchema], default: [] },
77
+ special_instructions: { type: String, default: '' },
78
+ payments: { type: [common_models_1.PaymentsSchema], required: true },
79
+ order_status: {
80
+ type: String,
81
+ enum: constants_1.ALL_TENANT_PURCHASE_ORDER_STATUS_NAMES,
82
+ required: true,
83
+ },
84
+ tax_number: { type: String, default: '' },
85
+ price: { type: Number, min: 0, required: true },
86
+ amount_collected: { type: Number, min: 0, required: true },
87
+ amount_earned: { type: Number, min: 0, required: true },
88
+ grand_total: { type: Number, min: 0, required: true },
89
+ order_number: { type: Number, min: 0, default: null },
90
+ delete_reason: { type: String, required: false },
91
+ cancel_reason: { type: String, required: false },
92
+ staff_details: { type: StaffDetailsSchema, required: true },
93
+ gst: { type: Number, min: 0, required: false },
94
+ gst_amount: { type: Number, min: 0, required: false },
95
+ is_gst_inclusive: { type: Boolean, required: false },
96
+ is_deleted: { type: Boolean, default: false },
97
+ order_status_updated_at: {
98
+ type: mongoose_1.Schema.Types.Date,
99
+ required: true,
100
+ default: () => new Date(),
101
+ },
102
+ is_reopened: { type: Boolean, required: false },
103
+ deferred_settlement: { type: Boolean, required: false },
104
+ order_settled_at: {
105
+ type: mongoose_1.Schema.Types.Date,
106
+ required: true,
107
+ default: () => new Date(),
108
+ },
109
+ order_settled_at_mins: {
110
+ type: Number,
111
+ required: true,
112
+ default: () => {
113
+ const date = new Date();
114
+ return Math.floor(date.getHours() * 60 + date.getMinutes());
115
+ },
116
+ },
117
+ createdAt_mins: {
118
+ type: Number,
119
+ required: true,
120
+ immutable: true,
121
+ default: () => {
122
+ const date = new Date();
123
+ return Math.floor(date.getHours() * 60 + date.getMinutes());
124
+ },
125
+ },
126
+ createdAt: {
127
+ type: mongoose_1.Schema.Types.Date,
128
+ required: true,
129
+ default: () => new Date(),
130
+ immutable: true,
131
+ },
132
+ updatedAt: {
133
+ type: mongoose_1.Schema.Types.Date,
134
+ required: true,
135
+ default: () => new Date(),
136
+ },
137
+ }, { timestamps: true, versionKey: false, minimize: false });
138
+ exports.TENANT_PURCHASE_ORDER_COLLECTION_NAME = 'tenant_purchase_orders';
@@ -18,24 +18,24 @@ export declare const PurchaseOrderReceiptsSchema: Schema<any, import("mongoose")
18
18
  price: number;
19
19
  subtotal: number;
20
20
  item_id: import("mongoose").Types.ObjectId;
21
- ordered_quantity: number;
22
21
  received_quantity: number;
22
+ ordered_quantity: number;
23
23
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
24
24
  _id: import("mongoose").Types.ObjectId;
25
25
  name: string;
26
26
  price: number;
27
27
  subtotal: number;
28
28
  item_id: import("mongoose").Types.ObjectId;
29
- ordered_quantity: number;
30
29
  received_quantity: number;
30
+ ordered_quantity: number;
31
31
  }> & {
32
32
  _id: import("mongoose").Types.ObjectId;
33
33
  name: string;
34
34
  price: number;
35
35
  subtotal: number;
36
36
  item_id: import("mongoose").Types.ObjectId;
37
- ordered_quantity: number;
38
37
  received_quantity: number;
38
+ ordered_quantity: number;
39
39
  }>;
40
40
  warehouse_id: string;
41
41
  vendor_name: string;
@@ -69,24 +69,24 @@ export declare const PurchaseOrderReceiptsSchema: Schema<any, import("mongoose")
69
69
  price: number;
70
70
  subtotal: number;
71
71
  item_id: import("mongoose").Types.ObjectId;
72
- ordered_quantity: number;
73
72
  received_quantity: number;
73
+ ordered_quantity: number;
74
74
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
75
75
  _id: import("mongoose").Types.ObjectId;
76
76
  name: string;
77
77
  price: number;
78
78
  subtotal: number;
79
79
  item_id: import("mongoose").Types.ObjectId;
80
- ordered_quantity: number;
81
80
  received_quantity: number;
81
+ ordered_quantity: number;
82
82
  }> & {
83
83
  _id: import("mongoose").Types.ObjectId;
84
84
  name: string;
85
85
  price: number;
86
86
  subtotal: number;
87
87
  item_id: import("mongoose").Types.ObjectId;
88
- ordered_quantity: number;
89
88
  received_quantity: number;
89
+ ordered_quantity: number;
90
90
  }>;
91
91
  warehouse_id: string;
92
92
  vendor_name: string;
@@ -120,24 +120,24 @@ export declare const PurchaseOrderReceiptsSchema: Schema<any, import("mongoose")
120
120
  price: number;
121
121
  subtotal: number;
122
122
  item_id: import("mongoose").Types.ObjectId;
123
- ordered_quantity: number;
124
123
  received_quantity: number;
124
+ ordered_quantity: number;
125
125
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
126
126
  _id: import("mongoose").Types.ObjectId;
127
127
  name: string;
128
128
  price: number;
129
129
  subtotal: number;
130
130
  item_id: import("mongoose").Types.ObjectId;
131
- ordered_quantity: number;
132
131
  received_quantity: number;
132
+ ordered_quantity: number;
133
133
  }> & {
134
134
  _id: import("mongoose").Types.ObjectId;
135
135
  name: string;
136
136
  price: number;
137
137
  subtotal: number;
138
138
  item_id: import("mongoose").Types.ObjectId;
139
- ordered_quantity: number;
140
139
  received_quantity: number;
140
+ ordered_quantity: number;
141
141
  }>;
142
142
  warehouse_id: string;
143
143
  vendor_name: string;
@@ -43,10 +43,10 @@ export declare const PurchaseOrderVendorReturnsSchema: Schema<any, import("mongo
43
43
  warehouse_id: string;
44
44
  vendor_name: string;
45
45
  vendor_id: import("mongoose").Types.ObjectId;
46
- purchase_order_id: import("mongoose").Types.ObjectId;
47
46
  return_status: WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM;
48
47
  inventory_consumed: boolean;
49
48
  total_return_amount: number;
49
+ purchase_order_id: import("mongoose").Types.ObjectId;
50
50
  cancel_reason?: string | null | undefined;
51
51
  notes?: string | null | undefined;
52
52
  created_by?: {
@@ -68,16 +68,16 @@ export declare const PurchaseOrderVendorReturnsSchema: Schema<any, import("mongo
68
68
  _id: string;
69
69
  name: string;
70
70
  } | null | undefined;
71
- vendor_confirmed_by?: {
71
+ completed_by?: {
72
72
  _id: string;
73
73
  name: string;
74
74
  } | null | undefined;
75
- completed_by?: {
75
+ completed_at?: NativeDate | null | undefined;
76
+ vendor_confirmed_by?: {
76
77
  _id: string;
77
78
  name: string;
78
79
  } | null | undefined;
79
80
  vendor_confirmed_at?: NativeDate | null | undefined;
80
- completed_at?: NativeDate | null | undefined;
81
81
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
82
82
  createdAt: NativeDate;
83
83
  updatedAt: NativeDate;
@@ -117,10 +117,10 @@ export declare const PurchaseOrderVendorReturnsSchema: Schema<any, import("mongo
117
117
  warehouse_id: string;
118
118
  vendor_name: string;
119
119
  vendor_id: import("mongoose").Types.ObjectId;
120
- purchase_order_id: import("mongoose").Types.ObjectId;
121
120
  return_status: WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM;
122
121
  inventory_consumed: boolean;
123
122
  total_return_amount: number;
123
+ purchase_order_id: import("mongoose").Types.ObjectId;
124
124
  cancel_reason?: string | null | undefined;
125
125
  notes?: string | null | undefined;
126
126
  created_by?: {
@@ -142,16 +142,16 @@ export declare const PurchaseOrderVendorReturnsSchema: Schema<any, import("mongo
142
142
  _id: string;
143
143
  name: string;
144
144
  } | null | undefined;
145
- vendor_confirmed_by?: {
145
+ completed_by?: {
146
146
  _id: string;
147
147
  name: string;
148
148
  } | null | undefined;
149
- completed_by?: {
149
+ completed_at?: NativeDate | null | undefined;
150
+ vendor_confirmed_by?: {
150
151
  _id: string;
151
152
  name: string;
152
153
  } | null | undefined;
153
154
  vendor_confirmed_at?: NativeDate | null | undefined;
154
- completed_at?: NativeDate | null | undefined;
155
155
  }>> & import("mongoose").FlatRecord<{
156
156
  createdAt: NativeDate;
157
157
  updatedAt: NativeDate;
@@ -191,10 +191,10 @@ export declare const PurchaseOrderVendorReturnsSchema: Schema<any, import("mongo
191
191
  warehouse_id: string;
192
192
  vendor_name: string;
193
193
  vendor_id: import("mongoose").Types.ObjectId;
194
- purchase_order_id: import("mongoose").Types.ObjectId;
195
194
  return_status: WAREHOUSE_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM;
196
195
  inventory_consumed: boolean;
197
196
  total_return_amount: number;
197
+ purchase_order_id: import("mongoose").Types.ObjectId;
198
198
  cancel_reason?: string | null | undefined;
199
199
  notes?: string | null | undefined;
200
200
  created_by?: {
@@ -216,16 +216,16 @@ export declare const PurchaseOrderVendorReturnsSchema: Schema<any, import("mongo
216
216
  _id: string;
217
217
  name: string;
218
218
  } | null | undefined;
219
- vendor_confirmed_by?: {
219
+ completed_by?: {
220
220
  _id: string;
221
221
  name: string;
222
222
  } | null | undefined;
223
- completed_by?: {
223
+ completed_at?: NativeDate | null | undefined;
224
+ vendor_confirmed_by?: {
224
225
  _id: string;
225
226
  name: string;
226
227
  } | null | undefined;
227
228
  vendor_confirmed_at?: NativeDate | null | undefined;
228
- completed_at?: NativeDate | null | undefined;
229
229
  }> & Required<{
230
230
  _id: import("mongoose").Types.ObjectId;
231
231
  }> & {
@@ -1,4 +1,5 @@
1
1
  import { Schema } from 'mongoose';
2
+ import { WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM } from '../../constants';
2
3
  export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
3
4
  timestamps: true;
4
5
  versionKey: false;
@@ -214,7 +215,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
214
215
  note?: string | null | undefined;
215
216
  }>;
216
217
  special_instructions: string;
217
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
218
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
218
219
  tax_number: string;
219
220
  amount_earned: number;
220
221
  grand_total: number;
@@ -422,7 +423,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
422
423
  note?: string | null | undefined;
423
424
  }>;
424
425
  special_instructions: string;
425
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
426
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
426
427
  tax_number: string;
427
428
  amount_earned: number;
428
429
  grand_total: number;
@@ -639,7 +640,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
639
640
  note?: string | null | undefined;
640
641
  }>;
641
642
  special_instructions: string;
642
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
643
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
643
644
  tax_number: string;
644
645
  amount_earned: number;
645
646
  grand_total: number;
@@ -856,7 +857,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
856
857
  note?: string | null | undefined;
857
858
  }>;
858
859
  special_instructions: string;
859
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
860
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
860
861
  tax_number: string;
861
862
  amount_earned: number;
862
863
  grand_total: number;
@@ -1103,7 +1104,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
1103
1104
  note?: string | null | undefined;
1104
1105
  }>;
1105
1106
  special_instructions: string;
1106
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
1107
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
1107
1108
  tax_number: string;
1108
1109
  amount_earned: number;
1109
1110
  grand_total: number;
@@ -1311,7 +1312,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
1311
1312
  note?: string | null | undefined;
1312
1313
  }>;
1313
1314
  special_instructions: string;
1314
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
1315
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
1315
1316
  tax_number: string;
1316
1317
  amount_earned: number;
1317
1318
  grand_total: number;
@@ -1528,7 +1529,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
1528
1529
  note?: string | null | undefined;
1529
1530
  }>;
1530
1531
  special_instructions: string;
1531
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
1532
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
1532
1533
  tax_number: string;
1533
1534
  amount_earned: number;
1534
1535
  grand_total: number;
@@ -1745,7 +1746,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
1745
1746
  note?: string | null | undefined;
1746
1747
  }>;
1747
1748
  special_instructions: string;
1748
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
1749
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
1749
1750
  tax_number: string;
1750
1751
  amount_earned: number;
1751
1752
  grand_total: number;
@@ -1992,7 +1993,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
1992
1993
  note?: string | null | undefined;
1993
1994
  }>;
1994
1995
  special_instructions: string;
1995
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
1996
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
1996
1997
  tax_number: string;
1997
1998
  amount_earned: number;
1998
1999
  grand_total: number;
@@ -2200,7 +2201,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
2200
2201
  note?: string | null | undefined;
2201
2202
  }>;
2202
2203
  special_instructions: string;
2203
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
2204
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
2204
2205
  tax_number: string;
2205
2206
  amount_earned: number;
2206
2207
  grand_total: number;
@@ -2417,7 +2418,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
2417
2418
  note?: string | null | undefined;
2418
2419
  }>;
2419
2420
  special_instructions: string;
2420
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
2421
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
2421
2422
  tax_number: string;
2422
2423
  amount_earned: number;
2423
2424
  grand_total: number;
@@ -2634,7 +2635,7 @@ export declare const PurchaseOrderSchema: Schema<any, import("mongoose").Model<a
2634
2635
  note?: string | null | undefined;
2635
2636
  }>;
2636
2637
  special_instructions: string;
2637
- order_status: import("../../constants").WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
2638
+ order_status: WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM;
2638
2639
  tax_number: string;
2639
2640
  amount_earned: number;
2640
2641
  grand_total: number;
@@ -4,9 +4,9 @@ exports.WAREHOUSE_PURCHASE_ORDER_COLLECTION_NAME = exports.PurchaseOrderSchema =
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 warehouse_purchase_order_rfqs_1 = require("./warehouse_purchase_order_rfqs");
8
7
  const warehouse_categories_1 = require("./warehouse_categories");
9
8
  const warehouse_items_1 = require("./warehouse_items");
9
+ const warehouse_purchase_order_rfqs_1 = require("./warehouse_purchase_order_rfqs");
10
10
  const warehouse_vendors_1 = require("./warehouse_vendors");
11
11
  const warehouses_1 = require("./warehouses");
12
12
  const StaffDetailsSchema = new mongoose_1.Schema({
@@ -218,7 +218,7 @@ exports.PurchaseOrderSchema = new mongoose_1.Schema({
218
218
  order_status: {
219
219
  type: String,
220
220
  enum: constants_1.ALL_WAREHOUSE_PURCHASE_ORDER_STATUS_NAMES,
221
- required: true,
221
+ default: constants_1.WAREHOUSE_PURCHASE_ORDER_STATUS_ENUM.DRAFT,
222
222
  },
223
223
  tax_number: {
224
224
  type: String,
@@ -51,6 +51,8 @@ export * from './specials';
51
51
  export * from './staff_shifts';
52
52
  export * from './tenant_days';
53
53
  export * from './tenant_metadata';
54
+ export * from './tenant_purchase_order_vendor_returns';
55
+ export * from './tenant_purchase_orders';
54
56
  export * from './tenant_shifts';
55
57
  export * from './tenant_staffs';
56
58
  export * from './tenant_vendors';
@@ -73,7 +75,6 @@ export * from './warehouse_invoices';
73
75
  export * from './warehouse_item_transactions';
74
76
  export * from './warehouse_items';
75
77
  export * from './warehouse_operational_roles';
76
- export * from './warehouse_purchase_order_common';
77
78
  export * from './warehouse_purchase_order_receipts';
78
79
  export * from './warehouse_purchase_order_rfqs';
79
80
  export * from './warehouse_purchase_order_vendor_returns';
@@ -67,6 +67,8 @@ __exportStar(require("./specials"), exports);
67
67
  __exportStar(require("./staff_shifts"), exports);
68
68
  __exportStar(require("./tenant_days"), exports);
69
69
  __exportStar(require("./tenant_metadata"), exports);
70
+ __exportStar(require("./tenant_purchase_order_vendor_returns"), exports);
71
+ __exportStar(require("./tenant_purchase_orders"), exports);
70
72
  __exportStar(require("./tenant_shifts"), exports);
71
73
  __exportStar(require("./tenant_staffs"), exports);
72
74
  __exportStar(require("./tenant_vendors"), exports);
@@ -89,7 +91,6 @@ __exportStar(require("./warehouse_invoices"), exports);
89
91
  __exportStar(require("./warehouse_item_transactions"), exports);
90
92
  __exportStar(require("./warehouse_items"), exports);
91
93
  __exportStar(require("./warehouse_operational_roles"), exports);
92
- __exportStar(require("./warehouse_purchase_order_common"), exports);
93
94
  __exportStar(require("./warehouse_purchase_order_receipts"), exports);
94
95
  __exportStar(require("./warehouse_purchase_order_rfqs"), exports);
95
96
  __exportStar(require("./warehouse_purchase_order_vendor_returns"), exports);
@@ -0,0 +1,46 @@
1
+ import { TENANT_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM } from '../../constants';
2
+ export interface ITenantPurchaseOrderVendorReturnStatus {
3
+ status: TENANT_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM;
4
+ color: string;
5
+ contrast_color: string;
6
+ priority: number;
7
+ }
8
+ export interface ITenantPurchaseOrderVendorReturnItem {
9
+ _id: string;
10
+ item_id: string;
11
+ name: string;
12
+ ordered_quantity: number;
13
+ return_quantity: number;
14
+ price: number;
15
+ subtotal: number;
16
+ reason?: string | null;
17
+ }
18
+ export interface ITenantPurchaseOrderVendorReturnActor {
19
+ _id: string;
20
+ name: string;
21
+ }
22
+ export interface ITenantPurchaseOrderVendorReturn {
23
+ _id: string;
24
+ tenant_id: string;
25
+ tenant_purchase_order_id: string;
26
+ vendor_id: string;
27
+ vendor_name: string;
28
+ return_status: TENANT_PURCHASE_ORDER_VENDOR_RETURN_STATUS_ENUM;
29
+ inventory_consumed: boolean;
30
+ items: ITenantPurchaseOrderVendorReturnItem[];
31
+ total_return_amount: number;
32
+ notes?: string | null;
33
+ created_by?: ITenantPurchaseOrderVendorReturnActor | null;
34
+ approved_by?: ITenantPurchaseOrderVendorReturnActor | null;
35
+ dispatched_by?: ITenantPurchaseOrderVendorReturnActor | null;
36
+ completed_by?: ITenantPurchaseOrderVendorReturnActor | null;
37
+ cancelled_by?: ITenantPurchaseOrderVendorReturnActor | null;
38
+ approved_at?: Date | null;
39
+ dispatched_at?: Date | null;
40
+ completed_at?: Date | null;
41
+ cancelled_at?: Date | null;
42
+ cancel_reason?: string | null;
43
+ createdAt_mins: number;
44
+ createdAt: Date;
45
+ updatedAt: Date;
46
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,61 @@
1
+ import { TENANT_PURCHASE_ORDER_STATUS_ENUM } from '../../constants';
2
+ import { IOrderPayment, IStaffDetails } from './orders';
3
+ export interface ITenantPurchaseOrderItem {
4
+ _id: string;
5
+ item_id: string;
6
+ is_ready?: boolean;
7
+ void_reason?: string | null;
8
+ name: string;
9
+ price: number;
10
+ subtotal: number;
11
+ quantity: number;
12
+ /** Quantity received directly on the PO (no separate receipts collection). */
13
+ received_quantity: number;
14
+ _net_amount: number;
15
+ _gross_amount: number;
16
+ _gst_amount: number;
17
+ _discount_amount: number;
18
+ special_instructions: string;
19
+ }
20
+ export interface ITenantPurchaseOrderCategory {
21
+ name: string;
22
+ category_id: string;
23
+ items: ITenantPurchaseOrderItem[];
24
+ }
25
+ interface ITenantPurchaseOrderIterationBase<TCategory, TStatus> {
26
+ categories: TCategory[];
27
+ staff_details: IStaffDetails;
28
+ is_gst_inclusive?: boolean;
29
+ gst?: number | null;
30
+ gst_amount?: number | null;
31
+ special_instructions: string;
32
+ price: number;
33
+ amount_earned: number;
34
+ grand_total: number;
35
+ order_status: TStatus;
36
+ updatedAt: Date;
37
+ }
38
+ export interface ITenantPurchaseOrderIteration extends ITenantPurchaseOrderIterationBase<ITenantPurchaseOrderCategory, TENANT_PURCHASE_ORDER_STATUS_ENUM> {
39
+ payments: IOrderPayment[];
40
+ tax_number: string;
41
+ }
42
+ export interface ITenantPurchaseOrder extends ITenantPurchaseOrderIteration {
43
+ _id: string;
44
+ tenant_id: string;
45
+ vendor_id: string;
46
+ vendor_name: string;
47
+ iterations: ITenantPurchaseOrderIteration[];
48
+ amount_collected: number;
49
+ order_number: number | null;
50
+ delete_reason?: string | null;
51
+ cancel_reason?: string | null;
52
+ is_deleted: boolean;
53
+ order_status_updated_at: Date;
54
+ is_reopened?: boolean;
55
+ deferred_settlement?: boolean;
56
+ order_settled_at: Date;
57
+ order_settled_at_mins: number;
58
+ createdAt_mins: number;
59
+ createdAt: Date;
60
+ }
61
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,37 @@
1
1
  import { WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM, WAREHOUSE_RFQ_VENDOR_STATUS_ENUM } from '../../constants';
2
- import { IWarehousePurchaseOrderCommonCategoryByCategoryId, IWarehousePurchaseOrderCommonItem, IWarehousePurchaseOrderCommonIterationBase } from './warehouse_purchase_order_common';
3
- export type IWarehousePurchaseOrderRFQItem = IWarehousePurchaseOrderCommonItem;
4
- export type IWarehousePurchaseOrderRFQCategory = IWarehousePurchaseOrderCommonCategoryByCategoryId;
5
- export interface IWarehousePurchaseOrderRFQIteration extends IWarehousePurchaseOrderCommonIterationBase<IWarehousePurchaseOrderRFQCategory, WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM | string> {
2
+ import { IStaffDetails } from './orders';
3
+ export type IWarehousePurchaseOrderRFQItem = {
4
+ _id: string;
5
+ item_id: string;
6
+ is_ready?: boolean;
7
+ void_reason?: string | null;
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 type IWarehousePurchaseOrderRFQCategory = {
19
+ name: string;
20
+ category_id: string;
21
+ items: IWarehousePurchaseOrderRFQItem[];
22
+ };
23
+ export interface IWarehousePurchaseOrderRFQIteration {
24
+ categories: IWarehousePurchaseOrderRFQCategory[];
25
+ staff_details: IStaffDetails;
26
+ is_gst_inclusive?: boolean;
27
+ gst?: number | null;
28
+ gst_amount?: number | null;
29
+ special_instructions: string;
30
+ price: number;
31
+ amount_earned: number;
32
+ grand_total: number;
33
+ order_status: WAREHOUSE_PURCHASE_ORDER_RFQ_STATUS_ENUM;
34
+ updatedAt: Date;
6
35
  tax_number: string;
7
36
  }
8
37
  export interface IWarehouseRFQVendorEntry {