@managesome/eposmatic-toolkit 0.4.83 → 0.4.84

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.
@@ -104,6 +104,16 @@ export function getTenantPurchaseOrderWithPrice(order, writeable) {
104
104
  ...(order.total_discount_applied != null
105
105
  ? { total_discount_applied: convertToPrice(order.total_discount_applied) }
106
106
  : {}),
107
+ ...(order.labor_charges != null && order.is_labor_charges_percentage !== true
108
+ ? { labor_charges: convertToPrice(order.labor_charges) }
109
+ : {}),
110
+ ...(order.labor_charges_amount != null ? { labor_charges_amount: convertToPrice(order.labor_charges_amount) } : {}),
111
+ ...(order.freight_charges != null && order.is_freight_charges_percentage !== true
112
+ ? { freight_charges: convertToPrice(order.freight_charges) }
113
+ : {}),
114
+ ...(order.freight_charges_amount != null
115
+ ? { freight_charges_amount: convertToPrice(order.freight_charges_amount) }
116
+ : {}),
107
117
  };
108
118
  return payload;
109
119
  }
@@ -143,6 +153,10 @@ function getCommonOptionalBoolFieldsTenantPurchaseOrder(order, partial) {
143
153
  is_reopened: order['is_reopened'] || defaultValue,
144
154
  exclude_discount_from_gst: order['exclude_discount_from_gst'] || defaultValue,
145
155
  is_gst_percentage: order['is_gst_percentage'] ?? (partial ? undefined : true),
156
+ is_labor_charges_percentage: order['is_labor_charges_percentage'] ?? defaultValue,
157
+ is_labor_charges_taxable: order['is_labor_charges_taxable'] || defaultValue,
158
+ is_freight_charges_percentage: order['is_freight_charges_percentage'] ?? defaultValue,
159
+ is_freight_charges_taxable: order['is_freight_charges_taxable'] || defaultValue,
146
160
  };
147
161
  }
148
162
  function getCommonOptionalNumFieldsTenantPurchaseOrder(order, partial) {
@@ -151,6 +165,10 @@ function getCommonOptionalNumFieldsTenantPurchaseOrder(order, partial) {
151
165
  gst: order['gst'] || defaultValue,
152
166
  gst_amount: order['gst_amount'] || defaultValue,
153
167
  total_discount_applied: order['total_discount_applied'] || defaultValue,
168
+ labor_charges: order['labor_charges'] || defaultValue,
169
+ labor_charges_amount: order['labor_charges_amount'] || defaultValue,
170
+ freight_charges: order['freight_charges'] || defaultValue,
171
+ freight_charges_amount: order['freight_charges_amount'] || defaultValue,
154
172
  };
155
173
  }
156
174
  export function getTenantPurchaseOrderWithAllFields(order, skipItemMetadata) {
@@ -87,6 +87,33 @@ export function calculateCartTenantPurchaseOrderInfoAndSyncData(data, calculateI
87
87
  if (!applyGSTOnOriginalPrice) {
88
88
  grand_total -= total_discount_applied;
89
89
  }
90
+ // Order-level charges (labor, freight): entered per PO, either a fixed amount
91
+ // or a percentage of the post-discount items value. The matching
92
+ // `is_*_charges_taxable` flag (snapshot of the tenant setting) decides the
93
+ // placement, exactly like `is_service_fee_taxable` on a POS order: taxable =>
94
+ // added BEFORE GST so the tax applies to it (an inclusive rate treats it as
95
+ // tax-inclusive); untaxed => added after GST.
96
+ const chargesBase = parseNum(Math.max(0, subtotal - total_discount_applied));
97
+ const getOrderCharge = (value, isPercentage) => {
98
+ const entered = parseNum(Math.max(0, value ?? 0));
99
+ return {
100
+ entered,
101
+ amount: isPercentage ? parseNum(getPercentageAmount(chargesBase, entered)) : entered,
102
+ };
103
+ };
104
+ const labor = getOrderCharge(data.labor_charges, data.is_labor_charges_percentage);
105
+ const freight = getOrderCharge(data.freight_charges, data.is_freight_charges_percentage);
106
+ const labor_charges = labor.entered;
107
+ const labor_charges_amount = labor.amount;
108
+ const freight_charges = freight.entered;
109
+ const freight_charges_amount = freight.amount;
110
+ const isLaborTaxable = data.is_labor_charges_taxable === true;
111
+ const isFreightTaxable = data.is_freight_charges_taxable === true;
112
+ // Taxable charges join the GST base here; untaxed ones are added further down.
113
+ const taxableCharges = (isLaborTaxable ? labor_charges_amount : 0) + (isFreightTaxable ? freight_charges_amount : 0);
114
+ if (taxableCharges > 0) {
115
+ grand_total += taxableCharges;
116
+ }
90
117
  let gst_amount = 0;
91
118
  const gst = data.gst ?? 0;
92
119
  const isGstPercentage = data.is_gst_percentage !== false;
@@ -112,6 +139,11 @@ export function calculateCartTenantPurchaseOrderInfoAndSyncData(data, calculateI
112
139
  if (applyGSTOnOriginalPrice) {
113
140
  grand_total -= total_discount_applied;
114
141
  }
142
+ // Untaxed charges sit outside the GST base, so they are added after the tax.
143
+ const untaxedCharges = (isLaborTaxable ? 0 : labor_charges_amount) + (isFreightTaxable ? 0 : freight_charges_amount);
144
+ if (untaxedCharges > 0) {
145
+ grand_total += untaxedCharges;
146
+ }
115
147
  const { cardCharges, amountCollected } = getCardChargesAndAmountCollected(data.payments);
116
148
  grand_total += cardCharges;
117
149
  grand_total = parseNum(grand_total);
@@ -168,6 +200,10 @@ export function calculateCartTenantPurchaseOrderInfoAndSyncData(data, calculateI
168
200
  order_discount_details,
169
201
  total_discount_applied,
170
202
  gst_amount,
203
+ labor_charges,
204
+ labor_charges_amount,
205
+ freight_charges,
206
+ freight_charges_amount,
171
207
  price: parseNum(subtotal),
172
208
  grand_total,
173
209
  };
@@ -93,6 +93,14 @@ const IterationsOrderSchema = new Schema({
93
93
  gst_amount: { type: Number, min: 0, required: false },
94
94
  is_gst_inclusive: { type: Boolean, required: false },
95
95
  is_gst_percentage: { type: Boolean, required: false },
96
+ labor_charges: { type: Number, min: 0, required: false },
97
+ labor_charges_amount: { type: Number, min: 0, required: false },
98
+ is_labor_charges_percentage: { type: Boolean, required: false },
99
+ is_labor_charges_taxable: { type: Boolean, required: false },
100
+ freight_charges: { type: Number, min: 0, required: false },
101
+ freight_charges_amount: { type: Number, min: 0, required: false },
102
+ is_freight_charges_percentage: { type: Boolean, required: false },
103
+ is_freight_charges_taxable: { type: Boolean, required: false },
96
104
  tax_number: { type: String, default: '' },
97
105
  updatedAt: { type: Schema.Types.Date, required: true },
98
106
  }, { _id: false, timestamps: false, versionKey: false });
@@ -134,6 +142,17 @@ export const TenantPurchaseOrderSchema = new Schema({
134
142
  is_gst_inclusive: { type: Boolean, required: false },
135
143
  // true/undefined => `gst` is a percentage, false => `gst` is a fixed amount
136
144
  is_gst_percentage: { type: Boolean, required: false },
145
+ labor_charges: { type: Number, min: 0, required: false },
146
+ labor_charges_amount: { type: Number, min: 0, required: false },
147
+ // true => `labor_charges` is a percentage of the post-discount subtotal
148
+ is_labor_charges_percentage: { type: Boolean, required: false },
149
+ // true => the labor charge is inside the GST base (added before GST)
150
+ is_labor_charges_taxable: { type: Boolean, required: false },
151
+ // freight charge, mirrors the labor fields above
152
+ freight_charges: { type: Number, min: 0, required: false },
153
+ freight_charges_amount: { type: Number, min: 0, required: false },
154
+ is_freight_charges_percentage: { type: Boolean, required: false },
155
+ is_freight_charges_taxable: { type: Boolean, required: false },
137
156
  is_deleted: { type: Boolean, default: false },
138
157
  order_status_updated_at: {
139
158
  type: Schema.Types.Date,
@@ -478,6 +478,14 @@ export const TenantSchema = new Schema({
478
478
  enum: ALL_GST_TYPES,
479
479
  required: false,
480
480
  },
481
+ is_labor_charges_taxable: {
482
+ type: Boolean,
483
+ default: false,
484
+ },
485
+ is_freight_charges_taxable: {
486
+ type: Boolean,
487
+ default: false,
488
+ },
481
489
  web_design_type: {
482
490
  type: String,
483
491
  enum: ALL_ONLINE_ORDERING_DESIGN_TYPES,
@@ -121,6 +121,16 @@ function getTenantPurchaseOrderWithPrice(order, writeable) {
121
121
  ...(order.total_discount_applied != null
122
122
  ? { total_discount_applied: convertToPrice(order.total_discount_applied) }
123
123
  : {}),
124
+ ...(order.labor_charges != null && order.is_labor_charges_percentage !== true
125
+ ? { labor_charges: convertToPrice(order.labor_charges) }
126
+ : {}),
127
+ ...(order.labor_charges_amount != null ? { labor_charges_amount: convertToPrice(order.labor_charges_amount) } : {}),
128
+ ...(order.freight_charges != null && order.is_freight_charges_percentage !== true
129
+ ? { freight_charges: convertToPrice(order.freight_charges) }
130
+ : {}),
131
+ ...(order.freight_charges_amount != null
132
+ ? { freight_charges_amount: convertToPrice(order.freight_charges_amount) }
133
+ : {}),
124
134
  };
125
135
  return payload;
126
136
  }
@@ -160,6 +170,10 @@ function getCommonOptionalBoolFieldsTenantPurchaseOrder(order, partial) {
160
170
  is_reopened: order['is_reopened'] || defaultValue,
161
171
  exclude_discount_from_gst: order['exclude_discount_from_gst'] || defaultValue,
162
172
  is_gst_percentage: order['is_gst_percentage'] ?? (partial ? undefined : true),
173
+ is_labor_charges_percentage: order['is_labor_charges_percentage'] ?? defaultValue,
174
+ is_labor_charges_taxable: order['is_labor_charges_taxable'] || defaultValue,
175
+ is_freight_charges_percentage: order['is_freight_charges_percentage'] ?? defaultValue,
176
+ is_freight_charges_taxable: order['is_freight_charges_taxable'] || defaultValue,
163
177
  };
164
178
  }
165
179
  function getCommonOptionalNumFieldsTenantPurchaseOrder(order, partial) {
@@ -168,6 +182,10 @@ function getCommonOptionalNumFieldsTenantPurchaseOrder(order, partial) {
168
182
  gst: order['gst'] || defaultValue,
169
183
  gst_amount: order['gst_amount'] || defaultValue,
170
184
  total_discount_applied: order['total_discount_applied'] || defaultValue,
185
+ labor_charges: order['labor_charges'] || defaultValue,
186
+ labor_charges_amount: order['labor_charges_amount'] || defaultValue,
187
+ freight_charges: order['freight_charges'] || defaultValue,
188
+ freight_charges_amount: order['freight_charges_amount'] || defaultValue,
171
189
  };
172
190
  }
173
191
  function getTenantPurchaseOrderWithAllFields(order, skipItemMetadata) {
@@ -103,6 +103,33 @@ function calculateCartTenantPurchaseOrderInfoAndSyncData(data, calculateItemMeta
103
103
  if (!applyGSTOnOriginalPrice) {
104
104
  grand_total -= total_discount_applied;
105
105
  }
106
+ // Order-level charges (labor, freight): entered per PO, either a fixed amount
107
+ // or a percentage of the post-discount items value. The matching
108
+ // `is_*_charges_taxable` flag (snapshot of the tenant setting) decides the
109
+ // placement, exactly like `is_service_fee_taxable` on a POS order: taxable =>
110
+ // added BEFORE GST so the tax applies to it (an inclusive rate treats it as
111
+ // tax-inclusive); untaxed => added after GST.
112
+ const chargesBase = (0, utils_1.parseNum)(Math.max(0, subtotal - total_discount_applied));
113
+ const getOrderCharge = (value, isPercentage) => {
114
+ const entered = (0, utils_1.parseNum)(Math.max(0, value ?? 0));
115
+ return {
116
+ entered,
117
+ amount: isPercentage ? (0, utils_1.parseNum)((0, utils_1.getPercentageAmount)(chargesBase, entered)) : entered,
118
+ };
119
+ };
120
+ const labor = getOrderCharge(data.labor_charges, data.is_labor_charges_percentage);
121
+ const freight = getOrderCharge(data.freight_charges, data.is_freight_charges_percentage);
122
+ const labor_charges = labor.entered;
123
+ const labor_charges_amount = labor.amount;
124
+ const freight_charges = freight.entered;
125
+ const freight_charges_amount = freight.amount;
126
+ const isLaborTaxable = data.is_labor_charges_taxable === true;
127
+ const isFreightTaxable = data.is_freight_charges_taxable === true;
128
+ // Taxable charges join the GST base here; untaxed ones are added further down.
129
+ const taxableCharges = (isLaborTaxable ? labor_charges_amount : 0) + (isFreightTaxable ? freight_charges_amount : 0);
130
+ if (taxableCharges > 0) {
131
+ grand_total += taxableCharges;
132
+ }
106
133
  let gst_amount = 0;
107
134
  const gst = data.gst ?? 0;
108
135
  const isGstPercentage = data.is_gst_percentage !== false;
@@ -128,6 +155,11 @@ function calculateCartTenantPurchaseOrderInfoAndSyncData(data, calculateItemMeta
128
155
  if (applyGSTOnOriginalPrice) {
129
156
  grand_total -= total_discount_applied;
130
157
  }
158
+ // Untaxed charges sit outside the GST base, so they are added after the tax.
159
+ const untaxedCharges = (isLaborTaxable ? 0 : labor_charges_amount) + (isFreightTaxable ? 0 : freight_charges_amount);
160
+ if (untaxedCharges > 0) {
161
+ grand_total += untaxedCharges;
162
+ }
131
163
  const { cardCharges, amountCollected } = (0, utils_1.getCardChargesAndAmountCollected)(data.payments);
132
164
  grand_total += cardCharges;
133
165
  grand_total = (0, utils_1.parseNum)(grand_total);
@@ -184,6 +216,10 @@ function calculateCartTenantPurchaseOrderInfoAndSyncData(data, calculateItemMeta
184
216
  order_discount_details,
185
217
  total_discount_applied,
186
218
  gst_amount,
219
+ labor_charges,
220
+ labor_charges_amount,
221
+ freight_charges,
222
+ freight_charges_amount,
187
223
  price: (0, utils_1.parseNum)(subtotal),
188
224
  grand_total,
189
225
  };
@@ -562,6 +562,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
562
562
  gst?: number | null | undefined;
563
563
  gst_amount?: number | null | undefined;
564
564
  is_gst_percentage?: boolean | null | undefined;
565
+ labor_charges?: number | null | undefined;
566
+ labor_charges_amount?: number | null | undefined;
567
+ is_labor_charges_percentage?: boolean | null | undefined;
568
+ is_labor_charges_taxable?: boolean | null | undefined;
569
+ freight_charges?: number | null | undefined;
570
+ freight_charges_amount?: number | null | undefined;
571
+ is_freight_charges_percentage?: boolean | null | undefined;
572
+ is_freight_charges_taxable?: boolean | null | undefined;
565
573
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
566
574
  updatedAt: NativeDate;
567
575
  categories: import("mongoose").Types.DocumentArray<{
@@ -881,6 +889,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
881
889
  gst?: number | null | undefined;
882
890
  gst_amount?: number | null | undefined;
883
891
  is_gst_percentage?: boolean | null | undefined;
892
+ labor_charges?: number | null | undefined;
893
+ labor_charges_amount?: number | null | undefined;
894
+ is_labor_charges_percentage?: boolean | null | undefined;
895
+ is_labor_charges_taxable?: boolean | null | undefined;
896
+ freight_charges?: number | null | undefined;
897
+ freight_charges_amount?: number | null | undefined;
898
+ is_freight_charges_percentage?: boolean | null | undefined;
899
+ is_freight_charges_taxable?: boolean | null | undefined;
884
900
  }> & {
885
901
  updatedAt: NativeDate;
886
902
  categories: import("mongoose").Types.DocumentArray<{
@@ -1200,6 +1216,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
1200
1216
  gst?: number | null | undefined;
1201
1217
  gst_amount?: number | null | undefined;
1202
1218
  is_gst_percentage?: boolean | null | undefined;
1219
+ labor_charges?: number | null | undefined;
1220
+ labor_charges_amount?: number | null | undefined;
1221
+ is_labor_charges_percentage?: boolean | null | undefined;
1222
+ is_labor_charges_taxable?: boolean | null | undefined;
1223
+ freight_charges?: number | null | undefined;
1224
+ freight_charges_amount?: number | null | undefined;
1225
+ is_freight_charges_percentage?: boolean | null | undefined;
1226
+ is_freight_charges_taxable?: boolean | null | undefined;
1203
1227
  }>;
1204
1228
  special_instructions: string;
1205
1229
  payments: import("mongoose").Types.DocumentArray<{
@@ -1299,6 +1323,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
1299
1323
  gst?: number | null | undefined;
1300
1324
  gst_amount?: number | null | undefined;
1301
1325
  is_gst_percentage?: boolean | null | undefined;
1326
+ labor_charges?: number | null | undefined;
1327
+ labor_charges_amount?: number | null | undefined;
1328
+ is_labor_charges_percentage?: boolean | null | undefined;
1329
+ is_labor_charges_taxable?: boolean | null | undefined;
1330
+ freight_charges?: number | null | undefined;
1331
+ freight_charges_amount?: number | null | undefined;
1332
+ is_freight_charges_percentage?: boolean | null | undefined;
1333
+ is_freight_charges_taxable?: boolean | null | undefined;
1302
1334
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
1303
1335
  createdAt: NativeDate;
1304
1336
  updatedAt: NativeDate;
@@ -1858,6 +1890,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
1858
1890
  gst?: number | null | undefined;
1859
1891
  gst_amount?: number | null | undefined;
1860
1892
  is_gst_percentage?: boolean | null | undefined;
1893
+ labor_charges?: number | null | undefined;
1894
+ labor_charges_amount?: number | null | undefined;
1895
+ is_labor_charges_percentage?: boolean | null | undefined;
1896
+ is_labor_charges_taxable?: boolean | null | undefined;
1897
+ freight_charges?: number | null | undefined;
1898
+ freight_charges_amount?: number | null | undefined;
1899
+ is_freight_charges_percentage?: boolean | null | undefined;
1900
+ is_freight_charges_taxable?: boolean | null | undefined;
1861
1901
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
1862
1902
  updatedAt: NativeDate;
1863
1903
  categories: import("mongoose").Types.DocumentArray<{
@@ -2177,6 +2217,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
2177
2217
  gst?: number | null | undefined;
2178
2218
  gst_amount?: number | null | undefined;
2179
2219
  is_gst_percentage?: boolean | null | undefined;
2220
+ labor_charges?: number | null | undefined;
2221
+ labor_charges_amount?: number | null | undefined;
2222
+ is_labor_charges_percentage?: boolean | null | undefined;
2223
+ is_labor_charges_taxable?: boolean | null | undefined;
2224
+ freight_charges?: number | null | undefined;
2225
+ freight_charges_amount?: number | null | undefined;
2226
+ is_freight_charges_percentage?: boolean | null | undefined;
2227
+ is_freight_charges_taxable?: boolean | null | undefined;
2180
2228
  }> & {
2181
2229
  updatedAt: NativeDate;
2182
2230
  categories: import("mongoose").Types.DocumentArray<{
@@ -2496,6 +2544,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
2496
2544
  gst?: number | null | undefined;
2497
2545
  gst_amount?: number | null | undefined;
2498
2546
  is_gst_percentage?: boolean | null | undefined;
2547
+ labor_charges?: number | null | undefined;
2548
+ labor_charges_amount?: number | null | undefined;
2549
+ is_labor_charges_percentage?: boolean | null | undefined;
2550
+ is_labor_charges_taxable?: boolean | null | undefined;
2551
+ freight_charges?: number | null | undefined;
2552
+ freight_charges_amount?: number | null | undefined;
2553
+ is_freight_charges_percentage?: boolean | null | undefined;
2554
+ is_freight_charges_taxable?: boolean | null | undefined;
2499
2555
  }>;
2500
2556
  special_instructions: string;
2501
2557
  payments: import("mongoose").Types.DocumentArray<{
@@ -2595,6 +2651,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
2595
2651
  gst?: number | null | undefined;
2596
2652
  gst_amount?: number | null | undefined;
2597
2653
  is_gst_percentage?: boolean | null | undefined;
2654
+ labor_charges?: number | null | undefined;
2655
+ labor_charges_amount?: number | null | undefined;
2656
+ is_labor_charges_percentage?: boolean | null | undefined;
2657
+ is_labor_charges_taxable?: boolean | null | undefined;
2658
+ freight_charges?: number | null | undefined;
2659
+ freight_charges_amount?: number | null | undefined;
2660
+ is_freight_charges_percentage?: boolean | null | undefined;
2661
+ is_freight_charges_taxable?: boolean | null | undefined;
2598
2662
  }>> & import("mongoose").FlatRecord<{
2599
2663
  createdAt: NativeDate;
2600
2664
  updatedAt: NativeDate;
@@ -3154,6 +3218,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
3154
3218
  gst?: number | null | undefined;
3155
3219
  gst_amount?: number | null | undefined;
3156
3220
  is_gst_percentage?: boolean | null | undefined;
3221
+ labor_charges?: number | null | undefined;
3222
+ labor_charges_amount?: number | null | undefined;
3223
+ is_labor_charges_percentage?: boolean | null | undefined;
3224
+ is_labor_charges_taxable?: boolean | null | undefined;
3225
+ freight_charges?: number | null | undefined;
3226
+ freight_charges_amount?: number | null | undefined;
3227
+ is_freight_charges_percentage?: boolean | null | undefined;
3228
+ is_freight_charges_taxable?: boolean | null | undefined;
3157
3229
  }, import("mongoose").Types.Subdocument<import("mongoose").Types.ObjectId, any, {
3158
3230
  updatedAt: NativeDate;
3159
3231
  categories: import("mongoose").Types.DocumentArray<{
@@ -3473,6 +3545,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
3473
3545
  gst?: number | null | undefined;
3474
3546
  gst_amount?: number | null | undefined;
3475
3547
  is_gst_percentage?: boolean | null | undefined;
3548
+ labor_charges?: number | null | undefined;
3549
+ labor_charges_amount?: number | null | undefined;
3550
+ is_labor_charges_percentage?: boolean | null | undefined;
3551
+ is_labor_charges_taxable?: boolean | null | undefined;
3552
+ freight_charges?: number | null | undefined;
3553
+ freight_charges_amount?: number | null | undefined;
3554
+ is_freight_charges_percentage?: boolean | null | undefined;
3555
+ is_freight_charges_taxable?: boolean | null | undefined;
3476
3556
  }> & {
3477
3557
  updatedAt: NativeDate;
3478
3558
  categories: import("mongoose").Types.DocumentArray<{
@@ -3792,6 +3872,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
3792
3872
  gst?: number | null | undefined;
3793
3873
  gst_amount?: number | null | undefined;
3794
3874
  is_gst_percentage?: boolean | null | undefined;
3875
+ labor_charges?: number | null | undefined;
3876
+ labor_charges_amount?: number | null | undefined;
3877
+ is_labor_charges_percentage?: boolean | null | undefined;
3878
+ is_labor_charges_taxable?: boolean | null | undefined;
3879
+ freight_charges?: number | null | undefined;
3880
+ freight_charges_amount?: number | null | undefined;
3881
+ is_freight_charges_percentage?: boolean | null | undefined;
3882
+ is_freight_charges_taxable?: boolean | null | undefined;
3795
3883
  }>;
3796
3884
  special_instructions: string;
3797
3885
  payments: import("mongoose").Types.DocumentArray<{
@@ -3891,6 +3979,14 @@ export declare const TenantPurchaseOrderSchema: Schema<any, import("mongoose").M
3891
3979
  gst?: number | null | undefined;
3892
3980
  gst_amount?: number | null | undefined;
3893
3981
  is_gst_percentage?: boolean | null | undefined;
3982
+ labor_charges?: number | null | undefined;
3983
+ labor_charges_amount?: number | null | undefined;
3984
+ is_labor_charges_percentage?: boolean | null | undefined;
3985
+ is_labor_charges_taxable?: boolean | null | undefined;
3986
+ freight_charges?: number | null | undefined;
3987
+ freight_charges_amount?: number | null | undefined;
3988
+ is_freight_charges_percentage?: boolean | null | undefined;
3989
+ is_freight_charges_taxable?: boolean | null | undefined;
3894
3990
  }> & Required<{
3895
3991
  _id: import("mongoose").Types.ObjectId;
3896
3992
  }> & {
@@ -96,6 +96,14 @@ const IterationsOrderSchema = new mongoose_1.Schema({
96
96
  gst_amount: { type: Number, min: 0, required: false },
97
97
  is_gst_inclusive: { type: Boolean, required: false },
98
98
  is_gst_percentage: { type: Boolean, required: false },
99
+ labor_charges: { type: Number, min: 0, required: false },
100
+ labor_charges_amount: { type: Number, min: 0, required: false },
101
+ is_labor_charges_percentage: { type: Boolean, required: false },
102
+ is_labor_charges_taxable: { type: Boolean, required: false },
103
+ freight_charges: { type: Number, min: 0, required: false },
104
+ freight_charges_amount: { type: Number, min: 0, required: false },
105
+ is_freight_charges_percentage: { type: Boolean, required: false },
106
+ is_freight_charges_taxable: { type: Boolean, required: false },
99
107
  tax_number: { type: String, default: '' },
100
108
  updatedAt: { type: mongoose_1.Schema.Types.Date, required: true },
101
109
  }, { _id: false, timestamps: false, versionKey: false });
@@ -137,6 +145,17 @@ exports.TenantPurchaseOrderSchema = new mongoose_1.Schema({
137
145
  is_gst_inclusive: { type: Boolean, required: false },
138
146
  // true/undefined => `gst` is a percentage, false => `gst` is a fixed amount
139
147
  is_gst_percentage: { type: Boolean, required: false },
148
+ labor_charges: { type: Number, min: 0, required: false },
149
+ labor_charges_amount: { type: Number, min: 0, required: false },
150
+ // true => `labor_charges` is a percentage of the post-discount subtotal
151
+ is_labor_charges_percentage: { type: Boolean, required: false },
152
+ // true => the labor charge is inside the GST base (added before GST)
153
+ is_labor_charges_taxable: { type: Boolean, required: false },
154
+ // freight charge, mirrors the labor fields above
155
+ freight_charges: { type: Number, min: 0, required: false },
156
+ freight_charges_amount: { type: Number, min: 0, required: false },
157
+ is_freight_charges_percentage: { type: Boolean, required: false },
158
+ is_freight_charges_taxable: { type: Boolean, required: false },
140
159
  is_deleted: { type: Boolean, default: false },
141
160
  order_status_updated_at: {
142
161
  type: mongoose_1.Schema.Types.Date,
@@ -21,6 +21,8 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
21
21
  packaging_charges: number;
22
22
  currency_symbol: CURRENCY_SYMBOL_ENUM;
23
23
  country_alpha_2: COUNTRY_ALPHA_2_ENUM;
24
+ is_labor_charges_taxable: boolean;
25
+ is_freight_charges_taxable: boolean;
24
26
  delivery_min_cost: number;
25
27
  restaurant_address: string;
26
28
  support_email: string;
@@ -203,6 +205,8 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
203
205
  packaging_charges: number;
204
206
  currency_symbol: CURRENCY_SYMBOL_ENUM;
205
207
  country_alpha_2: COUNTRY_ALPHA_2_ENUM;
208
+ is_labor_charges_taxable: boolean;
209
+ is_freight_charges_taxable: boolean;
206
210
  delivery_min_cost: number;
207
211
  restaurant_address: string;
208
212
  support_email: string;
@@ -385,6 +389,8 @@ export declare const TenantSchema: Schema<any, import("mongoose").Model<any, any
385
389
  packaging_charges: number;
386
390
  currency_symbol: CURRENCY_SYMBOL_ENUM;
387
391
  country_alpha_2: COUNTRY_ALPHA_2_ENUM;
392
+ is_labor_charges_taxable: boolean;
393
+ is_freight_charges_taxable: boolean;
388
394
  delivery_min_cost: number;
389
395
  restaurant_address: string;
390
396
  support_email: string;
@@ -481,6 +481,14 @@ exports.TenantSchema = new mongoose_1.Schema({
481
481
  enum: constants_1.ALL_GST_TYPES,
482
482
  required: false,
483
483
  },
484
+ is_labor_charges_taxable: {
485
+ type: Boolean,
486
+ default: false,
487
+ },
488
+ is_freight_charges_taxable: {
489
+ type: Boolean,
490
+ default: false,
491
+ },
484
492
  web_design_type: {
485
493
  type: String,
486
494
  enum: constants_1.ALL_ONLINE_ORDERING_DESIGN_TYPES,
@@ -45,6 +45,14 @@ interface ITenantPurchaseOrderIterationBase<TCategory, TStatus> {
45
45
  is_gst_percentage?: boolean;
46
46
  gst?: number | null;
47
47
  gst_amount?: number | null;
48
+ labor_charges?: number;
49
+ labor_charges_amount?: number;
50
+ is_labor_charges_percentage?: boolean;
51
+ is_labor_charges_taxable?: boolean;
52
+ freight_charges?: number;
53
+ freight_charges_amount?: number;
54
+ is_freight_charges_percentage?: boolean;
55
+ is_freight_charges_taxable?: boolean;
48
56
  special_instructions: string;
49
57
  price: number;
50
58
  amount_earned: number;
@@ -111,6 +111,8 @@ export interface ITenant {
111
111
  po_card_gst?: number;
112
112
  po_cash_gst?: number;
113
113
  default_po_gst_type?: GST_TYPE_ENUM;
114
+ is_labor_charges_taxable?: boolean;
115
+ is_freight_charges_taxable?: boolean;
114
116
  web_cover_image: string;
115
117
  web_favicon: string;
116
118
  web_design_type: ONLINE_ORDERING_DESIGN_TYPE_ENUM;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managesome/eposmatic-toolkit",
3
- "version": "0.4.83",
3
+ "version": "0.4.84",
4
4
  "description": "A Toolkit Library for Eposmatic",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",