shareneus 1.7.341 → 1.7.342
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.
|
@@ -50,12 +50,13 @@ function buildTaxesFromTaxCode(line, taxCode, netAmount) {
|
|
|
50
50
|
const taxComponents = safeArray(taxCode.Components);
|
|
51
51
|
if (taxComponents.length > 0) {
|
|
52
52
|
return taxComponents
|
|
53
|
-
.filter((component) => ["CGST", "SGST", "IGST"].includes(component === null || component === void 0 ? void 0 : component.Code))
|
|
53
|
+
.filter((component) => ["CGST", "SGST", "IGST", "CESS"].includes(component === null || component === void 0 ? void 0 : component.Code))
|
|
54
54
|
.map((component) => ({
|
|
55
55
|
Code: component.Code,
|
|
56
56
|
Amt: (0, math_operations_1.Multiply)(netAmount, (0, math_operations_1.Divide)((0, util_1.GetNumber)(component.Rate), 100)),
|
|
57
57
|
Rate: (0, util_1.GetNumber)(component.Rate),
|
|
58
|
-
TaxCodeId: (0, util_1.GetNumber)(taxCode._id)
|
|
58
|
+
TaxCodeId: (0, util_1.GetNumber)(taxCode._id),
|
|
59
|
+
CalcMethod: component.CalcMethod || "Percent",
|
|
59
60
|
}))
|
|
60
61
|
.filter((tax) => tax.Amt > 0);
|
|
61
62
|
}
|
|
@@ -76,7 +77,7 @@ function buildTaxesFromTaxCode(line, taxCode, netAmount) {
|
|
|
76
77
|
function getResolvedTaxes(line, taxCodes = []) {
|
|
77
78
|
const lineTaxes = safeArray(line === null || line === void 0 ? void 0 : line.Taxes);
|
|
78
79
|
if (lineTaxes.length > 0) {
|
|
79
|
-
return lineTaxes.map((tax) => (Object.assign(Object.assign({}, tax), { Code: tax === null || tax === void 0 ? void 0 : tax.Code, Amt: (0, util_1.GetNumber)(tax === null || tax === void 0 ? void 0 : tax.Amt), Rate: (0, util_1.GetNumber)(tax === null || tax === void 0 ? void 0 : tax.Rate), TaxCodeId: (0, util_1.GetNumber)(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId) }))).filter((tax) => !!tax.Code);
|
|
80
|
+
return lineTaxes.map((tax) => (Object.assign(Object.assign({}, tax), { Code: tax === null || tax === void 0 ? void 0 : tax.Code, Amt: (0, util_1.GetNumber)(tax === null || tax === void 0 ? void 0 : tax.Amt), Rate: (0, util_1.GetNumber)(tax === null || tax === void 0 ? void 0 : tax.Rate), TaxCodeId: (0, util_1.GetNumber)(tax === null || tax === void 0 ? void 0 : tax.TaxCodeId), CalcMethod: (tax === null || tax === void 0 ? void 0 : tax.CalcMethod) || "Percent", PerUnitAmt: (0, util_1.GetNumber)(tax === null || tax === void 0 ? void 0 : tax.PerUnitAmt), Unit: tax === null || tax === void 0 ? void 0 : tax.Unit }))).filter((tax) => !!tax.Code);
|
|
80
81
|
}
|
|
81
82
|
const netAmount = getLineNetAmount(line);
|
|
82
83
|
const taxCode = getTaxCodeById(taxCodes, line === null || line === void 0 ? void 0 : line.TCode);
|
|
@@ -122,12 +123,15 @@ function TotalCalculations(items = [], ops = [], isTaxable = false, taxCodes = [
|
|
|
122
123
|
let totalSGST = 0;
|
|
123
124
|
let totalCGST = 0;
|
|
124
125
|
let totalIGST = 0;
|
|
126
|
+
let totalCESS = 0;
|
|
125
127
|
let totalSGSTOnItems = 0;
|
|
126
128
|
let totalCGSTOnItems = 0;
|
|
127
129
|
let totalIGSTOnItems = 0;
|
|
130
|
+
let totalCESSOnItems = 0;
|
|
128
131
|
let totalSGSTOnLabor = 0;
|
|
129
132
|
let totalCGSTOnLabor = 0;
|
|
130
133
|
let totalIGSTOnLabor = 0;
|
|
134
|
+
let totalCESSOnLabor = 0;
|
|
131
135
|
// Calculate items totals with null safety
|
|
132
136
|
safeItems.forEach((item) => {
|
|
133
137
|
const itemDisc = (0, util_1.GetNumber)(item.Disc);
|
|
@@ -144,7 +148,8 @@ function TotalCalculations(items = [], ops = [], isTaxable = false, taxCodes = [
|
|
|
144
148
|
const itemSGST = getTaxAmountByCode(resolvedItemTaxes, "SGST");
|
|
145
149
|
const itemCGST = getTaxAmountByCode(resolvedItemTaxes, "CGST");
|
|
146
150
|
const itemIGST = getTaxAmountByCode(resolvedItemTaxes, "IGST");
|
|
147
|
-
const
|
|
151
|
+
const itemCESS = getTaxAmountByCode(resolvedItemTaxes, "CESS");
|
|
152
|
+
const itemTotalTax = (0, math_operations_1.Add)(itemSGST, itemCGST, itemIGST, itemCESS);
|
|
148
153
|
// Add to return tax
|
|
149
154
|
returnTax = (0, math_operations_1.Add)(returnTax, itemTotalTax);
|
|
150
155
|
// Return total includes net amount + tax
|
|
@@ -165,11 +170,13 @@ function TotalCalculations(items = [], ops = [], isTaxable = false, taxCodes = [
|
|
|
165
170
|
const itemSGST = getTaxAmountByCode(resolvedItemTaxes, "SGST");
|
|
166
171
|
const itemCGST = getTaxAmountByCode(resolvedItemTaxes, "CGST");
|
|
167
172
|
const itemIGST = getTaxAmountByCode(resolvedItemTaxes, "IGST");
|
|
173
|
+
const itemCESS = getTaxAmountByCode(resolvedItemTaxes, "CESS");
|
|
168
174
|
// Add individual tax amounts for items
|
|
169
175
|
totalSGSTOnItems = (0, math_operations_1.Add)(totalSGSTOnItems, itemSGST);
|
|
170
176
|
totalCGSTOnItems = (0, math_operations_1.Add)(totalCGSTOnItems, itemCGST);
|
|
171
177
|
totalIGSTOnItems = (0, math_operations_1.Add)(totalIGSTOnItems, itemIGST);
|
|
172
|
-
|
|
178
|
+
totalCESSOnItems = (0, math_operations_1.Add)(totalCESSOnItems, itemCESS);
|
|
179
|
+
totalTaxOnItems = (0, math_operations_1.Add)(totalTaxOnItems, itemSGST, itemCGST, itemIGST, itemCESS);
|
|
173
180
|
}
|
|
174
181
|
}
|
|
175
182
|
});
|
|
@@ -186,11 +193,13 @@ function TotalCalculations(items = [], ops = [], isTaxable = false, taxCodes = [
|
|
|
186
193
|
const opSGST = getTaxAmountByCode(resolvedOpTaxes, "SGST");
|
|
187
194
|
const opCGST = getTaxAmountByCode(resolvedOpTaxes, "CGST");
|
|
188
195
|
const opIGST = getTaxAmountByCode(resolvedOpTaxes, "IGST");
|
|
196
|
+
const opCESS = getTaxAmountByCode(resolvedOpTaxes, "CESS");
|
|
189
197
|
// Add individual tax amounts for operations/labor
|
|
190
198
|
totalSGSTOnLabor = (0, math_operations_1.Add)(totalSGSTOnLabor, opSGST);
|
|
191
199
|
totalCGSTOnLabor = (0, math_operations_1.Add)(totalCGSTOnLabor, opCGST);
|
|
192
200
|
totalIGSTOnLabor = (0, math_operations_1.Add)(totalIGSTOnLabor, opIGST);
|
|
193
|
-
|
|
201
|
+
totalCESSOnLabor = (0, math_operations_1.Add)(totalCESSOnLabor, opCESS);
|
|
202
|
+
totalTaxOnLabor = (0, math_operations_1.Add)(totalTaxOnLabor, opSGST, opCGST, opIGST, opCESS);
|
|
194
203
|
}
|
|
195
204
|
});
|
|
196
205
|
// Calculate combined totals
|
|
@@ -213,6 +222,7 @@ function TotalCalculations(items = [], ops = [], isTaxable = false, taxCodes = [
|
|
|
213
222
|
totalSGST = (0, math_operations_1.Add)(totalSGSTOnItems, totalSGSTOnLabor);
|
|
214
223
|
totalCGST = (0, math_operations_1.Add)(totalCGSTOnItems, totalCGSTOnLabor);
|
|
215
224
|
totalIGST = (0, math_operations_1.Add)(totalIGSTOnItems, totalIGSTOnLabor);
|
|
225
|
+
totalCESS = (0, math_operations_1.Add)(totalCESSOnItems, totalCESSOnLabor);
|
|
216
226
|
}
|
|
217
227
|
// FIXED CALCULATION: Correct order of operations
|
|
218
228
|
// Step 1: Calculate net amount after discount
|
|
@@ -257,12 +267,15 @@ function TotalCalculations(items = [], ops = [], isTaxable = false, taxCodes = [
|
|
|
257
267
|
result.totalSGST = totalSGST;
|
|
258
268
|
result.totalCGST = totalCGST;
|
|
259
269
|
result.totalIGST = totalIGST;
|
|
270
|
+
result.totalCESS = totalCESS;
|
|
260
271
|
result.totalSGSTOnItems = totalSGSTOnItems;
|
|
261
272
|
result.totalCGSTOnItems = totalCGSTOnItems;
|
|
262
273
|
result.totalIGSTOnItems = totalIGSTOnItems;
|
|
274
|
+
result.totalCESSOnItems = totalCESSOnItems;
|
|
263
275
|
result.totalSGSTOnLabor = totalSGSTOnLabor;
|
|
264
276
|
result.totalCGSTOnLabor = totalCGSTOnLabor;
|
|
265
277
|
result.totalIGSTOnLabor = totalIGSTOnLabor;
|
|
278
|
+
result.totalCESSOnLabor = totalCESSOnLabor;
|
|
266
279
|
// Calculate tax summary for both new Taxes[] and legacy tax-code based records
|
|
267
280
|
// Filter out items where Ret is true (only include non-return items)
|
|
268
281
|
const nonReturnItems = safeItems.filter((item) => item.Ret !== true);
|
|
@@ -314,12 +327,15 @@ function TotalCalculationsWithDecimals(items = [], ops = [], isTaxable = false,
|
|
|
314
327
|
roundedResult.totalSGSTOnLabor = roundToDecimals(result.totalSGSTOnLabor);
|
|
315
328
|
roundedResult.totalCGSTOnLabor = roundToDecimals(result.totalCGSTOnLabor);
|
|
316
329
|
roundedResult.totalIGSTOnLabor = roundToDecimals(result.totalIGSTOnLabor);
|
|
330
|
+
roundedResult.totalCESS = roundToDecimals(result.totalCESS);
|
|
331
|
+
roundedResult.totalCESSOnItems = roundToDecimals(result.totalCESSOnItems);
|
|
332
|
+
roundedResult.totalCESSOnLabor = roundToDecimals(result.totalCESSOnLabor);
|
|
317
333
|
// Round tax summary only if it exists
|
|
318
334
|
if (result.itemsTaxSummary) {
|
|
319
|
-
roundedResult.itemsTaxSummary = result.itemsTaxSummary.map((tax) => (Object.assign(Object.assign({}, tax), { TaxableAmount: roundToDecimals(tax.TaxableAmount), TaxAmount: roundToDecimals(tax.TaxAmount), CGSTAmount: roundToDecimals(tax.CGSTAmount), SGSTAmount: roundToDecimals(tax.SGSTAmount), IGSTAmount: roundToDecimals(tax.IGSTAmount) })));
|
|
335
|
+
roundedResult.itemsTaxSummary = result.itemsTaxSummary.map((tax) => (Object.assign(Object.assign({}, tax), { TaxableAmount: roundToDecimals(tax.TaxableAmount), TaxAmount: roundToDecimals(tax.TaxAmount), CGSTAmount: roundToDecimals(tax.CGSTAmount), SGSTAmount: roundToDecimals(tax.SGSTAmount), IGSTAmount: roundToDecimals(tax.IGSTAmount), CESSAmount: roundToDecimals(tax.CESSAmount) })));
|
|
320
336
|
}
|
|
321
337
|
if (result.opsTaxSummary) {
|
|
322
|
-
roundedResult.opsTaxSummary = result.opsTaxSummary.map((tax) => (Object.assign(Object.assign({}, tax), { TaxableAmount: roundToDecimals(tax.TaxableAmount), TaxAmount: roundToDecimals(tax.TaxAmount), CGSTAmount: roundToDecimals(tax.CGSTAmount), SGSTAmount: roundToDecimals(tax.SGSTAmount), IGSTAmount: roundToDecimals(tax.IGSTAmount) })));
|
|
338
|
+
roundedResult.opsTaxSummary = result.opsTaxSummary.map((tax) => (Object.assign(Object.assign({}, tax), { TaxableAmount: roundToDecimals(tax.TaxableAmount), TaxAmount: roundToDecimals(tax.TaxAmount), CGSTAmount: roundToDecimals(tax.CGSTAmount), SGSTAmount: roundToDecimals(tax.SGSTAmount), IGSTAmount: roundToDecimals(tax.IGSTAmount), CESSAmount: roundToDecimals(tax.CESSAmount) })));
|
|
323
339
|
}
|
|
324
340
|
}
|
|
325
341
|
return roundedResult;
|
|
@@ -334,6 +350,7 @@ function CalculateTaxSummary(items, taxCodes) {
|
|
|
334
350
|
const cgstAmount = getTaxAmountByCode(taxes, "CGST");
|
|
335
351
|
const sgstAmount = getTaxAmountByCode(taxes, "SGST");
|
|
336
352
|
const igstAmount = getTaxAmountByCode(taxes, "IGST");
|
|
353
|
+
const cessAmount = getTaxAmountByCode(taxes, "CESS");
|
|
337
354
|
const totalTaxAmount = (0, math_operations_1.Add)(cgstAmount, sgstAmount, igstAmount);
|
|
338
355
|
if (!acc[percent]) {
|
|
339
356
|
acc[percent] = {
|
|
@@ -342,7 +359,8 @@ function CalculateTaxSummary(items, taxCodes) {
|
|
|
342
359
|
TaxAmount: 0,
|
|
343
360
|
CGSTAmount: 0,
|
|
344
361
|
SGSTAmount: 0,
|
|
345
|
-
IGSTAmount: 0
|
|
362
|
+
IGSTAmount: 0,
|
|
363
|
+
CESSAmount: 0
|
|
346
364
|
};
|
|
347
365
|
}
|
|
348
366
|
acc[percent].TaxableAmount = (0, math_operations_1.Add)(acc[percent].TaxableAmount, taxable);
|
|
@@ -350,6 +368,7 @@ function CalculateTaxSummary(items, taxCodes) {
|
|
|
350
368
|
acc[percent].CGSTAmount = (0, math_operations_1.Add)(acc[percent].CGSTAmount, cgstAmount);
|
|
351
369
|
acc[percent].SGSTAmount = (0, math_operations_1.Add)(acc[percent].SGSTAmount, sgstAmount);
|
|
352
370
|
acc[percent].IGSTAmount = (0, math_operations_1.Add)(acc[percent].IGSTAmount, igstAmount);
|
|
371
|
+
acc[percent].CESSAmount = (0, math_operations_1.Add)(acc[percent].CESSAmount, cessAmount);
|
|
353
372
|
return acc;
|
|
354
373
|
}, {}));
|
|
355
374
|
}
|
package/package.json
CHANGED
|
@@ -55,12 +55,13 @@ function buildTaxesFromTaxCode(line: any, taxCode: any, netAmount: number): any[
|
|
|
55
55
|
const taxComponents = safeArray(taxCode.Components);
|
|
56
56
|
if (taxComponents.length > 0) {
|
|
57
57
|
return taxComponents
|
|
58
|
-
.filter((component: any) => ["CGST", "SGST", "IGST"].includes(component?.Code))
|
|
58
|
+
.filter((component: any) => ["CGST", "SGST", "IGST", "CESS"].includes(component?.Code))
|
|
59
59
|
.map((component: any) => ({
|
|
60
60
|
Code: component.Code,
|
|
61
61
|
Amt: Multiply(netAmount, Divide(GetNumber(component.Rate), 100)),
|
|
62
62
|
Rate: GetNumber(component.Rate),
|
|
63
|
-
TaxCodeId: GetNumber(taxCode._id)
|
|
63
|
+
TaxCodeId: GetNumber(taxCode._id),
|
|
64
|
+
CalcMethod: component.CalcMethod || "Percent",
|
|
64
65
|
}))
|
|
65
66
|
.filter((tax: any) => tax.Amt > 0);
|
|
66
67
|
}
|
|
@@ -89,7 +90,10 @@ function getResolvedTaxes(line: any, taxCodes: any[] = []): any[] {
|
|
|
89
90
|
Code: tax?.Code,
|
|
90
91
|
Amt: GetNumber(tax?.Amt),
|
|
91
92
|
Rate: GetNumber(tax?.Rate),
|
|
92
|
-
TaxCodeId: GetNumber(tax?.TaxCodeId)
|
|
93
|
+
TaxCodeId: GetNumber(tax?.TaxCodeId),
|
|
94
|
+
CalcMethod: tax?.CalcMethod || "Percent",
|
|
95
|
+
PerUnitAmt: GetNumber(tax?.PerUnitAmt),
|
|
96
|
+
Unit: tax?.Unit,
|
|
93
97
|
})).filter((tax: any) => !!tax.Code);
|
|
94
98
|
}
|
|
95
99
|
|
|
@@ -146,14 +150,17 @@ export function TotalCalculations(items: any[] = [], ops: any[] = [], isTaxable:
|
|
|
146
150
|
let totalSGST: number = 0;
|
|
147
151
|
let totalCGST: number = 0;
|
|
148
152
|
let totalIGST: number = 0;
|
|
153
|
+
let totalCESS: number = 0;
|
|
149
154
|
|
|
150
155
|
let totalSGSTOnItems: number = 0;
|
|
151
156
|
let totalCGSTOnItems: number = 0;
|
|
152
157
|
let totalIGSTOnItems: number = 0;
|
|
158
|
+
let totalCESSOnItems: number = 0;
|
|
153
159
|
|
|
154
160
|
let totalSGSTOnLabor: number = 0;
|
|
155
161
|
let totalCGSTOnLabor: number = 0;
|
|
156
162
|
let totalIGSTOnLabor: number = 0;
|
|
163
|
+
let totalCESSOnLabor: number = 0;
|
|
157
164
|
|
|
158
165
|
|
|
159
166
|
// Calculate items totals with null safety
|
|
@@ -175,7 +182,8 @@ export function TotalCalculations(items: any[] = [], ops: any[] = [], isTaxable:
|
|
|
175
182
|
const itemSGST = getTaxAmountByCode(resolvedItemTaxes, "SGST");
|
|
176
183
|
const itemCGST = getTaxAmountByCode(resolvedItemTaxes, "CGST");
|
|
177
184
|
const itemIGST = getTaxAmountByCode(resolvedItemTaxes, "IGST");
|
|
178
|
-
const
|
|
185
|
+
const itemCESS = getTaxAmountByCode(resolvedItemTaxes, "CESS");
|
|
186
|
+
const itemTotalTax = Add(itemSGST, itemCGST, itemIGST, itemCESS);
|
|
179
187
|
|
|
180
188
|
// Add to return tax
|
|
181
189
|
returnTax = Add(returnTax, itemTotalTax);
|
|
@@ -197,13 +205,14 @@ export function TotalCalculations(items: any[] = [], ops: any[] = [], isTaxable:
|
|
|
197
205
|
const itemSGST = getTaxAmountByCode(resolvedItemTaxes, "SGST");
|
|
198
206
|
const itemCGST = getTaxAmountByCode(resolvedItemTaxes, "CGST");
|
|
199
207
|
const itemIGST = getTaxAmountByCode(resolvedItemTaxes, "IGST");
|
|
200
|
-
|
|
208
|
+
const itemCESS = getTaxAmountByCode(resolvedItemTaxes, "CESS");
|
|
201
209
|
// Add individual tax amounts for items
|
|
202
210
|
totalSGSTOnItems = Add(totalSGSTOnItems, itemSGST);
|
|
203
211
|
totalCGSTOnItems = Add(totalCGSTOnItems, itemCGST);
|
|
204
212
|
totalIGSTOnItems = Add(totalIGSTOnItems, itemIGST);
|
|
213
|
+
totalCESSOnItems = Add(totalCESSOnItems, itemCESS);
|
|
205
214
|
|
|
206
|
-
totalTaxOnItems = Add(totalTaxOnItems, itemSGST, itemCGST, itemIGST);
|
|
215
|
+
totalTaxOnItems = Add(totalTaxOnItems, itemSGST, itemCGST, itemIGST, itemCESS);
|
|
207
216
|
}
|
|
208
217
|
}
|
|
209
218
|
});
|
|
@@ -223,13 +232,15 @@ export function TotalCalculations(items: any[] = [], ops: any[] = [], isTaxable:
|
|
|
223
232
|
const opSGST = getTaxAmountByCode(resolvedOpTaxes, "SGST");
|
|
224
233
|
const opCGST = getTaxAmountByCode(resolvedOpTaxes, "CGST");
|
|
225
234
|
const opIGST = getTaxAmountByCode(resolvedOpTaxes, "IGST");
|
|
235
|
+
const opCESS = getTaxAmountByCode(resolvedOpTaxes, "CESS");
|
|
226
236
|
|
|
227
237
|
// Add individual tax amounts for operations/labor
|
|
228
238
|
totalSGSTOnLabor = Add(totalSGSTOnLabor, opSGST);
|
|
229
239
|
totalCGSTOnLabor = Add(totalCGSTOnLabor, opCGST);
|
|
230
240
|
totalIGSTOnLabor = Add(totalIGSTOnLabor, opIGST);
|
|
241
|
+
totalCESSOnLabor = Add(totalCESSOnLabor, opCESS);
|
|
231
242
|
|
|
232
|
-
totalTaxOnLabor = Add(totalTaxOnLabor, opSGST, opCGST, opIGST);
|
|
243
|
+
totalTaxOnLabor = Add(totalTaxOnLabor, opSGST, opCGST, opIGST, opCESS);
|
|
233
244
|
}
|
|
234
245
|
});
|
|
235
246
|
|
|
@@ -258,6 +269,7 @@ export function TotalCalculations(items: any[] = [], ops: any[] = [], isTaxable:
|
|
|
258
269
|
totalSGST = Add(totalSGSTOnItems, totalSGSTOnLabor);
|
|
259
270
|
totalCGST = Add(totalCGSTOnItems, totalCGSTOnLabor);
|
|
260
271
|
totalIGST = Add(totalIGSTOnItems, totalIGSTOnLabor);
|
|
272
|
+
totalCESS = Add(totalCESSOnItems, totalCESSOnLabor);
|
|
261
273
|
}
|
|
262
274
|
|
|
263
275
|
// FIXED CALCULATION: Correct order of operations
|
|
@@ -310,12 +322,15 @@ export function TotalCalculations(items: any[] = [], ops: any[] = [], isTaxable:
|
|
|
310
322
|
result.totalSGST = totalSGST;
|
|
311
323
|
result.totalCGST = totalCGST;
|
|
312
324
|
result.totalIGST = totalIGST;
|
|
325
|
+
result.totalCESS = totalCESS;
|
|
313
326
|
result.totalSGSTOnItems = totalSGSTOnItems;
|
|
314
327
|
result.totalCGSTOnItems = totalCGSTOnItems;
|
|
315
328
|
result.totalIGSTOnItems = totalIGSTOnItems;
|
|
329
|
+
result.totalCESSOnItems = totalCESSOnItems;
|
|
316
330
|
result.totalSGSTOnLabor = totalSGSTOnLabor;
|
|
317
331
|
result.totalCGSTOnLabor = totalCGSTOnLabor;
|
|
318
332
|
result.totalIGSTOnLabor = totalIGSTOnLabor;
|
|
333
|
+
result.totalCESSOnLabor = totalCESSOnLabor;
|
|
319
334
|
|
|
320
335
|
// Calculate tax summary for both new Taxes[] and legacy tax-code based records
|
|
321
336
|
// Filter out items where Ret is true (only include non-return items)
|
|
@@ -380,6 +395,9 @@ export function TotalCalculationsWithDecimals(
|
|
|
380
395
|
roundedResult.totalSGSTOnLabor = roundToDecimals(result.totalSGSTOnLabor);
|
|
381
396
|
roundedResult.totalCGSTOnLabor = roundToDecimals(result.totalCGSTOnLabor);
|
|
382
397
|
roundedResult.totalIGSTOnLabor = roundToDecimals(result.totalIGSTOnLabor);
|
|
398
|
+
roundedResult.totalCESS = roundToDecimals(result.totalCESS);
|
|
399
|
+
roundedResult.totalCESSOnItems = roundToDecimals(result.totalCESSOnItems);
|
|
400
|
+
roundedResult.totalCESSOnLabor = roundToDecimals(result.totalCESSOnLabor);
|
|
383
401
|
|
|
384
402
|
// Round tax summary only if it exists
|
|
385
403
|
if (result.itemsTaxSummary) {
|
|
@@ -389,7 +407,8 @@ export function TotalCalculationsWithDecimals(
|
|
|
389
407
|
TaxAmount: roundToDecimals(tax.TaxAmount),
|
|
390
408
|
CGSTAmount: roundToDecimals(tax.CGSTAmount),
|
|
391
409
|
SGSTAmount: roundToDecimals(tax.SGSTAmount),
|
|
392
|
-
IGSTAmount: roundToDecimals(tax.IGSTAmount)
|
|
410
|
+
IGSTAmount: roundToDecimals(tax.IGSTAmount),
|
|
411
|
+
CESSAmount: roundToDecimals(tax.CESSAmount)
|
|
393
412
|
}));
|
|
394
413
|
}
|
|
395
414
|
if (result.opsTaxSummary) {
|
|
@@ -399,7 +418,8 @@ export function TotalCalculationsWithDecimals(
|
|
|
399
418
|
TaxAmount: roundToDecimals(tax.TaxAmount),
|
|
400
419
|
CGSTAmount: roundToDecimals(tax.CGSTAmount),
|
|
401
420
|
SGSTAmount: roundToDecimals(tax.SGSTAmount),
|
|
402
|
-
IGSTAmount: roundToDecimals(tax.IGSTAmount)
|
|
421
|
+
IGSTAmount: roundToDecimals(tax.IGSTAmount),
|
|
422
|
+
CESSAmount: roundToDecimals(tax.CESSAmount)
|
|
403
423
|
}));
|
|
404
424
|
}
|
|
405
425
|
}
|
|
@@ -418,6 +438,7 @@ export function CalculateTaxSummary(items: any[], taxCodes: any[]) {
|
|
|
418
438
|
const cgstAmount = getTaxAmountByCode(taxes, "CGST");
|
|
419
439
|
const sgstAmount = getTaxAmountByCode(taxes, "SGST");
|
|
420
440
|
const igstAmount = getTaxAmountByCode(taxes, "IGST");
|
|
441
|
+
const cessAmount = getTaxAmountByCode(taxes, "CESS");
|
|
421
442
|
const totalTaxAmount = Add(cgstAmount, sgstAmount, igstAmount);
|
|
422
443
|
|
|
423
444
|
if (!acc[percent]) {
|
|
@@ -427,7 +448,8 @@ export function CalculateTaxSummary(items: any[], taxCodes: any[]) {
|
|
|
427
448
|
TaxAmount: 0,
|
|
428
449
|
CGSTAmount: 0,
|
|
429
450
|
SGSTAmount: 0,
|
|
430
|
-
IGSTAmount: 0
|
|
451
|
+
IGSTAmount: 0,
|
|
452
|
+
CESSAmount: 0
|
|
431
453
|
};
|
|
432
454
|
}
|
|
433
455
|
|
|
@@ -436,6 +458,7 @@ export function CalculateTaxSummary(items: any[], taxCodes: any[]) {
|
|
|
436
458
|
acc[percent].CGSTAmount = Add(acc[percent].CGSTAmount, cgstAmount);
|
|
437
459
|
acc[percent].SGSTAmount = Add(acc[percent].SGSTAmount, sgstAmount);
|
|
438
460
|
acc[percent].IGSTAmount = Add(acc[percent].IGSTAmount, igstAmount);
|
|
461
|
+
acc[percent].CESSAmount = Add(acc[percent].CESSAmount, cessAmount);
|
|
439
462
|
|
|
440
463
|
return acc;
|
|
441
464
|
}, {})
|