shareneus 1.5.15 → 1.5.16

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.
@@ -9,6 +9,8 @@ export declare class SalesTotalsService {
9
9
  static GetSubTotalFor(ItemsList: any): any;
10
10
  static GetItemsTotalAfterDiscount(ItemsList: any): any;
11
11
  static GetDetailedTotalsData(finalTotalsData: any, IsIndependentTax: boolean, ItemsList: any, TaxCodes: any, DecimalsNumber: any): any;
12
+ static GetTaxGroupingForPartsByPerc(Parts: any, TaxCodes: any, DecimalsNumber: any): any[];
13
+ static ComparePartsByPerc(Parts: any, TaxCodes: any): any[];
12
14
  static GetLaborDiscountedTotal(LaborList: any): any;
13
15
  static GetItemDiscountedTotal(ItemsList: any): any;
14
16
  static GetItemsTaxTotalFor(ItemsList: any, IsIndependentTax: boolean): any;
@@ -22,6 +24,6 @@ export declare class SalesTotalsService {
22
24
  static GetTaxGroupingForItemsByHSN(Items: any, TaxCodes: any, DecimalsNumber: number): any[];
23
25
  static GetCombinedTaxPercentage(Items: any, TaxCodes: any): any;
24
26
  static CompareItemsByHSN(Items: any, TaxCodes: any): any[];
25
- static GetTaxGroupingInfoByHSN(FinalMatchedItems: any, TaxCodes: any, DecimalsNumber: number): any[];
27
+ static GetTaxGroupingInfoByHSN(FinalMatchedParts: any, TaxCodes: any, DecimalsNumber: any): any[];
26
28
  static GetGSTValueBasedOnTaxCode(TCode: any, TaxCodes: any): any[];
27
29
  }
@@ -122,6 +122,7 @@ class SalesTotalsService {
122
122
  // finalTotalsData.CustLaborAfterTax = TrUtils.FixedTo(finalTotalsData.CustLaborITax + finalTotalsData.CustLaborTotalAfterDisc);
123
123
  finalTotalsData.CustItemAfterTax = (0, math_operations_1.Add)(finalTotalsData.CustItemITax, finalTotalsData.CustItemsTotalAfterDisc);
124
124
  finalTotalsData.CustTaxGroupData = this.GetTaxGroupingForItemsByHSN(ItemsList, TaxCodes, DecimalsNumber);
125
+ finalTotalsData.CustTaxGroupDataByPerc = this.GetTaxGroupingForPartsByPerc(ItemsList, TaxCodes, DecimalsNumber);
125
126
  finalTotalsData.CustTotalRoundedBy = tr_utils_1.TrUtils.FixedTo(finalTotalsData.Round, DecimalsNumber);
126
127
  finalTotalsData.CustRoundedTotal = tr_utils_1.TrUtils.FixedTo(finalTotalsData.Total, DecimalsNumber);
127
128
  for (var key in finalTotalsData) {
@@ -134,6 +135,43 @@ class SalesTotalsService {
134
135
  }
135
136
  return finalTotalsData;
136
137
  }
138
+ static GetTaxGroupingForPartsByPerc(Parts, TaxCodes, DecimalsNumber) {
139
+ Parts = this.GetCombinedTaxPercentage(tr_utils_1.TrUtils.Stringify(Parts), TaxCodes);
140
+ // Parts = this.ResetPartsHSNIfInvalid(Parts);
141
+ let FinalMatchedParts = this.ComparePartsByPerc(Parts, TaxCodes);
142
+ return this.GetTaxGroupingInfoByHSN(FinalMatchedParts, TaxCodes, DecimalsNumber);
143
+ }
144
+ static ComparePartsByPerc(Parts, TaxCodes) {
145
+ let FinalMatchedParts = [];
146
+ Parts === null || Parts === void 0 ? void 0 : Parts.forEach((Part) => {
147
+ let MatchedPartsBasedOnHSN = Parts.filter((argPart) => {
148
+ let PartFound = false;
149
+ FinalMatchedParts.forEach((FinalArgParts) => {
150
+ let PartIndex = FinalArgParts.findIndex((FinalArgPart) => {
151
+ return FinalArgPart._id === argPart._id;
152
+ });
153
+ if (PartIndex !== -1) {
154
+ PartFound = true;
155
+ }
156
+ });
157
+ // let argGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(argPart.TCode, TaxCodes);
158
+ // let argCGST = argGSTValues[0];
159
+ // let argSGST = argGSTValues[1];
160
+ // let argIGST = argGSTValues[2];
161
+ // let partGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
162
+ // let partCGST = partGSTValues[0];
163
+ // let partSGST = partGSTValues[1];
164
+ // let partIGST = partGSTValues[2];
165
+ return (!PartFound) &&
166
+ (argPart.CGSTAmt === Part.CGSTAmt) && (argPart.IGSTAmt === Part.IGSTAmt) &&
167
+ (argPart.SGSTAmt === Part.SGSTAmt);
168
+ });
169
+ if (MatchedPartsBasedOnHSN.length !== 0) {
170
+ FinalMatchedParts.push(MatchedPartsBasedOnHSN);
171
+ }
172
+ });
173
+ return FinalMatchedParts;
174
+ }
137
175
  static GetLaborDiscountedTotal(LaborList) {
138
176
  let LaborDiscountedTotal = 0;
139
177
  LaborList.forEach((Labor) => {
@@ -283,31 +321,40 @@ class SalesTotalsService {
283
321
  });
284
322
  return FinalMatchedItems;
285
323
  }
286
- static GetTaxGroupingInfoByHSN(FinalMatchedItems, TaxCodes, DecimalsNumber) {
324
+ static GetTaxGroupingInfoByHSN(FinalMatchedParts, TaxCodes, DecimalsNumber) {
287
325
  let HSNTaxInfo = [];
288
- FinalMatchedItems.forEach((MatchedItem) => {
326
+ FinalMatchedParts.forEach((MatchedPart) => {
289
327
  let TaxInfo = {};
290
328
  let TaxOnAmount = 0;
291
329
  let TaxAmount = 0;
292
- let HSN = MatchedItem[0].HSN;
293
- TaxInfo.CombinedTaxPercentage = MatchedItem[0].CombinedTaxPercentage;
294
- MatchedItem.forEach((argMatchedGSTItem) => {
295
- TaxOnAmount = (0, math_operations_1.Add)(TaxOnAmount, argMatchedGSTItem.AfterItemDisc);
296
- TaxAmount = (0, math_operations_1.Add)(TaxAmount, argMatchedGSTItem.CGST);
297
- TaxAmount = (0, math_operations_1.Add)(TaxAmount, argMatchedGSTItem.IGST);
298
- TaxAmount = (0, math_operations_1.Add)(TaxAmount, argMatchedGSTItem.SGST);
330
+ let CGSTAmt = 0;
331
+ let SGSTAmt = 0;
332
+ let IGSTAmt = 0;
333
+ let HSN = MatchedPart[0].HSN;
334
+ TaxInfo.CombinedTaxPercentage = MatchedPart[0].CombinedTaxPercentage;
335
+ MatchedPart.forEach((argMatchedGSTPart) => {
336
+ TaxOnAmount = (0, math_operations_1.Add)(TaxOnAmount, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.AfterPartDisc, DecimalsNumber));
337
+ TaxAmount = (0, math_operations_1.Add)(TaxAmount, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.CGST, DecimalsNumber));
338
+ TaxAmount = (0, math_operations_1.Add)(TaxAmount, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.IGST, DecimalsNumber));
339
+ TaxAmount = (0, math_operations_1.Add)(TaxAmount, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.SGST, DecimalsNumber));
340
+ CGSTAmt = (0, math_operations_1.Add)(CGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.CGST, DecimalsNumber));
341
+ SGSTAmt = (0, math_operations_1.Add)(SGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.SGST, DecimalsNumber));
342
+ IGSTAmt = (0, math_operations_1.Add)(IGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTPart.IGST, DecimalsNumber));
299
343
  });
300
344
  TaxInfo.HSN = HSN;
345
+ TaxInfo.CGSTAmt = CGSTAmt;
346
+ TaxInfo.SGSTAmt = SGSTAmt;
347
+ TaxInfo.IGSTAmt = IGSTAmt;
301
348
  TaxInfo.TotalTaxableAmount = tr_utils_1.TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
302
349
  TaxInfo.TotalTaxAmount = tr_utils_1.TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
303
- TaxInfo.ItemsCount = MatchedItem.length;
304
- // let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedItem[0].TCode, TaxCodes);
350
+ TaxInfo.ItemsCount = MatchedPart.length;
351
+ // let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedPart[0].TCode, TaxCodes);
305
352
  // TaxInfo.CGST = GSTValues[0];
306
353
  // TaxInfo.SGST = GSTValues[1];
307
354
  // TaxInfo.IGST = GSTValues[2];
308
- TaxInfo.CGST = MatchedItem[0].CGSTAmt;
309
- TaxInfo.IGST = MatchedItem[0].IGSTAmt;
310
- TaxInfo.SGST = MatchedItem[0].SGSTAmt;
355
+ TaxInfo.CGST = MatchedPart[0].CGSTAmt;
356
+ TaxInfo.IGST = MatchedPart[0].IGSTAmt;
357
+ TaxInfo.SGST = MatchedPart[0].SGSTAmt;
311
358
  if (TaxOnAmount !== 0) {
312
359
  HSNTaxInfo.push(TaxInfo);
313
360
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.15",
3
+ "version": "1.5.16",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",