shareneus 1.0.5

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 +60 -0
  2. package/dist/enums/cache-enums.js +37 -0
  3. package/dist/enums/code-enums.js +288 -0
  4. package/dist/enums/enums.js +362 -0
  5. package/dist/enums/industry-enums.js +24 -0
  6. package/dist/excel-files/GSTR-RO-excel.service.js +935 -0
  7. package/dist/excel-files/GSTR1-excel.service.js +295 -0
  8. package/dist/excel-files/GSTR2-excel.service.js +295 -0
  9. package/dist/excel-files/analysis-excel.service.js +297 -0
  10. package/dist/excel-files/category-wise-item-excel.service.js +274 -0
  11. package/dist/excel-files/cust-balance-excel.service.js +287 -0
  12. package/dist/excel-files/cust-wise-sales-details.js +320 -0
  13. package/dist/excel-files/cust-wise-sales-summary-excel.service.js +302 -0
  14. package/dist/excel-files/expiring-drugs-excel.service.js +292 -0
  15. package/dist/excel-files/insurance-expire-excel.service.js +301 -0
  16. package/dist/excel-files/invoice-wise-excel.service.js +857 -0
  17. package/dist/excel-files/item-wise-doctor-sale-excel.service.js +258 -0
  18. package/dist/excel-files/item-wise-mout-details.js +292 -0
  19. package/dist/excel-files/item-wise-mout-summary.js +286 -0
  20. package/dist/excel-files/items-wise-sales-excel.service.js +314 -0
  21. package/dist/excel-files/manf-wise-sales-excel.service.js +276 -0
  22. package/dist/excel-files/operator-wise-details.js +265 -0
  23. package/dist/excel-files/operator-wise-summary.js +266 -0
  24. package/dist/excel-files/payment-receive-excel.service.js +225 -0
  25. package/dist/excel-files/payments-made-excel.service.js +302 -0
  26. package/dist/excel-files/repair-orders-excel.service.js +255 -0
  27. package/dist/excel-files/sa-wise-labor-sales-excel.service.js +232 -0
  28. package/dist/excel-files/sa-wise-part-sales-excel.service.js +232 -0
  29. package/dist/excel-files/sale-summary-excel.service.js +326 -0
  30. package/dist/excel-files/sales-by-service-details-excel.service.js +1 -0
  31. package/dist/excel-files/sales-by-service-summary-excel.service.js +422 -0
  32. package/dist/excel-files/scheduled-drug-summary-excel.service.js +367 -0
  33. package/dist/excel-files/scheduled-drugs-excel.service.js +366 -0
  34. package/dist/excel-files/spares-issue-excel.service.js +492 -0
  35. package/dist/excel-files/stock-excel.service.js +283 -0
  36. package/dist/excel-files/tally-sales-import.service.js +765 -0
  37. package/dist/excel-files/ven-balance-excel.service.js +293 -0
  38. package/dist/index.js +237 -0
  39. package/dist/services/analysis-pdf.service.js +105 -0
  40. package/dist/services/appointment-total.service.js +253 -0
  41. package/dist/services/auto-sales-receipt-pdf.service.js +539 -0
  42. package/dist/services/category-wise-item-pdf.service.js +98 -0
  43. package/dist/services/checklist-pdf.js +140 -0
  44. package/dist/services/checklists-pdf.js +124 -0
  45. package/dist/services/cn-print.service.js +211 -0
  46. package/dist/services/consultation-fee-receipt.service.js +378 -0
  47. package/dist/services/consultation-full-pdf.service.js +220 -0
  48. package/dist/services/consultation-pdf.service.js +360 -0
  49. package/dist/services/credit-note-pdf.service.js +578 -0
  50. package/dist/services/credit-note-totals.service.js +328 -0
  51. package/dist/services/cust-wise-sales-details-pdf.service.js +118 -0
  52. package/dist/services/cust-wise-sales-summary-pdf.service.js +111 -0
  53. package/dist/services/customer-balances-pdf.service.js +169 -0
  54. package/dist/services/dc-landscape-pdf.service.js +903 -0
  55. package/dist/services/dc-landscape-without-price-pdf.service.js +853 -0
  56. package/dist/services/dc-without-price-pdf.service.js +489 -0
  57. package/dist/services/debit-note-pdf.service.js +673 -0
  58. package/dist/services/debit-note-print.service.js +234 -0
  59. package/dist/services/debit-note-totals.service.js +293 -0
  60. package/dist/services/delivery-challan-pdf.service.js +434 -0
  61. package/dist/services/delivery-challan-print.service.js +177 -0
  62. package/dist/services/delivery-challan-totals.js +339 -0
  63. package/dist/services/equipment-design-pdf.service.js +144 -0
  64. package/dist/services/est.print-service.js +1053 -0
  65. package/dist/services/expiring-drugs-pdf.service.js +156 -0
  66. package/dist/services/hc-inv-pdf.service.js +837 -0
  67. package/dist/services/insurance-expire-pdf.service.js +99 -0
  68. package/dist/services/inv-pdf.service.js +785 -0
  69. package/dist/services/inv-print.service.js +415 -0
  70. package/dist/services/invoice-landscape-pdf.service.js +909 -0
  71. package/dist/services/invoice-total.service.js +659 -0
  72. package/dist/services/issue-parts-pdf.service.js +763 -0
  73. package/dist/services/item-detais-pdf.js +136 -0
  74. package/dist/services/item-wise-doctor-sale-pdf.service.js +164 -0
  75. package/dist/services/item-wise-mout-details-pdf.js +107 -0
  76. package/dist/services/item-wise-mout-summary-pdf.js +99 -0
  77. package/dist/services/item-wise-sales-pdf.service.js +178 -0
  78. package/dist/services/manf-wise-sales-pdf.service.js +173 -0
  79. package/dist/services/meeting-pdf.js +369 -0
  80. package/dist/services/mout-pdf.service.js +503 -0
  81. package/dist/services/operator-wise-details-pdf.service.js +103 -0
  82. package/dist/services/operator-wise-summary-pdf.js +101 -0
  83. package/dist/services/pack-ship-pdf.service.js +105 -0
  84. package/dist/services/pack-ship-print.service.js +167 -0
  85. package/dist/services/payment-pdf.service.js +373 -0
  86. package/dist/services/payment-report-pdf.service.js +106 -0
  87. package/dist/services/po-totals.service.js +279 -0
  88. package/dist/services/pos-receipt-pdf.js +438 -0
  89. package/dist/services/purchase-order-pdf.service.js +924 -0
  90. package/dist/services/purchase-order-print.service.js +150 -0
  91. package/dist/services/purchase-order-totals.service.js +280 -0
  92. package/dist/services/receipt-print.service.js +50 -0
  93. package/dist/services/reorder-point-pdf.service.js +151 -0
  94. package/dist/services/repair-orders-pdf.service.js +172 -0
  95. package/dist/services/ro-pdf.service.js +1764 -0
  96. package/dist/services/ro-print-service.js +737 -0
  97. package/dist/services/ro-totals.service.js +1241 -0
  98. package/dist/services/sales-by-service-pdf.service.js +116 -0
  99. package/dist/services/sales-pdf.service.js +630 -0
  100. package/dist/services/sales-print.service.js +305 -0
  101. package/dist/services/sales-receipt-pdf.service.js +611 -0
  102. package/dist/services/sales-receipt-print.service.js +425 -0
  103. package/dist/services/sales-totals.service.js +339 -0
  104. package/dist/services/scheduled-drug-pdf.service.js +176 -0
  105. package/dist/services/scheduled-drug-summary-pdf.service.js +188 -0
  106. package/dist/services/separate-wo-print.service.js +351 -0
  107. package/dist/services/shared-inv-pdf.service.js +763 -0
  108. package/dist/services/shared-pdf.service.js +2569 -0
  109. package/dist/services/shared-print.service.js +885 -0
  110. package/dist/services/task-pdf.service.js +220 -0
  111. package/dist/services/task-reports-pdf.service.js +296 -0
  112. package/dist/services/technician-pdf.service.js +238 -0
  113. package/dist/services/technician-print.service.js +87 -0
  114. package/dist/services/transfer-order-pdf.service.js +139 -0
  115. package/dist/services/vendor-balances-pdf.service.js +101 -0
  116. package/dist/services/vendor-credit-note-pdf.service.js +1007 -0
  117. package/dist/services/vendor-credit-note-print.service.js +104 -0
  118. package/dist/services/vendor-credit-note-totals.service.js +327 -0
  119. package/dist/services/vendor-debit-note-pdf.service.js +561 -0
  120. package/dist/services/vendor-debit-note-print.service.js +245 -0
  121. package/dist/services/vendor-debit-note-totals.service.js +305 -0
  122. package/dist/utils/my-date.js +652 -0
  123. package/dist/utils/tr-utils.js +354 -0
  124. package/package.json +24 -0
  125. package/tsconfig.json +109 -0
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AnalysisPDFService = void 0;
4
+ const my_date_1 = require("../utils/my-date");
5
+ const tr_utils_1 = require("../utils/tr-utils");
6
+ const shared_pdf_service_1 = require("./shared-pdf.service");
7
+ class AnalysisPDFService {
8
+ static GetAnalysisPDFPrint(InvoicesData, CName, isPhar, isHC, IsSales, HeaerName, searchValue, HeaderText) {
9
+ var dd = {
10
+ info: {
11
+ title: 'Analysis',
12
+ },
13
+ header: function (currentPage, pageCount) {
14
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
15
+ },
16
+ pageMargins: [10, 15, 10, 15],
17
+ content: [
18
+ { text: '' + CName + '', style: ['header'] },
19
+ { text: HeaerName, alignment: 'center', fontSize: 15, bold: true },
20
+ shared_pdf_service_1.SharedPDFService.GetSearchValueDetails(searchValue),
21
+ this.GetInvoiceDataTable(InvoicesData, isPhar, isHC, IsSales, HeaderText),
22
+ ],
23
+ styles: shared_pdf_service_1.SharedPDFService.GetStyles()
24
+ };
25
+ return dd;
26
+ }
27
+ static GetInvoiceDataTable(InvoicesData, isPhar, isHC, IsSales, HeaderText) {
28
+ let Data = [];
29
+ Data.push(this.GetItemsTable(InvoicesData, isPhar, isHC, IsSales, HeaderText));
30
+ return Data;
31
+ }
32
+ static getTableWidths(isHC) {
33
+ // if (isHC) {
34
+ return [25, '*', '*', '*', '*', '*', '*', '*', '*', '*', '*'];
35
+ // } else {
36
+ // return [25, '*', 40, 40, 80];
37
+ // }
38
+ }
39
+ static GetItemsTable(InvoiceData, isPhar, isHC, IsSales, HeaderText) {
40
+ return {
41
+ style: 'tableExample',
42
+ marginTop: 3,
43
+ marginBottom: 5,
44
+ table: {
45
+ widths: this.getTableWidths(isHC),
46
+ headerRows: 1,
47
+ body: this.BuildTableBodyForLaborAndParts(InvoiceData, isPhar, isHC, IsSales, HeaderText)
48
+ },
49
+ layout: {
50
+ hLineWidth: function (i, node) {
51
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0.5;
52
+ },
53
+ vLineWidth: function (i, node) {
54
+ return (i === 0 || i === node.table.widths.length) ? 1 : 0.5;
55
+ },
56
+ hLineColor: function (i, node) {
57
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 'gray' : 'lightgrey';
58
+ },
59
+ vLineColor: function (i, node) {
60
+ return 'gray';
61
+ },
62
+ }
63
+ };
64
+ }
65
+ static BuildTableBodyForLaborAndParts(InvoiceData, isPhar, isHC, IsSales, HeaderText) {
66
+ let body = this.GetHeaderNames(isPhar, isHC, HeaderText);
67
+ InvoiceData.forEach((invoice, index) => {
68
+ let dataRow = [];
69
+ dataRow.push({ text: index + 1 });
70
+ if (HeaderText === 'Month') {
71
+ dataRow.push({ text: my_date_1.MyDate.GetMonthName(invoice._id), style: ['headerstyle'], });
72
+ }
73
+ else {
74
+ dataRow.push({ text: my_date_1.MyDate.ConvertUTCDateToReadable(invoice._id), style: ['headerstyle'], });
75
+ }
76
+ dataRow.push({ text: invoice.Count, alignment: 'right' });
77
+ dataRow.push({ text: invoice.Qty, alignment: 'right' });
78
+ dataRow.push({ text: invoice.OfQty, alignment: 'right' });
79
+ dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(invoice.SubTotal), alignment: 'right' });
80
+ dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(invoice.Disc), alignment: 'right' });
81
+ dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(invoice.Tax), alignment: 'right' });
82
+ dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(invoice.Adjust), alignment: 'right' });
83
+ dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(invoice.Round), alignment: 'right' });
84
+ dataRow.push({ text: tr_utils_1.TrUtils.FixPriceValue(invoice.Total), alignment: 'right', style: ['headerstyle'], });
85
+ body.push(dataRow);
86
+ });
87
+ return body;
88
+ }
89
+ static GetHeaderNames(isPhar, isHC, HeaderText) {
90
+ let HeadingNames;
91
+ HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left', line: true },
92
+ { text: HeaderText, style: 'tableheader1', Field: 'Name' },
93
+ { text: 'Count', style: 'tableheader1', Field: 'Count', alignment: 'right' },
94
+ { text: 'Qty', style: 'tableheader1', Field: 'Qty', alignment: 'right' },
95
+ { text: 'Offer Qty', style: 'tableheader1', Field: 'OfQty', alignment: 'right' },
96
+ { text: 'SubTotal', style: 'tableheader1', Field: 'SubTotal', alignment: 'right' },
97
+ { text: 'Discount', style: 'tableheader1', Field: 'Disc', alignment: 'right' },
98
+ { text: 'Tax', style: 'tableheader1', Field: 'Tax', alignment: 'right' },
99
+ { text: 'Adjustment', style: 'tableheader1', Field: 'Adjust', alignment: 'right' },
100
+ { text: 'Round off', style: 'tableheader1', Field: 'Round', alignment: 'right' },
101
+ { text: 'Total', style: 'tableheader1', Field: 'Total', alignment: 'right' }]];
102
+ return HeadingNames;
103
+ }
104
+ }
105
+ exports.AnalysisPDFService = AnalysisPDFService;
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppointmentTotalsService = void 0;
4
+ const enums_1 = require("../enums/enums");
5
+ const tr_utils_1 = require("../utils/tr-utils");
6
+ class AppointmentTotalsService {
7
+ static GetTotalsValue(OriRecordData, TaxCodes, detailedInfo, withItems) {
8
+ let dupRecordData = tr_utils_1.TrUtils.Stringify(OriRecordData);
9
+ let argRecordData = {};
10
+ dupRecordData.Ops = this.CalculateLaborValues(dupRecordData.Ops, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax));
11
+ argRecordData = this.GetROTotalsData(argRecordData, dupRecordData, TaxCodes, withItems, detailedInfo);
12
+ return argRecordData;
13
+ }
14
+ static CalculateLaborValues(opCodesList, isTaxable) {
15
+ opCodesList = this.FilterValidLaborItems(opCodesList);
16
+ opCodesList = this.ResetLaborValuesIfInvalid(opCodesList);
17
+ opCodesList = this.GetOperationsDiscountPrice(opCodesList);
18
+ opCodesList = this.GetOperationsAfterDiscount(opCodesList);
19
+ opCodesList = this.GetOperationsAfterTax(opCodesList, isTaxable);
20
+ return opCodesList;
21
+ }
22
+ static FilterValidLaborItems(opCodesList) {
23
+ opCodesList = opCodesList.filter((Labor) => {
24
+ return Labor.Sts !== enums_1.LaborStatusEnum.Cancelled && Labor.Sts !== enums_1.LaborStatusEnum.Declined;
25
+ });
26
+ return opCodesList;
27
+ }
28
+ static ResetLaborValuesIfInvalid(opCodesList) {
29
+ opCodesList.forEach((Operation) => {
30
+ Operation = this.ResetLaborValueIfInvalid(Operation);
31
+ });
32
+ return opCodesList;
33
+ }
34
+ static ResetLaborValueIfInvalid(Operation) {
35
+ Operation.Perc = tr_utils_1.TrUtils.SetPercToStringIfNull(Operation.Perc);
36
+ Operation.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.Disc);
37
+ Operation.Pr = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.Pr);
38
+ Operation.CCGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.CCGST);
39
+ Operation.CSGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.CSGST);
40
+ Operation.CIGST = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.CIGST);
41
+ Operation.NetAmt = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.NetAmt);
42
+ Operation.RecDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(Operation.RecDisc);
43
+ return Operation;
44
+ }
45
+ static GetOperationsDiscountPrice(OperationsList) {
46
+ OperationsList.forEach((Operation) => {
47
+ Operation.CustDiscountedPrice = Operation.Disc + Operation.RecDisc;
48
+ });
49
+ return OperationsList;
50
+ }
51
+ static GetOperationsAfterDiscount(OperationsList) {
52
+ OperationsList.forEach((Operation) => {
53
+ let CustAfterLaborDisc = 0;
54
+ if (Operation.PBy === enums_1.PayTypeEnum.Customer) {
55
+ CustAfterLaborDisc = Operation.NetAmt;
56
+ }
57
+ else {
58
+ CustAfterLaborDisc = Operation.NetAmt;
59
+ }
60
+ Operation.CustAfterLaborDisc = CustAfterLaborDisc;
61
+ });
62
+ return OperationsList;
63
+ }
64
+ static GetOperationsAfterTax(OperationsList, isTaxable) {
65
+ OperationsList.forEach((Operation) => {
66
+ if (!isTaxable) {
67
+ Operation.CustAfterTax = Operation.CustAfterLaborDisc;
68
+ }
69
+ else {
70
+ if (Operation.PBy === enums_1.PayTypeEnum.Customer) {
71
+ Operation.CustAfterTax = Operation.CustAfterLaborDisc + Operation.CCGST + Operation.CSGST + Operation.CIGST;
72
+ }
73
+ else {
74
+ Operation.CustAfterTax = Operation.CustAfterLaborDisc + Operation.CCGST + Operation.CSGST + Operation.CIGST;
75
+ }
76
+ }
77
+ });
78
+ return OperationsList;
79
+ }
80
+ static GetROTotalsData(argRecordData, dupRecordData, TaxCodes, withItems, detailedInfo) {
81
+ dupRecordData = this.ResetDiscountValuesIfInvalid(dupRecordData);
82
+ argRecordData = this.SetMainDiscountValues(argRecordData, dupRecordData, detailedInfo);
83
+ argRecordData = this.GetFinalCustomerTotalsData(argRecordData, dupRecordData, detailedInfo);
84
+ if (detailedInfo) {
85
+ argRecordData = this.GetDetailedTotalsData(argRecordData, dupRecordData, TaxCodes);
86
+ }
87
+ if (withItems) {
88
+ argRecordData.Ops = dupRecordData.Ops;
89
+ }
90
+ return argRecordData;
91
+ }
92
+ static ResetDiscountValuesIfInvalid(dupRecordData) {
93
+ dupRecordData.LPerc = tr_utils_1.TrUtils.SetPercToStringIfNull(dupRecordData.LPerc);
94
+ dupRecordData.Perc = tr_utils_1.TrUtils.SetPercToStringIfNull(dupRecordData.Perc);
95
+ dupRecordData.LDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(dupRecordData.LDisc);
96
+ dupRecordData.Disc = tr_utils_1.TrUtils.SetValueToZeroIfNull(dupRecordData.Disc);
97
+ return dupRecordData;
98
+ }
99
+ static SetMainDiscountValues(argRecordData, dupRecordData, detailedInfo) {
100
+ argRecordData.LDisc = dupRecordData.LDisc;
101
+ argRecordData.LPerc = dupRecordData.LPerc;
102
+ argRecordData.PDisc = dupRecordData.PDisc;
103
+ argRecordData.PPerc = dupRecordData.PPerc;
104
+ argRecordData.Disc = dupRecordData.Disc;
105
+ argRecordData.Perc = dupRecordData.Perc;
106
+ if (detailedInfo) {
107
+ argRecordData.FixedLDisc = dupRecordData.LDisc;
108
+ argRecordData.FixedDisc = dupRecordData.Disc;
109
+ }
110
+ return argRecordData;
111
+ }
112
+ static GetFinalCustomerTotalsData(argRecordData, dupRecordData, detailedInfo) {
113
+ let CustomerAfterDiscTotals = this.GetCustSubTotal(dupRecordData.Ops);
114
+ let CustLaborTaxTotal = this.GetCustLaborTaxTotal(dupRecordData.Ops, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax));
115
+ let CustLaborDiscTotal = this.GetCustLaborDiscountedTotal(dupRecordData.Ops, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), dupRecordData);
116
+ let CustLaborTotalAfterDisc = this.GetCustLaborTotalAfterDiscount(dupRecordData.Ops);
117
+ argRecordData.STotal = tr_utils_1.TrUtils.FixPriceValue(CustLaborDiscTotal + CustLaborTotalAfterDisc);
118
+ argRecordData.CustLaborTotalBeforeDisc = tr_utils_1.TrUtils.FixedTo(argRecordData.CustLaborTotalAfterDisc
119
+ + argRecordData.CustLaborDiscTotal);
120
+ argRecordData.SubTotal = tr_utils_1.TrUtils.FixedTo(CustomerAfterDiscTotals);
121
+ let CustTotal = this.GetCustomerTotalBasedOnTaxType(dupRecordData, CustLaborTaxTotal, dupRecordData.Ops, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax));
122
+ if (detailedInfo) {
123
+ argRecordData.FixedSubTotal = tr_utils_1.TrUtils.FixedTo(CustomerAfterDiscTotals);
124
+ argRecordData.FixedTotal = tr_utils_1.TrUtils.FixedTo(CustTotal);
125
+ }
126
+ argRecordData.Round = tr_utils_1.TrUtils.FixedTo(Math.round(CustTotal) - CustTotal);
127
+ argRecordData.Total = Math.round(CustTotal);
128
+ return argRecordData;
129
+ }
130
+ static GetCustSubTotal(LaborList) {
131
+ let LaborTotalAfterDisc = this.GetCustLaborTotalAfterDiscount(LaborList);
132
+ return LaborTotalAfterDisc;
133
+ }
134
+ static GetCustLaborTotalAfterDiscount(LaborList) {
135
+ let LaborTotalAfterDisc = 0;
136
+ LaborList.forEach((Labor) => {
137
+ LaborTotalAfterDisc += Labor.CustAfterLaborDisc;
138
+ });
139
+ return LaborTotalAfterDisc;
140
+ }
141
+ static GetCustLaborTaxTotal(opCodesList, IsTaxable) {
142
+ let TotalTaxAmt = 0;
143
+ if (IsTaxable) {
144
+ opCodesList.forEach((Labor) => {
145
+ TotalTaxAmt = TotalTaxAmt + Labor.CCGST + Labor.CSGST + Labor.CIGST;
146
+ });
147
+ }
148
+ return TotalTaxAmt;
149
+ }
150
+ static GetCustomerTotalBasedOnTaxType(dupRecordData, LaborTaxAmount, LaborList, IsTaxable) {
151
+ let SubTotalWithTax = 0;
152
+ let LaborTotalAfterDisc = this.GetCustLaborTotalAfterDiscount(LaborList);
153
+ if (IsTaxable) {
154
+ SubTotalWithTax = LaborTotalAfterDisc + LaborTaxAmount;
155
+ }
156
+ else {
157
+ SubTotalWithTax = tr_utils_1.TrUtils.FixedTo((LaborTotalAfterDisc - dupRecordData.LDisc) - dupRecordData.Disc);
158
+ }
159
+ return SubTotalWithTax;
160
+ }
161
+ static GetDetailedTotalsData(argRecordData, dupRecordData, TaxCodes) {
162
+ argRecordData.CustLaborDiscTotal = this.GetCustLaborDiscountedTotal(dupRecordData.Ops, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax), dupRecordData);
163
+ argRecordData.CustLaborTotalAfterDisc = this.GetCustLaborTotalAfterDiscount(dupRecordData.Ops);
164
+ argRecordData.CustLaborTotalBeforeDisc = tr_utils_1.TrUtils.FixedTo(argRecordData.CustLaborTotalAfterDisc
165
+ + argRecordData.CustLaborDiscTotal);
166
+ argRecordData.CustLaborITax = this.GetCustLaborTaxTotal(dupRecordData.Ops, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax));
167
+ argRecordData.CustLaborSGST = this.GetCustLaborSGSTTaxTotal(dupRecordData.Ops, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax));
168
+ argRecordData.CustLaborCGST = this.GetCustLaborCGSTTaxTotal(dupRecordData.Ops, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax));
169
+ argRecordData.CustLaborIGST = this.GetCustLaborIGSTTaxTotal(dupRecordData.Ops, tr_utils_1.TrUtils.isTaxable(dupRecordData.Settings.Tax));
170
+ argRecordData.CustLaborLDiscAmount = this.GetLaborLDiscAmount(argRecordData.CustLaborTotalAfterDisc, argRecordData.LDisc);
171
+ argRecordData.CustLaborAfterLDisc = argRecordData.CustLaborTotalAfterDisc;
172
+ argRecordData.CustLaborAfterTax = tr_utils_1.TrUtils.FixedTo(argRecordData.CustLaborITax + argRecordData.CustLaborAfterLDisc);
173
+ argRecordData.CustTotalRoundedBy = argRecordData.Round;
174
+ argRecordData.CustRoundedTotal = argRecordData.Total;
175
+ for (var key in argRecordData) {
176
+ if (key !== 'Total' && key !== 'SubTotal' &&
177
+ key !== 'LDisc' && key !== 'LPerc' && key !== 'PDisc' &&
178
+ key !== 'PPerc' && key !== 'Disc' && key !== 'Perc' && key !== 'Tax'
179
+ && typeof argRecordData[key] === 'number') {
180
+ argRecordData[key] = tr_utils_1.TrUtils.FixPriceValue(argRecordData[key]);
181
+ }
182
+ }
183
+ return argRecordData;
184
+ }
185
+ static GetCustLaborDiscountedTotal(LaborList, isTaxable, finalTotalsData) {
186
+ let LaborDiscountedTotal = 0;
187
+ let overallLaborDisc = 0;
188
+ if (!isTaxable) {
189
+ overallLaborDisc = tr_utils_1.TrUtils.SetValueToZeroIfNull(finalTotalsData.LDisc);
190
+ }
191
+ LaborList.forEach((Labor) => {
192
+ LaborDiscountedTotal += Labor.CustDiscountedPrice;
193
+ });
194
+ return tr_utils_1.TrUtils.FixedTo(LaborDiscountedTotal + overallLaborDisc);
195
+ }
196
+ static GetCustLaborCGSTTaxTotal(opCodesList, IsTaxable) {
197
+ let TotalTaxAmt = 0;
198
+ if (IsTaxable) {
199
+ opCodesList.forEach((Labor) => {
200
+ TotalTaxAmt = TotalTaxAmt + Labor.CCGST;
201
+ });
202
+ }
203
+ return TotalTaxAmt;
204
+ }
205
+ static GetCustLaborIGSTTaxTotal(opCodesList, IsTaxable) {
206
+ let TotalTaxAmt = 0;
207
+ if (IsTaxable) {
208
+ opCodesList.forEach((Labor) => {
209
+ TotalTaxAmt = TotalTaxAmt + Labor.CIGST;
210
+ });
211
+ }
212
+ return TotalTaxAmt;
213
+ }
214
+ static GetCustLaborSGSTTaxTotal(opCodesList, IsTaxable) {
215
+ let TotalTaxAmt = 0;
216
+ if (IsTaxable) {
217
+ opCodesList.forEach((Labor) => {
218
+ TotalTaxAmt = TotalTaxAmt + Labor.CSGST;
219
+ });
220
+ }
221
+ return TotalTaxAmt;
222
+ }
223
+ static GetLaborLDiscAmount(LaborTotalAfterDisc, LDisc) {
224
+ let LaborLDiscAmt = 0;
225
+ if (!tr_utils_1.TrUtils.IsZero(LaborTotalAfterDisc)) {
226
+ LaborLDiscAmt = LDisc;
227
+ }
228
+ return LaborLDiscAmt;
229
+ }
230
+ static GetGSTValueBasedOnTaxCode(TCode, TaxCodes) {
231
+ let CGST = 0;
232
+ let SGST = 0;
233
+ let IGST = 0;
234
+ if (tr_utils_1.TrUtils.IsNull(TCode)) {
235
+ return [CGST, SGST, IGST];
236
+ }
237
+ let TCodeIndex = TaxCodes.findIndex((TaxCode) => {
238
+ return TaxCode._id === Number(TCode);
239
+ });
240
+ if (TCodeIndex !== -1) {
241
+ if (TaxCodes[TCodeIndex].Type === 'Intra') {
242
+ return [TaxCodes[TCodeIndex].CGST, TaxCodes[TCodeIndex].SGST, 0];
243
+ }
244
+ else {
245
+ return [0, 0, TaxCodes[TCodeIndex].IGST];
246
+ }
247
+ }
248
+ else {
249
+ return [CGST, SGST, IGST];
250
+ }
251
+ }
252
+ }
253
+ exports.AppointmentTotalsService = AppointmentTotalsService;