shareneus 1.4.35 → 1.4.36

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.
Files changed (125) hide show
  1. package/dist/aggregation/aggregation.js +13 -13
  2. package/dist/excel-files/GSTR-RO-excel.service.js +3 -3
  3. package/dist/excel-files/GSTR1-excel.service.js +7 -7
  4. package/dist/excel-files/GSTR2-excel.service.js +6 -6
  5. package/dist/excel-files/analysis-excel.service.js +4 -4
  6. package/dist/excel-files/category-wise-item-excel.service.js +10 -10
  7. package/dist/excel-files/cust-balance-excel.service.js +5 -5
  8. package/dist/excel-files/cust-wise-sales-details.js +5 -5
  9. package/dist/excel-files/cust-wise-sales-summary-excel.service.js +5 -5
  10. package/dist/excel-files/expiring-drugs-excel.service.js +7 -7
  11. package/dist/excel-files/insurance-expire-excel.service.js +4 -4
  12. package/dist/excel-files/invoice-wise-excel.service.js +3 -3
  13. package/dist/excel-files/item-wise-doctor-sale-excel.service.js +7 -7
  14. package/dist/excel-files/item-wise-mout-details.js +4 -4
  15. package/dist/excel-files/item-wise-mout-summary.js +4 -4
  16. package/dist/excel-files/items-wise-sales-excel.service.js +10 -10
  17. package/dist/excel-files/manf-wise-sales-excel.service.js +4 -4
  18. package/dist/excel-files/next-service-date-excel.service.js +5 -5
  19. package/dist/excel-files/operator-wise-details.js +4 -4
  20. package/dist/excel-files/operator-wise-summary.js +4 -4
  21. package/dist/excel-files/payment-receive-excel.service.js +6 -6
  22. package/dist/excel-files/payments-made-excel.service.js +6 -6
  23. package/dist/excel-files/repair-orders-excel.service.js +10 -10
  24. package/dist/excel-files/sa-wise-labor-sales-excel.service.js +6 -6
  25. package/dist/excel-files/sa-wise-part-sales-excel.service.js +6 -6
  26. package/dist/excel-files/sale-summary-excel.service.js +3 -3
  27. package/dist/excel-files/sales-by-service-summary-excel.service.js +14 -14
  28. package/dist/excel-files/scheduled-drug-summary-excel.service.js +8 -8
  29. package/dist/excel-files/scheduled-drugs-excel.service.js +10 -10
  30. package/dist/excel-files/spares-issue-excel.service.js +14 -14
  31. package/dist/excel-files/stock-excel.service.js +3 -3
  32. package/dist/excel-files/tally-sales-import.service.js +3 -3
  33. package/dist/excel-files/ven-balance-excel.service.js +3 -3
  34. package/dist/index.js +6 -6
  35. package/dist/services/analysis-pdf.service.js +8 -8
  36. package/dist/services/appointment-total.service.js +37 -37
  37. package/dist/services/auto-sales-receipt-pdf.service.js +24 -24
  38. package/dist/services/category-wise-item-pdf.service.js +6 -6
  39. package/dist/services/checklist-pdf.js +3 -3
  40. package/dist/services/cn-print.service.js +33 -33
  41. package/dist/services/consultation-fee-receipt.service.js +16 -16
  42. package/dist/services/consultation-full-pdf.service.js +10 -10
  43. package/dist/services/consultation-letterhead-pdf.service.js +15 -15
  44. package/dist/services/consultation-pdf.service.js +15 -15
  45. package/dist/services/credit-note-pdf.service.js +16 -16
  46. package/dist/services/credit-note-totals.service.js +31 -31
  47. package/dist/services/cust-wise-sales-details-pdf.service.js +8 -8
  48. package/dist/services/cust-wise-sales-summary-pdf.service.js +7 -7
  49. package/dist/services/customer-balances-pdf.service.js +7 -7
  50. package/dist/services/dc-landscape-pdf.service.js +28 -28
  51. package/dist/services/dc-landscape-without-price-pdf.service.js +24 -24
  52. package/dist/services/dc-without-price-pdf.service.js +15 -15
  53. package/dist/services/debit-note-pdf.service.js +14 -14
  54. package/dist/services/debit-note-print.service.js +33 -33
  55. package/dist/services/debit-note-totals.service.js +28 -28
  56. package/dist/services/delivery-challan-pdf.service.js +16 -16
  57. package/dist/services/delivery-challan-print.service.js +26 -26
  58. package/dist/services/delivery-challan-totals.js +32 -32
  59. package/dist/services/equipment-design-pdf.service.js +10 -10
  60. package/dist/services/est.print-service.js +150 -150
  61. package/dist/services/expiring-drugs-pdf.service.js +6 -6
  62. package/dist/services/hc-inv-pdf.service.js +42 -42
  63. package/dist/services/insurance-expire-pdf.service.js +1 -1
  64. package/dist/services/inv-pdf.service.js +54 -54
  65. package/dist/services/inv-print.service.js +59 -59
  66. package/dist/services/invoice-landscape-pdf.service.js +29 -29
  67. package/dist/services/invoice-letterhead-pdf.service.js +54 -54
  68. package/dist/services/invoice-portrait-pdf.js +51 -51
  69. package/dist/services/invoice-total.service.js +78 -78
  70. package/dist/services/issue-parts-pdf.service.js +43 -43
  71. package/dist/services/item-bar-code-label-pdf.js +2 -2
  72. package/dist/services/item-price-for-pricelist.js +29 -46
  73. package/dist/services/item-wise-doctor-sale-pdf.service.js +3 -3
  74. package/dist/services/item-wise-mout-details-pdf.js +3 -3
  75. package/dist/services/item-wise-mout-summary-pdf.js +2 -2
  76. package/dist/services/item-wise-sales-pdf.service.js +6 -6
  77. package/dist/services/manf-wise-sales-pdf.service.js +5 -5
  78. package/dist/services/meeting-pdf.js +14 -14
  79. package/dist/services/mout-pdf.service.js +17 -17
  80. package/dist/services/next-service-date-pdf.service.js +1 -1
  81. package/dist/services/operator-wise-details-pdf.service.js +8 -8
  82. package/dist/services/operator-wise-summary-pdf.js +7 -7
  83. package/dist/services/pack-ship-pdf.service.js +3 -3
  84. package/dist/services/pack-ship-print.service.js +26 -26
  85. package/dist/services/payment-pdf.service.js +4 -4
  86. package/dist/services/payment-report-pdf.service.js +3 -3
  87. package/dist/services/po-totals.service.js +28 -28
  88. package/dist/services/pos-receipt-pdf.js +19 -19
  89. package/dist/services/purchase-order-pdf.service.js +40 -40
  90. package/dist/services/purchase-order-print.service.js +43 -43
  91. package/dist/services/purchase-order-totals.service.js +53 -53
  92. package/dist/services/receipt-print.service.js +5 -5
  93. package/dist/services/reorder-point-pdf.service.js +3 -3
  94. package/dist/services/repair-orders-pdf.service.js +3 -3
  95. package/dist/services/ro-pdf.service.js +80 -80
  96. package/dist/services/ro-print-service.js +87 -87
  97. package/dist/services/ro-totals.service.js +123 -123
  98. package/dist/services/sales-by-service-pdf.service.js +6 -6
  99. package/dist/services/sales-pdf.service.js +23 -23
  100. package/dist/services/sales-print.service.js +54 -54
  101. package/dist/services/sales-receipt-pdf.service.js +25 -25
  102. package/dist/services/sales-receipt-print.service.js +62 -62
  103. package/dist/services/sales-totals.service.js +33 -33
  104. package/dist/services/scheduled-drug-pdf.service.js +7 -7
  105. package/dist/services/scheduled-drug-summary-pdf.service.js +4 -4
  106. package/dist/services/separate-wo-print.service.js +9 -9
  107. package/dist/services/shared-inv-pdf.service.js +44 -44
  108. package/dist/services/shared-pdf.service.js +119 -119
  109. package/dist/services/shared-print.service.js +68 -68
  110. package/dist/services/task-pdf.service.js +10 -10
  111. package/dist/services/task-reports-pdf.service.js +9 -9
  112. package/dist/services/technician-pdf.service.js +10 -10
  113. package/dist/services/technician-print.service.js +9 -9
  114. package/dist/services/vendor-balances-pdf.service.js +6 -6
  115. package/dist/services/vendor-credit-note-pdf.service.js +27 -27
  116. package/dist/services/vendor-credit-note-print.service.js +29 -29
  117. package/dist/services/vendor-credit-note-totals.service.js +37 -37
  118. package/dist/services/vendor-debit-note-pdf.service.js +16 -16
  119. package/dist/services/vendor-debit-note-print.service.js +29 -29
  120. package/dist/services/vendor-debit-note-totals.service.js +30 -30
  121. package/dist/shared/math-operations.js +184 -0
  122. package/dist/shared/util.js +15 -0
  123. package/dist/{shared → utils}/my-date.js +31 -31
  124. package/dist/{shared/utils.js → utils/tr-utils.js} +0 -8
  125. package/package.json +2 -1
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VendorDebitNotePdfService = void 0;
4
- const utils_1 = require("../shared/utils");
4
+ const tr_utils_1 = require("../utils/tr-utils");
5
5
  const shared_pdf_service_1 = require("./shared-pdf.service");
6
6
  const shared_print_service_1 = require("./shared-print.service");
7
7
  class VendorDebitNotePdfService {
@@ -31,7 +31,7 @@ class VendorDebitNotePdfService {
31
31
  }
32
32
  static GetFileName(ROPrintData) {
33
33
  let fileName = ROPrintData.HeaderName;
34
- if (!utils_1.TrUtils.IsNull(ROPrintData.Product) && !utils_1.TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
34
+ if (!tr_utils_1.TrUtils.IsNull(ROPrintData.Product) && !tr_utils_1.TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
35
35
  fileName = fileName + '-' + ROPrintData.Product.RegNo;
36
36
  }
37
37
  return fileName;
@@ -57,7 +57,7 @@ class VendorDebitNotePdfService {
57
57
  let List = [];
58
58
  if (ROPrintData.Entity.Body === 1) {
59
59
  for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
60
- if (utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
60
+ if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
61
61
  ROPrintData.PrintInfo[i].Text = '';
62
62
  }
63
63
  // List.push(ROPrintData.PrintInfo[i].Text,
@@ -68,10 +68,10 @@ class VendorDebitNotePdfService {
68
68
  else {
69
69
  if (ROPrintData.Entity.Body === 2) {
70
70
  for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
71
- if (utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
71
+ if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
72
72
  ROPrintData.PrintInfo[i].Text = '';
73
73
  }
74
- List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn));
74
+ List.push(ROPrintData.PrintInfo[i].Text, this.WithOutDiscountFieldTable(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn));
75
75
  }
76
76
  }
77
77
  else {
@@ -82,10 +82,10 @@ class VendorDebitNotePdfService {
82
82
  }
83
83
  else {
84
84
  for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
85
- if (utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
85
+ if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
86
86
  ROPrintData.PrintInfo[i].Text = '';
87
87
  }
88
- List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn));
88
+ List.push(ROPrintData.PrintInfo[i].Text, this.GetWithOutDiscAndTaxFieldHeader(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn));
89
89
  }
90
90
  }
91
91
  }
@@ -149,14 +149,14 @@ class VendorDebitNotePdfService {
149
149
  Parts.forEach((part) => {
150
150
  var dataRow = [];
151
151
  columns.forEach((column) => {
152
- if ((!utils_1.TrUtils.IsFixedZero(part[column.Field]) && !utils_1.TrUtils.IsNull(part[column.Field]))
152
+ if ((!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field]))
153
153
  || (column.text === 'Line Total')) {
154
154
  if (part[column.Field] === 'Spare Parts') {
155
155
  dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
156
156
  }
157
157
  else {
158
158
  if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
159
- && utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
159
+ && tr_utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
160
160
  part[column.Field] = '';
161
161
  dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
162
162
  }
@@ -166,7 +166,7 @@ class VendorDebitNotePdfService {
166
166
  || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
167
167
  if (column.Field === 'Disc') {
168
168
  if (column.type === 'percentage') {
169
- if (!utils_1.TrUtils.IsEmpty(part[column.Field])) {
169
+ if (!tr_utils_1.TrUtils.IsEmpty(part[column.Field])) {
170
170
  dataRow.push({ text: part[column.Field].toString(), noWrap: true });
171
171
  }
172
172
  else {
@@ -174,7 +174,7 @@ class VendorDebitNotePdfService {
174
174
  }
175
175
  }
176
176
  else {
177
- if (!utils_1.TrUtils.IsZero(part[column.Field])) {
177
+ if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
178
178
  dataRow.push({ text: part[column.Field].toString(), noWrap: true });
179
179
  }
180
180
  else {
@@ -183,7 +183,7 @@ class VendorDebitNotePdfService {
183
183
  }
184
184
  }
185
185
  else {
186
- if (!utils_1.TrUtils.IsZero(part[column.Field])) {
186
+ if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
187
187
  dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
188
188
  }
189
189
  else {
@@ -196,7 +196,7 @@ class VendorDebitNotePdfService {
196
196
  if (column.Field === 'Desc') {
197
197
  let DescData = [];
198
198
  DescData.push(part[column.Field].toString());
199
- if (!utils_1.TrUtils.IsEmpty(part['EDesc'])) {
199
+ if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
200
200
  DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
201
201
  }
202
202
  dataRow.push({ stack: DescData });
@@ -432,7 +432,7 @@ class VendorDebitNotePdfService {
432
432
  Parts.forEach((part) => {
433
433
  var dataRow = [];
434
434
  columns.forEach((column) => {
435
- if (!utils_1.TrUtils.IsFixedZero(part[column.Field]) && !utils_1.TrUtils.IsNull(part[column.Field])
435
+ if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])
436
436
  || column.text === 'Line Total') {
437
437
  if (part[column.Field] === 'Spare Parts') {
438
438
  dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
@@ -453,7 +453,7 @@ class VendorDebitNotePdfService {
453
453
  if (column.Field === 'Desc') {
454
454
  let DescData = [];
455
455
  DescData.push(part[column.Field].toString());
456
- if (!utils_1.TrUtils.IsEmpty(part['EDesc'])) {
456
+ if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
457
457
  DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
458
458
  }
459
459
  dataRow.push({ stack: DescData });
@@ -546,7 +546,7 @@ class VendorDebitNotePdfService {
546
546
  }
547
547
  static CommonTotalDetails(ROPrintData, moreDiscDetails) {
548
548
  let CommonDetails = [
549
- shared_pdf_service_1.SharedPDFService.GetDebitTotalDetails(ROPrintData, ROPrintData.CustLaborTotalBeforeDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST, ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST, ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts, ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn, utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.CustLaborITax, ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, moreDiscDetails),
549
+ shared_pdf_service_1.SharedPDFService.GetDebitTotalDetails(ROPrintData, ROPrintData.CustLaborTotalBeforeDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST, ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST, ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts, ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn, tr_utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.CustLaborITax, ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, moreDiscDetails),
550
550
  shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, false),
551
551
  shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
552
552
  shared_pdf_service_1.SharedPDFService.GetUnderLine(),
@@ -3,37 +3,37 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VendorDebitNotePrintService = void 0;
4
4
  const shared_print_service_1 = require("./shared-print.service");
5
5
  const debit_note_totals_service_1 = require("./debit-note-totals.service");
6
- const my_date_1 = require("../shared/my-date");
7
- const utils_1 = require("../shared/utils");
6
+ const my_date_1 = require("../utils/my-date");
7
+ const tr_utils_1 = require("../utils/tr-utils");
8
8
  const enums_1 = require("../enums/enums");
9
9
  const code_enums_1 = require("../enums/code-enums");
10
10
  const aggregation_1 = require("../aggregation/aggregation");
11
11
  class VendorDebitNotePrintService {
12
12
  static GetDebitNotePrintInfo(OriginalInvoiceData, OriginalEntityData, image, IncludeGST, ConsolidateGST, TaxCodes, IsProforma) {
13
13
  var _a, _b;
14
- let ForInsurance = !utils_1.TrUtils.IsNull(OriginalInvoiceData.BFrom.InsId);
14
+ let ForInsurance = !tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.BFrom.InsId);
15
15
  let InvoicePrintData = {};
16
- let argInvoiceData = utils_1.TrUtils.Stringify(OriginalInvoiceData);
16
+ let argInvoiceData = tr_utils_1.TrUtils.Stringify(OriginalInvoiceData);
17
17
  if (!IncludeGST) {
18
18
  argInvoiceData.Settings.Tax = 'NO';
19
19
  }
20
20
  InvoicePrintData.IsProforma = IsProforma;
21
- InvoicePrintData.Settings = utils_1.TrUtils.Stringify(argInvoiceData.Settings);
21
+ InvoicePrintData.Settings = tr_utils_1.TrUtils.Stringify(argInvoiceData.Settings);
22
22
  let SType;
23
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.SType)) {
23
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.SType)) {
24
24
  SType = OriginalInvoiceData.SType;
25
25
  }
26
26
  InvoicePrintData = this.GetPrintConditionsBasedOnInput(InvoicePrintData, IncludeGST, ConsolidateGST, ForInsurance, SType, argInvoiceData, IsProforma);
27
27
  InvoicePrintData.Entity = shared_print_service_1.PrintSharedService.GetFormattedEntityDataForPrint(OriginalEntityData, "Invoice", OriginalInvoiceData);
28
28
  InvoicePrintData = shared_print_service_1.PrintSharedService.GetEntityHeaderStyles(InvoicePrintData, OriginalEntityData, image);
29
29
  InvoicePrintData = this.GetInvoiceOtherDetailsForPrint(InvoicePrintData, argInvoiceData);
30
- let IsTaxable = (IncludeGST && utils_1.TrUtils.isTaxable(argInvoiceData.Settings.Tax)) ? true : false;
30
+ let IsTaxable = (IncludeGST && tr_utils_1.TrUtils.isTaxable(argInvoiceData.Settings.Tax)) ? true : false;
31
31
  let finalTotalsData = debit_note_totals_service_1.DebitNoteTotalsService.GetTotalsValue(argInvoiceData.Items, IsTaxable, true, argInvoiceData.Disc, argInvoiceData.Perc, TaxCodes, true, argInvoiceData.Settings);
32
32
  if (ConsolidateGST) {
33
33
  finalTotalsData.CustLaborTotalBeforeDisc = finalTotalsData.CustLaborAfterTax;
34
34
  finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustPartAfterTax;
35
35
  }
36
- InvoicePrintData = utils_1.TrUtils.ConcatObjects(InvoicePrintData, finalTotalsData);
36
+ InvoicePrintData = tr_utils_1.TrUtils.ConcatObjects(InvoicePrintData, finalTotalsData);
37
37
  InvoicePrintData.Items = this.GetItemsPrintInfo(InvoicePrintData.Items, ConsolidateGST, TaxCodes, (_b = (_a = OriginalEntityData.Entity.Settings) === null || _a === void 0 ? void 0 : _a.Acc) === null || _b === void 0 ? void 0 : _b.LTot);
38
38
  argInvoiceData = this.ReverseItemsForInvoicePrint(argInvoiceData);
39
39
  InvoicePrintData.PrintInfo = this.PrepareFormatForInvoicePrint(InvoicePrintData, code_enums_1.ROTypeEnum.Invoice, argInvoiceData.Sts);
@@ -65,11 +65,11 @@ class VendorDebitNotePrintService {
65
65
  InvoicePrintData.IncludeGST = IncludeGST;
66
66
  InvoicePrintData.ConsolidateGST = ConsolidateGST;
67
67
  InvoicePrintData.ShowAccParts = false;
68
- InvoicePrintData.ShowIGST = (utils_1.TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
68
+ InvoicePrintData.ShowIGST = (tr_utils_1.TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
69
69
  InvoicePrintData.ShowTaxColumn = (IncludeGST && !ConsolidateGST) ? true : false;
70
70
  // InvoicePrintData.ShowDiscountColumn = (!ForInsurance && !ConsolidateGST) ? true : false;
71
71
  InvoicePrintData = this.GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma);
72
- InvoicePrintData.PrDate = utils_1.TrUtils.IsNull(OriginalInvoiceData.PrDate) ? '' : my_date_1.MyDate.ConvertUTCDateToReadable(OriginalInvoiceData.PrDate);
72
+ InvoicePrintData.PrDate = tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.PrDate) ? '' : my_date_1.MyDate.ConvertUTCDateToReadable(OriginalInvoiceData.PrDate);
73
73
  return InvoicePrintData;
74
74
  }
75
75
  static GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma) {
@@ -109,24 +109,24 @@ class VendorDebitNotePrintService {
109
109
  let CTaxAmtPerItem = (0, aggregation_1.division)(Item.CGST, Item.Qty);
110
110
  let STaxAmtPerItem = (0, aggregation_1.division)(Item.SGST, Item.Qty);
111
111
  let ITaxAmtPerItem = (0, aggregation_1.division)(Item.IGST, Item.Qty);
112
- Item.UnPr = utils_1.TrUtils.FixedTo((0, aggregation_1.addition)(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem));
112
+ Item.UnPr = tr_utils_1.TrUtils.FixedTo((0, aggregation_1.addition)(AfterDiscForEach, CTaxAmtPerItem, STaxAmtPerItem, ITaxAmtPerItem));
113
113
  }
114
114
  else {
115
- Item.UnPr = utils_1.TrUtils.FixPriceValue(Item.UnPr);
115
+ Item.UnPr = tr_utils_1.TrUtils.FixPriceValue(Item.UnPr);
116
116
  }
117
- Item.CGSTAmt = utils_1.TrUtils.FixPriceValue(Item.CGST);
118
- Item.SGSTAmt = utils_1.TrUtils.FixPriceValue(Item.SGST);
119
- Item.IGSTAmt = utils_1.TrUtils.FixPriceValue(Item.IGST);
117
+ Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.CGST);
118
+ Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.SGST);
119
+ Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.IGST);
120
120
  Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
121
121
  Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
122
122
  Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
123
123
  if (LineTotal === 'AT') {
124
- Item.LineTotal = utils_1.TrUtils.FixPriceValue(Item.AfterPartTax);
124
+ Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Item.AfterPartTax);
125
125
  }
126
126
  else {
127
- Item.LineTotal = utils_1.TrUtils.FixPriceValue((0, aggregation_1.subtraction)(Item.UnAmt, Item.Disc));
127
+ Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue((0, aggregation_1.subtraction)(Item.UnAmt, Item.Disc));
128
128
  }
129
- if (!utils_1.TrUtils.IsZero(Item.Qty) && !utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
129
+ if (!tr_utils_1.TrUtils.IsZero(Item.Qty) && !tr_utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
130
130
  Item.QtyAndUoM = Item.Qty + ' ' + Item.UoM;
131
131
  }
132
132
  });
@@ -146,15 +146,15 @@ class VendorDebitNotePrintService {
146
146
  return PrintInfo;
147
147
  }
148
148
  static GetFormattedProductDataForPrint(OriginalInvoiceData, InvoicePrintData) {
149
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.Prod)) {
149
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.Prod)) {
150
150
  InvoicePrintData.Product = OriginalInvoiceData.Prod;
151
- if (utils_1.TrUtils.IsNull(InvoicePrintData.Product.VIN)) {
151
+ if (tr_utils_1.TrUtils.IsNull(InvoicePrintData.Product.VIN)) {
152
152
  InvoicePrintData.Product.VIN = '';
153
153
  }
154
- if (utils_1.TrUtils.IsNull(InvoicePrintData.Product.RegNo)) {
154
+ if (tr_utils_1.TrUtils.IsNull(InvoicePrintData.Product.RegNo)) {
155
155
  InvoicePrintData.Product.RegNo = '';
156
156
  }
157
- if (utils_1.TrUtils.IsNull(InvoicePrintData.Product.EngNo)) {
157
+ if (tr_utils_1.TrUtils.IsNull(InvoicePrintData.Product.EngNo)) {
158
158
  InvoicePrintData.Product.EngNo = '';
159
159
  }
160
160
  InvoicePrintData.MIn = OriginalInvoiceData.Prod.MIn;
@@ -186,7 +186,7 @@ class VendorDebitNotePrintService {
186
186
  // ];
187
187
  // }
188
188
  InvoicePrintData.Customer = Customer;
189
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.BFrom.InsId)) {
189
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.BFrom.InsId)) {
190
190
  InvoicePrintData.Cust = this.GetCustomerDetails(OriginalInvoiceData);
191
191
  }
192
192
  return InvoicePrintData;
@@ -195,7 +195,7 @@ class VendorDebitNotePrintService {
195
195
  let Customer = {};
196
196
  Customer.Name = this.GetBillToName(OriginalInvoiceData.Cust.Title, OriginalInvoiceData.Cust.Name);
197
197
  Customer.Cons = [];
198
- if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Ph)) {
198
+ if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Ph)) {
199
199
  Customer.Cons = [
200
200
  {
201
201
  Type: 'M',
@@ -205,9 +205,9 @@ class VendorDebitNotePrintService {
205
205
  }
206
206
  Customer.GSTIN = OriginalInvoiceData.Cust.GSTIN;
207
207
  Customer.Adrs = [];
208
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.Cust.Adrs)) {
208
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.Cust.Adrs)) {
209
209
  Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.A1);
210
- if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Adrs.A2)) {
210
+ if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Adrs.A2)) {
211
211
  Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.A2);
212
212
  }
213
213
  Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.Ct);
@@ -217,7 +217,7 @@ class VendorDebitNotePrintService {
217
217
  return Customer;
218
218
  }
219
219
  static GetBillToName(Title, Name) {
220
- return utils_1.TrUtils.IsEmpty(Title) ? Name : Title + ' ' + Name;
220
+ return tr_utils_1.TrUtils.IsEmpty(Title) ? Name : Title + ' ' + Name;
221
221
  }
222
222
  static GetPaymentsTotal(InvoicePayments, Total, InvoiceStatus) {
223
223
  var i = 0;
@@ -230,7 +230,7 @@ class VendorDebitNotePrintService {
230
230
  Data.Due = 0;
231
231
  }
232
232
  else {
233
- Data.Due = utils_1.TrUtils.FixedTo(Total - PaidTotal);
233
+ Data.Due = tr_utils_1.TrUtils.FixedTo(Total - PaidTotal);
234
234
  }
235
235
  if (Data.Due < 0) {
236
236
  Data.Due = 0;
@@ -238,7 +238,7 @@ class VendorDebitNotePrintService {
238
238
  if (Data.Due === 0) {
239
239
  Data.Sts = enums_1.InvoiceStatusEnum.Closed;
240
240
  }
241
- Data.Paid = utils_1.TrUtils.FixedTo(PaidTotal);
241
+ Data.Paid = tr_utils_1.TrUtils.FixedTo(PaidTotal);
242
242
  return Data;
243
243
  }
244
244
  }
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VendorDebitNoteTotalsService = void 0;
4
4
  const aggregation_1 = require("../aggregation/aggregation");
5
- const utils_1 = require("../shared/utils");
5
+ const tr_utils_1 = require("../utils/tr-utils");
6
6
  class VendorDebitNoteTotalsService {
7
7
  static GetTotalsValue(ItemsList, IsIndependentTax, DetailedInfo, Disc, Perc, TaxCodes, WithItems, Settings) {
8
8
  // LPerc = TrUtils.SetPercToStringIfNull(LPerc);
9
9
  // PPerc = TrUtils.SetPercToStringIfNull(PPerc);
10
- Perc = utils_1.TrUtils.SetPercToStringIfNull(Perc);
10
+ Perc = tr_utils_1.TrUtils.SetPercToStringIfNull(Perc);
11
11
  // LDisc = TrUtils.SetValueToZeroIfNull(LDisc);
12
12
  // PDisc = TrUtils.SetValueToZeroIfNull(PDisc);
13
- Disc = utils_1.TrUtils.SetValueToZeroIfNull(Disc);
13
+ Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Disc);
14
14
  // opCodesList = this.CalculateLaborValues(opCodesList, IsIndependentTax);
15
15
  ItemsList = this.CalculateLaborItemValues(ItemsList, IsIndependentTax);
16
16
  let finalTotalsData = this.GetFinalRODataForSave(ItemsList, IsIndependentTax, Disc, Perc, DetailedInfo, Settings);
@@ -33,7 +33,7 @@ class VendorDebitNoteTotalsService {
33
33
  static ResetLaborItemValues(ItemsList, IsIndependentTax) {
34
34
  ItemsList.forEach((Item) => {
35
35
  Item = this.ResetLaborItemValueIfInvalid(Item);
36
- if (utils_1.TrUtils.IsZero(Item.Qty)) {
36
+ if (tr_utils_1.TrUtils.IsZero(Item.Qty)) {
37
37
  Item.Qty = 1;
38
38
  }
39
39
  Item.DiscountedPrice = (0, aggregation_1.addition)(Item.Disc, Item.RecDisc);
@@ -48,12 +48,12 @@ class VendorDebitNoteTotalsService {
48
48
  return ItemsList;
49
49
  }
50
50
  static ResetLaborItemValueIfInvalid(Item) {
51
- Item.UnPr = utils_1.TrUtils.SetValueToZeroIfNull(Item.UnPr);
52
- Item.Disc = utils_1.TrUtils.SetValueToZeroIfNull(Item.Disc);
53
- Item.RecDisc = utils_1.TrUtils.SetValueToZeroIfNull(Item.RecDisc);
54
- Item.CGST = utils_1.TrUtils.SetValueToZeroIfNull(Item.CGST);
55
- Item.SGST = utils_1.TrUtils.SetValueToZeroIfNull(Item.SGST);
56
- Item.IGST = utils_1.TrUtils.SetValueToZeroIfNull(Item.IGST);
51
+ Item.UnPr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.UnPr);
52
+ Item.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.Disc);
53
+ Item.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.RecDisc);
54
+ Item.CGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.CGST);
55
+ Item.SGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.SGST);
56
+ Item.IGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.IGST);
57
57
  return Item;
58
58
  }
59
59
  static GetFinalRODataForSave(ItemsList, IsIndependentTax, Disc, Perc, DetailedInfo, Settings) {
@@ -81,7 +81,7 @@ class VendorDebitNoteTotalsService {
81
81
  let CustomerAfterDiscTotals = this.GetSubTotalFor(ItemsList);
82
82
  // let CustLaborTaxTotal = this.GetLaborTaxTotalFor(IsIndependentTax);
83
83
  let CustItemTaxTotal = this.GetItemsTaxTotalFor(ItemsList, IsIndependentTax);
84
- finalTotalsData.SubTotal = utils_1.TrUtils.FixedTo(CustomerAfterDiscTotals);
84
+ finalTotalsData.SubTotal = tr_utils_1.TrUtils.FixedTo(CustomerAfterDiscTotals);
85
85
  // let CustLaborDiscTotal = this.GetLaborDiscountedTotal(LaborList, IsIndependentTax, finalTotalsData);
86
86
  let CustItemsDiscTotal = this.GetItemDiscountedTotal(ItemsList, IsIndependentTax, finalTotalsData);
87
87
  // let CustLaborTotalAfterDisc = this.GetLaborTotalAfterDiscount(LaborList);
@@ -91,8 +91,8 @@ class VendorDebitNoteTotalsService {
91
91
  finalTotalsData.Round = (0, aggregation_1.subtraction)(Math.round(CustTotal), CustTotal);
92
92
  finalTotalsData.Total = Math.round(CustTotal);
93
93
  if (DetailedInfo) {
94
- finalTotalsData.FixedSubTotal = utils_1.TrUtils.FixedTo(CustomerAfterDiscTotals);
95
- finalTotalsData.FixedTotal = utils_1.TrUtils.FixedTo(CustTotal);
94
+ finalTotalsData.FixedSubTotal = tr_utils_1.TrUtils.FixedTo(CustomerAfterDiscTotals);
95
+ finalTotalsData.FixedTotal = tr_utils_1.TrUtils.FixedTo(CustTotal);
96
96
  }
97
97
  return finalTotalsData;
98
98
  }
@@ -121,10 +121,10 @@ class VendorDebitNoteTotalsService {
121
121
  // finalTotalsData.CustLaborCGST = this.GetLaborCGSTTaxTotal(opCodesList, IsIndependentTax);
122
122
  // finalTotalsData.CustLaborIGST = this.GetLaborIGSTTaxTotal(opCodesList, IsIndependentTax);
123
123
  let TaxInfo = this.GetItemGSTTaxTotal(ItemsList, IsIndependentTax);
124
- finalTotalsData.CustItemITax = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[3]);
125
- finalTotalsData.CustItemCGST = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[0]);
126
- finalTotalsData.CustItemIGST = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[2]);
127
- finalTotalsData.CustItemSGST = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[1]);
124
+ finalTotalsData.CustItemITax = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[3]);
125
+ finalTotalsData.CustItemCGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[0]);
126
+ finalTotalsData.CustItemIGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[2]);
127
+ finalTotalsData.CustItemSGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[1]);
128
128
  // finalTotalsData.CustItemITax = this.GetItemsTaxTotalFor(ItemsList, IsIndependentTax);
129
129
  // finalTotalsData.CustItemCGST = this.GetItemCGSTTaxTotal(ItemsList, IsIndependentTax);
130
130
  // finalTotalsData.CustItemIGST = this.GetItemIGSTTaxTotal(ItemsList, IsIndependentTax);
@@ -132,14 +132,14 @@ class VendorDebitNoteTotalsService {
132
132
  // finalTotalsData.CustLaborAfterTax = addition(finalTotalsData.CustLaborITax , finalTotalsData.CustLaborTotalAfterDisc);
133
133
  finalTotalsData.CustItemAfterTax = (0, aggregation_1.addition)(finalTotalsData.CustItemITax, finalTotalsData.CustItemsTotalAfterDisc);
134
134
  finalTotalsData.CustTaxGroupData = this.GetTaxGroupingForItemsByHSN(ItemsList, TaxCodes);
135
- finalTotalsData.CustTotalRoundedBy = utils_1.TrUtils.FixedTo(finalTotalsData.Round);
136
- finalTotalsData.CustRoundedTotal = utils_1.TrUtils.FixedTo(finalTotalsData.Total);
135
+ finalTotalsData.CustTotalRoundedBy = tr_utils_1.TrUtils.FixedTo(finalTotalsData.Round);
136
+ finalTotalsData.CustRoundedTotal = tr_utils_1.TrUtils.FixedTo(finalTotalsData.Total);
137
137
  for (var key in finalTotalsData) {
138
138
  if (key !== 'Total' && key !== 'SubTotal' &&
139
139
  key !== 'LDisc' && key !== 'LPerc' && key !== 'PDisc' &&
140
140
  key !== 'PPerc' && key !== 'Disc' && key !== 'Perc' && key !== 'Tax'
141
141
  && typeof finalTotalsData[key] === 'number') {
142
- finalTotalsData[key] = utils_1.TrUtils.FixPriceValue(finalTotalsData[key]);
142
+ finalTotalsData[key] = tr_utils_1.TrUtils.FixPriceValue(finalTotalsData[key]);
143
143
  }
144
144
  }
145
145
  return finalTotalsData;
@@ -148,7 +148,7 @@ class VendorDebitNoteTotalsService {
148
148
  let ItemsDiscountedTotal = 0;
149
149
  let overallItemDisc = 0;
150
150
  if (!isTaxable) {
151
- overallItemDisc = utils_1.TrUtils.SetValueToZeroIfNull(finalTotalsData.PDisc);
151
+ overallItemDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(finalTotalsData.PDisc);
152
152
  }
153
153
  ItemsList.forEach((Item) => {
154
154
  ItemsDiscountedTotal = (0, aggregation_1.addition)(ItemsDiscountedTotal, Item.DiscountedPrice);
@@ -176,8 +176,8 @@ class VendorDebitNoteTotalsService {
176
176
  }
177
177
  static ItemsTotalAfterDiscount(ItemsTotalAfterDisc, ItemsTaxAmount, MainPDisc, PDiscInPerc) {
178
178
  let ItemsTotal = (0, aggregation_1.addition)(ItemsTotalAfterDisc, ItemsTaxAmount);
179
- if (!utils_1.TrUtils.IsZero(MainPDisc)) {
180
- if (!utils_1.TrUtils.IsEmpty(PDiscInPerc)) {
179
+ if (!tr_utils_1.TrUtils.IsZero(MainPDisc)) {
180
+ if (!tr_utils_1.TrUtils.IsEmpty(PDiscInPerc)) {
181
181
  ItemsTotal = (0, aggregation_1.subtraction)(ItemsTotal, (0, aggregation_1.division)((0, aggregation_1.multiply)(ItemsTotal, Number(PDiscInPerc)), 100));
182
182
  }
183
183
  else {
@@ -209,13 +209,13 @@ class VendorDebitNoteTotalsService {
209
209
  }
210
210
  static GetCombinedTaxPercentage(Items, TaxCodes) {
211
211
  Items.forEach((Item) => {
212
- if (utils_1.TrUtils.IsNull(Item.HSN)) {
212
+ if (tr_utils_1.TrUtils.IsNull(Item.HSN)) {
213
213
  Item.HSN = '';
214
214
  }
215
215
  let TaxInfo = this.GetGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
216
- Item.CGSTAmt = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[0]);
217
- Item.SGSTAmt = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[1]);
218
- Item.IGSTAmt = utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[2]);
216
+ Item.CGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[0]);
217
+ Item.SGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[1]);
218
+ Item.IGSTAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(TaxInfo[2]);
219
219
  Item.CombinedTaxPercentage = (0, aggregation_1.addition)(Item.CGSTAmt, Item.SGSTAmt, Item.IGSTAmt);
220
220
  });
221
221
  return Items;
@@ -266,8 +266,8 @@ class VendorDebitNoteTotalsService {
266
266
  TaxAmount = (0, aggregation_1.addition)(TaxAmount, argMatchedGSTItem.SGST);
267
267
  });
268
268
  TaxInfo.HSN = HSN;
269
- TaxInfo.TotalTaxableAmount = utils_1.TrUtils.FixPriceValue(TaxOnAmount);
270
- TaxInfo.TotalTaxAmount = utils_1.TrUtils.FixPriceValue(TaxAmount);
269
+ TaxInfo.TotalTaxableAmount = tr_utils_1.TrUtils.FixPriceValue(TaxOnAmount);
270
+ TaxInfo.TotalTaxAmount = tr_utils_1.TrUtils.FixPriceValue(TaxAmount);
271
271
  TaxInfo.ItemsCount = MatchedItem.length;
272
272
  // let GSTValues: any[] = this.GetGSTValueBasedOnTaxCode(MatchedItem[0].TCode, TaxCodes);
273
273
  // TaxInfo.CGST = GSTValues[0];
@@ -286,7 +286,7 @@ class VendorDebitNoteTotalsService {
286
286
  let CGST = 0;
287
287
  let SGST = 0;
288
288
  let IGST = 0;
289
- if (utils_1.TrUtils.IsNull(TCode)) {
289
+ if (tr_utils_1.TrUtils.IsNull(TCode)) {
290
290
  return [CGST, SGST, IGST];
291
291
  }
292
292
  let TCodeIndex = TaxCodes.findIndex((TaxCode) => {
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Add = Add;
7
+ exports.Subtract = Subtract;
8
+ exports.Multiply = Multiply;
9
+ exports.Divide = Divide;
10
+ exports.CalcDiscPrice = CalcDiscPrice;
11
+ exports.CalcMarkup = CalcMarkup;
12
+ exports.CalcMarkdown = CalcMarkdown;
13
+ exports.GetMarginValue = GetMarginValue;
14
+ // Import Big.js for precise decimal arithmetic
15
+ const big_js_1 = __importDefault(require("big.js"));
16
+ // Import utility function for handling number conversions
17
+ const util_js_1 = require("./util.js");
18
+ /**
19
+ * Adds multiple numbers with high precision using Big.js
20
+ * @param numbers - Array of numbers to add
21
+ * @returns The sum as a number
22
+ */
23
+ function Add(...numbers) {
24
+ // Convert potential null/undefined values to numbers
25
+ numbers = numbers.map(util_js_1.GetNumber);
26
+ if (numbers.length === 0)
27
+ return 0;
28
+ // Initialize result with the first number
29
+ let result = new big_js_1.default(numbers[0]);
30
+ // Add each subsequent number to the result using a for loop
31
+ for (let i = 1; i < numbers.length; i++) {
32
+ const bigNumber = new big_js_1.default(numbers[i]);
33
+ result = result.plus(bigNumber);
34
+ }
35
+ // Convert back to JavaScript number type
36
+ return result.toNumber();
37
+ }
38
+ /**
39
+ * Subtracts multiple numbers with high precision using Big.js
40
+ * @param numbers - Array of numbers where the first is subtracted by all others
41
+ * @returns The subtraction result as a number
42
+ */
43
+ function Subtract(...numbers) {
44
+ // Convert potential null/undefined values to numbers
45
+ numbers = numbers.map(util_js_1.GetNumber);
46
+ if (numbers.length === 0)
47
+ return 0;
48
+ // Initialize result with the first number
49
+ let result = new big_js_1.default(numbers[0]);
50
+ // Subtract each subsequent number from the result using a for loop
51
+ for (let i = 1; i < numbers.length; i++) {
52
+ const bigNumber = new big_js_1.default(numbers[i]);
53
+ result = result.minus(bigNumber);
54
+ }
55
+ // Convert back to JavaScript number type
56
+ return result.toNumber();
57
+ }
58
+ /**
59
+ * Multiplies multiple numbers with high precision using Big.js
60
+ * @param numbers - Array of numbers to multiply
61
+ * @returns The product as a number
62
+ */
63
+ function Multiply(...numbers) {
64
+ // Convert potential null/undefined values to numbers
65
+ numbers = numbers.map(util_js_1.GetNumber);
66
+ if (numbers.length === 0)
67
+ return 0;
68
+ if (numbers.length === 1)
69
+ return numbers[0];
70
+ // Initialize result with the first number
71
+ let result = new big_js_1.default(numbers[0]);
72
+ // Multiply each subsequent number with the result using a for loop
73
+ for (let i = 1; i < numbers.length; i++) {
74
+ const bigNumber = new big_js_1.default(numbers[i]);
75
+ result = result.mul(bigNumber);
76
+ }
77
+ // Convert back to JavaScript number type
78
+ return result.toNumber();
79
+ }
80
+ /**
81
+ * Divides multiple numbers with high precision using Big.js
82
+ * @param numbers - Array of numbers where the first is divided by all others
83
+ * @returns The division result as a number
84
+ */
85
+ function Divide(...numbers) {
86
+ // Convert potential null/undefined values to numbers
87
+ numbers = numbers.map(util_js_1.GetNumber);
88
+ if (numbers.length === 0)
89
+ return 0;
90
+ if (numbers.length === 1)
91
+ return numbers[0];
92
+ // Initialize result with the first number
93
+ let result = new big_js_1.default(numbers[0]);
94
+ // Divide the result by each subsequent number using a for loop
95
+ for (let i = 1; i < numbers.length; i++) {
96
+ // Check for division by zero
97
+ if (numbers[i] === 0) {
98
+ throw new Error('Division by zero is not allowed');
99
+ }
100
+ const bigNumber = new big_js_1.default(numbers[i]);
101
+ result = result.div(bigNumber);
102
+ }
103
+ // Convert back to JavaScript number type
104
+ return result.toNumber();
105
+ }
106
+ /**
107
+ * Calculates discounted or marked-up price based on a percentage
108
+ * @param originalPrice - The starting price
109
+ * @param discountPercentage - Percentage to apply (discount or markup)
110
+ * @param markUp - When true, adds the percentage; when false, subtracts it
111
+ * @returns The final price after discount/markup as a number
112
+ */
113
+ function CalcDiscPrice(originalPrice, discountPercentage, markUp = false) {
114
+ console.log("DiscountedPrice");
115
+ console.log(originalPrice);
116
+ console.log(discountPercentage);
117
+ // Convert inputs to Big.js objects for precision
118
+ const price = new big_js_1.default((0, util_js_1.GetNumber)(originalPrice));
119
+ const percentage = new big_js_1.default((0, util_js_1.GetNumber)(discountPercentage)).div(100);
120
+ // Calculate the amount to add or subtract
121
+ const discountAmount = price.mul(percentage);
122
+ console.log(discountAmount.toNumber());
123
+ console.log(markUp);
124
+ // Calculate final price directly with Big.js
125
+ let result;
126
+ if (markUp) {
127
+ // Perform markup calculation (add the calculated amount)
128
+ result = price.plus(discountAmount);
129
+ }
130
+ else {
131
+ // Perform discount calculation (subtract the calculated amount)
132
+ result = price.minus(discountAmount);
133
+ }
134
+ const finalPrice = result.toNumber();
135
+ console.log(finalPrice);
136
+ return finalPrice;
137
+ }
138
+ /**
139
+ * Calculates a price with markup applied
140
+ * @param originalPrice - The starting price
141
+ * @param markupPercentage - Percentage to mark up by
142
+ * @returns The final marked-up price as a number
143
+ */
144
+ function CalcMarkup(originalPrice, markupPercentage) {
145
+ // Convert inputs to Big.js objects for precision
146
+ const price = new big_js_1.default((0, util_js_1.GetNumber)(originalPrice));
147
+ const percentage = new big_js_1.default((0, util_js_1.GetNumber)(markupPercentage)).div(100);
148
+ // Calculate markup amount based on percentage of original price
149
+ const markupAmount = price.mul(percentage);
150
+ // Add markup amount to original price
151
+ const result = price.plus(markupAmount);
152
+ return result.toNumber();
153
+ }
154
+ /**
155
+ * Calculates a price with markdown (discount) applied
156
+ * @param originalPrice - The starting price
157
+ * @param markdownPercentage - Percentage to mark down by
158
+ * @returns The final marked-down price as a number
159
+ */
160
+ function CalcMarkdown(originalPrice, markdownPercentage) {
161
+ // Convert inputs to Big.js objects for precision
162
+ const price = new big_js_1.default((0, util_js_1.GetNumber)(originalPrice));
163
+ const percentage = new big_js_1.default((0, util_js_1.GetNumber)(markdownPercentage)).div(100);
164
+ // Calculate markdown amount based on percentage of original price
165
+ const markdownAmount = price.mul(percentage);
166
+ // Subtract markdown amount from original price
167
+ const result = price.minus(markdownAmount);
168
+ return result.toNumber();
169
+ }
170
+ /**
171
+ * Calculates the margin value as a percentage based on price and cost
172
+ * @param price - The selling price of the item
173
+ * @param cost - The cost of the item
174
+ * @returns The margin value as a percentage
175
+ */
176
+ function GetMarginValue(price, cost) {
177
+ // Ensure inputs are valid numbers using GetNumber utility
178
+ const validPrice = (0, util_js_1.GetNumber)(price);
179
+ const validCost = (0, util_js_1.GetNumber)(cost);
180
+ // Calculate margin percentage: ((price - cost) / price) * 100
181
+ const margin = Multiply(Divide(Subtract(validPrice, validCost), validPrice), 100);
182
+ // Return the calculated margin
183
+ return margin;
184
+ }