shareneus 1.6.58 → 1.6.60

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.
@@ -87,10 +87,19 @@ class IssuePartsprintService {
87
87
  }
88
88
  else {
89
89
  for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
90
- if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
91
- ROPrintData.PrintInfo[i].Text = '';
90
+ // if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
91
+ // ROPrintData.PrintInfo[i].Text = '';
92
+ // }
93
+ const printInfo = ROPrintData.PrintInfo[i];
94
+ const hasText = !tr_utils_1.TrUtils.IsNull(printInfo.Text) && ('' + printInfo.Text).trim() !== '';
95
+ const hasPartsOrOps = (!tr_utils_1.TrUtils.IsNull(printInfo.Items) && printInfo.Items.length > 0)
96
+ || (!tr_utils_1.TrUtils.IsNull(printInfo.Ops) && printInfo.Ops.length > 0);
97
+ if (hasText) {
98
+ List.push(ROPrintData.PrintInfo[i].Text);
99
+ }
100
+ if (hasPartsOrOps) {
101
+ List.push(this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn, isAuto, ROPrintData.Entity.DecimalsNumber));
92
102
  }
93
- List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn, isAuto, ROPrintData.Entity.DecimalsNumber));
94
103
  }
95
104
  }
96
105
  }
@@ -183,7 +192,7 @@ class IssuePartsprintService {
183
192
  let Taxable = 0;
184
193
  let FinalTotal = 0;
185
194
  Parts.forEach((part) => {
186
- // console.log('part', part);
195
+ console.log('part', part);
187
196
  Qty = Qty + part.Qty;
188
197
  CGSTAMT = CGSTAMT + part.CGSTAmt;
189
198
  SGSTAMT = SGSTAMT + part.SGSTAmt;
@@ -59,7 +59,7 @@ export declare class ROTotalsService {
59
59
  static GetInsParts(PartsList: any): any[];
60
60
  static GetInsTaxGroupingForPartsByHSN(Parts: any, TaxCodes: any, DecimalsNumber: number): any[];
61
61
  static GetInsTaxGroupingInfoByHSN(FinalMatchedParts: any, TaxCodes: any, DecimalsNumber: number): any[];
62
- static GetGSTValueBasedOnTaxCode(TCode: any, TaxCodes: any): any[];
62
+ static GetGSTValueBasedOnTaxCode(item: any, TaxCodes: any): any[];
63
63
  static GetCombinedTaxPercentage(Parts: any, TaxCodes: any): any;
64
64
  static ResetPartsHSNIfInvalid(Parts: any): any;
65
65
  static ComparePartsByHSN(Parts: any, TaxCodes: any): any[];
@@ -1115,7 +1115,7 @@ class ROTotalsService {
1115
1115
  TaxInfo.TotalTaxableAmount = tr_utils_1.TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
1116
1116
  TaxInfo.TotalTaxAmount = tr_utils_1.TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
1117
1117
  TaxInfo.PartsCount = MatchedPart.length;
1118
- let GSTValues = this.GetGSTValueBasedOnTaxCode(MatchedPart[0].TCode, TaxCodes);
1118
+ let GSTValues = this.GetGSTValueBasedOnTaxCode(MatchedPart[0], TaxCodes);
1119
1119
  TaxInfo.CGST = GSTValues[0];
1120
1120
  TaxInfo.SGST = GSTValues[1];
1121
1121
  TaxInfo.IGST = GSTValues[2];
@@ -1168,7 +1168,7 @@ class ROTotalsService {
1168
1168
  TaxInfo.TotalTaxableAmount = tr_utils_1.TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
1169
1169
  TaxInfo.TotalTaxAmount = tr_utils_1.TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
1170
1170
  TaxInfo.PartsCount = MatchedPart.length;
1171
- let GSTValues = this.GetGSTValueBasedOnTaxCode(MatchedPart[0].TCode, TaxCodes);
1171
+ let GSTValues = this.GetGSTValueBasedOnTaxCode(MatchedPart[0], TaxCodes);
1172
1172
  TaxInfo.CGST = GSTValues[0];
1173
1173
  TaxInfo.SGST = GSTValues[1];
1174
1174
  TaxInfo.IGST = GSTValues[2];
@@ -1178,10 +1178,30 @@ class ROTotalsService {
1178
1178
  });
1179
1179
  return HSNTaxInfo;
1180
1180
  }
1181
- static GetGSTValueBasedOnTaxCode(TCode, TaxCodes) {
1181
+ static GetGSTValueBasedOnTaxCode(item, TaxCodes) {
1182
1182
  let CGST = 0;
1183
1183
  let SGST = 0;
1184
1184
  let IGST = 0;
1185
+ const taxGroupKeys = ['Taxes', 'CTaxes', 'ATaxes', 'ETaxes'];
1186
+ for (const taxGroupKey of taxGroupKeys) {
1187
+ const groupedTaxes = item === null || item === void 0 ? void 0 : item[taxGroupKey];
1188
+ if (!Array.isArray(groupedTaxes) || groupedTaxes.length === 0) {
1189
+ continue;
1190
+ }
1191
+ CGST = groupedTaxes
1192
+ .filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === 'CGST')
1193
+ .reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
1194
+ SGST = groupedTaxes
1195
+ .filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === 'SGST')
1196
+ .reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
1197
+ IGST = groupedTaxes
1198
+ .filter((tax) => (tax === null || tax === void 0 ? void 0 : tax.Code) === 'IGST')
1199
+ .reduce((total, tax) => (0, math_operations_1.Add)(total, tax === null || tax === void 0 ? void 0 : tax.Rate), 0);
1200
+ if (!tr_utils_1.TrUtils.IsZero((0, math_operations_1.Add)(CGST, SGST, IGST))) {
1201
+ return [CGST, SGST, IGST];
1202
+ }
1203
+ }
1204
+ const TCode = item === null || item === void 0 ? void 0 : item.TCode;
1185
1205
  if (tr_utils_1.TrUtils.IsNull(TCode)) {
1186
1206
  return [CGST, SGST, IGST];
1187
1207
  }
@@ -1202,7 +1222,7 @@ class ROTotalsService {
1202
1222
  }
1203
1223
  static GetCombinedTaxPercentage(Parts, TaxCodes) {
1204
1224
  Parts.forEach((Part) => {
1205
- let GSTValues = this.GetGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
1225
+ let GSTValues = this.GetGSTValueBasedOnTaxCode(Part, TaxCodes);
1206
1226
  let CGST = GSTValues[0];
1207
1227
  let SGST = GSTValues[1];
1208
1228
  let IGST = GSTValues[2];
@@ -1231,11 +1251,11 @@ class ROTotalsService {
1231
1251
  PartFound = true;
1232
1252
  }
1233
1253
  });
1234
- let argGSTValues = this.GetGSTValueBasedOnTaxCode(argPart.TCode, TaxCodes);
1254
+ let argGSTValues = this.GetGSTValueBasedOnTaxCode(argPart, TaxCodes);
1235
1255
  let argCGST = argGSTValues[0];
1236
1256
  let argSGST = argGSTValues[1];
1237
1257
  let argIGST = argGSTValues[2];
1238
- let partGSTValues = this.GetGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
1258
+ let partGSTValues = this.GetGSTValueBasedOnTaxCode(Part, TaxCodes);
1239
1259
  let partCGST = partGSTValues[0];
1240
1260
  let partSGST = partGSTValues[1];
1241
1261
  let partIGST = partGSTValues[2];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.58",
3
+ "version": "1.6.60",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",