@managesome/eposmatic-toolkit 0.4.84 → 0.4.86
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/esm/helpers/order/generate-warehouse-internal-movement.js +8 -0
- package/esm/helpers/store/common-warehouse-internal-movement-actions.js +41 -0
- package/esm/schemas/models/customers.js +37 -1
- package/esm/schemas/models/tenants.js +8 -0
- package/esm/schemas/models/warehouse_internal_movements.js +16 -0
- package/esm/schemas/models/warehouses.js +8 -0
- package/lib/helpers/order/generate-warehouse-internal-movement.js +8 -0
- package/lib/helpers/store/common-warehouse-internal-movement-actions.js +41 -0
- package/lib/schemas/models/customers.d.ts +53 -1
- package/lib/schemas/models/customers.js +38 -2
- package/lib/schemas/models/tenants.d.ts +6 -0
- package/lib/schemas/models/tenants.js +8 -0
- package/lib/schemas/models/warehouse_internal_movements.d.ts +120 -0
- package/lib/schemas/models/warehouse_internal_movements.js +16 -0
- package/lib/schemas/models/warehouses.d.ts +6 -0
- package/lib/schemas/models/warehouses.js +8 -0
- package/lib/schemas/types/tenants.d.ts +2 -0
- package/lib/schemas/types/warehouse_internal_movements.d.ts +8 -0
- package/lib/schemas/types/warehouses.d.ts +2 -0
- package/package.json +1 -1
|
@@ -17,6 +17,14 @@ export function generateWarehouseInternalMovementIteration(movement, partial = t
|
|
|
17
17
|
is_gst_inclusive: movement.is_gst_inclusive,
|
|
18
18
|
gst: movement.gst,
|
|
19
19
|
gst_amount: movement.gst_amount,
|
|
20
|
+
labor_charges: movement.labor_charges,
|
|
21
|
+
labor_charges_amount: movement.labor_charges_amount,
|
|
22
|
+
is_labor_charges_percentage: movement.is_labor_charges_percentage,
|
|
23
|
+
is_labor_charges_taxable: movement.is_labor_charges_taxable,
|
|
24
|
+
freight_charges: movement.freight_charges,
|
|
25
|
+
freight_charges_amount: movement.freight_charges_amount,
|
|
26
|
+
is_freight_charges_percentage: movement.is_freight_charges_percentage,
|
|
27
|
+
is_freight_charges_taxable: movement.is_freight_charges_taxable,
|
|
20
28
|
notes: movement.notes,
|
|
21
29
|
status: movement.status,
|
|
22
30
|
updatedAt: movement.updatedAt,
|
|
@@ -53,6 +53,16 @@ export function getWarehouseInternalMovementWithPrice(order, writeable) {
|
|
|
53
53
|
...(order.amount_collected != null ? { amount_collected: convertToPrice(order.amount_collected) } : {}),
|
|
54
54
|
...(order.amount_earned != null ? { amount_earned: convertToPrice(order.amount_earned) } : {}),
|
|
55
55
|
...(order.gst != null ? { gst: convertToPrice(order.gst) } : {}),
|
|
56
|
+
...(order.labor_charges != null && order.is_labor_charges_percentage !== true
|
|
57
|
+
? { labor_charges: convertToPrice(order.labor_charges) }
|
|
58
|
+
: {}),
|
|
59
|
+
...(order.labor_charges_amount != null ? { labor_charges_amount: convertToPrice(order.labor_charges_amount) } : {}),
|
|
60
|
+
...(order.freight_charges != null && order.is_freight_charges_percentage !== true
|
|
61
|
+
? { freight_charges: convertToPrice(order.freight_charges) }
|
|
62
|
+
: {}),
|
|
63
|
+
...(order.freight_charges_amount != null
|
|
64
|
+
? { freight_charges_amount: convertToPrice(order.freight_charges_amount) }
|
|
65
|
+
: {}),
|
|
56
66
|
...(order.items != null
|
|
57
67
|
? {
|
|
58
68
|
items: getWarehouseInternalMovementItemsWithPrice(order.items, convertToPrice),
|
|
@@ -75,6 +85,29 @@ export function calculateCartInternalMovementInfoAndSyncData(data) {
|
|
|
75
85
|
let grand_total = subtotal;
|
|
76
86
|
let gst_amount = 0;
|
|
77
87
|
const gst = data.gst ?? 0;
|
|
88
|
+
// Order-level charges (labor, freight): entered per movement, either a fixed
|
|
89
|
+
// amount or a percentage of the items subtotal. `is_*_charges_taxable`
|
|
90
|
+
// (snapshot of the warehouse setting) decides the placement: taxable => added
|
|
91
|
+
// BEFORE GST, untaxed => added after it.
|
|
92
|
+
const getOrderCharge = (value, isPercentage) => {
|
|
93
|
+
const entered = parseNum(Math.max(0, value ?? 0));
|
|
94
|
+
return {
|
|
95
|
+
entered,
|
|
96
|
+
amount: isPercentage ? parseNum(getPercentageAmount(subtotal, entered)) : entered,
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
const labor = getOrderCharge(data.labor_charges, data.is_labor_charges_percentage);
|
|
100
|
+
const freight = getOrderCharge(data.freight_charges, data.is_freight_charges_percentage);
|
|
101
|
+
const labor_charges = labor.entered;
|
|
102
|
+
const labor_charges_amount = labor.amount;
|
|
103
|
+
const freight_charges = freight.entered;
|
|
104
|
+
const freight_charges_amount = freight.amount;
|
|
105
|
+
const isLaborTaxable = data.is_labor_charges_taxable === true;
|
|
106
|
+
const isFreightTaxable = data.is_freight_charges_taxable === true;
|
|
107
|
+
const taxableCharges = (isLaborTaxable ? labor_charges_amount : 0) + (isFreightTaxable ? freight_charges_amount : 0);
|
|
108
|
+
if (taxableCharges > 0) {
|
|
109
|
+
grand_total += taxableCharges;
|
|
110
|
+
}
|
|
78
111
|
if (gst > 0 && data.is_gst_inclusive) {
|
|
79
112
|
gst_amount = parseFloatCeil((grand_total * gst) / (100 + gst));
|
|
80
113
|
}
|
|
@@ -82,6 +115,10 @@ export function calculateCartInternalMovementInfoAndSyncData(data) {
|
|
|
82
115
|
gst_amount = getPercentageAmount(grand_total, gst);
|
|
83
116
|
grand_total += gst_amount;
|
|
84
117
|
}
|
|
118
|
+
const untaxedCharges = (isLaborTaxable ? 0 : labor_charges_amount) + (isFreightTaxable ? 0 : freight_charges_amount);
|
|
119
|
+
if (untaxedCharges > 0) {
|
|
120
|
+
grand_total += untaxedCharges;
|
|
121
|
+
}
|
|
85
122
|
const { cardCharges, amountCollected } = getCardChargesAndAmountCollected(data.payments);
|
|
86
123
|
grand_total += cardCharges;
|
|
87
124
|
grand_total = parseNum(grand_total);
|
|
@@ -89,6 +126,10 @@ export function calculateCartInternalMovementInfoAndSyncData(data) {
|
|
|
89
126
|
...data,
|
|
90
127
|
grand_total,
|
|
91
128
|
gst_amount,
|
|
129
|
+
labor_charges,
|
|
130
|
+
labor_charges_amount,
|
|
131
|
+
freight_charges,
|
|
132
|
+
freight_charges_amount,
|
|
92
133
|
amount_collected: parseNum(amountCollected),
|
|
93
134
|
amount_earned: parseNum(grand_total - cardCharges),
|
|
94
135
|
};
|
|
@@ -219,7 +219,10 @@ export const CUSTOMER_COLLECTION_NAME = 'customers';
|
|
|
219
219
|
* be passed straight to `.hint()`.
|
|
220
220
|
* - `_id`: unique primary key.
|
|
221
221
|
* - `brand_id__phone_number`: per-brand customer lookups by phone number.
|
|
222
|
-
*
|
|
222
|
+
* UNIQUE (partial on non-empty phone) — one customer per phone per brand.
|
|
223
|
+
* - `brand_id__email`: per-brand customer lookups by email (email login).
|
|
224
|
+
* UNIQUE (partial on non-empty email) — one customer per email per brand.
|
|
225
|
+
* See `CUSTOMER_COLLECTION_UNIQUE_INDEXES` for the exact index options.
|
|
223
226
|
* - `brand_id__createdAt`: per-brand customer lookups newest first.
|
|
224
227
|
* - `brand_id__total_spent`: per-brand customer lookups by total spent.
|
|
225
228
|
* - `brand_id__total_orders`: per-brand customer lookups by total orders.
|
|
@@ -272,3 +275,36 @@ export const CUSTOMER_COLLECTION_INDEXES = {
|
|
|
272
275
|
voucher_codes: 1,
|
|
273
276
|
}, // per-brand customer lookups by voucher codes
|
|
274
277
|
};
|
|
278
|
+
/**
|
|
279
|
+
* Unique indexes that protect the customer identity inside a brand:
|
|
280
|
+
* - one customer per phone number,
|
|
281
|
+
* - one customer per email.
|
|
282
|
+
*
|
|
283
|
+
* Both are PARTIAL on non-empty values. A plain unique index would allow only
|
|
284
|
+
* one customer per brand without an email/phone because MongoDB indexes `null`
|
|
285
|
+
* and missing fields like any other value; the `$gt: ''` filter keeps those
|
|
286
|
+
* documents out of the index entirely.
|
|
287
|
+
*
|
|
288
|
+
* Use these definitions as the source of truth for the indexes that must exist
|
|
289
|
+
* in Atlas. Creating and maintaining them is an ops/deployment concern —
|
|
290
|
+
* application code only hints the existing indexes (CUSTOMER_COLLECTION_INDEXES)
|
|
291
|
+
* and must never create or drop them.
|
|
292
|
+
*/
|
|
293
|
+
export const CUSTOMER_COLLECTION_UNIQUE_INDEXES = {
|
|
294
|
+
brand_id__phone_number: {
|
|
295
|
+
keys: CUSTOMER_COLLECTION_INDEXES.brand_id__phone_number,
|
|
296
|
+
options: {
|
|
297
|
+
name: 'brand_id__phone_number_unique',
|
|
298
|
+
unique: true,
|
|
299
|
+
partialFilterExpression: { phone_number: { $type: 'string', $gt: '' } },
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
brand_id__email: {
|
|
303
|
+
keys: CUSTOMER_COLLECTION_INDEXES.brand_id__email,
|
|
304
|
+
options: {
|
|
305
|
+
name: 'brand_id__email_unique',
|
|
306
|
+
unique: true,
|
|
307
|
+
partialFilterExpression: { email: { $type: 'string', $gt: '' } },
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
};
|
|
@@ -465,6 +465,14 @@ export const TenantSchema = new Schema({
|
|
|
465
465
|
enum: ALL_GST_TYPES,
|
|
466
466
|
required: false,
|
|
467
467
|
},
|
|
468
|
+
is_im_labor_charges_taxable: {
|
|
469
|
+
type: Boolean,
|
|
470
|
+
default: false,
|
|
471
|
+
},
|
|
472
|
+
is_im_freight_charges_taxable: {
|
|
473
|
+
type: Boolean,
|
|
474
|
+
default: false,
|
|
475
|
+
},
|
|
468
476
|
po_card_gst: {
|
|
469
477
|
type: Number,
|
|
470
478
|
required: false,
|
|
@@ -120,6 +120,14 @@ export const WarehouseInternalMovementIterationSchema = new Schema({
|
|
|
120
120
|
min: 0,
|
|
121
121
|
required: false,
|
|
122
122
|
},
|
|
123
|
+
labor_charges: { type: Number, min: 0, required: false },
|
|
124
|
+
labor_charges_amount: { type: Number, min: 0, required: false },
|
|
125
|
+
is_labor_charges_percentage: { type: Boolean, required: false },
|
|
126
|
+
is_labor_charges_taxable: { type: Boolean, required: false },
|
|
127
|
+
freight_charges: { type: Number, min: 0, required: false },
|
|
128
|
+
freight_charges_amount: { type: Number, min: 0, required: false },
|
|
129
|
+
is_freight_charges_percentage: { type: Boolean, required: false },
|
|
130
|
+
is_freight_charges_taxable: { type: Boolean, required: false },
|
|
123
131
|
notes: {
|
|
124
132
|
type: String,
|
|
125
133
|
required: false,
|
|
@@ -258,6 +266,14 @@ export const WarehouseInternalMovementsSchema = new Schema({
|
|
|
258
266
|
min: 0,
|
|
259
267
|
required: false,
|
|
260
268
|
},
|
|
269
|
+
labor_charges: { type: Number, min: 0, required: false },
|
|
270
|
+
labor_charges_amount: { type: Number, min: 0, required: false },
|
|
271
|
+
is_labor_charges_percentage: { type: Boolean, required: false },
|
|
272
|
+
is_labor_charges_taxable: { type: Boolean, required: false },
|
|
273
|
+
freight_charges: { type: Number, min: 0, required: false },
|
|
274
|
+
freight_charges_amount: { type: Number, min: 0, required: false },
|
|
275
|
+
is_freight_charges_percentage: { type: Boolean, required: false },
|
|
276
|
+
is_freight_charges_taxable: { type: Boolean, required: false },
|
|
261
277
|
parent_movement_id: {
|
|
262
278
|
type: Schema.Types.ObjectId,
|
|
263
279
|
required: false, // ID of another warehouse internal movement that this movement is a child of (e.g., a dispatched movement may have a parent requested movement)
|
|
@@ -130,6 +130,14 @@ export const WarehouseSchema = new Schema({
|
|
|
130
130
|
type: Number,
|
|
131
131
|
default: 0,
|
|
132
132
|
},
|
|
133
|
+
is_im_labor_charges_taxable: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
default: false,
|
|
136
|
+
},
|
|
137
|
+
is_im_freight_charges_taxable: {
|
|
138
|
+
type: Boolean,
|
|
139
|
+
default: false,
|
|
140
|
+
},
|
|
133
141
|
im_cash_gst: {
|
|
134
142
|
type: Number,
|
|
135
143
|
default: 0,
|
|
@@ -24,6 +24,14 @@ function generateWarehouseInternalMovementIteration(movement, partial = true) {
|
|
|
24
24
|
is_gst_inclusive: movement.is_gst_inclusive,
|
|
25
25
|
gst: movement.gst,
|
|
26
26
|
gst_amount: movement.gst_amount,
|
|
27
|
+
labor_charges: movement.labor_charges,
|
|
28
|
+
labor_charges_amount: movement.labor_charges_amount,
|
|
29
|
+
is_labor_charges_percentage: movement.is_labor_charges_percentage,
|
|
30
|
+
is_labor_charges_taxable: movement.is_labor_charges_taxable,
|
|
31
|
+
freight_charges: movement.freight_charges,
|
|
32
|
+
freight_charges_amount: movement.freight_charges_amount,
|
|
33
|
+
is_freight_charges_percentage: movement.is_freight_charges_percentage,
|
|
34
|
+
is_freight_charges_taxable: movement.is_freight_charges_taxable,
|
|
27
35
|
notes: movement.notes,
|
|
28
36
|
status: movement.status,
|
|
29
37
|
updatedAt: movement.updatedAt,
|
|
@@ -59,6 +59,16 @@ function getWarehouseInternalMovementWithPrice(order, writeable) {
|
|
|
59
59
|
...(order.amount_collected != null ? { amount_collected: convertToPrice(order.amount_collected) } : {}),
|
|
60
60
|
...(order.amount_earned != null ? { amount_earned: convertToPrice(order.amount_earned) } : {}),
|
|
61
61
|
...(order.gst != null ? { gst: convertToPrice(order.gst) } : {}),
|
|
62
|
+
...(order.labor_charges != null && order.is_labor_charges_percentage !== true
|
|
63
|
+
? { labor_charges: convertToPrice(order.labor_charges) }
|
|
64
|
+
: {}),
|
|
65
|
+
...(order.labor_charges_amount != null ? { labor_charges_amount: convertToPrice(order.labor_charges_amount) } : {}),
|
|
66
|
+
...(order.freight_charges != null && order.is_freight_charges_percentage !== true
|
|
67
|
+
? { freight_charges: convertToPrice(order.freight_charges) }
|
|
68
|
+
: {}),
|
|
69
|
+
...(order.freight_charges_amount != null
|
|
70
|
+
? { freight_charges_amount: convertToPrice(order.freight_charges_amount) }
|
|
71
|
+
: {}),
|
|
62
72
|
...(order.items != null
|
|
63
73
|
? {
|
|
64
74
|
items: getWarehouseInternalMovementItemsWithPrice(order.items, convertToPrice),
|
|
@@ -81,6 +91,29 @@ function calculateCartInternalMovementInfoAndSyncData(data) {
|
|
|
81
91
|
let grand_total = subtotal;
|
|
82
92
|
let gst_amount = 0;
|
|
83
93
|
const gst = data.gst ?? 0;
|
|
94
|
+
// Order-level charges (labor, freight): entered per movement, either a fixed
|
|
95
|
+
// amount or a percentage of the items subtotal. `is_*_charges_taxable`
|
|
96
|
+
// (snapshot of the warehouse setting) decides the placement: taxable => added
|
|
97
|
+
// BEFORE GST, untaxed => added after it.
|
|
98
|
+
const getOrderCharge = (value, isPercentage) => {
|
|
99
|
+
const entered = (0, utils_1.parseNum)(Math.max(0, value ?? 0));
|
|
100
|
+
return {
|
|
101
|
+
entered,
|
|
102
|
+
amount: isPercentage ? (0, utils_1.parseNum)((0, utils_1.getPercentageAmount)(subtotal, entered)) : entered,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
const labor = getOrderCharge(data.labor_charges, data.is_labor_charges_percentage);
|
|
106
|
+
const freight = getOrderCharge(data.freight_charges, data.is_freight_charges_percentage);
|
|
107
|
+
const labor_charges = labor.entered;
|
|
108
|
+
const labor_charges_amount = labor.amount;
|
|
109
|
+
const freight_charges = freight.entered;
|
|
110
|
+
const freight_charges_amount = freight.amount;
|
|
111
|
+
const isLaborTaxable = data.is_labor_charges_taxable === true;
|
|
112
|
+
const isFreightTaxable = data.is_freight_charges_taxable === true;
|
|
113
|
+
const taxableCharges = (isLaborTaxable ? labor_charges_amount : 0) + (isFreightTaxable ? freight_charges_amount : 0);
|
|
114
|
+
if (taxableCharges > 0) {
|
|
115
|
+
grand_total += taxableCharges;
|
|
116
|
+
}
|
|
84
117
|
if (gst > 0 && data.is_gst_inclusive) {
|
|
85
118
|
gst_amount = (0, utils_1.parseFloatCeil)((grand_total * gst) / (100 + gst));
|
|
86
119
|
}
|
|
@@ -88,6 +121,10 @@ function calculateCartInternalMovementInfoAndSyncData(data) {
|
|
|
88
121
|
gst_amount = (0, utils_1.getPercentageAmount)(grand_total, gst);
|
|
89
122
|
grand_total += gst_amount;
|
|
90
123
|
}
|
|
124
|
+
const untaxedCharges = (isLaborTaxable ? 0 : labor_charges_amount) + (isFreightTaxable ? 0 : freight_charges_amount);
|
|
125
|
+
if (untaxedCharges > 0) {
|
|
126
|
+
grand_total += untaxedCharges;
|
|
127
|
+
}
|
|
91
128
|
const { cardCharges, amountCollected } = (0, utils_1.getCardChargesAndAmountCollected)(data.payments);
|
|
92
129
|
grand_total += cardCharges;
|
|
93
130
|
grand_total = (0, utils_1.parseNum)(grand_total);
|
|
@@ -95,6 +132,10 @@ function calculateCartInternalMovementInfoAndSyncData(data) {
|
|
|
95
132
|
...data,
|
|
96
133
|
grand_total,
|
|
97
134
|
gst_amount,
|
|
135
|
+
labor_charges,
|
|
136
|
+
labor_charges_amount,
|
|
137
|
+
freight_charges,
|
|
138
|
+
freight_charges_amount,
|
|
98
139
|
amount_collected: (0, utils_1.parseNum)(amountCollected),
|
|
99
140
|
amount_earned: (0, utils_1.parseNum)(grand_total - cardCharges),
|
|
100
141
|
};
|
|
@@ -572,7 +572,10 @@ export declare const CUSTOMER_COLLECTION_NAME = "customers";
|
|
|
572
572
|
* be passed straight to `.hint()`.
|
|
573
573
|
* - `_id`: unique primary key.
|
|
574
574
|
* - `brand_id__phone_number`: per-brand customer lookups by phone number.
|
|
575
|
-
*
|
|
575
|
+
* UNIQUE (partial on non-empty phone) — one customer per phone per brand.
|
|
576
|
+
* - `brand_id__email`: per-brand customer lookups by email (email login).
|
|
577
|
+
* UNIQUE (partial on non-empty email) — one customer per email per brand.
|
|
578
|
+
* See `CUSTOMER_COLLECTION_UNIQUE_INDEXES` for the exact index options.
|
|
576
579
|
* - `brand_id__createdAt`: per-brand customer lookups newest first.
|
|
577
580
|
* - `brand_id__total_spent`: per-brand customer lookups by total spent.
|
|
578
581
|
* - `brand_id__total_orders`: per-brand customer lookups by total orders.
|
|
@@ -627,3 +630,52 @@ export declare const CUSTOMER_COLLECTION_INDEXES: {
|
|
|
627
630
|
voucher_codes: number;
|
|
628
631
|
};
|
|
629
632
|
};
|
|
633
|
+
/**
|
|
634
|
+
* Unique indexes that protect the customer identity inside a brand:
|
|
635
|
+
* - one customer per phone number,
|
|
636
|
+
* - one customer per email.
|
|
637
|
+
*
|
|
638
|
+
* Both are PARTIAL on non-empty values. A plain unique index would allow only
|
|
639
|
+
* one customer per brand without an email/phone because MongoDB indexes `null`
|
|
640
|
+
* and missing fields like any other value; the `$gt: ''` filter keeps those
|
|
641
|
+
* documents out of the index entirely.
|
|
642
|
+
*
|
|
643
|
+
* Use these definitions as the source of truth for the indexes that must exist
|
|
644
|
+
* in Atlas. Creating and maintaining them is an ops/deployment concern —
|
|
645
|
+
* application code only hints the existing indexes (CUSTOMER_COLLECTION_INDEXES)
|
|
646
|
+
* and must never create or drop them.
|
|
647
|
+
*/
|
|
648
|
+
export declare const CUSTOMER_COLLECTION_UNIQUE_INDEXES: {
|
|
649
|
+
brand_id__phone_number: {
|
|
650
|
+
keys: {
|
|
651
|
+
brand_id: number;
|
|
652
|
+
phone_number: number;
|
|
653
|
+
};
|
|
654
|
+
options: {
|
|
655
|
+
name: string;
|
|
656
|
+
unique: boolean;
|
|
657
|
+
partialFilterExpression: {
|
|
658
|
+
phone_number: {
|
|
659
|
+
$type: string;
|
|
660
|
+
$gt: string;
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
};
|
|
664
|
+
};
|
|
665
|
+
brand_id__email: {
|
|
666
|
+
keys: {
|
|
667
|
+
brand_id: number;
|
|
668
|
+
email: number;
|
|
669
|
+
};
|
|
670
|
+
options: {
|
|
671
|
+
name: string;
|
|
672
|
+
unique: boolean;
|
|
673
|
+
partialFilterExpression: {
|
|
674
|
+
email: {
|
|
675
|
+
$type: string;
|
|
676
|
+
$gt: string;
|
|
677
|
+
};
|
|
678
|
+
};
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CUSTOMER_COLLECTION_INDEXES = exports.CUSTOMER_COLLECTION_NAME = exports.CustomersSchema = void 0;
|
|
3
|
+
exports.CUSTOMER_COLLECTION_UNIQUE_INDEXES = exports.CUSTOMER_COLLECTION_INDEXES = exports.CUSTOMER_COLLECTION_NAME = exports.CustomersSchema = 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");
|
|
@@ -222,7 +222,10 @@ exports.CUSTOMER_COLLECTION_NAME = 'customers';
|
|
|
222
222
|
* be passed straight to `.hint()`.
|
|
223
223
|
* - `_id`: unique primary key.
|
|
224
224
|
* - `brand_id__phone_number`: per-brand customer lookups by phone number.
|
|
225
|
-
*
|
|
225
|
+
* UNIQUE (partial on non-empty phone) — one customer per phone per brand.
|
|
226
|
+
* - `brand_id__email`: per-brand customer lookups by email (email login).
|
|
227
|
+
* UNIQUE (partial on non-empty email) — one customer per email per brand.
|
|
228
|
+
* See `CUSTOMER_COLLECTION_UNIQUE_INDEXES` for the exact index options.
|
|
226
229
|
* - `brand_id__createdAt`: per-brand customer lookups newest first.
|
|
227
230
|
* - `brand_id__total_spent`: per-brand customer lookups by total spent.
|
|
228
231
|
* - `brand_id__total_orders`: per-brand customer lookups by total orders.
|
|
@@ -275,3 +278,36 @@ exports.CUSTOMER_COLLECTION_INDEXES = {
|
|
|
275
278
|
voucher_codes: 1,
|
|
276
279
|
}, // per-brand customer lookups by voucher codes
|
|
277
280
|
};
|
|
281
|
+
/**
|
|
282
|
+
* Unique indexes that protect the customer identity inside a brand:
|
|
283
|
+
* - one customer per phone number,
|
|
284
|
+
* - one customer per email.
|
|
285
|
+
*
|
|
286
|
+
* Both are PARTIAL on non-empty values. A plain unique index would allow only
|
|
287
|
+
* one customer per brand without an email/phone because MongoDB indexes `null`
|
|
288
|
+
* and missing fields like any other value; the `$gt: ''` filter keeps those
|
|
289
|
+
* documents out of the index entirely.
|
|
290
|
+
*
|
|
291
|
+
* Use these definitions as the source of truth for the indexes that must exist
|
|
292
|
+
* in Atlas. Creating and maintaining them is an ops/deployment concern —
|
|
293
|
+
* application code only hints the existing indexes (CUSTOMER_COLLECTION_INDEXES)
|
|
294
|
+
* and must never create or drop them.
|
|
295
|
+
*/
|
|
296
|
+
exports.CUSTOMER_COLLECTION_UNIQUE_INDEXES = {
|
|
297
|
+
brand_id__phone_number: {
|
|
298
|
+
keys: exports.CUSTOMER_COLLECTION_INDEXES.brand_id__phone_number,
|
|
299
|
+
options: {
|
|
300
|
+
name: 'brand_id__phone_number_unique',
|
|
301
|
+
unique: true,
|
|
302
|
+
partialFilterExpression: { phone_number: { $type: 'string', $gt: '' } },
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
brand_id__email: {
|
|
306
|
+
keys: exports.CUSTOMER_COLLECTION_INDEXES.brand_id__email,
|
|
307
|
+
options: {
|
|
308
|
+
name: 'brand_id__email_unique',
|
|
309
|
+
unique: true,
|
|
310
|
+
partialFilterExpression: { email: { $type: 'string', $gt: '' } },
|
|
311
|
+
},
|
|
312
|
+
},
|
|
313
|
+
};
|
|
@@ -104,6 +104,8 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
|
|
|
104
104
|
card_gst: number;
|
|
105
105
|
cash_gst: number;
|
|
106
106
|
default_gst_type: GST_TYPE_ENUM;
|
|
107
|
+
is_im_labor_charges_taxable: boolean;
|
|
108
|
+
is_im_freight_charges_taxable: boolean;
|
|
107
109
|
web_cover_image: string;
|
|
108
110
|
web_favicon: string;
|
|
109
111
|
web_design_type: ONLINE_ORDERING_DESIGN_TYPE_ENUM;
|
|
@@ -288,6 +290,8 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
|
|
|
288
290
|
card_gst: number;
|
|
289
291
|
cash_gst: number;
|
|
290
292
|
default_gst_type: GST_TYPE_ENUM;
|
|
293
|
+
is_im_labor_charges_taxable: boolean;
|
|
294
|
+
is_im_freight_charges_taxable: boolean;
|
|
291
295
|
web_cover_image: string;
|
|
292
296
|
web_favicon: string;
|
|
293
297
|
web_design_type: ONLINE_ORDERING_DESIGN_TYPE_ENUM;
|
|
@@ -472,6 +476,8 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
|
|
|
472
476
|
card_gst: number;
|
|
473
477
|
cash_gst: number;
|
|
474
478
|
default_gst_type: GST_TYPE_ENUM;
|
|
479
|
+
is_im_labor_charges_taxable: boolean;
|
|
480
|
+
is_im_freight_charges_taxable: boolean;
|
|
475
481
|
web_cover_image: string;
|
|
476
482
|
web_favicon: string;
|
|
477
483
|
web_design_type: ONLINE_ORDERING_DESIGN_TYPE_ENUM;
|
|
@@ -468,6 +468,14 @@ exports.TenantSchema = new mongoose_1.Schema({
|
|
|
468
468
|
enum: constants_1.ALL_GST_TYPES,
|
|
469
469
|
required: false,
|
|
470
470
|
},
|
|
471
|
+
is_im_labor_charges_taxable: {
|
|
472
|
+
type: Boolean,
|
|
473
|
+
default: false,
|
|
474
|
+
},
|
|
475
|
+
is_im_freight_charges_taxable: {
|
|
476
|
+
type: Boolean,
|
|
477
|
+
default: false,
|
|
478
|
+
},
|
|
471
479
|
po_card_gst: {
|
|
472
480
|
type: Number,
|
|
473
481
|
required: false,
|
|
@@ -106,6 +106,14 @@ export declare const WarehouseInternalMovementIterationSchema: Schema<any, impor
|
|
|
106
106
|
is_gst_inclusive?: boolean | null | undefined;
|
|
107
107
|
gst?: number | null | undefined;
|
|
108
108
|
gst_amount?: number | null | undefined;
|
|
109
|
+
labor_charges?: number | null | undefined;
|
|
110
|
+
labor_charges_amount?: number | null | undefined;
|
|
111
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
112
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
113
|
+
freight_charges?: number | null | undefined;
|
|
114
|
+
freight_charges_amount?: number | null | undefined;
|
|
115
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
116
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
109
117
|
notes?: string | null | undefined;
|
|
110
118
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
111
119
|
updatedAt: NativeDate;
|
|
@@ -210,6 +218,14 @@ export declare const WarehouseInternalMovementIterationSchema: Schema<any, impor
|
|
|
210
218
|
is_gst_inclusive?: boolean | null | undefined;
|
|
211
219
|
gst?: number | null | undefined;
|
|
212
220
|
gst_amount?: number | null | undefined;
|
|
221
|
+
labor_charges?: number | null | undefined;
|
|
222
|
+
labor_charges_amount?: number | null | undefined;
|
|
223
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
224
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
225
|
+
freight_charges?: number | null | undefined;
|
|
226
|
+
freight_charges_amount?: number | null | undefined;
|
|
227
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
228
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
213
229
|
notes?: string | null | undefined;
|
|
214
230
|
}>> & import("mongoose").FlatRecord<{
|
|
215
231
|
updatedAt: NativeDate;
|
|
@@ -314,6 +330,14 @@ export declare const WarehouseInternalMovementIterationSchema: Schema<any, impor
|
|
|
314
330
|
is_gst_inclusive?: boolean | null | undefined;
|
|
315
331
|
gst?: number | null | undefined;
|
|
316
332
|
gst_amount?: number | null | undefined;
|
|
333
|
+
labor_charges?: number | null | undefined;
|
|
334
|
+
labor_charges_amount?: number | null | undefined;
|
|
335
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
336
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
337
|
+
freight_charges?: number | null | undefined;
|
|
338
|
+
freight_charges_amount?: number | null | undefined;
|
|
339
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
340
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
317
341
|
notes?: string | null | undefined;
|
|
318
342
|
}> & {
|
|
319
343
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -468,6 +492,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
468
492
|
is_gst_inclusive?: boolean | null | undefined;
|
|
469
493
|
gst?: number | null | undefined;
|
|
470
494
|
gst_amount?: number | null | undefined;
|
|
495
|
+
labor_charges?: number | null | undefined;
|
|
496
|
+
labor_charges_amount?: number | null | undefined;
|
|
497
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
498
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
499
|
+
freight_charges?: number | null | undefined;
|
|
500
|
+
freight_charges_amount?: number | null | undefined;
|
|
501
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
502
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
471
503
|
notes?: string | null | undefined;
|
|
472
504
|
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
|
|
473
505
|
updatedAt: NativeDate;
|
|
@@ -572,6 +604,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
572
604
|
is_gst_inclusive?: boolean | null | undefined;
|
|
573
605
|
gst?: number | null | undefined;
|
|
574
606
|
gst_amount?: number | null | undefined;
|
|
607
|
+
labor_charges?: number | null | undefined;
|
|
608
|
+
labor_charges_amount?: number | null | undefined;
|
|
609
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
610
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
611
|
+
freight_charges?: number | null | undefined;
|
|
612
|
+
freight_charges_amount?: number | null | undefined;
|
|
613
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
614
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
575
615
|
notes?: string | null | undefined;
|
|
576
616
|
}> & {
|
|
577
617
|
updatedAt: NativeDate;
|
|
@@ -676,6 +716,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
676
716
|
is_gst_inclusive?: boolean | null | undefined;
|
|
677
717
|
gst?: number | null | undefined;
|
|
678
718
|
gst_amount?: number | null | undefined;
|
|
719
|
+
labor_charges?: number | null | undefined;
|
|
720
|
+
labor_charges_amount?: number | null | undefined;
|
|
721
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
722
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
723
|
+
freight_charges?: number | null | undefined;
|
|
724
|
+
freight_charges_amount?: number | null | undefined;
|
|
725
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
726
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
679
727
|
notes?: string | null | undefined;
|
|
680
728
|
}>;
|
|
681
729
|
payments: import("mongoose").Types.DocumentArray<{
|
|
@@ -763,6 +811,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
763
811
|
is_gst_inclusive?: boolean | null | undefined;
|
|
764
812
|
gst?: number | null | undefined;
|
|
765
813
|
gst_amount?: number | null | undefined;
|
|
814
|
+
labor_charges?: number | null | undefined;
|
|
815
|
+
labor_charges_amount?: number | null | undefined;
|
|
816
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
817
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
818
|
+
freight_charges?: number | null | undefined;
|
|
819
|
+
freight_charges_amount?: number | null | undefined;
|
|
820
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
821
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
766
822
|
notes?: string | null | undefined;
|
|
767
823
|
approved_by?: {
|
|
768
824
|
name: string;
|
|
@@ -969,6 +1025,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
969
1025
|
is_gst_inclusive?: boolean | null | undefined;
|
|
970
1026
|
gst?: number | null | undefined;
|
|
971
1027
|
gst_amount?: number | null | undefined;
|
|
1028
|
+
labor_charges?: number | null | undefined;
|
|
1029
|
+
labor_charges_amount?: number | null | undefined;
|
|
1030
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
1031
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
1032
|
+
freight_charges?: number | null | undefined;
|
|
1033
|
+
freight_charges_amount?: number | null | undefined;
|
|
1034
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
1035
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
972
1036
|
notes?: string | null | undefined;
|
|
973
1037
|
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
|
|
974
1038
|
updatedAt: NativeDate;
|
|
@@ -1073,6 +1137,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
1073
1137
|
is_gst_inclusive?: boolean | null | undefined;
|
|
1074
1138
|
gst?: number | null | undefined;
|
|
1075
1139
|
gst_amount?: number | null | undefined;
|
|
1140
|
+
labor_charges?: number | null | undefined;
|
|
1141
|
+
labor_charges_amount?: number | null | undefined;
|
|
1142
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
1143
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
1144
|
+
freight_charges?: number | null | undefined;
|
|
1145
|
+
freight_charges_amount?: number | null | undefined;
|
|
1146
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
1147
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
1076
1148
|
notes?: string | null | undefined;
|
|
1077
1149
|
}> & {
|
|
1078
1150
|
updatedAt: NativeDate;
|
|
@@ -1177,6 +1249,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
1177
1249
|
is_gst_inclusive?: boolean | null | undefined;
|
|
1178
1250
|
gst?: number | null | undefined;
|
|
1179
1251
|
gst_amount?: number | null | undefined;
|
|
1252
|
+
labor_charges?: number | null | undefined;
|
|
1253
|
+
labor_charges_amount?: number | null | undefined;
|
|
1254
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
1255
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
1256
|
+
freight_charges?: number | null | undefined;
|
|
1257
|
+
freight_charges_amount?: number | null | undefined;
|
|
1258
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
1259
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
1180
1260
|
notes?: string | null | undefined;
|
|
1181
1261
|
}>;
|
|
1182
1262
|
payments: import("mongoose").Types.DocumentArray<{
|
|
@@ -1264,6 +1344,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
1264
1344
|
is_gst_inclusive?: boolean | null | undefined;
|
|
1265
1345
|
gst?: number | null | undefined;
|
|
1266
1346
|
gst_amount?: number | null | undefined;
|
|
1347
|
+
labor_charges?: number | null | undefined;
|
|
1348
|
+
labor_charges_amount?: number | null | undefined;
|
|
1349
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
1350
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
1351
|
+
freight_charges?: number | null | undefined;
|
|
1352
|
+
freight_charges_amount?: number | null | undefined;
|
|
1353
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
1354
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
1267
1355
|
notes?: string | null | undefined;
|
|
1268
1356
|
approved_by?: {
|
|
1269
1357
|
name: string;
|
|
@@ -1470,6 +1558,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
1470
1558
|
is_gst_inclusive?: boolean | null | undefined;
|
|
1471
1559
|
gst?: number | null | undefined;
|
|
1472
1560
|
gst_amount?: number | null | undefined;
|
|
1561
|
+
labor_charges?: number | null | undefined;
|
|
1562
|
+
labor_charges_amount?: number | null | undefined;
|
|
1563
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
1564
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
1565
|
+
freight_charges?: number | null | undefined;
|
|
1566
|
+
freight_charges_amount?: number | null | undefined;
|
|
1567
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
1568
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
1473
1569
|
notes?: string | null | undefined;
|
|
1474
1570
|
}, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
|
|
1475
1571
|
updatedAt: NativeDate;
|
|
@@ -1574,6 +1670,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
1574
1670
|
is_gst_inclusive?: boolean | null | undefined;
|
|
1575
1671
|
gst?: number | null | undefined;
|
|
1576
1672
|
gst_amount?: number | null | undefined;
|
|
1673
|
+
labor_charges?: number | null | undefined;
|
|
1674
|
+
labor_charges_amount?: number | null | undefined;
|
|
1675
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
1676
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
1677
|
+
freight_charges?: number | null | undefined;
|
|
1678
|
+
freight_charges_amount?: number | null | undefined;
|
|
1679
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
1680
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
1577
1681
|
notes?: string | null | undefined;
|
|
1578
1682
|
}> & {
|
|
1579
1683
|
updatedAt: NativeDate;
|
|
@@ -1678,6 +1782,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
1678
1782
|
is_gst_inclusive?: boolean | null | undefined;
|
|
1679
1783
|
gst?: number | null | undefined;
|
|
1680
1784
|
gst_amount?: number | null | undefined;
|
|
1785
|
+
labor_charges?: number | null | undefined;
|
|
1786
|
+
labor_charges_amount?: number | null | undefined;
|
|
1787
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
1788
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
1789
|
+
freight_charges?: number | null | undefined;
|
|
1790
|
+
freight_charges_amount?: number | null | undefined;
|
|
1791
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
1792
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
1681
1793
|
notes?: string | null | undefined;
|
|
1682
1794
|
}>;
|
|
1683
1795
|
payments: import("mongoose").Types.DocumentArray<{
|
|
@@ -1765,6 +1877,14 @@ export declare const WarehouseInternalMovementsSchema: Schema<any, import("mongo
|
|
|
1765
1877
|
is_gst_inclusive?: boolean | null | undefined;
|
|
1766
1878
|
gst?: number | null | undefined;
|
|
1767
1879
|
gst_amount?: number | null | undefined;
|
|
1880
|
+
labor_charges?: number | null | undefined;
|
|
1881
|
+
labor_charges_amount?: number | null | undefined;
|
|
1882
|
+
is_labor_charges_percentage?: boolean | null | undefined;
|
|
1883
|
+
is_labor_charges_taxable?: boolean | null | undefined;
|
|
1884
|
+
freight_charges?: number | null | undefined;
|
|
1885
|
+
freight_charges_amount?: number | null | undefined;
|
|
1886
|
+
is_freight_charges_percentage?: boolean | null | undefined;
|
|
1887
|
+
is_freight_charges_taxable?: boolean | null | undefined;
|
|
1768
1888
|
notes?: string | null | undefined;
|
|
1769
1889
|
approved_by?: {
|
|
1770
1890
|
name: string;
|
|
@@ -123,6 +123,14 @@ exports.WarehouseInternalMovementIterationSchema = new mongoose_1.Schema({
|
|
|
123
123
|
min: 0,
|
|
124
124
|
required: false,
|
|
125
125
|
},
|
|
126
|
+
labor_charges: { type: Number, min: 0, required: false },
|
|
127
|
+
labor_charges_amount: { type: Number, min: 0, required: false },
|
|
128
|
+
is_labor_charges_percentage: { type: Boolean, required: false },
|
|
129
|
+
is_labor_charges_taxable: { type: Boolean, required: false },
|
|
130
|
+
freight_charges: { type: Number, min: 0, required: false },
|
|
131
|
+
freight_charges_amount: { type: Number, min: 0, required: false },
|
|
132
|
+
is_freight_charges_percentage: { type: Boolean, required: false },
|
|
133
|
+
is_freight_charges_taxable: { type: Boolean, required: false },
|
|
126
134
|
notes: {
|
|
127
135
|
type: String,
|
|
128
136
|
required: false,
|
|
@@ -261,6 +269,14 @@ exports.WarehouseInternalMovementsSchema = new mongoose_1.Schema({
|
|
|
261
269
|
min: 0,
|
|
262
270
|
required: false,
|
|
263
271
|
},
|
|
272
|
+
labor_charges: { type: Number, min: 0, required: false },
|
|
273
|
+
labor_charges_amount: { type: Number, min: 0, required: false },
|
|
274
|
+
is_labor_charges_percentage: { type: Boolean, required: false },
|
|
275
|
+
is_labor_charges_taxable: { type: Boolean, required: false },
|
|
276
|
+
freight_charges: { type: Number, min: 0, required: false },
|
|
277
|
+
freight_charges_amount: { type: Number, min: 0, required: false },
|
|
278
|
+
is_freight_charges_percentage: { type: Boolean, required: false },
|
|
279
|
+
is_freight_charges_taxable: { type: Boolean, required: false },
|
|
264
280
|
parent_movement_id: {
|
|
265
281
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
266
282
|
required: false, // ID of another warehouse internal movement that this movement is a child of (e.g., a dispatched movement may have a parent requested movement)
|
|
@@ -35,6 +35,8 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
|
|
|
35
35
|
im_card_gst: number;
|
|
36
36
|
im_cash_gst: number;
|
|
37
37
|
default_im_gst_type: GST_TYPE_ENUM;
|
|
38
|
+
is_im_labor_charges_taxable: boolean;
|
|
39
|
+
is_im_freight_charges_taxable: boolean;
|
|
38
40
|
po_card_gst: number;
|
|
39
41
|
po_cash_gst: number;
|
|
40
42
|
default_po_gst_type: GST_TYPE_ENUM;
|
|
@@ -91,6 +93,8 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
|
|
|
91
93
|
im_card_gst: number;
|
|
92
94
|
im_cash_gst: number;
|
|
93
95
|
default_im_gst_type: GST_TYPE_ENUM;
|
|
96
|
+
is_im_labor_charges_taxable: boolean;
|
|
97
|
+
is_im_freight_charges_taxable: boolean;
|
|
94
98
|
po_card_gst: number;
|
|
95
99
|
po_cash_gst: number;
|
|
96
100
|
default_po_gst_type: GST_TYPE_ENUM;
|
|
@@ -147,6 +151,8 @@ export declare const WarehouseSchema: Schema<any, import("mongoose").Model<any,
|
|
|
147
151
|
im_card_gst: number;
|
|
148
152
|
im_cash_gst: number;
|
|
149
153
|
default_im_gst_type: GST_TYPE_ENUM;
|
|
154
|
+
is_im_labor_charges_taxable: boolean;
|
|
155
|
+
is_im_freight_charges_taxable: boolean;
|
|
150
156
|
po_card_gst: number;
|
|
151
157
|
po_cash_gst: number;
|
|
152
158
|
default_po_gst_type: GST_TYPE_ENUM;
|
|
@@ -133,6 +133,14 @@ exports.WarehouseSchema = new mongoose_1.Schema({
|
|
|
133
133
|
type: Number,
|
|
134
134
|
default: 0,
|
|
135
135
|
},
|
|
136
|
+
is_im_labor_charges_taxable: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
default: false,
|
|
139
|
+
},
|
|
140
|
+
is_im_freight_charges_taxable: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
default: false,
|
|
143
|
+
},
|
|
136
144
|
im_cash_gst: {
|
|
137
145
|
type: Number,
|
|
138
146
|
default: 0,
|
|
@@ -108,6 +108,8 @@ export interface ITenant {
|
|
|
108
108
|
im_card_gst?: number;
|
|
109
109
|
im_cash_gst?: number;
|
|
110
110
|
default_im_gst_type?: GST_TYPE_ENUM;
|
|
111
|
+
is_im_labor_charges_taxable?: boolean;
|
|
112
|
+
is_im_freight_charges_taxable?: boolean;
|
|
111
113
|
po_card_gst?: number;
|
|
112
114
|
po_cash_gst?: number;
|
|
113
115
|
default_po_gst_type?: GST_TYPE_ENUM;
|
|
@@ -59,6 +59,14 @@ export interface IWarehouseInternalMovementIteration {
|
|
|
59
59
|
is_gst_inclusive?: boolean;
|
|
60
60
|
gst?: number | null;
|
|
61
61
|
gst_amount?: number | null;
|
|
62
|
+
labor_charges?: number;
|
|
63
|
+
labor_charges_amount?: number;
|
|
64
|
+
is_labor_charges_percentage?: boolean;
|
|
65
|
+
is_labor_charges_taxable?: boolean;
|
|
66
|
+
freight_charges?: number;
|
|
67
|
+
freight_charges_amount?: number;
|
|
68
|
+
is_freight_charges_percentage?: boolean;
|
|
69
|
+
is_freight_charges_taxable?: boolean;
|
|
62
70
|
notes?: string | null;
|
|
63
71
|
status: WAREHOUSE_INTERNAL_MOVEMENT_STATUS_ENUM;
|
|
64
72
|
updatedAt: Date;
|
|
@@ -30,6 +30,8 @@ export interface IWarehouse {
|
|
|
30
30
|
im_card_gst: number;
|
|
31
31
|
im_cash_gst: number;
|
|
32
32
|
default_im_gst_type: GST_TYPE_ENUM;
|
|
33
|
+
is_im_labor_charges_taxable?: boolean;
|
|
34
|
+
is_im_freight_charges_taxable?: boolean;
|
|
33
35
|
tax_business_number: string;
|
|
34
36
|
tax_invoice_provider?: TAX_INVOICE_PROVIDER_ENUM;
|
|
35
37
|
tax_invoice_generation_id?: string | null;
|