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.
@@ -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);