@managesome/eposmatic-toolkit 0.2.501 → 0.2.502
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/common-warehouse-internal-movement-actions.d.ts +6 -0
- package/lib/helpers/store/common-warehouse-internal-movement-actions.js +29 -0
- package/lib/helpers/utils/warehouse-settings-helpers.js +10 -0
- package/lib/schemas/models/warehouses.d.ts +13 -1
- package/lib/schemas/models/warehouses.js +17 -0
- package/lib/schemas/types/warehouses.d.ts +5 -1
- package/package.json +1 -1
|
@@ -10,3 +10,9 @@ export declare function getWarehouseInternalMovementItemsWithPrice(items: IWareh
|
|
|
10
10
|
* - `writeable = false` → cents → decimal (after receiving from backend)
|
|
11
11
|
*/
|
|
12
12
|
export declare function getWarehouseInternalMovementWithPrice<T extends Partial<IWarehouseInternalMovement> | IWarehouseInternalMovement>(order: T, writeable?: boolean): T;
|
|
13
|
+
/**
|
|
14
|
+
* Recalculate financial totals for an internal movement — mirrors
|
|
15
|
+
* `calculateCartWarehousePurchaseOrderInfoAndSyncData` but for the flat
|
|
16
|
+
* `items` array instead of nested `categories`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function calculateCartInternalMovementInfoAndSyncData<T extends Partial<IWarehouseInternalMovement> | IWarehouseInternalMovement>(data: T): T;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getWarehouseInternalMovementItemsWithPrice = getWarehouseInternalMovementItemsWithPrice;
|
|
4
4
|
exports.getWarehouseInternalMovementWithPrice = getWarehouseInternalMovementWithPrice;
|
|
5
|
+
exports.calculateCartInternalMovementInfoAndSyncData = calculateCartInternalMovementInfoAndSyncData;
|
|
5
6
|
const utils_1 = require("../utils");
|
|
6
7
|
const common_order_actions_1 = require("./common-order-actions");
|
|
7
8
|
/**
|
|
@@ -56,3 +57,31 @@ function getWarehouseInternalMovementWithPrice(order, writeable) {
|
|
|
56
57
|
: {}),
|
|
57
58
|
};
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Recalculate financial totals for an internal movement — mirrors
|
|
62
|
+
* `calculateCartWarehousePurchaseOrderInfoAndSyncData` but for the flat
|
|
63
|
+
* `items` array instead of nested `categories`.
|
|
64
|
+
*/
|
|
65
|
+
function calculateCartInternalMovementInfoAndSyncData(data) {
|
|
66
|
+
const subtotal = (data.items ?? []).reduce((sum, item) => sum + (0, utils_1.parseNum)((item.unit_price ?? 0) * (item.quantity ?? 0)), 0);
|
|
67
|
+
let grand_total = subtotal;
|
|
68
|
+
let gst_amount = 0;
|
|
69
|
+
const gst = data.gst ?? 0;
|
|
70
|
+
if (gst > 0 && data.is_gst_inclusive) {
|
|
71
|
+
gst_amount = (0, utils_1.parseFloatCeil)((grand_total * gst) / (100 + gst));
|
|
72
|
+
}
|
|
73
|
+
else if (gst > 0) {
|
|
74
|
+
gst_amount = (0, utils_1.getPercentageAmount)(grand_total, gst);
|
|
75
|
+
grand_total += gst_amount;
|
|
76
|
+
}
|
|
77
|
+
const { cardCharges, amountCollected } = (0, utils_1.getCardChargesAndAmountCollected)(data.payments);
|
|
78
|
+
grand_total += cardCharges;
|
|
79
|
+
grand_total = (0, utils_1.parseNum)(grand_total);
|
|
80
|
+
return {
|
|
81
|
+
...data,
|
|
82
|
+
grand_total,
|
|
83
|
+
gst_amount,
|
|
84
|
+
amount_collected: (0, utils_1.parseNum)(amountCollected),
|
|
85
|
+
amount_earned: (0, utils_1.parseNum)(grand_total - cardCharges),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -26,5 +26,15 @@ function getWarehouseSettingsWithPrice(settings, writeable) {
|
|
|
26
26
|
cash_gst: convertToPrice(settings.invoice_cash_gst),
|
|
27
27
|
}
|
|
28
28
|
: {}),
|
|
29
|
+
...(settings.im_card_gst != null
|
|
30
|
+
? {
|
|
31
|
+
im_card_gst: convertToPrice(settings.im_card_gst),
|
|
32
|
+
}
|
|
33
|
+
: {}),
|
|
34
|
+
...(settings.im_cash_gst != null
|
|
35
|
+
? {
|
|
36
|
+
im_cash_gst: convertToPrice(settings.im_cash_gst),
|
|
37
|
+
}
|
|
38
|
+
: {}),
|
|
29
39
|
};
|
|
30
40
|
}
|
|
@@ -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,
|
|
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, WAREHOUSE_REMOVAL_STRATEGY_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;
|
|
@@ -42,12 +42,16 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
|
|
|
42
42
|
invoice_cash_gst: number;
|
|
43
43
|
default_po_gst_type: GST_TYPE_ENUM;
|
|
44
44
|
default_invoice_gst_type: GST_TYPE_ENUM;
|
|
45
|
+
im_card_gst: number;
|
|
46
|
+
im_cash_gst: number;
|
|
47
|
+
default_im_gst_type: GST_TYPE_ENUM;
|
|
45
48
|
track_purchase_order_number_by: TRACK_ORDER_NUMBER_ENUM;
|
|
46
49
|
track_invoice_number_by: TRACK_ORDER_NUMBER_ENUM;
|
|
47
50
|
enable_lot_serial_tracking: boolean;
|
|
48
51
|
default_removal_strategy: WAREHOUSE_REMOVAL_STRATEGY_ENUM;
|
|
49
52
|
po_custom_payment_types: string[];
|
|
50
53
|
invoice_custom_payment_types: string[];
|
|
54
|
+
im_custom_payment_types: string[];
|
|
51
55
|
tax_invoice_provider?: import("../../constants").TAX_INVOICE_PROVIDER_ENUM | null | undefined;
|
|
52
56
|
is_gst_inclusive?: boolean | null | undefined;
|
|
53
57
|
exclude_discount_from_gst?: boolean | null | undefined;
|
|
@@ -92,12 +96,16 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
|
|
|
92
96
|
invoice_cash_gst: number;
|
|
93
97
|
default_po_gst_type: GST_TYPE_ENUM;
|
|
94
98
|
default_invoice_gst_type: GST_TYPE_ENUM;
|
|
99
|
+
im_card_gst: number;
|
|
100
|
+
im_cash_gst: number;
|
|
101
|
+
default_im_gst_type: GST_TYPE_ENUM;
|
|
95
102
|
track_purchase_order_number_by: TRACK_ORDER_NUMBER_ENUM;
|
|
96
103
|
track_invoice_number_by: TRACK_ORDER_NUMBER_ENUM;
|
|
97
104
|
enable_lot_serial_tracking: boolean;
|
|
98
105
|
default_removal_strategy: WAREHOUSE_REMOVAL_STRATEGY_ENUM;
|
|
99
106
|
po_custom_payment_types: string[];
|
|
100
107
|
invoice_custom_payment_types: string[];
|
|
108
|
+
im_custom_payment_types: string[];
|
|
101
109
|
tax_invoice_provider?: import("../../constants").TAX_INVOICE_PROVIDER_ENUM | null | undefined;
|
|
102
110
|
is_gst_inclusive?: boolean | null | undefined;
|
|
103
111
|
exclude_discount_from_gst?: boolean | null | undefined;
|
|
@@ -142,12 +150,16 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
|
|
|
142
150
|
invoice_cash_gst: number;
|
|
143
151
|
default_po_gst_type: GST_TYPE_ENUM;
|
|
144
152
|
default_invoice_gst_type: GST_TYPE_ENUM;
|
|
153
|
+
im_card_gst: number;
|
|
154
|
+
im_cash_gst: number;
|
|
155
|
+
default_im_gst_type: GST_TYPE_ENUM;
|
|
145
156
|
track_purchase_order_number_by: TRACK_ORDER_NUMBER_ENUM;
|
|
146
157
|
track_invoice_number_by: TRACK_ORDER_NUMBER_ENUM;
|
|
147
158
|
enable_lot_serial_tracking: boolean;
|
|
148
159
|
default_removal_strategy: WAREHOUSE_REMOVAL_STRATEGY_ENUM;
|
|
149
160
|
po_custom_payment_types: string[];
|
|
150
161
|
invoice_custom_payment_types: string[];
|
|
162
|
+
im_custom_payment_types: string[];
|
|
151
163
|
tax_invoice_provider?: import("../../constants").TAX_INVOICE_PROVIDER_ENUM | null | undefined;
|
|
152
164
|
is_gst_inclusive?: boolean | null | undefined;
|
|
153
165
|
exclude_discount_from_gst?: boolean | null | undefined;
|
|
@@ -121,6 +121,19 @@ exports.WarehouseSchema = new mongoose_1.Schema({
|
|
|
121
121
|
enum: constants_1.ALL_GST_TYPES,
|
|
122
122
|
default: constants_1.GST_TYPE_ENUM.CARD,
|
|
123
123
|
},
|
|
124
|
+
im_card_gst: {
|
|
125
|
+
type: Number,
|
|
126
|
+
default: 0,
|
|
127
|
+
},
|
|
128
|
+
im_cash_gst: {
|
|
129
|
+
type: Number,
|
|
130
|
+
default: 0,
|
|
131
|
+
},
|
|
132
|
+
default_im_gst_type: {
|
|
133
|
+
type: String,
|
|
134
|
+
enum: constants_1.ALL_GST_TYPES,
|
|
135
|
+
default: constants_1.GST_TYPE_ENUM.CARD,
|
|
136
|
+
},
|
|
124
137
|
tax_business_number: {
|
|
125
138
|
type: String,
|
|
126
139
|
default: '',
|
|
@@ -203,6 +216,10 @@ exports.WarehouseSchema = new mongoose_1.Schema({
|
|
|
203
216
|
type: [String],
|
|
204
217
|
default: [],
|
|
205
218
|
},
|
|
219
|
+
im_custom_payment_types: {
|
|
220
|
+
type: [String],
|
|
221
|
+
default: [],
|
|
222
|
+
},
|
|
206
223
|
createdAt: {
|
|
207
224
|
type: mongoose_1.Schema.Types.Date,
|
|
208
225
|
required: true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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,
|
|
1
|
+
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, TAX_INVOICE_PROVIDER_ENUM, TRACK_ORDER_NUMBER_ENUM, WAREHOUSE_REMOVAL_STRATEGY_ENUM } from '../../constants';
|
|
2
2
|
export interface IWarehouse {
|
|
3
3
|
_id: string;
|
|
4
4
|
brand_id: string;
|
|
@@ -25,6 +25,9 @@ export interface IWarehouse {
|
|
|
25
25
|
invoice_cash_gst: number;
|
|
26
26
|
default_po_gst_type: GST_TYPE_ENUM;
|
|
27
27
|
default_invoice_gst_type: GST_TYPE_ENUM;
|
|
28
|
+
im_card_gst: number;
|
|
29
|
+
im_cash_gst: number;
|
|
30
|
+
default_im_gst_type: GST_TYPE_ENUM;
|
|
28
31
|
tax_business_number: string;
|
|
29
32
|
tax_invoice_provider?: TAX_INVOICE_PROVIDER_ENUM;
|
|
30
33
|
tax_invoice_generation_id?: string | null;
|
|
@@ -43,6 +46,7 @@ export interface IWarehouse {
|
|
|
43
46
|
default_removal_strategy: WAREHOUSE_REMOVAL_STRATEGY_ENUM;
|
|
44
47
|
po_custom_payment_types: string[];
|
|
45
48
|
invoice_custom_payment_types: string[];
|
|
49
|
+
im_custom_payment_types: string[];
|
|
46
50
|
active: boolean;
|
|
47
51
|
createdAt: Date;
|
|
48
52
|
updatedAt: Date;
|