shareneus 1.7.341 → 1.7.343

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.
@@ -286,7 +286,8 @@ function GetItemsPrintInfo(Items, Consolidate, TaxCodes, LineTotal, DecimalsNumb
286
286
  let CTaxAmtPerItem = (0, math_operations_1.Divide)(GetTaxAmountFromTaxes(Item, 'CGST'), Item.Qty);
287
287
  let STaxAmtPerItem = (0, math_operations_1.Divide)(GetTaxAmountFromTaxes(Item, 'SGST'), Item.Qty);
288
288
  let ITaxAmtPerItem = (0, math_operations_1.Divide)(GetTaxAmountFromTaxes(Item, 'IGST'), Item.Qty);
289
- Item.UnPr = tr_utils_1.TrUtils.FixedTo((0, math_operations_1.Add)(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem), DecimalsNumber);
289
+ let CESSAmtPerItem = (0, math_operations_1.Divide)(GetTaxAmountFromTaxes(Item, 'CESS'), Item.Qty);
290
+ Item.UnPr = tr_utils_1.TrUtils.FixedTo((0, math_operations_1.Add)(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem, CESSAmtPerItem), DecimalsNumber);
290
291
  }
291
292
  else {
292
293
  Item.UnPr = tr_utils_1.TrUtils.FixPriceValue(Item.UnPr, DecimalsNumber);
@@ -103,7 +103,7 @@ class InvoiceTotalsService {
103
103
  if (IsIndependentTax) {
104
104
  let NetAmt = (0, math_operations_1.Subtract)(Part.UnAmt, Part.Disc, Part.RecDisc);
105
105
  Part.AfterPartDisc = NetAmt;
106
- Part.AfterPartTax = (0, math_operations_1.Add)(Part.AfterPartDisc, Part.CGST, Part.SGST, Part.IGST);
106
+ Part.AfterPartTax = (0, math_operations_1.Add)(Part.AfterPartDisc, Part.CGST, Part.SGST, Part.IGST, Part.CESS);
107
107
  }
108
108
  else {
109
109
  Part.AfterPartDisc = (0, math_operations_1.Subtract)(Part.UnAmt, Part.Disc, Part.RecDisc);
@@ -119,6 +119,7 @@ class InvoiceTotalsService {
119
119
  Part.CGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'CGST'));
120
120
  Part.SGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'SGST'));
121
121
  Part.IGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'IGST'));
122
+ Part.CESS = tr_utils_1.TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'CESS'));
122
123
  Part.TCode = this.GetTCodeFromTaxes(Part);
123
124
  return Part;
124
125
  }
@@ -60,6 +60,7 @@ export declare class ROTotalsService {
60
60
  static GetInsTaxGroupingForPartsByHSN(Parts: any, TaxCodes: any, DecimalsNumber: number): any[];
61
61
  static GetInsTaxGroupingInfoByHSN(FinalMatchedParts: any, TaxCodes: any, DecimalsNumber: number): any[];
62
62
  static GetGSTValueBasedOnTaxCode(item: any, TaxCodes: any): any[];
63
+ static GetTaxComponentRate(taxCode: any, code: string): any;
63
64
  static GetCombinedTaxPercentage(Parts: any, TaxCodes: any): any;
64
65
  static ResetPartsHSNIfInvalid(Parts: any): any;
65
66
  static ComparePartsByHSN(Parts: any, TaxCodes: any): any[];
@@ -51,9 +51,11 @@ class ROTotalsService {
51
51
  Operation.ACGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'CGST', 'ACGST');
52
52
  Operation.ASGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'SGST', 'ASGST');
53
53
  Operation.AIGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'IGST', 'AIGST');
54
+ Operation.ACESS = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'CESS', 'ACESS');
54
55
  Operation.CCGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'CGST', 'CCGST');
55
56
  Operation.CSGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'SGST', 'CSGST');
56
57
  Operation.CIGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'IGST', 'CIGST');
58
+ Operation.CCESS = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'CESS', 'CCESS');
57
59
  Operation.NetAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.NetAmt);
58
60
  Operation.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.RecDisc);
59
61
  if (!isWorkOrder) {
@@ -61,6 +63,7 @@ class ROTotalsService {
61
63
  Operation.ECGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'CGST', 'ECGST');
62
64
  Operation.ESGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'SGST', 'ESGST');
63
65
  Operation.EIGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'IGST', 'EIGST');
66
+ Operation.ECESS = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'CESS', 'ECESS');
64
67
  }
65
68
  return Operation;
66
69
  }
@@ -126,31 +129,31 @@ class ROTotalsService {
126
129
  else {
127
130
  if (Operation.PBy === enums_1.PayTypeEnum.Customer) {
128
131
  if (isWorkOrder) {
129
- Operation.CustAfterTax = (0, math_operations_1.Add)(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST);
132
+ Operation.CustAfterTax = (0, math_operations_1.Add)(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
130
133
  }
131
134
  else {
132
135
  if (Operation.Sts !== enums_1.LaborStatusEnum.New && Operation.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
133
- Operation.CustAfterTax = (0, math_operations_1.Add)(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST);
136
+ Operation.CustAfterTax = (0, math_operations_1.Add)(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
134
137
  }
135
138
  else {
136
- Operation.CustAfterTax = (0, math_operations_1.Add)(Operation.CustAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST);
139
+ Operation.CustAfterTax = (0, math_operations_1.Add)(Operation.CustAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST, Operation.ECESS);
137
140
  }
138
141
  }
139
142
  Operation.InsAfterTax = 0;
140
143
  }
141
144
  else {
142
145
  if (isWorkOrder) {
143
- Operation.CustAfterTax = (0, math_operations_1.Add)(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST);
144
- Operation.InsAfterTax = (0, math_operations_1.Add)(Operation.InsAfterLaborDisc, Operation.ACGST, Operation.ASGST, Operation.AIGST);
146
+ Operation.CustAfterTax = (0, math_operations_1.Add)(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
147
+ Operation.InsAfterTax = (0, math_operations_1.Add)(Operation.InsAfterLaborDisc, Operation.ACGST, Operation.ASGST, Operation.AIGST, Operation.ACESS);
145
148
  }
146
149
  else {
147
150
  if (Operation.Sts !== enums_1.LaborStatusEnum.New && Operation.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
148
- Operation.CustAfterTax = (0, math_operations_1.Add)(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST);
149
- Operation.InsAfterTax = (0, math_operations_1.Add)(Operation.InsAfterLaborDisc, Operation.ACGST, Operation.ASGST, Operation.AIGST);
151
+ Operation.CustAfterTax = (0, math_operations_1.Add)(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
152
+ Operation.InsAfterTax = (0, math_operations_1.Add)(Operation.InsAfterLaborDisc, Operation.ACGST, Operation.ASGST, Operation.AIGST, Operation.ACESS);
150
153
  }
151
154
  else {
152
155
  Operation.CustAfterTax = 0;
153
- Operation.InsAfterTax = (0, math_operations_1.Add)(Operation.InsAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST);
156
+ Operation.InsAfterTax = (0, math_operations_1.Add)(Operation.InsAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST, Operation.ECESS);
154
157
  }
155
158
  }
156
159
  }
@@ -192,9 +195,11 @@ class ROTotalsService {
192
195
  Part.ACGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CGST', 'ACGST');
193
196
  Part.ASGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'SGST', 'ASGST');
194
197
  Part.AIGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'IGST', 'AIGST');
198
+ Part.ACESS = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CESS', 'ACESS');
195
199
  Part.CCGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CGST', 'CCGST');
196
200
  Part.CSGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'SGST', 'CSGST');
197
201
  Part.CIGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'IGST', 'CIGST');
202
+ Part.CCESS = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CESS', 'CCESS');
198
203
  Part.UnAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.UnAmt);
199
204
  Part.AssAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.AssAmt);
200
205
  Part.NetAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.NetAmt);
@@ -204,6 +209,7 @@ class ROTotalsService {
204
209
  Part.ECGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CGST', 'ECGST');
205
210
  Part.ESGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'SGST', 'ESGST');
206
211
  Part.EIGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'IGST', 'EIGST');
212
+ Part.ECESS = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CESS', 'ECESS');
207
213
  Part.EstAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Part.EstAmt);
208
214
  }
209
215
  return Part;
@@ -323,20 +329,20 @@ class ROTotalsService {
323
329
  else {
324
330
  if (tr_utils_1.TrUtils.IsNull(Part.CollId)) {
325
331
  if (isWorkOrder) {
326
- Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
332
+ Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
327
333
  if (tr_utils_1.TrUtils.IsNull(Part.OpId)) {
328
- Part.InsAfterTax = (0, math_operations_1.Add)(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST);
334
+ Part.InsAfterTax = (0, math_operations_1.Add)(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
329
335
  }
330
336
  }
331
337
  else {
332
338
  let LaborSts = this.GetPartParentStatus(Part, LaborList);
333
339
  if (LaborSts === enums_1.LaborStatusEnum.New || LaborSts === enums_1.LaborStatusEnum.WtngForAppr) {
334
- Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST);
340
+ Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
335
341
  }
336
342
  else {
337
- Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
343
+ Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
338
344
  if (tr_utils_1.TrUtils.IsNull(Part.OpId)) {
339
- Part.InsAfterTax = (0, math_operations_1.Add)(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST);
345
+ Part.InsAfterTax = (0, math_operations_1.Add)(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
340
346
  }
341
347
  }
342
348
  }
@@ -345,31 +351,31 @@ class ROTotalsService {
345
351
  else {
346
352
  if (Part.PBy === enums_1.PayTypeEnum.Customer) {
347
353
  if (isWorkOrder) {
348
- Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
354
+ Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
349
355
  }
350
356
  else {
351
357
  if (Part.Sts !== enums_1.LaborStatusEnum.New && Part.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
352
- Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
358
+ Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
353
359
  }
354
360
  else {
355
- Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST);
361
+ Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
356
362
  }
357
363
  }
358
364
  Part.InsAfterTax = 0;
359
365
  }
360
366
  else {
361
367
  if (isWorkOrder) {
362
- Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
363
- Part.InsAfterTax = (0, math_operations_1.Add)(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST);
368
+ Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
369
+ Part.InsAfterTax = (0, math_operations_1.Add)(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
364
370
  }
365
371
  else {
366
372
  if (Part.Sts !== enums_1.LaborStatusEnum.New && Part.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
367
- Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
368
- Part.InsAfterTax = (0, math_operations_1.Add)(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST);
373
+ Part.CustAfterTax = (0, math_operations_1.Add)(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
374
+ Part.InsAfterTax = (0, math_operations_1.Add)(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
369
375
  }
370
376
  else {
371
377
  Part.CustAfterTax = 0;
372
- Part.InsAfterTax = (0, math_operations_1.Add)(Part.InsAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST);
378
+ Part.InsAfterTax = (0, math_operations_1.Add)(Part.InsAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
373
379
  }
374
380
  }
375
381
  }
@@ -476,7 +482,7 @@ class ROTotalsService {
476
482
  if (isWorkOrder) {
477
483
  // if (Labor.PBy === PayTypeEnum.Customer) {
478
484
  if ((Labor.PBy === enums_1.PayTypeEnum.Customer || Labor.PBy === enums_1.PayTypeEnum.Shared)) {
479
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST);
485
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST, Labor.CCESS);
480
486
  }
481
487
  // }else{
482
488
  // TotalTaxAmt = Add(TotalTaxAmt , Labor.ACGST , Labor.ASGST , Labor.AIGST);
@@ -484,11 +490,11 @@ class ROTotalsService {
484
490
  }
485
491
  else {
486
492
  if (Labor.Sts !== enums_1.LaborStatusEnum.New && Labor.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
487
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST);
493
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST, Labor.CCESS);
488
494
  }
489
495
  else {
490
496
  if (Labor.PBy === enums_1.PayTypeEnum.Customer) {
491
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST);
497
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST, Labor.ECESS);
492
498
  }
493
499
  }
494
500
  }
@@ -503,16 +509,16 @@ class ROTotalsService {
503
509
  if (!tr_utils_1.TrUtils.IsNull(Part.CollId)) {
504
510
  if (isWorkOrder) {
505
511
  if ((Part.PBy === enums_1.PayTypeEnum.Customer || Part.PBy === enums_1.PayTypeEnum.Shared)) {
506
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST);
512
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
507
513
  }
508
514
  }
509
515
  else {
510
516
  if (Part.Sts !== enums_1.LaborStatusEnum.New && Part.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
511
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST);
517
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
512
518
  }
513
519
  else {
514
520
  if (Part.PBy === enums_1.PayTypeEnum.Customer) {
515
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST);
521
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
516
522
  }
517
523
  }
518
524
  }
@@ -521,7 +527,7 @@ class ROTotalsService {
521
527
  if (isWorkOrder) {
522
528
  // if (Part.PBy === PayTypeEnum.Customer) {
523
529
  if ((Part.PBy === enums_1.PayTypeEnum.Customer || Part.PBy === enums_1.PayTypeEnum.Shared)) {
524
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST);
530
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
525
531
  }
526
532
  // }else{
527
533
  // TotalTaxAmt = Add(TotalTaxAmt , Part.ACGST , Part.ASGST , Part.AIGST);
@@ -533,14 +539,14 @@ class ROTotalsService {
533
539
  });
534
540
  if (Index !== -1) {
535
541
  if (OpsList[Index].Sts !== enums_1.LaborStatusEnum.New && OpsList[Index].Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
536
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST);
542
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
537
543
  }
538
544
  else {
539
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST);
545
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
540
546
  }
541
547
  }
542
548
  else {
543
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST);
549
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
544
550
  }
545
551
  }
546
552
  }
@@ -597,16 +603,16 @@ class ROTotalsService {
597
603
  opCodesList.forEach((Labor) => {
598
604
  if (isWorkOrder) {
599
605
  if ((Labor.PBy === enums_1.PayTypeEnum.Insurance || Labor.PBy === enums_1.PayTypeEnum.Shared)) {
600
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST);
606
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST, Labor.ACESS);
601
607
  }
602
608
  }
603
609
  else {
604
610
  if (Labor.Sts !== enums_1.LaborStatusEnum.New && Labor.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
605
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST);
611
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST, Labor.ACESS);
606
612
  }
607
613
  else {
608
614
  if (Labor.PBy === enums_1.PayTypeEnum.Insurance || Labor.PBy === enums_1.PayTypeEnum.Shared) {
609
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST);
615
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST, Labor.ECESS);
610
616
  }
611
617
  }
612
618
  }
@@ -621,16 +627,16 @@ class ROTotalsService {
621
627
  if (!tr_utils_1.TrUtils.IsNull(Part.CollId) || Part.PBy === enums_1.PayTypeEnum.Insurance || Part.PBy === enums_1.PayTypeEnum.Shared) {
622
628
  if (isWorkOrder) {
623
629
  if ((Part.PBy === enums_1.PayTypeEnum.Insurance || Part.PBy === enums_1.PayTypeEnum.Shared)) {
624
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST);
630
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
625
631
  }
626
632
  }
627
633
  else {
628
634
  if (Part.Sts !== enums_1.LaborStatusEnum.New && Part.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
629
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST);
635
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
630
636
  }
631
637
  else {
632
638
  if (Part.PBy === enums_1.PayTypeEnum.Insurance || Part.PBy === enums_1.PayTypeEnum.Shared) {
633
- TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST);
639
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
634
640
  }
635
641
  }
636
642
  }
@@ -1090,6 +1096,7 @@ class ROTotalsService {
1090
1096
  let CGSTAmt = 0;
1091
1097
  let SGSTAmt = 0;
1092
1098
  let IGSTAmt = 0;
1099
+ let CESSAmt = 0;
1093
1100
  let HSN = MatchedPart[0].HSN;
1094
1101
  TaxInfo.CombinedTaxPercentage = MatchedPart[0].CombinedTaxPercentage;
1095
1102
  MatchedPart.forEach((argMatchedGSTPart) => {
@@ -1098,35 +1105,39 @@ class ROTotalsService {
1098
1105
  CGSTAmt = (0, math_operations_1.Add)(CGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.CCGST, DecimalsNumber));
1099
1106
  IGSTAmt = (0, math_operations_1.Add)(IGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.CIGST, DecimalsNumber));
1100
1107
  SGSTAmt = (0, math_operations_1.Add)(SGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.CSGST, DecimalsNumber));
1108
+ CESSAmt = (0, math_operations_1.Add)(CESSAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.CCESS, DecimalsNumber));
1101
1109
  }
1102
1110
  else {
1103
1111
  if (argMatchedGSTPart.Sts !== enums_1.LaborStatusEnum.New && argMatchedGSTPart.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
1104
1112
  CGSTAmt = (0, math_operations_1.Add)(CGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.CCGST, DecimalsNumber));
1105
1113
  IGSTAmt = (0, math_operations_1.Add)(IGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.CIGST, DecimalsNumber));
1106
1114
  SGSTAmt = (0, math_operations_1.Add)(SGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.CSGST, DecimalsNumber));
1115
+ CESSAmt = (0, math_operations_1.Add)(CESSAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.CCESS, DecimalsNumber));
1107
1116
  }
1108
1117
  else {
1109
1118
  if (argMatchedGSTPart.PBy === enums_1.PayTypeEnum.Customer) {
1110
1119
  CGSTAmt = (0, math_operations_1.Add)(CGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.ECGST, DecimalsNumber));
1111
1120
  IGSTAmt = (0, math_operations_1.Add)(IGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.EIGST, DecimalsNumber));
1112
1121
  SGSTAmt = (0, math_operations_1.Add)(SGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.ESGST, DecimalsNumber));
1122
+ CESSAmt = (0, math_operations_1.Add)(CESSAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.ECESS, DecimalsNumber));
1113
1123
  }
1114
1124
  }
1115
1125
  }
1116
1126
  });
1117
- TaxAmount = (0, math_operations_1.Add)(CGSTAmt, SGSTAmt, IGSTAmt);
1127
+ TaxAmount = (0, math_operations_1.Add)(CGSTAmt, SGSTAmt, IGSTAmt, CESSAmt);
1118
1128
  TaxInfo.HSN = HSN;
1119
1129
  TaxInfo.TotalTaxableAmount = tr_utils_1.TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
1120
1130
  TaxInfo.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(CGSTAmt, DecimalsNumber);
1121
1131
  TaxInfo.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(SGSTAmt, DecimalsNumber);
1122
1132
  TaxInfo.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(IGSTAmt, DecimalsNumber);
1133
+ TaxInfo.CESSAmt = tr_utils_1.TrUtils.FixPriceValue(CESSAmt, DecimalsNumber);
1123
1134
  TaxInfo.TotalTaxAmount = tr_utils_1.TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
1124
1135
  TaxInfo.PartsCount = MatchedPart.length;
1125
1136
  let GSTValues = this.GetGSTValueBasedOnTaxCode(MatchedPart[0], TaxCodes);
1126
- console.log("GSTValues: ", GSTValues);
1127
1137
  TaxInfo.CGST = GSTValues[0];
1128
1138
  TaxInfo.SGST = GSTValues[1];
1129
1139
  TaxInfo.IGST = GSTValues[2];
1140
+ TaxInfo.CESS = GSTValues[3];
1130
1141
  if (TaxOnAmount !== 0) {
1131
1142
  HSNTaxInfo.push(TaxInfo);
1132
1143
  }
@@ -1158,6 +1169,7 @@ class ROTotalsService {
1158
1169
  let CGSTAmt = 0;
1159
1170
  let SGSTAmt = 0;
1160
1171
  let IGSTAmt = 0;
1172
+ let CESSAmt = 0;
1161
1173
  let HSN = MatchedPart[0].HSN;
1162
1174
  TaxInfo.CombinedTaxPercentage = MatchedPart[0].CombinedTaxPercentage;
1163
1175
  MatchedPart.forEach((argMatchedGSTPart) => {
@@ -1167,26 +1179,30 @@ class ROTotalsService {
1167
1179
  CGSTAmt = (0, math_operations_1.Add)(CGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.ACGST, DecimalsNumber));
1168
1180
  IGSTAmt = (0, math_operations_1.Add)(IGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.AIGST, DecimalsNumber));
1169
1181
  SGSTAmt = (0, math_operations_1.Add)(SGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.ASGST, DecimalsNumber));
1182
+ CESSAmt = (0, math_operations_1.Add)(CESSAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.ACESS, DecimalsNumber));
1170
1183
  }
1171
1184
  else {
1172
1185
  CGSTAmt = (0, math_operations_1.Add)(CGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.ECGST, DecimalsNumber));
1173
1186
  IGSTAmt = (0, math_operations_1.Add)(IGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.EIGST, DecimalsNumber));
1174
1187
  SGSTAmt = (0, math_operations_1.Add)(SGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.ESGST, DecimalsNumber));
1188
+ CESSAmt = (0, math_operations_1.Add)(CESSAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.ECESS, DecimalsNumber));
1175
1189
  }
1176
1190
  }
1177
1191
  });
1178
- TaxAmount = (0, math_operations_1.Add)(CGSTAmt, SGSTAmt, IGSTAmt);
1192
+ TaxAmount = (0, math_operations_1.Add)(CGSTAmt, SGSTAmt, IGSTAmt, CESSAmt);
1179
1193
  TaxInfo.HSN = HSN;
1180
1194
  TaxInfo.TotalTaxableAmount = tr_utils_1.TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
1181
1195
  TaxInfo.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(CGSTAmt, DecimalsNumber);
1182
1196
  TaxInfo.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(SGSTAmt, DecimalsNumber);
1183
1197
  TaxInfo.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(IGSTAmt, DecimalsNumber);
1198
+ TaxInfo.CESSAmt = tr_utils_1.TrUtils.FixPriceValue(CESSAmt, DecimalsNumber);
1184
1199
  TaxInfo.TotalTaxAmount = tr_utils_1.TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
1185
1200
  TaxInfo.PartsCount = MatchedPart.length;
1186
1201
  let GSTValues = this.GetGSTValueBasedOnTaxCode(MatchedPart[0], TaxCodes);
1187
1202
  TaxInfo.CGST = GSTValues[0];
1188
1203
  TaxInfo.SGST = GSTValues[1];
1189
1204
  TaxInfo.IGST = GSTValues[2];
1205
+ TaxInfo.CESS = GSTValues[3];
1190
1206
  if (TaxOnAmount !== 0) {
1191
1207
  HSNTaxInfo.push(TaxInfo);
1192
1208
  }
@@ -1197,6 +1213,7 @@ class ROTotalsService {
1197
1213
  let CGST = 0;
1198
1214
  let SGST = 0;
1199
1215
  let IGST = 0;
1216
+ let CESS = 0;
1200
1217
  const taxGroupKeys = ['Taxes', 'CTaxes', 'ATaxes', 'ETaxes'];
1201
1218
  for (const taxGroupKey of taxGroupKeys) {
1202
1219
  const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
@@ -1212,28 +1229,42 @@ class ROTotalsService {
1212
1229
  IGST = groupedTaxes
1213
1230
  .filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === 'IGST')
1214
1231
  .reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
1215
- if (!tr_utils_1.TrUtils.IsZero((0, math_operations_1.Add)(CGST, SGST, IGST))) {
1216
- return [CGST, SGST, IGST];
1232
+ CESS = groupedTaxes
1233
+ .filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === 'CESS')
1234
+ .reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
1235
+ if (!tr_utils_1.TrUtils.IsZero((0, math_operations_1.Add)(CGST, SGST, IGST, CESS))) {
1236
+ return [CGST, SGST, IGST, CESS];
1217
1237
  }
1218
1238
  }
1219
1239
  const TCode = item === null || item === void 0 ? void 0 : item.TCode;
1220
1240
  if (tr_utils_1.TrUtils.IsNull(TCode)) {
1221
- return [CGST, SGST, IGST];
1241
+ return [CGST, SGST, IGST, CESS];
1222
1242
  }
1223
1243
  let TCodeIndex = TaxCodes.findIndex((TaxCode) => {
1224
1244
  return TaxCode._id === Number(TCode);
1225
1245
  });
1226
1246
  if (TCodeIndex !== -1) {
1247
+ const CESS = this.GetTaxComponentRate(TaxCodes[TCodeIndex], 'CESS');
1227
1248
  if (TaxCodes[TCodeIndex].Type === 'Intra') {
1228
- return [TaxCodes[TCodeIndex].CGST, TaxCodes[TCodeIndex].SGST, 0];
1249
+ return [TaxCodes[TCodeIndex].CGST, TaxCodes[TCodeIndex].SGST, 0, CESS];
1229
1250
  }
1230
1251
  else {
1231
- return [0, 0, TaxCodes[TCodeIndex].IGST];
1252
+ return [0, 0, TaxCodes[TCodeIndex].IGST, CESS];
1232
1253
  }
1233
1254
  }
1234
1255
  else {
1235
- return [CGST, SGST, IGST];
1256
+ return [CGST, SGST, IGST, CESS];
1257
+ }
1258
+ }
1259
+ static GetTaxComponentRate(taxCode, code) {
1260
+ const components = taxCode === null || taxCode === void 0 ? void 0 : taxCode.Components;
1261
+ if (Array.isArray(components)) {
1262
+ const matchedComponents = components.filter((component) => (component === null || component === void 0 ? void 0 : component.Code) === code);
1263
+ if (matchedComponents.length !== 0) {
1264
+ return matchedComponents.reduce((total, component) => (0, math_operations_1.Add)(total, component === null || component === void 0 ? void 0 : component.Rate), 0);
1265
+ }
1236
1266
  }
1267
+ return tr_utils_1.TrUtils.SetValueToZeroIfNull(taxCode === null || taxCode === void 0 ? void 0 : taxCode[code]);
1237
1268
  }
1238
1269
  static GetCombinedTaxPercentage(Parts, TaxCodes) {
1239
1270
  Parts.forEach((Part) => {
@@ -1241,7 +1272,8 @@ class ROTotalsService {
1241
1272
  let CGST = GSTValues[0];
1242
1273
  let SGST = GSTValues[1];
1243
1274
  let IGST = GSTValues[2];
1244
- Part.CombinedTaxPercentage = (0, math_operations_1.Add)(CGST, SGST, IGST);
1275
+ let CESS = GSTValues[3];
1276
+ Part.CombinedTaxPercentage = (0, math_operations_1.Add)(CGST, SGST, IGST, CESS);
1245
1277
  });
1246
1278
  return Parts;
1247
1279
  }
@@ -1270,13 +1302,15 @@ class ROTotalsService {
1270
1302
  let argCGST = argGSTValues[0];
1271
1303
  let argSGST = argGSTValues[1];
1272
1304
  let argIGST = argGSTValues[2];
1305
+ let argCESS = argGSTValues[3];
1273
1306
  let partGSTValues = this.GetGSTValueBasedOnTaxCode(Part, TaxCodes);
1274
1307
  let partCGST = partGSTValues[0];
1275
1308
  let partSGST = partGSTValues[1];
1276
1309
  let partIGST = partGSTValues[2];
1310
+ let partCESS = partGSTValues[3];
1277
1311
  return (argPart.HSN === Part.HSN) && (!PartFound) &&
1278
1312
  (argCGST === partCGST) && (argIGST === partIGST) &&
1279
- (argSGST === partSGST);
1313
+ (argSGST === partSGST) && (argCESS === partCESS);
1280
1314
  });
1281
1315
  if (MatchedPartsBasedOnHSN.length !== 0) {
1282
1316
  FinalMatchedParts.push(MatchedPartsBasedOnHSN);
@@ -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 itemTotalTax = (0, math_operations_1.Add)(itemSGST, itemCGST, itemIGST);
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
- totalTaxOnItems = (0, math_operations_1.Add)(totalTaxOnItems, itemSGST, itemCGST, itemIGST);
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
- totalTaxOnLabor = (0, math_operations_1.Add)(totalTaxOnLabor, opSGST, opCGST, opIGST);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.341",
3
+ "version": "1.7.343",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -299,7 +299,8 @@ export function GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: an
299
299
  let CTaxAmtPerItem = Divide(GetTaxAmountFromTaxes(Item, 'CGST'), Item.Qty);
300
300
  let STaxAmtPerItem = Divide(GetTaxAmountFromTaxes(Item, 'SGST'), Item.Qty);
301
301
  let ITaxAmtPerItem = Divide(GetTaxAmountFromTaxes(Item, 'IGST'), Item.Qty);
302
- Item.UnPr = TrUtils.FixedTo(Add(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem), DecimalsNumber);
302
+ let CESSAmtPerItem = Divide(GetTaxAmountFromTaxes(Item, 'CESS'), Item.Qty);
303
+ Item.UnPr = TrUtils.FixedTo(Add(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem, CESSAmtPerItem), DecimalsNumber);
303
304
  } else {
304
305
  Item.UnPr = TrUtils.FixPriceValue(Item.UnPr, DecimalsNumber);
305
306
  }