@managesome/eposmatic-toolkit 0.2.497 → 0.2.499
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.
|
@@ -1369,24 +1369,10 @@ const getUsableData = (data, subtitles) => {
|
|
|
1369
1369
|
const netSale = totalPaymentSalesAmount || salesData.grossAmount;
|
|
1370
1370
|
const itemSales = salesData.totalItemSales;
|
|
1371
1371
|
const amountCollected = netSale - unpaidAmount;
|
|
1372
|
-
//
|
|
1373
|
-
//
|
|
1374
|
-
//
|
|
1375
|
-
|
|
1376
|
-
// "Net Revenue excl. Tax" reflects only GST on collected amounts.
|
|
1377
|
-
const collectedRatio = netSale > 0 ? Math.min(1, amountCollected / netSale) : 0;
|
|
1378
|
-
const netWithoutGst = netSale - totalGst * collectedRatio;
|
|
1379
|
-
// Scale down GST subchannel amounts proportionally so unpaid
|
|
1380
|
-
// invoices don't inflate the GST breakdown.
|
|
1381
|
-
if (collectedRatio < 1) {
|
|
1382
|
-
for (const ch of topLevelChannels) {
|
|
1383
|
-
if (ch.ref === constants_1.WAREHOUSE_SALE_ORDER_X_REPORT_TYPE_ENUM.GST) {
|
|
1384
|
-
for (const sc of ch.subChannels) {
|
|
1385
|
-
sc.amount = (0, common_1.parseNum)(sc.amount * collectedRatio);
|
|
1386
|
-
}
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1372
|
+
// Backend already excludes unpaid invoices from the GST aggregation,
|
|
1373
|
+
// so the GST amounts reflect only collected payments. No proportional
|
|
1374
|
+
// scaling is needed — the full GST amount is already correct.
|
|
1375
|
+
const netWithoutGst = netSale - totalGst;
|
|
1390
1376
|
const channelData = {
|
|
1391
1377
|
...subtitles,
|
|
1392
1378
|
_id: staffId,
|
|
@@ -41,6 +41,70 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
41
41
|
}>;
|
|
42
42
|
status: import("../../constants").WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM;
|
|
43
43
|
ref_id: string;
|
|
44
|
+
payments: import("mongoose").Types.DocumentArray<{
|
|
45
|
+
payment_type: string;
|
|
46
|
+
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
47
|
+
card_details: {
|
|
48
|
+
transaction_id: string;
|
|
49
|
+
payment_provider_linked_customer_id: string;
|
|
50
|
+
card_number: string;
|
|
51
|
+
card_type: string;
|
|
52
|
+
card_holder_name: string;
|
|
53
|
+
card_charges: number;
|
|
54
|
+
card_country_code: string;
|
|
55
|
+
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
56
|
+
};
|
|
57
|
+
amount_paid: number;
|
|
58
|
+
amount_due: number;
|
|
59
|
+
amount_refunded: number;
|
|
60
|
+
payment_id: string;
|
|
61
|
+
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
62
|
+
refund_reason?: string | null | undefined;
|
|
63
|
+
note?: string | null | undefined;
|
|
64
|
+
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId | null | undefined, any, {
|
|
65
|
+
payment_type: string;
|
|
66
|
+
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
67
|
+
card_details: {
|
|
68
|
+
transaction_id: string;
|
|
69
|
+
payment_provider_linked_customer_id: string;
|
|
70
|
+
card_number: string;
|
|
71
|
+
card_type: string;
|
|
72
|
+
card_holder_name: string;
|
|
73
|
+
card_charges: number;
|
|
74
|
+
card_country_code: string;
|
|
75
|
+
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
76
|
+
};
|
|
77
|
+
amount_paid: number;
|
|
78
|
+
amount_due: number;
|
|
79
|
+
amount_refunded: number;
|
|
80
|
+
payment_id: string;
|
|
81
|
+
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
82
|
+
refund_reason?: string | null | undefined;
|
|
83
|
+
note?: string | null | undefined;
|
|
84
|
+
}> & {
|
|
85
|
+
payment_type: string;
|
|
86
|
+
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
87
|
+
card_details: {
|
|
88
|
+
transaction_id: string;
|
|
89
|
+
payment_provider_linked_customer_id: string;
|
|
90
|
+
card_number: string;
|
|
91
|
+
card_type: string;
|
|
92
|
+
card_holder_name: string;
|
|
93
|
+
card_charges: number;
|
|
94
|
+
card_country_code: string;
|
|
95
|
+
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
96
|
+
};
|
|
97
|
+
amount_paid: number;
|
|
98
|
+
amount_due: number;
|
|
99
|
+
amount_refunded: number;
|
|
100
|
+
payment_id: string;
|
|
101
|
+
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
102
|
+
refund_reason?: string | null | undefined;
|
|
103
|
+
note?: string | null | undefined;
|
|
104
|
+
}>;
|
|
105
|
+
amount_earned: number;
|
|
106
|
+
grand_total: number;
|
|
107
|
+
amount_collected: number;
|
|
44
108
|
is_deleted: boolean;
|
|
45
109
|
created_by: {
|
|
46
110
|
name: string;
|
|
@@ -58,6 +122,9 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
58
122
|
destination_name: string;
|
|
59
123
|
total_items: number;
|
|
60
124
|
total_quantity: number;
|
|
125
|
+
is_gst_inclusive?: boolean | null | undefined;
|
|
126
|
+
gst?: number | null | undefined;
|
|
127
|
+
gst_amount?: number | null | undefined;
|
|
61
128
|
notes?: string | null | undefined;
|
|
62
129
|
approved_by?: {
|
|
63
130
|
name: string;
|
|
@@ -159,6 +226,70 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
159
226
|
}>;
|
|
160
227
|
status: import("../../constants").WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM;
|
|
161
228
|
ref_id: string;
|
|
229
|
+
payments: import("mongoose").Types.DocumentArray<{
|
|
230
|
+
payment_type: string;
|
|
231
|
+
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
232
|
+
card_details: {
|
|
233
|
+
transaction_id: string;
|
|
234
|
+
payment_provider_linked_customer_id: string;
|
|
235
|
+
card_number: string;
|
|
236
|
+
card_type: string;
|
|
237
|
+
card_holder_name: string;
|
|
238
|
+
card_charges: number;
|
|
239
|
+
card_country_code: string;
|
|
240
|
+
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
241
|
+
};
|
|
242
|
+
amount_paid: number;
|
|
243
|
+
amount_due: number;
|
|
244
|
+
amount_refunded: number;
|
|
245
|
+
payment_id: string;
|
|
246
|
+
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
247
|
+
refund_reason?: string | null | undefined;
|
|
248
|
+
note?: string | null | undefined;
|
|
249
|
+
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId | null | undefined, any, {
|
|
250
|
+
payment_type: string;
|
|
251
|
+
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
252
|
+
card_details: {
|
|
253
|
+
transaction_id: string;
|
|
254
|
+
payment_provider_linked_customer_id: string;
|
|
255
|
+
card_number: string;
|
|
256
|
+
card_type: string;
|
|
257
|
+
card_holder_name: string;
|
|
258
|
+
card_charges: number;
|
|
259
|
+
card_country_code: string;
|
|
260
|
+
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
261
|
+
};
|
|
262
|
+
amount_paid: number;
|
|
263
|
+
amount_due: number;
|
|
264
|
+
amount_refunded: number;
|
|
265
|
+
payment_id: string;
|
|
266
|
+
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
267
|
+
refund_reason?: string | null | undefined;
|
|
268
|
+
note?: string | null | undefined;
|
|
269
|
+
}> & {
|
|
270
|
+
payment_type: string;
|
|
271
|
+
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
272
|
+
card_details: {
|
|
273
|
+
transaction_id: string;
|
|
274
|
+
payment_provider_linked_customer_id: string;
|
|
275
|
+
card_number: string;
|
|
276
|
+
card_type: string;
|
|
277
|
+
card_holder_name: string;
|
|
278
|
+
card_charges: number;
|
|
279
|
+
card_country_code: string;
|
|
280
|
+
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
281
|
+
};
|
|
282
|
+
amount_paid: number;
|
|
283
|
+
amount_due: number;
|
|
284
|
+
amount_refunded: number;
|
|
285
|
+
payment_id: string;
|
|
286
|
+
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
287
|
+
refund_reason?: string | null | undefined;
|
|
288
|
+
note?: string | null | undefined;
|
|
289
|
+
}>;
|
|
290
|
+
amount_earned: number;
|
|
291
|
+
grand_total: number;
|
|
292
|
+
amount_collected: number;
|
|
162
293
|
is_deleted: boolean;
|
|
163
294
|
created_by: {
|
|
164
295
|
name: string;
|
|
@@ -176,6 +307,9 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
176
307
|
destination_name: string;
|
|
177
308
|
total_items: number;
|
|
178
309
|
total_quantity: number;
|
|
310
|
+
is_gst_inclusive?: boolean | null | undefined;
|
|
311
|
+
gst?: number | null | undefined;
|
|
312
|
+
gst_amount?: number | null | undefined;
|
|
179
313
|
notes?: string | null | undefined;
|
|
180
314
|
approved_by?: {
|
|
181
315
|
name: string;
|
|
@@ -277,6 +411,70 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
277
411
|
}>;
|
|
278
412
|
status: import("../../constants").WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM;
|
|
279
413
|
ref_id: string;
|
|
414
|
+
payments: import("mongoose").Types.DocumentArray<{
|
|
415
|
+
payment_type: string;
|
|
416
|
+
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
417
|
+
card_details: {
|
|
418
|
+
transaction_id: string;
|
|
419
|
+
payment_provider_linked_customer_id: string;
|
|
420
|
+
card_number: string;
|
|
421
|
+
card_type: string;
|
|
422
|
+
card_holder_name: string;
|
|
423
|
+
card_charges: number;
|
|
424
|
+
card_country_code: string;
|
|
425
|
+
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
426
|
+
};
|
|
427
|
+
amount_paid: number;
|
|
428
|
+
amount_due: number;
|
|
429
|
+
amount_refunded: number;
|
|
430
|
+
payment_id: string;
|
|
431
|
+
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
432
|
+
refund_reason?: string | null | undefined;
|
|
433
|
+
note?: string | null | undefined;
|
|
434
|
+
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId | null | undefined, any, {
|
|
435
|
+
payment_type: string;
|
|
436
|
+
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
437
|
+
card_details: {
|
|
438
|
+
transaction_id: string;
|
|
439
|
+
payment_provider_linked_customer_id: string;
|
|
440
|
+
card_number: string;
|
|
441
|
+
card_type: string;
|
|
442
|
+
card_holder_name: string;
|
|
443
|
+
card_charges: number;
|
|
444
|
+
card_country_code: string;
|
|
445
|
+
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
446
|
+
};
|
|
447
|
+
amount_paid: number;
|
|
448
|
+
amount_due: number;
|
|
449
|
+
amount_refunded: number;
|
|
450
|
+
payment_id: string;
|
|
451
|
+
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
452
|
+
refund_reason?: string | null | undefined;
|
|
453
|
+
note?: string | null | undefined;
|
|
454
|
+
}> & {
|
|
455
|
+
payment_type: string;
|
|
456
|
+
payment_status: import("../../constants").PAYMENT_STATUS_ENUM;
|
|
457
|
+
card_details: {
|
|
458
|
+
transaction_id: string;
|
|
459
|
+
payment_provider_linked_customer_id: string;
|
|
460
|
+
card_number: string;
|
|
461
|
+
card_type: string;
|
|
462
|
+
card_holder_name: string;
|
|
463
|
+
card_charges: number;
|
|
464
|
+
card_country_code: string;
|
|
465
|
+
payment_provider: import("../../constants").PAYMENT_PROVIDERS_ENUM;
|
|
466
|
+
};
|
|
467
|
+
amount_paid: number;
|
|
468
|
+
amount_due: number;
|
|
469
|
+
amount_refunded: number;
|
|
470
|
+
payment_id: string;
|
|
471
|
+
_id?: import("mongoose").Types.ObjectId | null | undefined;
|
|
472
|
+
refund_reason?: string | null | undefined;
|
|
473
|
+
note?: string | null | undefined;
|
|
474
|
+
}>;
|
|
475
|
+
amount_earned: number;
|
|
476
|
+
grand_total: number;
|
|
477
|
+
amount_collected: number;
|
|
280
478
|
is_deleted: boolean;
|
|
281
479
|
created_by: {
|
|
282
480
|
name: string;
|
|
@@ -294,6 +492,9 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
294
492
|
destination_name: string;
|
|
295
493
|
total_items: number;
|
|
296
494
|
total_quantity: number;
|
|
495
|
+
is_gst_inclusive?: boolean | null | undefined;
|
|
496
|
+
gst?: number | null | undefined;
|
|
497
|
+
gst_amount?: number | null | undefined;
|
|
297
498
|
notes?: string | null | undefined;
|
|
298
499
|
approved_by?: {
|
|
299
500
|
name: string;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.WarehouseInternalMovementsSchema = exports.WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_NAME = void 0;
|
|
4
4
|
const mongoose_1 = require("mongoose");
|
|
5
5
|
const constants_1 = require("../../constants");
|
|
6
|
+
const common_models_1 = require("./common-models");
|
|
6
7
|
const warehouse_items_1 = require("./warehouse_items");
|
|
7
8
|
exports.WAREHOUSE_INTERNAL_MOVEMENTS_COLLECTION_NAME = 'warehouse_internal_movements';
|
|
8
9
|
const WarehouseInternalMovementActorSchema = new mongoose_1.Schema({
|
|
@@ -142,6 +143,43 @@ exports.WarehouseInternalMovementsSchema = new mongoose_1.Schema({
|
|
|
142
143
|
required: true,
|
|
143
144
|
default: 0,
|
|
144
145
|
},
|
|
146
|
+
grand_total: {
|
|
147
|
+
type: Number,
|
|
148
|
+
min: 0,
|
|
149
|
+
required: true,
|
|
150
|
+
default: 0,
|
|
151
|
+
},
|
|
152
|
+
payments: {
|
|
153
|
+
type: [common_models_1.PaymentsSchema],
|
|
154
|
+
required: true,
|
|
155
|
+
default: [],
|
|
156
|
+
},
|
|
157
|
+
amount_collected: {
|
|
158
|
+
type: Number,
|
|
159
|
+
min: 0,
|
|
160
|
+
required: true,
|
|
161
|
+
default: 0,
|
|
162
|
+
},
|
|
163
|
+
amount_earned: {
|
|
164
|
+
type: Number,
|
|
165
|
+
min: 0,
|
|
166
|
+
required: true,
|
|
167
|
+
default: 0,
|
|
168
|
+
},
|
|
169
|
+
is_gst_inclusive: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
required: false,
|
|
172
|
+
},
|
|
173
|
+
gst: {
|
|
174
|
+
type: Number,
|
|
175
|
+
min: 0,
|
|
176
|
+
required: false,
|
|
177
|
+
},
|
|
178
|
+
gst_amount: {
|
|
179
|
+
type: Number,
|
|
180
|
+
min: 0,
|
|
181
|
+
required: false,
|
|
182
|
+
},
|
|
145
183
|
parent_movement_id: {
|
|
146
184
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
147
185
|
required: false,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WAREHOUSE_INTERNAL_MOVEMENT_EDIT_REQUEST_STATUS_ENUM, WAREHOUSE_INTERNAL_MOVEMENT_FLOW_ENUM, WAREHOUSE_INTERNAL_MOVEMENT_LOCATION_TYPE_ENUM, WAREHOUSE_INTERNAL_MOVEMENT_RECORD_TYPE_ENUM, WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM, WAREHOUSE_REF_TYPE_ENUM } from '../../constants';
|
|
2
|
+
import { IOrderPayment } from './orders';
|
|
2
3
|
export interface IWarehouseInternalMovementActorRef {
|
|
3
4
|
uid: string;
|
|
4
5
|
name: string;
|
|
@@ -63,6 +64,13 @@ export interface IWarehouseInternalMovement extends IWarehouseInternalMovementSt
|
|
|
63
64
|
items: IWarehouseInternalMovementItem[];
|
|
64
65
|
total_items: number;
|
|
65
66
|
total_quantity: number;
|
|
67
|
+
grand_total: number;
|
|
68
|
+
payments: IOrderPayment[];
|
|
69
|
+
amount_collected: number;
|
|
70
|
+
amount_earned: number;
|
|
71
|
+
is_gst_inclusive?: boolean;
|
|
72
|
+
gst?: number | null;
|
|
73
|
+
gst_amount?: number | null;
|
|
66
74
|
parent_movement_id?: string | null;
|
|
67
75
|
notes?: string | null;
|
|
68
76
|
created_by: IWarehouseInternalMovementActorRef;
|