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
@@ -4,12 +4,12 @@ exports.SalesPdfService = void 0;
4
4
  const shared_pdf_service_1 = require("./shared-pdf.service");
5
5
  const shared_print_service_1 = require("./shared-print.service");
6
6
  const equipment_design_pdf_service_1 = require("./equipment-design-pdf.service");
7
- const utils_1 = require("../shared/utils");
7
+ const tr_utils_1 = require("../utils/tr-utils");
8
8
  class SalesPdfService {
9
9
  static GetSalesPrint(ROPrintData, numberofCopies, isOtherIndustry, Entity, Sites, Items, Image, moreDiscDetails) {
10
10
  console.log('ROPrintData', ROPrintData);
11
11
  var contents = [];
12
- if (utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
12
+ if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
13
13
  contents.push(this.CommonHeaderDetails(ROPrintData, null), this.PreparesparePartsTable(ROPrintData), this.CommonTotalDetails(ROPrintData, null, numberofCopies, moreDiscDetails));
14
14
  }
15
15
  else {
@@ -17,9 +17,9 @@ class SalesPdfService {
17
17
  contents.push(this.CommonHeaderDetails(ROPrintData, text), this.PreparesparePartsTable(ROPrintData), this.CommonTotalDetails(ROPrintData, index, numberofCopies, moreDiscDetails));
18
18
  });
19
19
  }
20
- if (isOtherIndustry && !utils_1.TrUtils.IsNull(Sites) && Sites.length != 0) {
20
+ if (isOtherIndustry && !tr_utils_1.TrUtils.IsNull(Sites) && Sites.length != 0) {
21
21
  contents.push({ text: '', pageBreak: 'after' });
22
- contents.push(equipment_design_pdf_service_1.EquipmentDesignPdf.GetContentData(utils_1.TrUtils.Stringify(Entity), Sites, Items, Image));
22
+ contents.push(equipment_design_pdf_service_1.EquipmentDesignPdf.GetContentData(tr_utils_1.TrUtils.Stringify(Entity), Sites, Items, Image));
23
23
  }
24
24
  var dd = {
25
25
  info: {
@@ -42,7 +42,7 @@ class SalesPdfService {
42
42
  }
43
43
  static GetFileName(ROPrintData) {
44
44
  let fileName = ROPrintData.HeaderName;
45
- if (!utils_1.TrUtils.IsNull(ROPrintData.Product) && !utils_1.TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
45
+ if (!tr_utils_1.TrUtils.IsNull(ROPrintData.Product) && !tr_utils_1.TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
46
46
  fileName = fileName + '-' + ROPrintData.Product.RegNo;
47
47
  }
48
48
  return fileName;
@@ -68,19 +68,19 @@ class SalesPdfService {
68
68
  let List = [];
69
69
  if (ROPrintData.Entity.Body === 1) {
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.GetLaborPartsTableForView(utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.Entity.MPN));
74
+ List.push(ROPrintData.PrintInfo[i].Text, this.GetLaborPartsTableForView(tr_utils_1.TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.Entity.MPN));
75
75
  }
76
76
  }
77
77
  else {
78
78
  if (ROPrintData.Entity.Body === 2) {
79
79
  for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
80
- if (utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
80
+ if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
81
81
  ROPrintData.PrintInfo[i].Text = '';
82
82
  }
83
- 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));
83
+ 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));
84
84
  }
85
85
  }
86
86
  else {
@@ -89,10 +89,10 @@ class SalesPdfService {
89
89
  }
90
90
  else {
91
91
  for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
92
- if (utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
92
+ if (tr_utils_1.TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
93
93
  ROPrintData.PrintInfo[i].Text = '';
94
94
  }
95
- 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));
95
+ 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));
96
96
  }
97
97
  }
98
98
  }
@@ -188,13 +188,13 @@ class SalesPdfService {
188
188
  Parts.forEach((part) => {
189
189
  var dataRow = [];
190
190
  columns.forEach((column) => {
191
- if (((!utils_1.TrUtils.IsNull(part.Type) && part.Type !== 'Lab') || (!utils_1.TrUtils.IsFixedZero(part[column.Field]) && !utils_1.TrUtils.IsNull(part[column.Field])))
191
+ if (((!tr_utils_1.TrUtils.IsNull(part.Type) && part.Type !== 'Lab') || (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])))
192
192
  || (column.text === 'Line Total')) {
193
193
  if (part[column.Field] === 'Spare Parts') {
194
194
  dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
195
195
  }
196
196
  else {
197
- if (!utils_1.TrUtils.IsNull(part.Type) && part.Type !== 'Lab') {
197
+ if (!tr_utils_1.TrUtils.IsNull(part.Type) && part.Type !== 'Lab') {
198
198
  if (column.Field === 'Desc') {
199
199
  if (part.Type === 'Note') {
200
200
  dataRow.push({ text: part[column.Field].toString(), colSpan: 11, bold: true });
@@ -219,7 +219,7 @@ class SalesPdfService {
219
219
  }
220
220
  else {
221
221
  if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
222
- && utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
222
+ && tr_utils_1.TrUtils.CheckInvalidSelect(part.TCode))) {
223
223
  part[column.Field] = '';
224
224
  dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
225
225
  }
@@ -229,7 +229,7 @@ class SalesPdfService {
229
229
  || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
230
230
  if (column.Field === 'Disc') {
231
231
  if (column.type === 'percentage') {
232
- if (!utils_1.TrUtils.IsEmpty(part[column.Field])) {
232
+ if (!tr_utils_1.TrUtils.IsEmpty(part[column.Field])) {
233
233
  dataRow.push({ text: part[column.Field].toString(), noWrap: true });
234
234
  }
235
235
  else {
@@ -237,7 +237,7 @@ class SalesPdfService {
237
237
  }
238
238
  }
239
239
  else {
240
- if (!utils_1.TrUtils.IsZero(part[column.Field])) {
240
+ if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
241
241
  dataRow.push({ text: part[column.Field].toString(), noWrap: true });
242
242
  }
243
243
  else {
@@ -246,7 +246,7 @@ class SalesPdfService {
246
246
  }
247
247
  }
248
248
  else {
249
- if (!utils_1.TrUtils.IsZero(part[column.Field])) {
249
+ if (!tr_utils_1.TrUtils.IsZero(part[column.Field])) {
250
250
  dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
251
251
  }
252
252
  else {
@@ -259,13 +259,13 @@ class SalesPdfService {
259
259
  if (column.Field === 'Desc') {
260
260
  let DescData = [];
261
261
  DescData.push(part[column.Field].toString());
262
- if (!utils_1.TrUtils.IsEmpty(part['EDesc'])) {
262
+ if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
263
263
  DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
264
264
  }
265
265
  dataRow.push({ stack: DescData });
266
266
  }
267
267
  else {
268
- part[column.Field] = utils_1.TrUtils.IsNull(part[column.Field]) ? '' : part[column.Field];
268
+ part[column.Field] = tr_utils_1.TrUtils.IsNull(part[column.Field]) ? '' : part[column.Field];
269
269
  dataRow.push({ text: part[column.Field].toString() });
270
270
  }
271
271
  }
@@ -497,7 +497,7 @@ class SalesPdfService {
497
497
  Parts.forEach((part) => {
498
498
  var dataRow = [];
499
499
  columns.forEach((column) => {
500
- if (!utils_1.TrUtils.IsFixedZero(part[column.Field]) && !utils_1.TrUtils.IsNull(part[column.Field])
500
+ if (!tr_utils_1.TrUtils.IsFixedZero(part[column.Field]) && !tr_utils_1.TrUtils.IsNull(part[column.Field])
501
501
  || column.text === 'Line Total') {
502
502
  if (part[column.Field] === 'Spare Parts') {
503
503
  dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
@@ -518,7 +518,7 @@ class SalesPdfService {
518
518
  if (column.Field === 'Desc') {
519
519
  let DescData = [];
520
520
  DescData.push(part[column.Field].toString());
521
- if (!utils_1.TrUtils.IsEmpty(part['EDesc'])) {
521
+ if (!tr_utils_1.TrUtils.IsEmpty(part['EDesc'])) {
522
522
  DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
523
523
  }
524
524
  dataRow.push({ stack: DescData });
@@ -611,7 +611,7 @@ class SalesPdfService {
611
611
  }
612
612
  static CommonTotalDetails(ROPrintData, index, numberofCopies, moreDiscDetails) {
613
613
  let CommonDetails = [
614
- shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails(ROPrintData, '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustItemsTotalBeforeDisc, ROPrintData.CustItemsDiscTotal, ROPrintData.CustItemCGST, ROPrintData.CustItemSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts, '0.00', ROPrintData.CustItemAfterTax, ROPrintData.FixedDisc, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn, utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax), '0.00', ROPrintData.CustItemITax, ROPrintData.Consolidate, ROPrintData.From, null, ROPrintData.SubTotal, moreDiscDetails),
614
+ shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails(ROPrintData, '0.00', '0.00', '0.00', '0.00', '0.00', '0.00', ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustItemsTotalBeforeDisc, ROPrintData.CustItemsDiscTotal, ROPrintData.CustItemCGST, ROPrintData.CustItemSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts, '0.00', ROPrintData.CustItemAfterTax, ROPrintData.FixedDisc, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn, tr_utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax), '0.00', ROPrintData.CustItemITax, ROPrintData.Consolidate, ROPrintData.From, null, ROPrintData.SubTotal, moreDiscDetails),
615
615
  shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, false),
616
616
  shared_pdf_service_1.SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
617
617
  shared_pdf_service_1.SharedPDFService.GetUnderLine(),
@@ -620,7 +620,7 @@ class SalesPdfService {
620
620
  if (ROPrintData.Type !== 'Invoice') {
621
621
  CommonDetails.splice(2, 0, shared_pdf_service_1.SharedPDFService.GetUnderLine());
622
622
  }
623
- if (!utils_1.TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
623
+ if (!tr_utils_1.TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
624
624
  CommonDetails.push({ text: '', pageBreak: 'after' });
625
625
  }
626
626
  return CommonDetails;
@@ -3,25 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SalesPrintService = void 0;
4
4
  const shared_print_service_1 = require("./shared-print.service");
5
5
  const sales_totals_service_1 = require("./sales-totals.service");
6
- const utils_1 = require("../shared/utils");
6
+ const tr_utils_1 = require("../utils/tr-utils");
7
7
  const code_enums_1 = require("../enums/code-enums");
8
- const my_date_1 = require("../shared/my-date");
8
+ const my_date_1 = require("../utils/my-date");
9
9
  const enums_1 = require("../enums/enums");
10
10
  const aggregation_1 = require("../aggregation/aggregation");
11
11
  class SalesPrintService {
12
12
  static GetSalesPrintInfo(OriginalInvoiceData, OriginalEntityData, image, IncludeGST, ConsolidateGST, TaxCodes, IsProforma, isOtherIndustry) {
13
13
  var _a, _b;
14
- let ForInsurance = !utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.InsId);
14
+ let ForInsurance = !tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.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);
22
- InvoicePrintData.DoS = utils_1.TrUtils.Stringify(argInvoiceData.DoS);
21
+ InvoicePrintData.Settings = tr_utils_1.TrUtils.Stringify(argInvoiceData.Settings);
22
+ InvoicePrintData.DoS = tr_utils_1.TrUtils.Stringify(argInvoiceData.DoS);
23
23
  let SType;
24
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.SType)) {
24
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.SType)) {
25
25
  SType = OriginalInvoiceData.SType;
26
26
  }
27
27
  InvoicePrintData = this.GetPrintConditionsBasedOnInput(InvoicePrintData, IncludeGST, ConsolidateGST, ForInsurance, SType, argInvoiceData, IsProforma);
@@ -29,7 +29,7 @@ class SalesPrintService {
29
29
  InvoicePrintData = shared_print_service_1.PrintSharedService.GetEntityHeaderStyles(InvoicePrintData, OriginalEntityData, image);
30
30
  InvoicePrintData = this.GetInvoiceOtherDetailsForPrint(InvoicePrintData, argInvoiceData);
31
31
  // console.log(InvoicePrintData);
32
- let IsTaxable = (IncludeGST && utils_1.TrUtils.isTaxable(argInvoiceData.Settings.Tax)) ? true : false;
32
+ let IsTaxable = (IncludeGST && tr_utils_1.TrUtils.isTaxable(argInvoiceData.Settings.Tax)) ? true : false;
33
33
  // argInvoiceData.Items = argInvoiceData.Items.filter((item: any) => {
34
34
  // return TrUtils.IsNull(item.Type);
35
35
  // });
@@ -37,7 +37,7 @@ class SalesPrintService {
37
37
  if (ConsolidateGST) {
38
38
  finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustItemAfterTax;
39
39
  }
40
- InvoicePrintData = utils_1.TrUtils.ConcatObjects(InvoicePrintData, finalTotalsData);
40
+ InvoicePrintData = tr_utils_1.TrUtils.ConcatObjects(InvoicePrintData, finalTotalsData);
41
41
  // InvoicePrintData.Ops = this.GetLaborPrintInfo(InvoicePrintData.Ops, ConsolidateGST, TaxCodes);
42
42
  InvoicePrintData.Items = this.GetItemsPrintInfo(InvoicePrintData.Items, ConsolidateGST, TaxCodes, isOtherIndustry, (_b = (_a = OriginalEntityData.Entity.Settings) === null || _a === void 0 ? void 0 : _a.Acc) === null || _b === void 0 ? void 0 : _b.LTot);
43
43
  // argInvoiceData = this.ReverseItemsForInvoicePrint(argInvoiceData);
@@ -45,7 +45,7 @@ class SalesPrintService {
45
45
  InvoicePrintData = this.GetFormattedProductDataForPrint(argInvoiceData, InvoicePrintData);
46
46
  InvoicePrintData = this.GetBillNameForInvoicePrint(argInvoiceData, InvoicePrintData);
47
47
  InvoicePrintData = this.GetShipToForSOPrint(argInvoiceData, InvoicePrintData);
48
- if (utils_1.TrUtils.IsNull(argInvoiceData.Payments)) {
48
+ if (tr_utils_1.TrUtils.IsNull(argInvoiceData.Payments)) {
49
49
  argInvoiceData.Payments = [];
50
50
  }
51
51
  let PaymentData = this.GetPaymentsTotal(argInvoiceData.Payments, InvoicePrintData.Total, argInvoiceData.Sts);
@@ -54,7 +54,7 @@ class SalesPrintService {
54
54
  }
55
55
  InvoicePrintData.Due = PaymentData.Due;
56
56
  InvoicePrintData.Paid = PaymentData.Paid;
57
- if (!utils_1.TrUtils.IsNull(PaymentData.Sts)) {
57
+ if (!tr_utils_1.TrUtils.IsNull(PaymentData.Sts)) {
58
58
  InvoicePrintData.Sts = PaymentData.Sts;
59
59
  }
60
60
  InvoicePrintData.Consolidate = ConsolidateGST;
@@ -72,11 +72,11 @@ class SalesPrintService {
72
72
  InvoicePrintData.IncludeGST = IncludeGST;
73
73
  InvoicePrintData.ConsolidateGST = ConsolidateGST;
74
74
  InvoicePrintData.ShowAccParts = false;
75
- InvoicePrintData.ShowIGST = (utils_1.TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
75
+ InvoicePrintData.ShowIGST = (tr_utils_1.TrUtils.IsNull(SType) || (SType === 'Intra')) ? false : true;
76
76
  InvoicePrintData.ShowTaxColumn = (IncludeGST && !ConsolidateGST) ? true : false;
77
77
  // InvoicePrintData.ShowDiscountColumn = (!ForInsurance && !ConsolidateGST) ? true : false;
78
78
  InvoicePrintData = this.GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma);
79
- InvoicePrintData.PrDate = utils_1.TrUtils.IsNull(OriginalInvoiceData.PrDate) ? '' : my_date_1.MyDate.ConvertUTCDateToReadable(OriginalInvoiceData.PrDate);
79
+ InvoicePrintData.PrDate = tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.PrDate) ? '' : my_date_1.MyDate.ConvertUTCDateToReadable(OriginalInvoiceData.PrDate);
80
80
  return InvoicePrintData;
81
81
  }
82
82
  static GetInvoiceTypeHeading(InvoicePrintData, OriginalInvoiceData, IncludeGST, ConsolidateGST, IsProforma) {
@@ -102,59 +102,59 @@ class SalesPrintService {
102
102
  let TotalAmt = 0;
103
103
  let DiscAmt = 0;
104
104
  Items.forEach((Item) => {
105
- if (utils_1.TrUtils.IsNull(Item.Type) || Item.Type === 'Lab') {
106
- Amt = Amt + utils_1.TrUtils.SetValueToZeroIfNull(Item.UnAmt);
107
- DiscAmt = DiscAmt + utils_1.TrUtils.SetValueToZeroIfNull(Item.Disc) + utils_1.TrUtils.SetValueToZeroIfNull(Item.RecDisc);
108
- TaxAmt = TaxAmt + utils_1.TrUtils.SetValueToZeroIfNull(Item.CGST) + utils_1.TrUtils.SetValueToZeroIfNull(Item.SGST)
109
- + utils_1.TrUtils.SetValueToZeroIfNull(Item.IGST);
105
+ if (tr_utils_1.TrUtils.IsNull(Item.Type) || Item.Type === 'Lab') {
106
+ Amt = Amt + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.UnAmt);
107
+ DiscAmt = DiscAmt + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.Disc) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.RecDisc);
108
+ TaxAmt = TaxAmt + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.CGST) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.SGST)
109
+ + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.IGST);
110
110
  let NetAmt = (0, aggregation_1.subtraction)(Item.UnAmt, Item.Disc, Item.RecDisc);
111
- TotalAmt = TotalAmt + utils_1.TrUtils.SetValueToZeroIfNull(NetAmt) +
112
- utils_1.TrUtils.SetValueToZeroIfNull(Item.CGST) + utils_1.TrUtils.SetValueToZeroIfNull(Item.SGST)
113
- + utils_1.TrUtils.SetValueToZeroIfNull(Item.IGST);
111
+ TotalAmt = TotalAmt + tr_utils_1.TrUtils.SetValueToZeroIfNull(NetAmt) +
112
+ tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.CGST) + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.SGST)
113
+ + tr_utils_1.TrUtils.SetValueToZeroIfNull(Item.IGST);
114
114
  if (Consolidate) {
115
115
  let AfterDiscForEach = Item.AfterItemDisc / Item.Qty;
116
116
  let CTaxAmtPerItem = Item.CGST / Item.Qty;
117
117
  let STaxAmtPerItem = Item.SGST / Item.Qty;
118
118
  let ITaxAmtPerItem = Item.IGST / Item.Qty;
119
- Item.UnPr = utils_1.TrUtils.FixedTo(AfterDiscForEach + CTaxAmtPerItem + STaxAmtPerItem + ITaxAmtPerItem);
119
+ Item.UnPr = tr_utils_1.TrUtils.FixedTo(AfterDiscForEach + CTaxAmtPerItem + STaxAmtPerItem + ITaxAmtPerItem);
120
120
  }
121
121
  else {
122
- Item.UnPr = utils_1.TrUtils.FixPriceValue(Item.UnPr);
122
+ Item.UnPr = tr_utils_1.TrUtils.FixPriceValue(Item.UnPr);
123
123
  }
124
- if (isOtherIndustry && utils_1.TrUtils.IsNull(Item.Type) && !utils_1.TrUtils.IsNull(Item.Model) && !utils_1.TrUtils.IsNull(Item.TR)) {
124
+ if (isOtherIndustry && tr_utils_1.TrUtils.IsNull(Item.Type) && !tr_utils_1.TrUtils.IsNull(Item.Model) && !tr_utils_1.TrUtils.IsNull(Item.TR)) {
125
125
  Item.Desc = Item.Desc + '( ' + Item.Model + ', ' + Item.TR + ' TR )';
126
126
  }
127
- Item.CGSTAmt = utils_1.TrUtils.FixPriceValue(Item.CGST);
128
- Item.SGSTAmt = utils_1.TrUtils.FixPriceValue(Item.SGST);
129
- Item.IGSTAmt = utils_1.TrUtils.FixPriceValue(Item.IGST);
127
+ Item.CGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.CGST);
128
+ Item.SGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.SGST);
129
+ Item.IGSTAmt = tr_utils_1.TrUtils.FixPriceValue(Item.IGST);
130
130
  Item.CGSTPerc = shared_print_service_1.PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
131
131
  Item.SGSTPerc = shared_print_service_1.PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
132
132
  Item.IGSTPerc = shared_print_service_1.PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes);
133
133
  if (LineTotal === 'AT') {
134
- Item.LineTotal = utils_1.TrUtils.FixPriceValue(Item.AfterItemTax);
134
+ Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue(Item.AfterItemTax);
135
135
  }
136
136
  else {
137
- Item.LineTotal = utils_1.TrUtils.FixPriceValue((0, aggregation_1.subtraction)(Item.UnAmt, Item.Disc));
137
+ Item.LineTotal = tr_utils_1.TrUtils.FixPriceValue((0, aggregation_1.subtraction)(Item.UnAmt, Item.Disc));
138
138
  }
139
- if (!utils_1.TrUtils.IsZero(Item.Qty) && !utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
139
+ if (!tr_utils_1.TrUtils.IsZero(Item.Qty) && !tr_utils_1.TrUtils.CheckInvalidSelect(Item.UoM)) {
140
140
  Item.QtyAndUoM = Item.Qty + ' ' + Item.UoM;
141
141
  }
142
142
  }
143
143
  else {
144
144
  if (Item.Type === 'Sub') {
145
- Item.LineTotal = utils_1.TrUtils.FixedTo(Amt);
145
+ Item.LineTotal = tr_utils_1.TrUtils.FixedTo(Amt);
146
146
  Amt = 0;
147
147
  }
148
148
  if (Item.Type === 'Tax') {
149
- Item.LineTotal = utils_1.TrUtils.FixedTo(TaxAmt);
149
+ Item.LineTotal = tr_utils_1.TrUtils.FixedTo(TaxAmt);
150
150
  TaxAmt = 0;
151
151
  }
152
152
  if (Item.Type === 'Disc') {
153
- Item.LineTotal = utils_1.TrUtils.FixedTo(DiscAmt);
153
+ Item.LineTotal = tr_utils_1.TrUtils.FixedTo(DiscAmt);
154
154
  DiscAmt = 0;
155
155
  }
156
156
  if (Item.Type === 'Tot') {
157
- Item.LineTotal = utils_1.TrUtils.FixedTo(TotalAmt);
157
+ Item.LineTotal = tr_utils_1.TrUtils.FixedTo(TotalAmt);
158
158
  TotalAmt = 0;
159
159
  }
160
160
  }
@@ -177,15 +177,15 @@ class SalesPrintService {
177
177
  return PrintInfo;
178
178
  }
179
179
  static GetFormattedProductDataForPrint(OriginalInvoiceData, InvoicePrintData) {
180
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.Prod)) {
180
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.Prod)) {
181
181
  InvoicePrintData.Product = OriginalInvoiceData.Prod;
182
- if (utils_1.TrUtils.IsNull(InvoicePrintData.Product.VIN)) {
182
+ if (tr_utils_1.TrUtils.IsNull(InvoicePrintData.Product.VIN)) {
183
183
  InvoicePrintData.Product.VIN = '';
184
184
  }
185
- if (utils_1.TrUtils.IsNull(InvoicePrintData.Product.RegNo)) {
185
+ if (tr_utils_1.TrUtils.IsNull(InvoicePrintData.Product.RegNo)) {
186
186
  InvoicePrintData.Product.RegNo = '';
187
187
  }
188
- if (utils_1.TrUtils.IsNull(InvoicePrintData.Product.EngNo)) {
188
+ if (tr_utils_1.TrUtils.IsNull(InvoicePrintData.Product.EngNo)) {
189
189
  InvoicePrintData.Product.EngNo = '';
190
190
  }
191
191
  InvoicePrintData.MIn = OriginalInvoiceData.Prod.MIn;
@@ -199,17 +199,17 @@ class SalesPrintService {
199
199
  Customer.DLNo = OriginalInvoiceData.ShipTo.DLNo;
200
200
  Customer.Adrs = [];
201
201
  Customer.Cons = [];
202
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.ShipTo.Adrs)) {
202
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.ShipTo.Adrs)) {
203
203
  Customer.Adrs.push(OriginalInvoiceData.ShipTo.Adrs.A1);
204
- if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Adrs.A2)) {
204
+ if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Adrs.A2)) {
205
205
  Customer.Adrs.push(OriginalInvoiceData.ShipTo.Adrs.A2);
206
206
  }
207
- if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Adrs.Ct)) {
207
+ if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Adrs.Ct)) {
208
208
  Customer.Adrs.push(OriginalInvoiceData.ShipTo.Adrs.Ct);
209
209
  }
210
210
  }
211
211
  Customer.GSTIN = OriginalInvoiceData.ShipTo.GSTIN;
212
- if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Ph)) {
212
+ if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.ShipTo.Ph)) {
213
213
  Customer.Cons = [
214
214
  {
215
215
  Type: 'M',
@@ -218,7 +218,7 @@ class SalesPrintService {
218
218
  ];
219
219
  }
220
220
  InvoicePrintData.ShippmentTo = Customer;
221
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.ShipTo.InsId)) {
221
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.ShipTo.InsId)) {
222
222
  InvoicePrintData.Cust = this.GetCustomerDetails(OriginalInvoiceData);
223
223
  }
224
224
  return InvoicePrintData;
@@ -229,17 +229,17 @@ class SalesPrintService {
229
229
  Customer.DLNo = OriginalInvoiceData.BillTo.DLNo;
230
230
  Customer.Adrs = [];
231
231
  Customer.Cons = [];
232
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.Adrs)) {
232
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.Adrs)) {
233
233
  Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.A1);
234
- if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Adrs.A2)) {
234
+ if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Adrs.A2)) {
235
235
  Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.A2);
236
236
  }
237
- if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Adrs.Ct)) {
237
+ if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Adrs.Ct)) {
238
238
  Customer.Adrs.push(OriginalInvoiceData.BillTo.Adrs.Ct);
239
239
  }
240
240
  }
241
241
  Customer.GSTIN = OriginalInvoiceData.BillTo.GSTIN;
242
- if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Ph)) {
242
+ if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.BillTo.Ph)) {
243
243
  Customer.Cons = [
244
244
  {
245
245
  Type: 'M',
@@ -248,7 +248,7 @@ class SalesPrintService {
248
248
  ];
249
249
  }
250
250
  InvoicePrintData.Customer = Customer;
251
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.InsId)) {
251
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.BillTo.InsId)) {
252
252
  InvoicePrintData.Cust = this.GetCustomerDetails(OriginalInvoiceData);
253
253
  }
254
254
  return InvoicePrintData;
@@ -257,7 +257,7 @@ class SalesPrintService {
257
257
  let Customer = {};
258
258
  Customer.Name = this.GetBillToName(OriginalInvoiceData.Cust.Title, OriginalInvoiceData.Cust.Name);
259
259
  Customer.Cons = [];
260
- if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Ph)) {
260
+ if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Ph)) {
261
261
  Customer.Cons = [
262
262
  {
263
263
  Type: 'M',
@@ -267,9 +267,9 @@ class SalesPrintService {
267
267
  }
268
268
  Customer.GSTIN = OriginalInvoiceData.Cust.GSTIN;
269
269
  Customer.Adrs = [];
270
- if (!utils_1.TrUtils.IsNull(OriginalInvoiceData.Cust.Adrs)) {
270
+ if (!tr_utils_1.TrUtils.IsNull(OriginalInvoiceData.Cust.Adrs)) {
271
271
  Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.A1);
272
- if (!utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Adrs.A2)) {
272
+ if (!tr_utils_1.TrUtils.IsEmpty(OriginalInvoiceData.Cust.Adrs.A2)) {
273
273
  Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.A2);
274
274
  }
275
275
  Customer.Adrs.push(OriginalInvoiceData.Cust.Adrs.Ct);
@@ -279,7 +279,7 @@ class SalesPrintService {
279
279
  return Customer;
280
280
  }
281
281
  static GetBillToName(Title, Name) {
282
- return utils_1.TrUtils.IsEmpty(Title) ? Name : Title + ' ' + Name;
282
+ return tr_utils_1.TrUtils.IsEmpty(Title) ? Name : Title + ' ' + Name;
283
283
  }
284
284
  static GetPaymentsTotal(InvoicePayments, Total, InvoiceStatus) {
285
285
  var i = 0;
@@ -292,7 +292,7 @@ class SalesPrintService {
292
292
  Data.Due = 0;
293
293
  }
294
294
  else {
295
- Data.Due = utils_1.TrUtils.FixedTo(Total - PaidTotal);
295
+ Data.Due = tr_utils_1.TrUtils.FixedTo(Total - PaidTotal);
296
296
  }
297
297
  if (Data.Due < 0) {
298
298
  Data.Due = 0;
@@ -300,7 +300,7 @@ class SalesPrintService {
300
300
  if (Data.Due === 0) {
301
301
  Data.Sts = enums_1.InvoiceStatusEnum.Closed;
302
302
  }
303
- Data.Paid = utils_1.TrUtils.FixedTo(PaidTotal);
303
+ Data.Paid = tr_utils_1.TrUtils.FixedTo(PaidTotal);
304
304
  return Data;
305
305
  }
306
306
  }