shareneus 1.4.84 → 1.4.86

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.
@@ -442,7 +442,17 @@ class HCInvoiceprintService {
442
442
  }
443
443
  }
444
444
  else {
445
- dataRow.push({ text: Ops[column.Field].toString(), bold: Ops.bold });
445
+ if (column.Field === 'Desc') {
446
+ let DescData = [];
447
+ DescData.push({ text: Ops[column.Field].toString(), bold: Ops.bold });
448
+ if (!tr_utils_1.TrUtils.IsEmpty(Ops['EDesc'])) {
449
+ DescData.push({ text: Ops['EDesc'].toString(), color: 'grey' });
450
+ }
451
+ dataRow.push({ stack: DescData });
452
+ }
453
+ else {
454
+ dataRow.push({ text: Ops[column.Field].toString(), bold: Ops.bold });
455
+ }
446
456
  }
447
457
  }
448
458
  }
@@ -720,7 +730,18 @@ class HCInvoiceprintService {
720
730
  }
721
731
  }
722
732
  else {
723
- dataRow.push({ text: labor[column.Field].toString() });
733
+ // dataRow.push({ text: labor[column.Field].toString() });
734
+ if (column.Field === 'Desc') {
735
+ let DescData = [];
736
+ DescData.push(labor[column.Field].toString());
737
+ if (!tr_utils_1.TrUtils.IsEmpty(labor['EDesc'])) {
738
+ DescData.push({ text: labor['EDesc'].toString(), color: 'grey' });
739
+ }
740
+ dataRow.push({ stack: DescData });
741
+ }
742
+ else {
743
+ dataRow.push({ text: labor[column.Field].toString() });
744
+ }
724
745
  }
725
746
  }
726
747
  }
@@ -435,7 +435,17 @@ class InvoicePortraitPrintService {
435
435
  var _a;
436
436
  let dataRow = [];
437
437
  dataRow.push({ text: index + 1, });
438
- dataRow.push({ text: item.Desc, });
438
+ if (!tr_utils_1.TrUtils.IsEmpty(item.EDesc)) {
439
+ let DescData = [];
440
+ DescData.push({ text: item.Desc, });
441
+ if (!tr_utils_1.TrUtils.IsEmpty(item['EDesc'])) {
442
+ DescData.push({ text: item.EDesc, color: 'grey' });
443
+ }
444
+ dataRow.push({ stack: DescData });
445
+ }
446
+ else {
447
+ dataRow.push({ text: item.Desc, });
448
+ }
439
449
  if (ShowTaxColumn) {
440
450
  dataRow.push({ text: item.SAC, alignment: 'center', style: ['headerstyle'], });
441
451
  }
@@ -504,7 +514,18 @@ class InvoicePortraitPrintService {
504
514
  var _a, _b, _c;
505
515
  let dataRow = [];
506
516
  dataRow.push({ text: index + 1, });
507
- dataRow.push({ text: item.Desc, });
517
+ // dataRow.push({ text: item.Desc, });
518
+ if (!tr_utils_1.TrUtils.IsEmpty(item.EDesc)) {
519
+ let DescData = [];
520
+ DescData.push({ text: item.Desc, });
521
+ if (!tr_utils_1.TrUtils.IsEmpty(item['EDesc'])) {
522
+ DescData.push({ text: item.EDesc, color: 'grey' });
523
+ }
524
+ dataRow.push({ stack: DescData });
525
+ }
526
+ else {
527
+ dataRow.push({ text: item.Desc, });
528
+ }
508
529
  if (ShowTaxColumn) {
509
530
  dataRow.push({ text: item.HSN, alignment: 'center', style: ['headerstyle'], });
510
531
  }
@@ -600,7 +621,9 @@ class InvoicePortraitPrintService {
600
621
  widths: ['*', '*'],
601
622
  body: [
602
623
  [
603
- { stack: [this.PartsTaxAmounts1(ROPrintData.TaxSummary, true, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn)] },
624
+ {
625
+ stack: [this.PartsTaxAmounts1(ROPrintData.TaxSummary, true, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn)]
626
+ },
604
627
  {
605
628
  columns: [{ text: '', width: moreDiscDetails ? 120 : 150 }, this.GrandTotal(ROPrintData, '0.00', ROPrintData.CustPartsTotalBeforeDisc, totalDisc, totalTax, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, null, ROPrintData.Consolidate, ROPrintData.STotal, moreDiscDetails, ROPrintData.Entity.DecimalsNumber)],
606
629
  }
@@ -13,6 +13,12 @@ export declare class PurchaseOrderTotalsService {
13
13
  static GetPartsTotalTaxAndAfterDiscount(PartsList: any): any[];
14
14
  static GetTotalBasedOnTaxType(PartsTotalAfterDisc: number, PartsTaxAmount: number, ServicesTotalAfterDisc: number, ServicesTaxTotal: number, IsTaxable: boolean, Adjust: number, DecimalsNumber: number): number;
15
15
  static GetDetailedTotalsData(finalTotalsData: any, IsTaxable: boolean, PartsList: any, LaborList: any, TaxCodes: any, Tax: any, HasNoTax: boolean, DecimalsNumber: number): any;
16
+ static groupTaxData(items: any[], ops: any[]): any[];
17
+ static GetTaxGroupingForLaborByPerc(opCodesList: any, TaxCodes: any, DecimalsNumber: any): any[];
18
+ static GetTaxGroupingForPartsByPerc(Parts: any, TaxCodes: any, DecimalsNumber: any): any[];
19
+ static GetTaxGroupingInfoBySAC(FinalMatchedLabors: any, TaxCodes: any, DecimalsNumber: any): any[];
20
+ static CompareLaborByPerc(opCodesList: any, TaxCodes: any): any[];
21
+ static ComparePartsByPerc(Parts: any, TaxCodes: any): any[];
16
22
  static GetPartGSTTaxTotal(PartsList: Array<any>): number[];
17
23
  static GetServicesGSTTaxTotal(ServicesList: Array<any>): number[];
18
24
  static GetPartsTaxGroupingFor(PartsList: any, TaxCodes: any, DecimalsNumber: number): any[];
@@ -250,12 +250,148 @@ class PurchaseOrderTotalsService {
250
250
  finalTotalsData.Tax = Tax;
251
251
  finalTotalsData.HasNoTax = HasNoTax;
252
252
  finalTotalsData.TaxGroupData = this.GetPartsTaxGroupingFor(PartsList, TaxCodes, DecimalsNumber);
253
+ finalTotalsData.CustTaxGroupDataByPerc = this.GetTaxGroupingForPartsByPerc(PartsList, TaxCodes, DecimalsNumber);
254
+ finalTotalsData.CustLaborTaxGroupDataByPerc = this.GetTaxGroupingForLaborByPerc(LaborList, TaxCodes, DecimalsNumber);
255
+ finalTotalsData.TaxSummary = this.groupTaxData(finalTotalsData.CustTaxGroupData, finalTotalsData.CustLaborTaxGroupDataByPerc);
253
256
  // finalTotalsData.TotalRoundedBy = TrUtils.FixedTo(Math.round(finalTotalsData.Total) - finalTotalsData.Total);
254
257
  finalTotalsData.RoundedTotal = Math.round(finalTotalsData.Total);
255
258
  // finalTotalsData.Round = TrUtils.FixedTo(Math.round(finalTotalsData.Total) - finalTotalsData.Total);
256
259
  // finalTotalsData.Total = Math.round(finalTotalsData.Total);
257
260
  return finalTotalsData;
258
261
  }
262
+ static groupTaxData(items, ops) {
263
+ const combined = [...items, ...ops];
264
+ const groupedMap = new Map();
265
+ combined.forEach(item => {
266
+ if (groupedMap.has(item.CombinedTaxPercentage)) {
267
+ const existing = groupedMap.get(item.CombinedTaxPercentage);
268
+ existing.CGSTAmt = (0, aggregation_1.addition)(existing.CGSTAmt, item.CGSTAmt);
269
+ existing.SGSTAmt = (0, aggregation_1.addition)(existing.SGSTAmt, item.SGSTAmt);
270
+ // Sum IGST if present
271
+ if (item.IGSTAmt !== undefined) {
272
+ existing.IGSTAmt = (0, aggregation_1.addition)(existing.IGSTAmt || 0, item.IGSTAmt);
273
+ }
274
+ existing.TotalTaxAmount = (0, aggregation_1.addition)(existing.TotalTaxAmount || 0, item.TotalTaxAmount || 0);
275
+ existing.TotalTaxableAmount = (0, aggregation_1.addition)(existing.TotalTaxableAmount || 0, item.TotalTaxableAmount || 0);
276
+ }
277
+ else {
278
+ // Clone the object to avoid mutation
279
+ groupedMap.set(item.CombinedTaxPercentage, Object.assign({}, item));
280
+ }
281
+ });
282
+ return Array.from(groupedMap.values());
283
+ }
284
+ static GetTaxGroupingForLaborByPerc(opCodesList, TaxCodes, DecimalsNumber) {
285
+ opCodesList = this.GetCombinedTaxPercentage(tr_utils_1.TrUtils.Stringify(opCodesList), TaxCodes);
286
+ // opCodesList = this.ResetPartsHSNIfInvalid(opCodesList);
287
+ let FinalMatchedParts = this.CompareLaborByPerc(opCodesList, TaxCodes);
288
+ return this.GetTaxGroupingInfoBySAC(FinalMatchedParts, TaxCodes, DecimalsNumber);
289
+ }
290
+ static GetTaxGroupingForPartsByPerc(Parts, TaxCodes, DecimalsNumber) {
291
+ Parts = this.GetCombinedTaxPercentage(tr_utils_1.TrUtils.Stringify(Parts), TaxCodes);
292
+ // Parts = this.ResetPartsHSNIfInvalid(Parts);
293
+ let FinalMatchedParts = this.ComparePartsByPerc(Parts, TaxCodes);
294
+ return this.GetTaxGroupingInfoByHSN(FinalMatchedParts, TaxCodes, DecimalsNumber);
295
+ }
296
+ static GetTaxGroupingInfoBySAC(FinalMatchedLabors, TaxCodes, DecimalsNumber) {
297
+ let SACTaxInfo = [];
298
+ FinalMatchedLabors === null || FinalMatchedLabors === void 0 ? void 0 : FinalMatchedLabors.forEach((MatchedLabor) => {
299
+ let TaxInfo = {};
300
+ let TaxOnAmount = 0;
301
+ let TaxAmount = 0;
302
+ let CGSTAmt = 0;
303
+ let SGSTAmt = 0;
304
+ let IGSTAmt = 0;
305
+ let SAC = MatchedLabor[0].SAC;
306
+ TaxInfo.CombinedTaxPercentage = MatchedLabor[0].CombinedTaxPercentage;
307
+ MatchedLabor === null || MatchedLabor === void 0 ? void 0 : MatchedLabor.forEach((argMatchedGSTLabor) => {
308
+ TaxOnAmount = (0, aggregation_1.addition)(TaxOnAmount, tr_utils_1.TrUtils.FixedTo(argMatchedGSTLabor.AfterLaborDisc, DecimalsNumber));
309
+ TaxAmount = (0, aggregation_1.addition)(TaxAmount, tr_utils_1.TrUtils.FixedTo(argMatchedGSTLabor.CGST, DecimalsNumber));
310
+ TaxAmount = (0, aggregation_1.addition)(TaxAmount, tr_utils_1.TrUtils.FixedTo(argMatchedGSTLabor.IGST, DecimalsNumber));
311
+ TaxAmount = (0, aggregation_1.addition)(TaxAmount, tr_utils_1.TrUtils.FixedTo(argMatchedGSTLabor.SGST, DecimalsNumber));
312
+ CGSTAmt = (0, aggregation_1.addition)(CGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTLabor.CGST, DecimalsNumber));
313
+ SGSTAmt = (0, aggregation_1.addition)(SGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTLabor.SGST, DecimalsNumber));
314
+ IGSTAmt = (0, aggregation_1.addition)(IGSTAmt, tr_utils_1.TrUtils.FixedTo(argMatchedGSTLabor.IGST, DecimalsNumber));
315
+ });
316
+ TaxInfo.SAC = SAC;
317
+ TaxInfo.CGSTAmt = CGSTAmt;
318
+ TaxInfo.SGSTAmt = SGSTAmt;
319
+ TaxInfo.IGSTAmt = IGSTAmt;
320
+ TaxInfo.TotalTaxableAmount = tr_utils_1.TrUtils.FixPriceValue(TaxOnAmount, DecimalsNumber);
321
+ TaxInfo.TotalTaxAmount = tr_utils_1.TrUtils.FixPriceValue(TaxAmount, DecimalsNumber);
322
+ TaxInfo.ItemsCount = MatchedLabor.length;
323
+ let GSTValues = this.GetGSTValueBasedOnTaxCode(MatchedLabor[0].TCode, TaxCodes);
324
+ TaxInfo.CGST = GSTValues[0];
325
+ TaxInfo.SGST = GSTValues[1];
326
+ TaxInfo.IGST = GSTValues[2];
327
+ if (TaxOnAmount !== 0) {
328
+ SACTaxInfo.push(TaxInfo);
329
+ }
330
+ });
331
+ return SACTaxInfo;
332
+ }
333
+ static CompareLaborByPerc(opCodesList, TaxCodes) {
334
+ let FinalMatchedLabors = [];
335
+ opCodesList === null || opCodesList === void 0 ? void 0 : opCodesList.forEach((Labor) => {
336
+ let MatchedLaborsBasedOnPerc = opCodesList.filter((argLabor) => {
337
+ let PartFound = false;
338
+ FinalMatchedLabors.forEach((FinalArgLabors) => {
339
+ let PartIndex = FinalArgLabors.findIndex((FinalArgPart) => {
340
+ return FinalArgPart._id === argLabor._id;
341
+ });
342
+ if (PartIndex !== -1) {
343
+ PartFound = true;
344
+ }
345
+ });
346
+ // let argGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(argLabor.TCode, TaxCodes);
347
+ // let argCGST = argGSTValues[0];
348
+ // let argSGST = argGSTValues[1];
349
+ // let argIGST = argGSTValues[2];
350
+ // let laborGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(Labor.TCode, TaxCodes);
351
+ // let laborCGST = laborGSTValues[0];
352
+ // let laborSGST = laborGSTValues[1];
353
+ // let laborIGST = laborGSTValues[2];
354
+ return (!PartFound) &&
355
+ (argLabor.CGSTAmt === Labor.CGSTAmt) && (argLabor.IGSTAmt === Labor.IGSTAmt) &&
356
+ (argLabor.SGSTAmt === Labor.SGSTAmt);
357
+ });
358
+ if (MatchedLaborsBasedOnPerc.length !== 0) {
359
+ FinalMatchedLabors.push(MatchedLaborsBasedOnPerc);
360
+ }
361
+ });
362
+ return FinalMatchedLabors;
363
+ }
364
+ static ComparePartsByPerc(Parts, TaxCodes) {
365
+ let FinalMatchedParts = [];
366
+ Parts === null || Parts === void 0 ? void 0 : Parts.forEach((Part) => {
367
+ let MatchedPartsBasedOnHSN = Parts.filter((argPart) => {
368
+ let PartFound = false;
369
+ FinalMatchedParts.forEach((FinalArgParts) => {
370
+ let PartIndex = FinalArgParts.findIndex((FinalArgPart) => {
371
+ return FinalArgPart._id === argPart._id;
372
+ });
373
+ if (PartIndex !== -1) {
374
+ PartFound = true;
375
+ }
376
+ });
377
+ // let argGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(argPart.TCode, TaxCodes);
378
+ // let argCGST = argGSTValues[0];
379
+ // let argSGST = argGSTValues[1];
380
+ // let argIGST = argGSTValues[2];
381
+ // let partGSTValues: any[] = this.GetGSTValueBasedOnTaxCode(Part.TCode, TaxCodes);
382
+ // let partCGST = partGSTValues[0];
383
+ // let partSGST = partGSTValues[1];
384
+ // let partIGST = partGSTValues[2];
385
+ return (!PartFound) &&
386
+ (argPart.CGSTAmt === Part.CGSTAmt) && (argPart.IGSTAmt === Part.IGSTAmt) &&
387
+ (argPart.SGSTAmt === Part.SGSTAmt);
388
+ });
389
+ if (MatchedPartsBasedOnHSN.length !== 0) {
390
+ FinalMatchedParts.push(MatchedPartsBasedOnHSN);
391
+ }
392
+ });
393
+ return FinalMatchedParts;
394
+ }
259
395
  static GetPartGSTTaxTotal(PartsList) {
260
396
  let CGSTAmt = 0;
261
397
  let SGSTAmt = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.4.84",
3
+ "version": "1.4.86",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",