@managesome/eposmatic-toolkit 0.2.596 → 0.2.598
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/catalog-actions.js +5 -2
- package/lib/helpers/utils/expense.d.ts +0 -1
- package/lib/helpers/utils/expense.js +0 -22
- package/lib/schemas/models/expense_details.d.ts +0 -183
- package/lib/schemas/models/expense_details.js +0 -5
- package/lib/schemas/models/orders.d.ts +228 -228
- package/lib/schemas/models/tenant_purchase_orders.d.ts +228 -228
- package/lib/schemas/models/warehouse_internal_movements.d.ts +12 -12
- package/lib/schemas/models/warehouse_purchase_orders.d.ts +228 -228
- package/lib/schemas/models/warehouse_sale_invoices.d.ts +3 -3
- package/lib/schemas/types/expense_details.d.ts +0 -2
- package/package.json +1 -1
|
@@ -304,12 +304,15 @@ function getGroupedInventoryCategories(categories, items) {
|
|
|
304
304
|
uncategorizedItems.push(item);
|
|
305
305
|
}
|
|
306
306
|
}
|
|
307
|
-
// Add each category with its items, sorted by category sort_id
|
|
307
|
+
// Add each category with its items, sorted by category sort_id. Match items
|
|
308
|
+
// by category _id OR ref_id: synced categories carry a fresh per-target _id
|
|
309
|
+
// (≠ ref_id) while items store that category _id, so a ref_id-only lookup
|
|
310
|
+
// would omit those items from the group.
|
|
308
311
|
const sortedCategories = [...categories].sort((a, b) => a.sort_id - b.sort_id);
|
|
309
312
|
for (const cat of sortedCategories) {
|
|
310
313
|
result.push({
|
|
311
314
|
category: cat,
|
|
312
|
-
items: itemsByCategory[cat.ref_id] || [],
|
|
315
|
+
items: itemsByCategory[cat.ref_id] || itemsByCategory[cat._id] || [],
|
|
313
316
|
});
|
|
314
317
|
}
|
|
315
318
|
// Append uncategorized items as a synthetic category (ref_id: null so the API receives null, not a fake string)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { IExpenseDetails } from '../../schemas';
|
|
2
|
-
export declare function getExpenseDetailsWithCents<T extends Partial<IExpenseDetails> | IExpenseDetails>(expense: T): T;
|
|
3
2
|
export declare function getExpenseDetailsFromCents<T extends Partial<IExpenseDetails> | IExpenseDetails>(expense: T): T;
|
|
4
3
|
export declare function getFetchedExpenseDetails(expenses: IExpenseDetails[]): IExpenseDetails[];
|
|
@@ -1,25 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getExpenseDetailsWithCents = getExpenseDetailsWithCents;
|
|
4
3
|
exports.getExpenseDetailsFromCents = getExpenseDetailsFromCents;
|
|
5
4
|
exports.getFetchedExpenseDetails = getFetchedExpenseDetails;
|
|
6
|
-
const store_1 = require("../store");
|
|
7
5
|
const price_conversion_1 = require("./price-conversion");
|
|
8
|
-
function getExpenseDetailsWithCents(expense) {
|
|
9
|
-
return {
|
|
10
|
-
...expense,
|
|
11
|
-
...(typeof expense.amount === 'number'
|
|
12
|
-
? {
|
|
13
|
-
amount: (0, price_conversion_1.convertPriceToCents)(expense.amount),
|
|
14
|
-
}
|
|
15
|
-
: {}),
|
|
16
|
-
...(expense.payments != null
|
|
17
|
-
? {
|
|
18
|
-
payments: (0, store_1.getOrderPaymentsWithPrice)(expense.payments, price_conversion_1.convertPriceToCents),
|
|
19
|
-
}
|
|
20
|
-
: {}),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
6
|
function getExpenseDetailsFromCents(expense) {
|
|
24
7
|
return {
|
|
25
8
|
...expense,
|
|
@@ -28,11 +11,6 @@ function getExpenseDetailsFromCents(expense) {
|
|
|
28
11
|
amount: (0, price_conversion_1.convertPriceFromCents)(expense.amount),
|
|
29
12
|
}
|
|
30
13
|
: {}),
|
|
31
|
-
...(expense.payments != null
|
|
32
|
-
? {
|
|
33
|
-
payments: (0, store_1.getOrderPaymentsWithPrice)(expense.payments, price_conversion_1.convertPriceFromCents),
|
|
34
|
-
}
|
|
35
|
-
: {}),
|
|
36
14
|
};
|
|
37
15
|
}
|
|
38
16
|
function getFetchedExpenseDetails(expenses) {
|
|
@@ -19,67 +19,6 @@ export declare const ExpenseDetailsSchema: Schema<any, import("mongoose").Model<
|
|
|
19
19
|
expense_sub_category_id: import("mongoose").Types.ObjectId;
|
|
20
20
|
amount: number;
|
|
21
21
|
payment_method: string;
|
|
22
|
-
payments: import("mongoose").Types.DocumentArray<{
|
|
23
|
-
payment_type: string;
|
|
24
|
-
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
25
|
-
card_details: {
|
|
26
|
-
transaction_id: string;
|
|
27
|
-
payment_provider_linked_customer_id: string;
|
|
28
|
-
card_number: string;
|
|
29
|
-
card_type: string;
|
|
30
|
-
card_holder_name: string;
|
|
31
|
-
card_charges: number;
|
|
32
|
-
card_country_code: string;
|
|
33
|
-
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
34
|
-
};
|
|
35
|
-
amount_paid: number;
|
|
36
|
-
amount_due: number;
|
|
37
|
-
amount_refunded: number;
|
|
38
|
-
payment_id: string;
|
|
39
|
-
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
40
|
-
refund_reason?: string | null | undefined;
|
|
41
|
-
note?: string | null | undefined;
|
|
42
|
-
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId | null | undefined, any, {
|
|
43
|
-
payment_type: string;
|
|
44
|
-
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
45
|
-
card_details: {
|
|
46
|
-
transaction_id: string;
|
|
47
|
-
payment_provider_linked_customer_id: string;
|
|
48
|
-
card_number: string;
|
|
49
|
-
card_type: string;
|
|
50
|
-
card_holder_name: string;
|
|
51
|
-
card_charges: number;
|
|
52
|
-
card_country_code: string;
|
|
53
|
-
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
54
|
-
};
|
|
55
|
-
amount_paid: number;
|
|
56
|
-
amount_due: number;
|
|
57
|
-
amount_refunded: number;
|
|
58
|
-
payment_id: string;
|
|
59
|
-
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
60
|
-
refund_reason?: string | null | undefined;
|
|
61
|
-
note?: string | null | undefined;
|
|
62
|
-
}> & {
|
|
63
|
-
payment_type: string;
|
|
64
|
-
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
65
|
-
card_details: {
|
|
66
|
-
transaction_id: string;
|
|
67
|
-
payment_provider_linked_customer_id: string;
|
|
68
|
-
card_number: string;
|
|
69
|
-
card_type: string;
|
|
70
|
-
card_holder_name: string;
|
|
71
|
-
card_charges: number;
|
|
72
|
-
card_country_code: string;
|
|
73
|
-
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
74
|
-
};
|
|
75
|
-
amount_paid: number;
|
|
76
|
-
amount_due: number;
|
|
77
|
-
amount_refunded: number;
|
|
78
|
-
payment_id: string;
|
|
79
|
-
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
80
|
-
refund_reason?: string | null | undefined;
|
|
81
|
-
note?: string | null | undefined;
|
|
82
|
-
}>;
|
|
83
22
|
date_incurred: NativeDate;
|
|
84
23
|
date_incurred_mins: number;
|
|
85
24
|
receipt_image?: string | null | undefined;
|
|
@@ -104,67 +43,6 @@ export declare const ExpenseDetailsSchema: Schema<any, import("mongoose").Model<
|
|
|
104
43
|
expense_sub_category_id: import("mongoose").Types.ObjectId;
|
|
105
44
|
amount: number;
|
|
106
45
|
payment_method: string;
|
|
107
|
-
payments: import("mongoose").Types.DocumentArray<{
|
|
108
|
-
payment_type: string;
|
|
109
|
-
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
110
|
-
card_details: {
|
|
111
|
-
transaction_id: string;
|
|
112
|
-
payment_provider_linked_customer_id: string;
|
|
113
|
-
card_number: string;
|
|
114
|
-
card_type: string;
|
|
115
|
-
card_holder_name: string;
|
|
116
|
-
card_charges: number;
|
|
117
|
-
card_country_code: string;
|
|
118
|
-
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
119
|
-
};
|
|
120
|
-
amount_paid: number;
|
|
121
|
-
amount_due: number;
|
|
122
|
-
amount_refunded: number;
|
|
123
|
-
payment_id: string;
|
|
124
|
-
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
125
|
-
refund_reason?: string | null | undefined;
|
|
126
|
-
note?: string | null | undefined;
|
|
127
|
-
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId | null | undefined, any, {
|
|
128
|
-
payment_type: string;
|
|
129
|
-
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
130
|
-
card_details: {
|
|
131
|
-
transaction_id: string;
|
|
132
|
-
payment_provider_linked_customer_id: string;
|
|
133
|
-
card_number: string;
|
|
134
|
-
card_type: string;
|
|
135
|
-
card_holder_name: string;
|
|
136
|
-
card_charges: number;
|
|
137
|
-
card_country_code: string;
|
|
138
|
-
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
139
|
-
};
|
|
140
|
-
amount_paid: number;
|
|
141
|
-
amount_due: number;
|
|
142
|
-
amount_refunded: number;
|
|
143
|
-
payment_id: string;
|
|
144
|
-
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
145
|
-
refund_reason?: string | null | undefined;
|
|
146
|
-
note?: string | null | undefined;
|
|
147
|
-
}> & {
|
|
148
|
-
payment_type: string;
|
|
149
|
-
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
150
|
-
card_details: {
|
|
151
|
-
transaction_id: string;
|
|
152
|
-
payment_provider_linked_customer_id: string;
|
|
153
|
-
card_number: string;
|
|
154
|
-
card_type: string;
|
|
155
|
-
card_holder_name: string;
|
|
156
|
-
card_charges: number;
|
|
157
|
-
card_country_code: string;
|
|
158
|
-
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
159
|
-
};
|
|
160
|
-
amount_paid: number;
|
|
161
|
-
amount_due: number;
|
|
162
|
-
amount_refunded: number;
|
|
163
|
-
payment_id: string;
|
|
164
|
-
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
165
|
-
refund_reason?: string | null | undefined;
|
|
166
|
-
note?: string | null | undefined;
|
|
167
|
-
}>;
|
|
168
46
|
date_incurred: NativeDate;
|
|
169
47
|
date_incurred_mins: number;
|
|
170
48
|
receipt_image?: string | null | undefined;
|
|
@@ -189,67 +67,6 @@ export declare const ExpenseDetailsSchema: Schema<any, import("mongoose").Model<
|
|
|
189
67
|
expense_sub_category_id: import("mongoose").Types.ObjectId;
|
|
190
68
|
amount: number;
|
|
191
69
|
payment_method: string;
|
|
192
|
-
payments: import("mongoose").Types.DocumentArray<{
|
|
193
|
-
payment_type: string;
|
|
194
|
-
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
195
|
-
card_details: {
|
|
196
|
-
transaction_id: string;
|
|
197
|
-
payment_provider_linked_customer_id: string;
|
|
198
|
-
card_number: string;
|
|
199
|
-
card_type: string;
|
|
200
|
-
card_holder_name: string;
|
|
201
|
-
card_charges: number;
|
|
202
|
-
card_country_code: string;
|
|
203
|
-
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
204
|
-
};
|
|
205
|
-
amount_paid: number;
|
|
206
|
-
amount_due: number;
|
|
207
|
-
amount_refunded: number;
|
|
208
|
-
payment_id: string;
|
|
209
|
-
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
210
|
-
refund_reason?: string | null | undefined;
|
|
211
|
-
note?: string | null | undefined;
|
|
212
|
-
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId | null | undefined, any, {
|
|
213
|
-
payment_type: string;
|
|
214
|
-
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
215
|
-
card_details: {
|
|
216
|
-
transaction_id: string;
|
|
217
|
-
payment_provider_linked_customer_id: string;
|
|
218
|
-
card_number: string;
|
|
219
|
-
card_type: string;
|
|
220
|
-
card_holder_name: string;
|
|
221
|
-
card_charges: number;
|
|
222
|
-
card_country_code: string;
|
|
223
|
-
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
224
|
-
};
|
|
225
|
-
amount_paid: number;
|
|
226
|
-
amount_due: number;
|
|
227
|
-
amount_refunded: number;
|
|
228
|
-
payment_id: string;
|
|
229
|
-
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
230
|
-
refund_reason?: string | null | undefined;
|
|
231
|
-
note?: string | null | undefined;
|
|
232
|
-
}> & {
|
|
233
|
-
payment_type: string;
|
|
234
|
-
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
235
|
-
card_details: {
|
|
236
|
-
transaction_id: string;
|
|
237
|
-
payment_provider_linked_customer_id: string;
|
|
238
|
-
card_number: string;
|
|
239
|
-
card_type: string;
|
|
240
|
-
card_holder_name: string;
|
|
241
|
-
card_charges: number;
|
|
242
|
-
card_country_code: string;
|
|
243
|
-
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
244
|
-
};
|
|
245
|
-
amount_paid: number;
|
|
246
|
-
amount_due: number;
|
|
247
|
-
amount_refunded: number;
|
|
248
|
-
payment_id: string;
|
|
249
|
-
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
250
|
-
refund_reason?: string | null | undefined;
|
|
251
|
-
note?: string | null | undefined;
|
|
252
|
-
}>;
|
|
253
70
|
date_incurred: NativeDate;
|
|
254
71
|
date_incurred_mins: number;
|
|
255
72
|
receipt_image?: string | null | undefined;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EXPENSE_DETAILS_COLLECTION_NAME = exports.ExpenseDetailsSchema = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
|
-
const common_models_1 = require("./common-models");
|
|
7
6
|
const ExpenseReacurringSchema = new mongoose_1.Schema({
|
|
8
7
|
is_recurring: {
|
|
9
8
|
type: Boolean,
|
|
@@ -59,10 +58,6 @@ exports.ExpenseDetailsSchema = new mongoose_1.Schema({
|
|
|
59
58
|
type: String,
|
|
60
59
|
default: '',
|
|
61
60
|
},
|
|
62
|
-
payments: {
|
|
63
|
-
type: [common_models_1.PaymentsSchema],
|
|
64
|
-
default: [],
|
|
65
|
-
},
|
|
66
61
|
recurring: {
|
|
67
62
|
type: ExpenseReacurringSchema,
|
|
68
63
|
required: false,
|