shareneus 1.7.342 → 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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.342",
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
  }
@@ -131,7 +131,7 @@ export class InvoiceTotalsService {
131
131
  if (IsIndependentTax) {
132
132
  let NetAmt: number = Subtract(Part.UnAmt, Part.Disc, Part.RecDisc);
133
133
  Part.AfterPartDisc = NetAmt;
134
- Part.AfterPartTax = Add(Part.AfterPartDisc, Part.CGST, Part.SGST, Part.IGST);
134
+ Part.AfterPartTax = Add(Part.AfterPartDisc, Part.CGST, Part.SGST, Part.IGST, Part.CESS);
135
135
  } else {
136
136
  Part.AfterPartDisc = Subtract(Part.UnAmt, Part.Disc, Part.RecDisc);
137
137
  Part.AfterPartTax = Part.AfterPartDisc;
@@ -148,6 +148,7 @@ export class InvoiceTotalsService {
148
148
  Part.CGST = TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'CGST'));
149
149
  Part.SGST = TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'SGST'));
150
150
  Part.IGST = TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'IGST'));
151
+ Part.CESS = TrUtils.SetValueToZeroIfNull(this.GetTaxAmountFromTaxes(Part, 'CESS'));
151
152
  Part.TCode = this.GetTCodeFromTaxes(Part);
152
153
  return Part;
153
154
  }
@@ -57,20 +57,23 @@ export class ROTotalsService {
57
57
  Operation.Disc = TrUtils.SetValueToZeroIfNull(Operation.Disc);
58
58
  Operation.Pr = TrUtils.SetValueToZeroIfNull(Operation.Pr);
59
59
  Operation.AssPr = TrUtils.SetValueToZeroIfNull(Operation.AssPr);
60
- Operation.ACGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'CGST', 'ACGST');
61
- Operation.ASGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'SGST', 'ASGST');
62
- Operation.AIGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'IGST', 'AIGST');
63
- Operation.CCGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'CGST', 'CCGST');
64
- Operation.CSGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'SGST', 'CSGST');
65
- Operation.CIGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'IGST', 'CIGST');
60
+ Operation.ACGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'CGST', 'ACGST');
61
+ Operation.ASGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'SGST', 'ASGST');
62
+ Operation.AIGST = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'IGST', 'AIGST');
63
+ Operation.ACESS = this.GetTaxAmountFromGroup(Operation, 'ATaxes', 'CESS', 'ACESS');
64
+ Operation.CCGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'CGST', 'CCGST');
65
+ Operation.CSGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'SGST', 'CSGST');
66
+ Operation.CIGST = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'IGST', 'CIGST');
67
+ Operation.CCESS = this.GetTaxAmountFromGroup(Operation, 'CTaxes', 'CESS', 'CCESS');
66
68
  Operation.NetAmt = TrUtils.SetValueToZeroIfNull(Operation.NetAmt);
67
69
  Operation.RecDisc = TrUtils.SetValueToZeroIfNull(Operation.RecDisc);
68
70
 
69
71
  if (!isWorkOrder) {
70
72
  Operation.EstPr = TrUtils.SetValueToZeroIfNull(Operation.EstPr);
71
- Operation.ECGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'CGST', 'ECGST');
72
- Operation.ESGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'SGST', 'ESGST');
73
- Operation.EIGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'IGST', 'EIGST');
73
+ Operation.ECGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'CGST', 'ECGST');
74
+ Operation.ESGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'SGST', 'ESGST');
75
+ Operation.EIGST = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'IGST', 'EIGST');
76
+ Operation.ECESS = this.GetTaxAmountFromGroup(Operation, 'ETaxes', 'CESS', 'ECESS');
74
77
  }
75
78
  return Operation;
76
79
  }
@@ -131,26 +134,26 @@ export class ROTotalsService {
131
134
  } else {
132
135
  if (Operation.PBy === PayTypeEnum.Customer) {
133
136
  if (isWorkOrder) {
134
- Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST);
137
+ Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
135
138
  } else {
136
139
  if (Operation.Sts !== LaborStatusEnum.New && Operation.Sts !== LaborStatusEnum.WtngForAppr) {
137
- Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST);
140
+ Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
138
141
  } else {
139
- Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST);
142
+ Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST, Operation.ECESS);
140
143
  }
141
144
  }
142
145
  Operation.InsAfterTax = 0;
143
146
  } else {
144
147
  if (isWorkOrder) {
145
- Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST);
146
- Operation.InsAfterTax = Add(Operation.InsAfterLaborDisc, Operation.ACGST, Operation.ASGST, Operation.AIGST);
148
+ Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
149
+ Operation.InsAfterTax = Add(Operation.InsAfterLaborDisc, Operation.ACGST, Operation.ASGST, Operation.AIGST, Operation.ACESS);
147
150
  } else {
148
151
  if (Operation.Sts !== LaborStatusEnum.New && Operation.Sts !== LaborStatusEnum.WtngForAppr) {
149
- Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST);
150
- Operation.InsAfterTax = Add(Operation.InsAfterLaborDisc, Operation.ACGST, Operation.ASGST, Operation.AIGST);
152
+ Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
153
+ Operation.InsAfterTax = Add(Operation.InsAfterLaborDisc, Operation.ACGST, Operation.ASGST, Operation.AIGST, Operation.ACESS);
151
154
  } else {
152
155
  Operation.CustAfterTax = 0;
153
- Operation.InsAfterTax = Add(Operation.InsAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST);
156
+ Operation.InsAfterTax = Add(Operation.InsAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST, Operation.ECESS);
154
157
  }
155
158
  }
156
159
  }
@@ -199,21 +202,24 @@ export class ROTotalsService {
199
202
  Part.Disc = TrUtils.SetValueToZeroIfNull(Part.Disc);
200
203
  Part.UnPr = TrUtils.SetValueToZeroIfNull(Part.UnPr);
201
204
  Part.AssPr = TrUtils.SetValueToZeroIfNull(Part.AssPr);
202
- Part.ACGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CGST', 'ACGST');
203
- Part.ASGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'SGST', 'ASGST');
204
- Part.AIGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'IGST', 'AIGST');
205
- Part.CCGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CGST', 'CCGST');
206
- Part.CSGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'SGST', 'CSGST');
207
- Part.CIGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'IGST', 'CIGST');
205
+ Part.ACGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CGST', 'ACGST');
206
+ Part.ASGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'SGST', 'ASGST');
207
+ Part.AIGST = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'IGST', 'AIGST');
208
+ Part.ACESS = this.GetTaxAmountFromGroup(Part, 'ATaxes', 'CESS', 'ACESS');
209
+ Part.CCGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CGST', 'CCGST');
210
+ Part.CSGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'SGST', 'CSGST');
211
+ Part.CIGST = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'IGST', 'CIGST');
212
+ Part.CCESS = this.GetTaxAmountFromGroup(Part, 'CTaxes', 'CESS', 'CCESS');
208
213
  Part.UnAmt = TrUtils.SetValueToZeroIfNull(Part.UnAmt);
209
214
  Part.AssAmt = TrUtils.SetValueToZeroIfNull(Part.AssAmt);
210
215
  Part.NetAmt = TrUtils.SetValueToZeroIfNull(Part.NetAmt);
211
216
  Part.RecDisc = TrUtils.SetValueToZeroIfNull(Part.RecDisc);
212
217
  if (!isWorkOrder) {
213
218
  Part.EstPr = TrUtils.SetValueToZeroIfNull(Part.EstPr);
214
- Part.ECGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CGST', 'ECGST');
215
- Part.ESGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'SGST', 'ESGST');
216
- Part.EIGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'IGST', 'EIGST');
219
+ Part.ECGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CGST', 'ECGST');
220
+ Part.ESGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'SGST', 'ESGST');
221
+ Part.EIGST = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'IGST', 'EIGST');
222
+ Part.ECESS = this.GetTaxAmountFromGroup(Part, 'ETaxes', 'CESS', 'ECESS');
217
223
  Part.EstAmt = TrUtils.SetValueToZeroIfNull(Part.EstAmt);
218
224
  }
219
225
  return Part;
@@ -323,18 +329,18 @@ export class ROTotalsService {
323
329
  } else {
324
330
  if (TrUtils.IsNull(Part.CollId)) {
325
331
  if (isWorkOrder) {
326
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
332
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
327
333
  if (TrUtils.IsNull(Part.OpId)) {
328
- Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST);
334
+ Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
329
335
  }
330
336
  } else {
331
337
  let LaborSts: string = this.GetPartParentStatus(Part, LaborList);
332
338
  if (LaborSts === LaborStatusEnum.New || LaborSts === LaborStatusEnum.WtngForAppr) {
333
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST);
339
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
334
340
  } else {
335
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
341
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
336
342
  if (TrUtils.IsNull(Part.OpId)) {
337
- Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST);
343
+ Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
338
344
  }
339
345
  }
340
346
  }
@@ -343,26 +349,26 @@ export class ROTotalsService {
343
349
  } else {
344
350
  if (Part.PBy === PayTypeEnum.Customer) {
345
351
  if (isWorkOrder) {
346
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
352
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
347
353
  } else {
348
354
  if (Part.Sts !== LaborStatusEnum.New && Part.Sts !== LaborStatusEnum.WtngForAppr) {
349
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
355
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
350
356
  } else {
351
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST);
357
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
352
358
  }
353
359
  }
354
360
  Part.InsAfterTax = 0;
355
361
  } else {
356
362
  if (isWorkOrder) {
357
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
358
- Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST);
363
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
364
+ Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
359
365
  } else {
360
366
  if (Part.Sts !== LaborStatusEnum.New && Part.Sts !== LaborStatusEnum.WtngForAppr) {
361
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST);
362
- Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST);
367
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
368
+ Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
363
369
  } else {
364
370
  Part.CustAfterTax = 0;
365
- Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST);
371
+ Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
366
372
  }
367
373
  }
368
374
  }
@@ -484,17 +490,17 @@ export class ROTotalsService {
484
490
  if (isWorkOrder) {
485
491
  // if (Labor.PBy === PayTypeEnum.Customer) {
486
492
  if ((Labor.PBy === PayTypeEnum.Customer || Labor.PBy === PayTypeEnum.Shared)) {
487
- TotalTaxAmt = Add(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST);
493
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST, Labor.CCESS);
488
494
  }
489
495
  // }else{
490
496
  // TotalTaxAmt = Add(TotalTaxAmt , Labor.ACGST , Labor.ASGST , Labor.AIGST);
491
497
  // }
492
498
  } else {
493
499
  if (Labor.Sts !== LaborStatusEnum.New && Labor.Sts !== LaborStatusEnum.WtngForAppr) {
494
- TotalTaxAmt = Add(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST);
500
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST, Labor.CCESS);
495
501
  } else {
496
502
  if (Labor.PBy === PayTypeEnum.Customer) {
497
- TotalTaxAmt = Add(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST);
503
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST, Labor.ECESS);
498
504
  }
499
505
  }
500
506
  }
@@ -510,14 +516,14 @@ export class ROTotalsService {
510
516
  if (!TrUtils.IsNull(Part.CollId)) {
511
517
  if (isWorkOrder) {
512
518
  if ((Part.PBy === PayTypeEnum.Customer || Part.PBy === PayTypeEnum.Shared)) {
513
- TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST);
519
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
514
520
  }
515
521
  } else {
516
522
  if (Part.Sts !== LaborStatusEnum.New && Part.Sts !== LaborStatusEnum.WtngForAppr) {
517
- TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST);
523
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
518
524
  } else {
519
525
  if (Part.PBy === PayTypeEnum.Customer) {
520
- TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST);
526
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
521
527
  }
522
528
  }
523
529
  }
@@ -525,7 +531,7 @@ export class ROTotalsService {
525
531
  if (isWorkOrder) {
526
532
  // if (Part.PBy === PayTypeEnum.Customer) {
527
533
  if ((Part.PBy === PayTypeEnum.Customer || Part.PBy === PayTypeEnum.Shared)) {
528
- TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST);
534
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
529
535
  }
530
536
  // }else{
531
537
  // TotalTaxAmt = Add(TotalTaxAmt , Part.ACGST , Part.ASGST , Part.AIGST);
@@ -536,12 +542,12 @@ export class ROTotalsService {
536
542
  });
537
543
  if (Index !== -1) {
538
544
  if (OpsList[Index].Sts !== LaborStatusEnum.New && OpsList[Index].Sts !== LaborStatusEnum.WtngForAppr) {
539
- TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST);
545
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
540
546
  } else {
541
- TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST);
547
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
542
548
  }
543
549
  } else {
544
- TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST);
550
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
545
551
  }
546
552
  }
547
553
  }
@@ -613,14 +619,14 @@ export class ROTotalsService {
613
619
  opCodesList.forEach((Labor: any) => {
614
620
  if (isWorkOrder) {
615
621
  if ((Labor.PBy === PayTypeEnum.Insurance || Labor.PBy === PayTypeEnum.Shared)) {
616
- TotalTaxAmt = Add(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST);
622
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST, Labor.ACESS);
617
623
  }
618
624
  } else {
619
625
  if (Labor.Sts !== LaborStatusEnum.New && Labor.Sts !== LaborStatusEnum.WtngForAppr) {
620
- TotalTaxAmt = Add(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST);
626
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST, Labor.ACESS);
621
627
  } else {
622
628
  if (Labor.PBy === PayTypeEnum.Insurance || Labor.PBy === PayTypeEnum.Shared) {
623
- TotalTaxAmt = Add(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST);
629
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST, Labor.ECESS);
624
630
  }
625
631
  }
626
632
  }
@@ -636,14 +642,14 @@ export class ROTotalsService {
636
642
  if (!TrUtils.IsNull(Part.CollId) || Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared) {
637
643
  if (isWorkOrder) {
638
644
  if ((Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared)) {
639
- TotalTaxAmt = Add(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST);
645
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
640
646
  }
641
647
  } else {
642
648
  if (Part.Sts !== LaborStatusEnum.New && Part.Sts !== LaborStatusEnum.WtngForAppr) {
643
- TotalTaxAmt = Add(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST);
649
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
644
650
  } else {
645
651
  if (Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared) {
646
- TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST);
652
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
647
653
  }
648
654
  }
649
655
  }
@@ -1115,44 +1121,49 @@ export class ROTotalsService {
1115
1121
  let TaxInfo: any = {};
1116
1122
  let TaxOnAmount: any = 0;
1117
1123
  let TaxAmount: any = 0;
1118
- let CGSTAmt: any = 0;
1119
- let SGSTAmt: any = 0;
1120
- let IGSTAmt: any = 0;
1124
+ let CGSTAmt: any = 0;
1125
+ let SGSTAmt: any = 0;
1126
+ let IGSTAmt: any = 0;
1127
+ let CESSAmt: any = 0;
1121
1128
  let HSN: any = MatchedPart[0].HSN;
1122
1129
  TaxInfo.CombinedTaxPercentage = MatchedPart[0].CombinedTaxPercentage;
1123
1130
  MatchedPart.forEach((argMatchedGSTPart: any) => {
1124
1131
  TaxOnAmount = Add(TaxOnAmount, TrUtils.FixedTo(argMatchedGSTPart.CustAfterPartDisc, DecimalsNumber));
1125
1132
  if (isWorkOrder) {
1126
- CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CCGST, DecimalsNumber));
1127
- IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CIGST, DecimalsNumber));
1128
- SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CSGST, DecimalsNumber));
1129
- } else {
1130
- if (argMatchedGSTPart.Sts !== LaborStatusEnum.New && argMatchedGSTPart.Sts !== LaborStatusEnum.WtngForAppr) {
1131
- CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CCGST, DecimalsNumber));
1132
- IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CIGST, DecimalsNumber));
1133
- SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CSGST, DecimalsNumber));
1134
- } else {
1135
- if (argMatchedGSTPart.PBy === PayTypeEnum.Customer) {
1136
- CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ECGST, DecimalsNumber));
1137
- IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.EIGST, DecimalsNumber));
1138
- SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ESGST, DecimalsNumber));
1139
- }
1140
- }
1141
- }
1142
- });
1143
- TaxAmount = Add(CGSTAmt, SGSTAmt, IGSTAmt);
1144
- TaxInfo.HSN = HSN;
1145
- TaxInfo.TotalTaxableAmount = TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
1146
- TaxInfo.CGSTAmt = TrUtils.FixPriceValue(CGSTAmt, DecimalsNumber);
1147
- TaxInfo.SGSTAmt = TrUtils.FixPriceValue(SGSTAmt, DecimalsNumber);
1148
- TaxInfo.IGSTAmt = TrUtils.FixPriceValue(IGSTAmt, DecimalsNumber);
1149
- TaxInfo.TotalTaxAmount = TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
1150
- TaxInfo.PartsCount = MatchedPart.length;
1151
- let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedPart[0], TaxCodes);
1152
- console.log("GSTValues: ", GSTValues);
1153
- TaxInfo.CGST = GSTValues[0];
1154
- TaxInfo.SGST = GSTValues[1];
1155
- TaxInfo.IGST = GSTValues[2];
1133
+ CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CCGST, DecimalsNumber));
1134
+ IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CIGST, DecimalsNumber));
1135
+ SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CSGST, DecimalsNumber));
1136
+ CESSAmt = Add(CESSAmt, TrUtils.FixedTo(argMatchedGSTPart.CCESS, DecimalsNumber));
1137
+ } else {
1138
+ if (argMatchedGSTPart.Sts !== LaborStatusEnum.New && argMatchedGSTPart.Sts !== LaborStatusEnum.WtngForAppr) {
1139
+ CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CCGST, DecimalsNumber));
1140
+ IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CIGST, DecimalsNumber));
1141
+ SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CSGST, DecimalsNumber));
1142
+ CESSAmt = Add(CESSAmt, TrUtils.FixedTo(argMatchedGSTPart.CCESS, DecimalsNumber));
1143
+ } else {
1144
+ if (argMatchedGSTPart.PBy === PayTypeEnum.Customer) {
1145
+ CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ECGST, DecimalsNumber));
1146
+ IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.EIGST, DecimalsNumber));
1147
+ SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ESGST, DecimalsNumber));
1148
+ CESSAmt = Add(CESSAmt, TrUtils.FixedTo(argMatchedGSTPart.ECESS, DecimalsNumber));
1149
+ }
1150
+ }
1151
+ }
1152
+ });
1153
+ TaxAmount = Add(CGSTAmt, SGSTAmt, IGSTAmt, CESSAmt);
1154
+ TaxInfo.HSN = HSN;
1155
+ TaxInfo.TotalTaxableAmount = TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
1156
+ TaxInfo.CGSTAmt = TrUtils.FixPriceValue(CGSTAmt, DecimalsNumber);
1157
+ TaxInfo.SGSTAmt = TrUtils.FixPriceValue(SGSTAmt, DecimalsNumber);
1158
+ TaxInfo.IGSTAmt = TrUtils.FixPriceValue(IGSTAmt, DecimalsNumber);
1159
+ TaxInfo.CESSAmt = TrUtils.FixPriceValue(CESSAmt, DecimalsNumber);
1160
+ TaxInfo.TotalTaxAmount = TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
1161
+ TaxInfo.PartsCount = MatchedPart.length;
1162
+ let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedPart[0], TaxCodes);
1163
+ TaxInfo.CGST = GSTValues[0];
1164
+ TaxInfo.SGST = GSTValues[1];
1165
+ TaxInfo.IGST = GSTValues[2];
1166
+ TaxInfo.CESS = GSTValues[3];
1156
1167
  if (TaxOnAmount !== 0) {
1157
1168
  HSNTaxInfo.push(TaxInfo);
1158
1169
  }
@@ -1187,37 +1198,42 @@ export class ROTotalsService {
1187
1198
  let TaxInfo: any = {};
1188
1199
  let TaxOnAmount: any = 0;
1189
1200
  let TaxAmount: any = 0;
1190
- let CGSTAmt: any = 0;
1191
- let SGSTAmt: any = 0;
1192
- let IGSTAmt: any = 0;
1201
+ let CGSTAmt: any = 0;
1202
+ let SGSTAmt: any = 0;
1203
+ let IGSTAmt: any = 0;
1204
+ let CESSAmt: any = 0;
1193
1205
  let HSN: any = MatchedPart[0].HSN;
1194
1206
  TaxInfo.CombinedTaxPercentage = MatchedPart[0].CombinedTaxPercentage;
1195
1207
  MatchedPart.forEach((argMatchedGSTPart: any) => {
1196
1208
  TaxOnAmount = Add(TaxOnAmount, TrUtils.FixedTo(argMatchedGSTPart.InsAfterPartDisc, DecimalsNumber));
1197
1209
  if (argMatchedGSTPart.PBy === PayTypeEnum.Insurance || argMatchedGSTPart.PBy === PayTypeEnum.Shared) {
1198
1210
  if (argMatchedGSTPart.Sts !== LaborStatusEnum.New && argMatchedGSTPart.Sts !== LaborStatusEnum.WtngForAppr) {
1199
- CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ACGST, DecimalsNumber));
1200
- IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.AIGST, DecimalsNumber));
1201
- SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ASGST, DecimalsNumber));
1202
- } else {
1203
- CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ECGST, DecimalsNumber));
1204
- IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.EIGST, DecimalsNumber));
1205
- SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ESGST, DecimalsNumber));
1206
- }
1207
- }
1208
- });
1209
- TaxAmount = Add(CGSTAmt, SGSTAmt, IGSTAmt);
1210
- TaxInfo.HSN = HSN;
1211
- TaxInfo.TotalTaxableAmount = TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
1212
- TaxInfo.CGSTAmt = TrUtils.FixPriceValue(CGSTAmt, DecimalsNumber);
1213
- TaxInfo.SGSTAmt = TrUtils.FixPriceValue(SGSTAmt, DecimalsNumber);
1214
- TaxInfo.IGSTAmt = TrUtils.FixPriceValue(IGSTAmt, DecimalsNumber);
1215
- TaxInfo.TotalTaxAmount = TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
1216
- TaxInfo.PartsCount = MatchedPart.length;
1217
- let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedPart[0], TaxCodes);
1218
- TaxInfo.CGST = GSTValues[0];
1219
- TaxInfo.SGST = GSTValues[1];
1220
- TaxInfo.IGST = GSTValues[2];
1211
+ CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ACGST, DecimalsNumber));
1212
+ IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.AIGST, DecimalsNumber));
1213
+ SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ASGST, DecimalsNumber));
1214
+ CESSAmt = Add(CESSAmt, TrUtils.FixedTo(argMatchedGSTPart.ACESS, DecimalsNumber));
1215
+ } else {
1216
+ CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ECGST, DecimalsNumber));
1217
+ IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.EIGST, DecimalsNumber));
1218
+ SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ESGST, DecimalsNumber));
1219
+ CESSAmt = Add(CESSAmt, TrUtils.FixedTo(argMatchedGSTPart.ECESS, DecimalsNumber));
1220
+ }
1221
+ }
1222
+ });
1223
+ TaxAmount = Add(CGSTAmt, SGSTAmt, IGSTAmt, CESSAmt);
1224
+ TaxInfo.HSN = HSN;
1225
+ TaxInfo.TotalTaxableAmount = TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
1226
+ TaxInfo.CGSTAmt = TrUtils.FixPriceValue(CGSTAmt, DecimalsNumber);
1227
+ TaxInfo.SGSTAmt = TrUtils.FixPriceValue(SGSTAmt, DecimalsNumber);
1228
+ TaxInfo.IGSTAmt = TrUtils.FixPriceValue(IGSTAmt, DecimalsNumber);
1229
+ TaxInfo.CESSAmt = TrUtils.FixPriceValue(CESSAmt, DecimalsNumber);
1230
+ TaxInfo.TotalTaxAmount = TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
1231
+ TaxInfo.PartsCount = MatchedPart.length;
1232
+ let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedPart[0], TaxCodes);
1233
+ TaxInfo.CGST = GSTValues[0];
1234
+ TaxInfo.SGST = GSTValues[1];
1235
+ TaxInfo.IGST = GSTValues[2];
1236
+ TaxInfo.CESS = GSTValues[3];
1221
1237
  if (TaxOnAmount !== 0) {
1222
1238
  HSNTaxInfo.push(TaxInfo);
1223
1239
  }
@@ -1226,10 +1242,11 @@ export class ROTotalsService {
1226
1242
  }
1227
1243
 
1228
1244
  static GetGSTValueBasedOnTaxCode(item: any, TaxCodes: any) {
1229
- let CGST: number = 0;
1230
- let SGST: number = 0;
1231
- let IGST: number = 0;
1232
- const taxGroupKeys: string[] = ['Taxes', 'CTaxes', 'ATaxes', 'ETaxes'];
1245
+ let CGST: number = 0;
1246
+ let SGST: number = 0;
1247
+ let IGST: number = 0;
1248
+ let CESS: number = 0;
1249
+ const taxGroupKeys: string[] = ['Taxes', 'CTaxes', 'ATaxes', 'ETaxes'];
1233
1250
 
1234
1251
  for (const taxGroupKey of taxGroupKeys) {
1235
1252
  const groupedTaxes = item?.[taxGroupKey];
@@ -1243,41 +1260,57 @@ export class ROTotalsService {
1243
1260
  SGST = groupedTaxes
1244
1261
  .filter((tax: any) => tax?.Code === 'SGST')
1245
1262
  .reduce((total: number, tax: any) => Add(total, tax?.Rate), 0);
1246
- IGST = groupedTaxes
1247
- .filter((tax: any) => tax?.Code === 'IGST')
1248
- .reduce((total: number, tax: any) => Add(total, tax?.Rate), 0);
1249
-
1250
- if (!TrUtils.IsZero(Add(CGST, SGST, IGST))) {
1251
- return [CGST, SGST, IGST];
1252
- }
1253
- }
1254
-
1255
- const TCode = item?.TCode;
1256
- if (TrUtils.IsNull(TCode)) {
1257
- return [CGST, SGST, IGST];
1258
- }
1263
+ IGST = groupedTaxes
1264
+ .filter((tax: any) => tax?.Code === 'IGST')
1265
+ .reduce((total: number, tax: any) => Add(total, tax?.Rate), 0);
1266
+ CESS = groupedTaxes
1267
+ .filter((tax: any) => tax?.Code === 'CESS')
1268
+ .reduce((total: number, tax: any) => Add(total, tax?.Rate), 0);
1269
+
1270
+ if (!TrUtils.IsZero(Add(CGST, SGST, IGST, CESS))) {
1271
+ return [CGST, SGST, IGST, CESS];
1272
+ }
1273
+ }
1274
+
1275
+ const TCode = item?.TCode;
1276
+ if (TrUtils.IsNull(TCode)) {
1277
+ return [CGST, SGST, IGST, CESS];
1278
+ }
1259
1279
  let TCodeIndex: any = TaxCodes.findIndex((TaxCode: any) => {
1260
1280
  return TaxCode._id === Number(TCode);
1261
1281
  });
1262
- if (TCodeIndex !== -1) {
1263
- if (TaxCodes[TCodeIndex].Type === 'Intra') {
1264
- return [TaxCodes[TCodeIndex].CGST, TaxCodes[TCodeIndex].SGST, 0];
1265
- } else {
1266
- return [0, 0, TaxCodes[TCodeIndex].IGST];
1267
- }
1268
- } else {
1269
- return [CGST, SGST, IGST];
1270
- }
1271
- }
1282
+ if (TCodeIndex !== -1) {
1283
+ const CESS = this.GetTaxComponentRate(TaxCodes[TCodeIndex], 'CESS');
1284
+ if (TaxCodes[TCodeIndex].Type === 'Intra') {
1285
+ return [TaxCodes[TCodeIndex].CGST, TaxCodes[TCodeIndex].SGST, 0, CESS];
1286
+ } else {
1287
+ return [0, 0, TaxCodes[TCodeIndex].IGST, CESS];
1288
+ }
1289
+ } else {
1290
+ return [CGST, SGST, IGST, CESS];
1291
+ }
1292
+ }
1293
+
1294
+ static GetTaxComponentRate(taxCode: any, code: string) {
1295
+ const components = taxCode?.Components;
1296
+ if (Array.isArray(components)) {
1297
+ const matchedComponents = components.filter((component: any) => component?.Code === code);
1298
+ if (matchedComponents.length !== 0) {
1299
+ return matchedComponents.reduce((total: number, component: any) => Add(total, component?.Rate), 0);
1300
+ }
1301
+ }
1302
+ return TrUtils.SetValueToZeroIfNull(taxCode?.[code]);
1303
+ }
1272
1304
 
1273
1305
  static GetCombinedTaxPercentage(Parts: any, TaxCodes: any) {
1274
1306
  Parts.forEach((Part: any) => {
1275
1307
  let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(Part, TaxCodes);
1276
- let CGST = GSTValues[0];
1277
- let SGST = GSTValues[1];
1278
- let IGST = GSTValues[2];
1279
-
1280
- Part.CombinedTaxPercentage = Add(CGST, SGST, IGST);
1308
+ let CGST = GSTValues[0];
1309
+ let SGST = GSTValues[1];
1310
+ let IGST = GSTValues[2];
1311
+ let CESS = GSTValues[3];
1312
+
1313
+ Part.CombinedTaxPercentage = Add(CGST, SGST, IGST, CESS);
1281
1314
  });
1282
1315
  return Parts;
1283
1316
  }
@@ -1306,18 +1339,20 @@ export class ROTotalsService {
1306
1339
  });
1307
1340
 
1308
1341
  let argGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(argPart, TaxCodes);
1309
- let argCGST = argGSTValues[0];
1310
- let argSGST = argGSTValues[1];
1311
- let argIGST = argGSTValues[2];
1312
-
1313
- let partGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(Part, TaxCodes);
1314
- let partCGST = partGSTValues[0];
1315
- let partSGST = partGSTValues[1];
1316
- let partIGST = partGSTValues[2];
1317
-
1318
- return (argPart.HSN === Part.HSN) && (!PartFound) &&
1319
- (argCGST === partCGST) && (argIGST === partIGST) &&
1320
- (argSGST === partSGST);
1342
+ let argCGST = argGSTValues[0];
1343
+ let argSGST = argGSTValues[1];
1344
+ let argIGST = argGSTValues[2];
1345
+ let argCESS = argGSTValues[3];
1346
+
1347
+ let partGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(Part, TaxCodes);
1348
+ let partCGST = partGSTValues[0];
1349
+ let partSGST = partGSTValues[1];
1350
+ let partIGST = partGSTValues[2];
1351
+ let partCESS = partGSTValues[3];
1352
+
1353
+ return (argPart.HSN === Part.HSN) && (!PartFound) &&
1354
+ (argCGST === partCGST) && (argIGST === partIGST) &&
1355
+ (argSGST === partSGST) && (argCESS === partCESS);
1321
1356
  });
1322
1357
  if (MatchedPartsBasedOnHSN.length !== 0) {
1323
1358
  FinalMatchedParts.push(MatchedPartsBasedOnHSN);