shareneus 1.7.360 → 1.7.362

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.
@@ -43,12 +43,14 @@ export declare class ROTotalsService {
43
43
  static GetCustPartCGSTTaxTotal(OpsList: any, PartsList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
44
44
  static GetCustPartIGSTTaxTotal(OpsList: any, PartsList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
45
45
  static GetCustPartSGSTTaxTotal(OpsList: any, PartsList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
46
+ static GetCustPartCESSTaxTotal(OpsList: any, PartsList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
46
47
  static GetInsLaborCGSTTaxTotal(opCodesList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
47
48
  static GetInsLaborIGSTTaxTotal(opCodesList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
48
49
  static GetInsLaborSGSTTaxTotal(opCodesList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
49
50
  static GetInsPartCGSTTaxTotal(PartsList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
50
51
  static GetInsPartIGSTTaxTotal(PartsList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
51
52
  static GetInsPartSGSTTaxTotal(PartsList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
53
+ static GetInsPartCESSTaxTotal(PartsList: any, IsTaxable: boolean, isWorkOrder: boolean): any;
52
54
  static GetLaborLDiscAmount(LaborTotalAfterDisc: any, LDisc: any): any;
53
55
  static GetPartsPDiscAmount(PartsTotalAfterDisc: any, PDisc: any): any;
54
56
  static GetCustPartsTaxGrouping(PartsList: any, TaxCodes: any, isWorkOrder: boolean, DecimalsNumber: number): any[];
@@ -670,6 +670,7 @@ class ROTotalsService {
670
670
  argRecordData.InsPartCGST = this.GetInsPartCGSTTaxTotal(dupRecordData.Parts, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
671
671
  argRecordData.InsPartIGST = this.GetInsPartIGSTTaxTotal(dupRecordData.Parts, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
672
672
  argRecordData.InsPartSGST = this.GetInsPartSGSTTaxTotal(dupRecordData.Parts, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
673
+ argRecordData.InsPartCESS = this.GetInsPartCESSTaxTotal(dupRecordData.Parts, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
673
674
  argRecordData.InsLaborTotalAfterTax = (0, math_operations_1.Add)(argRecordData.InsLaborTotalAfterDisc, argRecordData.InsLaborITax);
674
675
  argRecordData.InsPartsTotalAfterTax = (0, math_operations_1.Add)(argRecordData.InsPartsTotalAfterDisc, argRecordData.InsPartITax);
675
676
  argRecordData.CustLaborDiscTotal = this.GetCustLaborDiscountedTotal(dupRecordData.Ops, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), dupRecordData);
@@ -686,6 +687,7 @@ class ROTotalsService {
686
687
  argRecordData.CustPartCGST = this.GetCustPartCGSTTaxTotal(dupRecordData.Ops, dupRecordData.Parts, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
687
688
  argRecordData.CustPartIGST = this.GetCustPartIGSTTaxTotal(dupRecordData.Ops, dupRecordData.Parts, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
688
689
  argRecordData.CustPartSGST = this.GetCustPartSGSTTaxTotal(dupRecordData.Ops, dupRecordData.Parts, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
690
+ argRecordData.CustPartCESS = this.GetCustPartCESSTaxTotal(dupRecordData.Ops, dupRecordData.Parts, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
689
691
  argRecordData.CustLaborLDiscAmount = this.GetLaborLDiscAmount(argRecordData.CustLaborTotalAfterDisc, argRecordData.LDisc);
690
692
  argRecordData.CustPartsPDiscAmount = this.GetPartsPDiscAmount(argRecordData.CustPartsTotalAfterDisc, argRecordData.PDisc);
691
693
  argRecordData.CustLaborAfterLDisc = argRecordData.CustLaborTotalAfterDisc;
@@ -925,6 +927,51 @@ class ROTotalsService {
925
927
  }
926
928
  return TotalTaxAmt;
927
929
  }
930
+ static GetCustPartCESSTaxTotal(OpsList, PartsList, IsTaxable, isWorkOrder) {
931
+ let TotalTaxAmt = 0;
932
+ if (IsTaxable) {
933
+ PartsList.forEach((Part) => {
934
+ if (!tr_utils_1.TrUtils.IsNull(Part.CollId)) {
935
+ if (isWorkOrder) {
936
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCESS);
937
+ }
938
+ else {
939
+ if (Part.Sts !== enums_1.LaborStatusEnum.New && Part.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
940
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCESS);
941
+ }
942
+ else {
943
+ if (Part.PBy === enums_1.PayTypeEnum.Customer) {
944
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ECESS);
945
+ }
946
+ }
947
+ }
948
+ }
949
+ else {
950
+ if (isWorkOrder) {
951
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCESS);
952
+ }
953
+ else {
954
+ let Index = OpsList.findIndex((labor) => {
955
+ return labor._id === Part.OpId;
956
+ });
957
+ if (Index !== -1) {
958
+ if (OpsList[Index].Sts !== enums_1.LaborStatusEnum.New && OpsList[Index].Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
959
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCESS);
960
+ }
961
+ else {
962
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ECESS);
963
+ }
964
+ }
965
+ else {
966
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.CCESS);
967
+ }
968
+ }
969
+ }
970
+ });
971
+ }
972
+ console.log('CESS TotalTaxAmt', TotalTaxAmt);
973
+ return TotalTaxAmt;
974
+ }
928
975
  static GetInsLaborCGSTTaxTotal(opCodesList, IsTaxable, isWorkOrder) {
929
976
  let TotalTaxAmt = 0;
930
977
  if (IsTaxable) {
@@ -1057,6 +1104,29 @@ class ROTotalsService {
1057
1104
  }
1058
1105
  return TotalTaxAmt;
1059
1106
  }
1107
+ static GetInsPartCESSTaxTotal(PartsList, IsTaxable, isWorkOrder) {
1108
+ let TotalTaxAmt = 0;
1109
+ if (IsTaxable) {
1110
+ PartsList.forEach((Part) => {
1111
+ if (!tr_utils_1.TrUtils.IsNull(Part.CollId) || Part.PBy === enums_1.PayTypeEnum.Insurance || Part.PBy === enums_1.PayTypeEnum.Shared) {
1112
+ if (isWorkOrder) {
1113
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ACESS);
1114
+ }
1115
+ else {
1116
+ if (Part.Sts !== enums_1.LaborStatusEnum.New && Part.Sts !== enums_1.LaborStatusEnum.WtngForAppr) {
1117
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ACESS);
1118
+ }
1119
+ else {
1120
+ if (Part.PBy === enums_1.PayTypeEnum.Insurance || Part.PBy === enums_1.PayTypeEnum.Shared) {
1121
+ TotalTaxAmt = (0, math_operations_1.Add)(TotalTaxAmt, Part.ECESS);
1122
+ }
1123
+ }
1124
+ }
1125
+ }
1126
+ });
1127
+ }
1128
+ return TotalTaxAmt;
1129
+ }
1060
1130
  static GetLaborLDiscAmount(LaborTotalAfterDisc, LDisc) {
1061
1131
  let LaborLDiscAmt = 0;
1062
1132
  if (!tr_utils_1.TrUtils.IsZero(LaborTotalAfterDisc)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.360",
3
+ "version": "1.7.362",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -57,23 +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.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');
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');
68
68
  Operation.NetAmt = TrUtils.SetValueToZeroIfNull(Operation.NetAmt);
69
69
  Operation.RecDisc = TrUtils.SetValueToZeroIfNull(Operation.RecDisc);
70
70
 
71
71
  if (!isWorkOrder) {
72
72
  Operation.EstPr = TrUtils.SetValueToZeroIfNull(Operation.EstPr);
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');
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');
77
77
  }
78
78
  return Operation;
79
79
  }
@@ -134,26 +134,26 @@ export class ROTotalsService {
134
134
  } else {
135
135
  if (Operation.PBy === PayTypeEnum.Customer) {
136
136
  if (isWorkOrder) {
137
- Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
137
+ Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
138
138
  } else {
139
139
  if (Operation.Sts !== LaborStatusEnum.New && Operation.Sts !== LaborStatusEnum.WtngForAppr) {
140
- Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
140
+ Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.CCGST, Operation.CSGST, Operation.CIGST, Operation.CCESS);
141
141
  } else {
142
- Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST, Operation.ECESS);
142
+ Operation.CustAfterTax = Add(Operation.CustAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST, Operation.ECESS);
143
143
  }
144
144
  }
145
145
  Operation.InsAfterTax = 0;
146
146
  } else {
147
147
  if (isWorkOrder) {
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);
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);
150
150
  } else {
151
151
  if (Operation.Sts !== LaborStatusEnum.New && Operation.Sts !== LaborStatusEnum.WtngForAppr) {
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);
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);
154
154
  } else {
155
155
  Operation.CustAfterTax = 0;
156
- Operation.InsAfterTax = Add(Operation.InsAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST, Operation.ECESS);
156
+ Operation.InsAfterTax = Add(Operation.InsAfterLaborDisc, Operation.ECGST, Operation.ESGST, Operation.EIGST, Operation.ECESS);
157
157
  }
158
158
  }
159
159
  }
@@ -202,24 +202,24 @@ export class ROTotalsService {
202
202
  Part.Disc = TrUtils.SetValueToZeroIfNull(Part.Disc);
203
203
  Part.UnPr = TrUtils.SetValueToZeroIfNull(Part.UnPr);
204
204
  Part.AssPr = TrUtils.SetValueToZeroIfNull(Part.AssPr);
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');
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');
213
213
  Part.UnAmt = TrUtils.SetValueToZeroIfNull(Part.UnAmt);
214
214
  Part.AssAmt = TrUtils.SetValueToZeroIfNull(Part.AssAmt);
215
215
  Part.NetAmt = TrUtils.SetValueToZeroIfNull(Part.NetAmt);
216
216
  Part.RecDisc = TrUtils.SetValueToZeroIfNull(Part.RecDisc);
217
217
  if (!isWorkOrder) {
218
218
  Part.EstPr = TrUtils.SetValueToZeroIfNull(Part.EstPr);
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');
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');
223
223
  Part.EstAmt = TrUtils.SetValueToZeroIfNull(Part.EstAmt);
224
224
  }
225
225
  return Part;
@@ -329,18 +329,18 @@ export class ROTotalsService {
329
329
  } else {
330
330
  if (TrUtils.IsNull(Part.CollId)) {
331
331
  if (isWorkOrder) {
332
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
332
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
333
333
  if (TrUtils.IsNull(Part.OpId)) {
334
- Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
334
+ Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
335
335
  }
336
336
  } else {
337
337
  let LaborSts: string = this.GetPartParentStatus(Part, LaborList);
338
338
  if (LaborSts === LaborStatusEnum.New || LaborSts === LaborStatusEnum.WtngForAppr) {
339
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
339
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
340
340
  } else {
341
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
341
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
342
342
  if (TrUtils.IsNull(Part.OpId)) {
343
- Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
343
+ Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
344
344
  }
345
345
  }
346
346
  }
@@ -349,26 +349,26 @@ export class ROTotalsService {
349
349
  } else {
350
350
  if (Part.PBy === PayTypeEnum.Customer) {
351
351
  if (isWorkOrder) {
352
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
352
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
353
353
  } else {
354
354
  if (Part.Sts !== LaborStatusEnum.New && Part.Sts !== LaborStatusEnum.WtngForAppr) {
355
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
355
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
356
356
  } else {
357
- Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
357
+ Part.CustAfterTax = Add(Part.CustAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
358
358
  }
359
359
  }
360
360
  Part.InsAfterTax = 0;
361
361
  } else {
362
362
  if (isWorkOrder) {
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);
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);
365
365
  } else {
366
366
  if (Part.Sts !== LaborStatusEnum.New && Part.Sts !== LaborStatusEnum.WtngForAppr) {
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);
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);
369
369
  } else {
370
370
  Part.CustAfterTax = 0;
371
- Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
371
+ Part.InsAfterTax = Add(Part.InsAfterPartDisc, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
372
372
  }
373
373
  }
374
374
  }
@@ -490,17 +490,17 @@ export class ROTotalsService {
490
490
  if (isWorkOrder) {
491
491
  // if (Labor.PBy === PayTypeEnum.Customer) {
492
492
  if ((Labor.PBy === PayTypeEnum.Customer || Labor.PBy === PayTypeEnum.Shared)) {
493
- TotalTaxAmt = Add(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST, Labor.CCESS);
493
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST, Labor.CCESS);
494
494
  }
495
495
  // }else{
496
496
  // TotalTaxAmt = Add(TotalTaxAmt , Labor.ACGST , Labor.ASGST , Labor.AIGST);
497
497
  // }
498
498
  } else {
499
499
  if (Labor.Sts !== LaborStatusEnum.New && Labor.Sts !== LaborStatusEnum.WtngForAppr) {
500
- TotalTaxAmt = Add(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST, Labor.CCESS);
500
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.CCGST, Labor.CSGST, Labor.CIGST, Labor.CCESS);
501
501
  } else {
502
502
  if (Labor.PBy === PayTypeEnum.Customer) {
503
- TotalTaxAmt = Add(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST, Labor.ECESS);
503
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST, Labor.ECESS);
504
504
  }
505
505
  }
506
506
  }
@@ -516,14 +516,14 @@ export class ROTotalsService {
516
516
  if (!TrUtils.IsNull(Part.CollId)) {
517
517
  if (isWorkOrder) {
518
518
  if ((Part.PBy === PayTypeEnum.Customer || Part.PBy === PayTypeEnum.Shared)) {
519
- TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
519
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
520
520
  }
521
521
  } else {
522
522
  if (Part.Sts !== LaborStatusEnum.New && Part.Sts !== LaborStatusEnum.WtngForAppr) {
523
- TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
523
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
524
524
  } else {
525
525
  if (Part.PBy === PayTypeEnum.Customer) {
526
- TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
526
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
527
527
  }
528
528
  }
529
529
  }
@@ -531,7 +531,7 @@ export class ROTotalsService {
531
531
  if (isWorkOrder) {
532
532
  // if (Part.PBy === PayTypeEnum.Customer) {
533
533
  if ((Part.PBy === PayTypeEnum.Customer || Part.PBy === PayTypeEnum.Shared)) {
534
- TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
534
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
535
535
  }
536
536
  // }else{
537
537
  // TotalTaxAmt = Add(TotalTaxAmt , Part.ACGST , Part.ASGST , Part.AIGST);
@@ -542,12 +542,12 @@ export class ROTotalsService {
542
542
  });
543
543
  if (Index !== -1) {
544
544
  if (OpsList[Index].Sts !== LaborStatusEnum.New && OpsList[Index].Sts !== LaborStatusEnum.WtngForAppr) {
545
- TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
545
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
546
546
  } else {
547
- TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
547
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
548
548
  }
549
549
  } else {
550
- TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
550
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCGST, Part.CSGST, Part.CIGST, Part.CCESS);
551
551
  }
552
552
  }
553
553
  }
@@ -619,14 +619,14 @@ export class ROTotalsService {
619
619
  opCodesList.forEach((Labor: any) => {
620
620
  if (isWorkOrder) {
621
621
  if ((Labor.PBy === PayTypeEnum.Insurance || Labor.PBy === PayTypeEnum.Shared)) {
622
- TotalTaxAmt = Add(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST, Labor.ACESS);
622
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST, Labor.ACESS);
623
623
  }
624
624
  } else {
625
625
  if (Labor.Sts !== LaborStatusEnum.New && Labor.Sts !== LaborStatusEnum.WtngForAppr) {
626
- TotalTaxAmt = Add(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST, Labor.ACESS);
626
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.ACGST, Labor.ASGST, Labor.AIGST, Labor.ACESS);
627
627
  } else {
628
628
  if (Labor.PBy === PayTypeEnum.Insurance || Labor.PBy === PayTypeEnum.Shared) {
629
- TotalTaxAmt = Add(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST, Labor.ECESS);
629
+ TotalTaxAmt = Add(TotalTaxAmt, Labor.ECGST, Labor.ESGST, Labor.EIGST, Labor.ECESS);
630
630
  }
631
631
  }
632
632
  }
@@ -642,14 +642,14 @@ export class ROTotalsService {
642
642
  if (!TrUtils.IsNull(Part.CollId) || Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared) {
643
643
  if (isWorkOrder) {
644
644
  if ((Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared)) {
645
- TotalTaxAmt = Add(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
645
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
646
646
  }
647
647
  } else {
648
648
  if (Part.Sts !== LaborStatusEnum.New && Part.Sts !== LaborStatusEnum.WtngForAppr) {
649
- TotalTaxAmt = Add(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
649
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ACGST, Part.ASGST, Part.AIGST, Part.ACESS);
650
650
  } else {
651
651
  if (Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared) {
652
- TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
652
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ECGST, Part.ESGST, Part.EIGST, Part.ECESS);
653
653
  }
654
654
  }
655
655
  }
@@ -690,6 +690,7 @@ export class ROTotalsService {
690
690
  argRecordData.InsPartCGST = this.GetInsPartCGSTTaxTotal(dupRecordData.Parts, TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
691
691
  argRecordData.InsPartIGST = this.GetInsPartIGSTTaxTotal(dupRecordData.Parts, TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
692
692
  argRecordData.InsPartSGST = this.GetInsPartSGSTTaxTotal(dupRecordData.Parts, TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
693
+ argRecordData.InsPartCESS = this.GetInsPartCESSTaxTotal(dupRecordData.Parts, TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
693
694
 
694
695
  argRecordData.InsLaborTotalAfterTax = Add(argRecordData.InsLaborTotalAfterDisc,
695
696
  argRecordData.InsLaborITax);
@@ -716,6 +717,7 @@ export class ROTotalsService {
716
717
  argRecordData.CustPartCGST = this.GetCustPartCGSTTaxTotal(dupRecordData.Ops, dupRecordData.Parts, TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
717
718
  argRecordData.CustPartIGST = this.GetCustPartIGSTTaxTotal(dupRecordData.Ops, dupRecordData.Parts, TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
718
719
  argRecordData.CustPartSGST = this.GetCustPartSGSTTaxTotal(dupRecordData.Ops, dupRecordData.Parts, TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
720
+ argRecordData.CustPartCESS = this.GetCustPartCESSTaxTotal(dupRecordData.Ops, dupRecordData.Parts, TrUtils.isTaxable(dupRecordData.Settings.Tax), isWorkOrder);
719
721
 
720
722
 
721
723
  argRecordData.CustLaborLDiscAmount = this.GetLaborLDiscAmount(argRecordData.CustLaborTotalAfterDisc, argRecordData.LDisc);
@@ -949,6 +951,46 @@ export class ROTotalsService {
949
951
  return TotalTaxAmt;
950
952
  }
951
953
 
954
+ static GetCustPartCESSTaxTotal(OpsList: any, PartsList: any, IsTaxable: boolean, isWorkOrder: boolean) {
955
+ let TotalTaxAmt: any = 0;
956
+ if (IsTaxable) {
957
+ PartsList.forEach((Part: any) => {
958
+ if (!TrUtils.IsNull(Part.CollId)) {
959
+ if (isWorkOrder) {
960
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCESS);
961
+ } else {
962
+ if (Part.Sts !== LaborStatusEnum.New && Part.Sts !== LaborStatusEnum.WtngForAppr) {
963
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCESS);
964
+ } else {
965
+ if (Part.PBy === PayTypeEnum.Customer) {
966
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ECESS);
967
+ }
968
+ }
969
+ }
970
+ } else {
971
+ if (isWorkOrder) {
972
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCESS);
973
+ } else {
974
+ let Index: any = OpsList.findIndex((labor: any) => {
975
+ return labor._id === Part.OpId;
976
+ });
977
+ if (Index !== -1) {
978
+ if (OpsList[Index].Sts !== LaborStatusEnum.New && OpsList[Index].Sts !== LaborStatusEnum.WtngForAppr) {
979
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCESS);
980
+ } else {
981
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ECESS);
982
+ }
983
+ } else {
984
+ TotalTaxAmt = Add(TotalTaxAmt, Part.CCESS);
985
+ }
986
+ }
987
+ }
988
+ });
989
+ }
990
+ console.log('CESS TotalTaxAmt', TotalTaxAmt);
991
+ return TotalTaxAmt;
992
+ }
993
+
952
994
  static GetInsLaborCGSTTaxTotal(opCodesList: any, IsTaxable: boolean, isWorkOrder: boolean) {
953
995
  let TotalTaxAmt: any = 0;
954
996
  if (IsTaxable) {
@@ -1075,6 +1117,28 @@ export class ROTotalsService {
1075
1117
  return TotalTaxAmt;
1076
1118
  }
1077
1119
 
1120
+ static GetInsPartCESSTaxTotal(PartsList: any, IsTaxable: boolean, isWorkOrder: boolean) {
1121
+ let TotalTaxAmt: any = 0;
1122
+ if (IsTaxable) {
1123
+ PartsList.forEach((Part: any) => {
1124
+ if (!TrUtils.IsNull(Part.CollId) || Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared) {
1125
+ if (isWorkOrder) {
1126
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ACESS);
1127
+ } else {
1128
+ if (Part.Sts !== LaborStatusEnum.New && Part.Sts !== LaborStatusEnum.WtngForAppr) {
1129
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ACESS);
1130
+ } else {
1131
+ if (Part.PBy === PayTypeEnum.Insurance || Part.PBy === PayTypeEnum.Shared) {
1132
+ TotalTaxAmt = Add(TotalTaxAmt, Part.ECESS);
1133
+ }
1134
+ }
1135
+ }
1136
+ }
1137
+ });
1138
+ }
1139
+ return TotalTaxAmt;
1140
+ }
1141
+
1078
1142
  static GetLaborLDiscAmount(LaborTotalAfterDisc: any, LDisc: any) {
1079
1143
  let LaborLDiscAmt: any = 0;
1080
1144
 
@@ -1121,49 +1185,49 @@ export class ROTotalsService {
1121
1185
  let TaxInfo: any = {};
1122
1186
  let TaxOnAmount: any = 0;
1123
1187
  let TaxAmount: any = 0;
1124
- let CGSTAmt: any = 0;
1125
- let SGSTAmt: any = 0;
1126
- let IGSTAmt: any = 0;
1127
- let CESSAmt: any = 0;
1188
+ let CGSTAmt: any = 0;
1189
+ let SGSTAmt: any = 0;
1190
+ let IGSTAmt: any = 0;
1191
+ let CESSAmt: any = 0;
1128
1192
  let HSN: any = MatchedPart[0].HSN;
1129
1193
  TaxInfo.CombinedTaxPercentage = MatchedPart[0].CombinedTaxPercentage;
1130
1194
  MatchedPart.forEach((argMatchedGSTPart: any) => {
1131
1195
  TaxOnAmount = Add(TaxOnAmount, TrUtils.FixedTo(argMatchedGSTPart.CustAfterPartDisc, DecimalsNumber));
1132
1196
  if (isWorkOrder) {
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];
1197
+ CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CCGST, DecimalsNumber));
1198
+ IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CIGST, DecimalsNumber));
1199
+ SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CSGST, DecimalsNumber));
1200
+ CESSAmt = Add(CESSAmt, TrUtils.FixedTo(argMatchedGSTPart.CCESS, DecimalsNumber));
1201
+ } else {
1202
+ if (argMatchedGSTPart.Sts !== LaborStatusEnum.New && argMatchedGSTPart.Sts !== LaborStatusEnum.WtngForAppr) {
1203
+ CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CCGST, DecimalsNumber));
1204
+ IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CIGST, DecimalsNumber));
1205
+ SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.CSGST, DecimalsNumber));
1206
+ CESSAmt = Add(CESSAmt, TrUtils.FixedTo(argMatchedGSTPart.CCESS, DecimalsNumber));
1207
+ } else {
1208
+ if (argMatchedGSTPart.PBy === PayTypeEnum.Customer) {
1209
+ CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ECGST, DecimalsNumber));
1210
+ IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.EIGST, DecimalsNumber));
1211
+ SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ESGST, DecimalsNumber));
1212
+ CESSAmt = Add(CESSAmt, TrUtils.FixedTo(argMatchedGSTPart.ECESS, DecimalsNumber));
1213
+ }
1214
+ }
1215
+ }
1216
+ });
1217
+ TaxAmount = Add(CGSTAmt, SGSTAmt, IGSTAmt, CESSAmt);
1218
+ TaxInfo.HSN = HSN;
1219
+ TaxInfo.TotalTaxableAmount = TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
1220
+ TaxInfo.CGSTAmt = TrUtils.FixPriceValue(CGSTAmt, DecimalsNumber);
1221
+ TaxInfo.SGSTAmt = TrUtils.FixPriceValue(SGSTAmt, DecimalsNumber);
1222
+ TaxInfo.IGSTAmt = TrUtils.FixPriceValue(IGSTAmt, DecimalsNumber);
1223
+ TaxInfo.CESSAmt = TrUtils.FixPriceValue(CESSAmt, DecimalsNumber);
1224
+ TaxInfo.TotalTaxAmount = TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
1225
+ TaxInfo.PartsCount = MatchedPart.length;
1226
+ let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedPart[0], TaxCodes);
1227
+ TaxInfo.CGST = GSTValues[0];
1228
+ TaxInfo.SGST = GSTValues[1];
1229
+ TaxInfo.IGST = GSTValues[2];
1230
+ TaxInfo.CESS = GSTValues[3];
1167
1231
  if (TaxOnAmount !== 0) {
1168
1232
  HSNTaxInfo.push(TaxInfo);
1169
1233
  }
@@ -1198,42 +1262,42 @@ export class ROTotalsService {
1198
1262
  let TaxInfo: any = {};
1199
1263
  let TaxOnAmount: any = 0;
1200
1264
  let TaxAmount: any = 0;
1201
- let CGSTAmt: any = 0;
1202
- let SGSTAmt: any = 0;
1203
- let IGSTAmt: any = 0;
1204
- let CESSAmt: any = 0;
1265
+ let CGSTAmt: any = 0;
1266
+ let SGSTAmt: any = 0;
1267
+ let IGSTAmt: any = 0;
1268
+ let CESSAmt: any = 0;
1205
1269
  let HSN: any = MatchedPart[0].HSN;
1206
1270
  TaxInfo.CombinedTaxPercentage = MatchedPart[0].CombinedTaxPercentage;
1207
1271
  MatchedPart.forEach((argMatchedGSTPart: any) => {
1208
1272
  TaxOnAmount = Add(TaxOnAmount, TrUtils.FixedTo(argMatchedGSTPart.InsAfterPartDisc, DecimalsNumber));
1209
1273
  if (argMatchedGSTPart.PBy === PayTypeEnum.Insurance || argMatchedGSTPart.PBy === PayTypeEnum.Shared) {
1210
1274
  if (argMatchedGSTPart.Sts !== LaborStatusEnum.New && argMatchedGSTPart.Sts !== LaborStatusEnum.WtngForAppr) {
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];
1275
+ CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ACGST, DecimalsNumber));
1276
+ IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.AIGST, DecimalsNumber));
1277
+ SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ASGST, DecimalsNumber));
1278
+ CESSAmt = Add(CESSAmt, TrUtils.FixedTo(argMatchedGSTPart.ACESS, DecimalsNumber));
1279
+ } else {
1280
+ CGSTAmt = Add(CGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ECGST, DecimalsNumber));
1281
+ IGSTAmt = Add(IGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.EIGST, DecimalsNumber));
1282
+ SGSTAmt = Add(SGSTAmt, TrUtils.FixedTo(argMatchedGSTPart.ESGST, DecimalsNumber));
1283
+ CESSAmt = Add(CESSAmt, TrUtils.FixedTo(argMatchedGSTPart.ECESS, DecimalsNumber));
1284
+ }
1285
+ }
1286
+ });
1287
+ TaxAmount = Add(CGSTAmt, SGSTAmt, IGSTAmt, CESSAmt);
1288
+ TaxInfo.HSN = HSN;
1289
+ TaxInfo.TotalTaxableAmount = TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
1290
+ TaxInfo.CGSTAmt = TrUtils.FixPriceValue(CGSTAmt, DecimalsNumber);
1291
+ TaxInfo.SGSTAmt = TrUtils.FixPriceValue(SGSTAmt, DecimalsNumber);
1292
+ TaxInfo.IGSTAmt = TrUtils.FixPriceValue(IGSTAmt, DecimalsNumber);
1293
+ TaxInfo.CESSAmt = TrUtils.FixPriceValue(CESSAmt, DecimalsNumber);
1294
+ TaxInfo.TotalTaxAmount = TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
1295
+ TaxInfo.PartsCount = MatchedPart.length;
1296
+ let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedPart[0], TaxCodes);
1297
+ TaxInfo.CGST = GSTValues[0];
1298
+ TaxInfo.SGST = GSTValues[1];
1299
+ TaxInfo.IGST = GSTValues[2];
1300
+ TaxInfo.CESS = GSTValues[3];
1237
1301
  if (TaxOnAmount !== 0) {
1238
1302
  HSNTaxInfo.push(TaxInfo);
1239
1303
  }
@@ -1242,11 +1306,11 @@ export class ROTotalsService {
1242
1306
  }
1243
1307
 
1244
1308
  static GetGSTValueBasedOnTaxCode(item: any, TaxCodes: any) {
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'];
1309
+ let CGST: number = 0;
1310
+ let SGST: number = 0;
1311
+ let IGST: number = 0;
1312
+ let CESS: number = 0;
1313
+ const taxGroupKeys: string[] = ['Taxes', 'CTaxes', 'ATaxes', 'ETaxes'];
1250
1314
 
1251
1315
  for (const taxGroupKey of taxGroupKeys) {
1252
1316
  const groupedTaxes = item?.[taxGroupKey];
@@ -1260,57 +1324,57 @@ export class ROTotalsService {
1260
1324
  SGST = groupedTaxes
1261
1325
  .filter((tax: any) => tax?.Code === 'SGST')
1262
1326
  .reduce((total: number, tax: any) => Add(total, tax?.Rate), 0);
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
- }
1327
+ IGST = groupedTaxes
1328
+ .filter((tax: any) => tax?.Code === 'IGST')
1329
+ .reduce((total: number, tax: any) => Add(total, tax?.Rate), 0);
1330
+ CESS = groupedTaxes
1331
+ .filter((tax: any) => tax?.Code === 'CESS')
1332
+ .reduce((total: number, tax: any) => Add(total, tax?.Rate), 0);
1333
+
1334
+ if (!TrUtils.IsZero(Add(CGST, SGST, IGST, CESS))) {
1335
+ return [CGST, SGST, IGST, CESS];
1336
+ }
1337
+ }
1338
+
1339
+ const TCode = item?.TCode;
1340
+ if (TrUtils.IsNull(TCode)) {
1341
+ return [CGST, SGST, IGST, CESS];
1342
+ }
1279
1343
  let TCodeIndex: any = TaxCodes.findIndex((TaxCode: any) => {
1280
1344
  return TaxCode._id === Number(TCode);
1281
1345
  });
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
- }
1346
+ if (TCodeIndex !== -1) {
1347
+ const CESS = this.GetTaxComponentRate(TaxCodes[TCodeIndex], 'CESS');
1348
+ if (TaxCodes[TCodeIndex].Type === 'Intra') {
1349
+ return [TaxCodes[TCodeIndex].CGST, TaxCodes[TCodeIndex].SGST, 0, CESS];
1350
+ } else {
1351
+ return [0, 0, TaxCodes[TCodeIndex].IGST, CESS];
1352
+ }
1353
+ } else {
1354
+ return [CGST, SGST, IGST, CESS];
1355
+ }
1356
+ }
1357
+
1358
+ static GetTaxComponentRate(taxCode: any, code: string) {
1359
+ const components = taxCode?.Components;
1360
+ if (Array.isArray(components)) {
1361
+ const matchedComponents = components.filter((component: any) => component?.Code === code);
1362
+ if (matchedComponents.length !== 0) {
1363
+ return matchedComponents.reduce((total: number, component: any) => Add(total, component?.Rate), 0);
1364
+ }
1365
+ }
1366
+ return TrUtils.SetValueToZeroIfNull(taxCode?.[code]);
1367
+ }
1304
1368
 
1305
1369
  static GetCombinedTaxPercentage(Parts: any, TaxCodes: any) {
1306
1370
  Parts.forEach((Part: any) => {
1307
1371
  let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(Part, TaxCodes);
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);
1372
+ let CGST = GSTValues[0];
1373
+ let SGST = GSTValues[1];
1374
+ let IGST = GSTValues[2];
1375
+ let CESS = GSTValues[3];
1376
+
1377
+ Part.CombinedTaxPercentage = Add(CGST, SGST, IGST, CESS);
1314
1378
  });
1315
1379
  return Parts;
1316
1380
  }
@@ -1339,20 +1403,20 @@ export class ROTotalsService {
1339
1403
  });
1340
1404
 
1341
1405
  let argGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(argPart, TaxCodes);
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);
1406
+ let argCGST = argGSTValues[0];
1407
+ let argSGST = argGSTValues[1];
1408
+ let argIGST = argGSTValues[2];
1409
+ let argCESS = argGSTValues[3];
1410
+
1411
+ let partGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(Part, TaxCodes);
1412
+ let partCGST = partGSTValues[0];
1413
+ let partSGST = partGSTValues[1];
1414
+ let partIGST = partGSTValues[2];
1415
+ let partCESS = partGSTValues[3];
1416
+
1417
+ return (argPart.HSN === Part.HSN) && (!PartFound) &&
1418
+ (argCGST === partCGST) && (argIGST === partIGST) &&
1419
+ (argSGST === partSGST) && (argCESS === partCESS);
1356
1420
  });
1357
1421
  if (MatchedPartsBasedOnHSN.length !== 0) {
1358
1422
  FinalMatchedParts.push(MatchedPartsBasedOnHSN);