shareneus 1.7.4 → 1.7.6

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 (212) hide show
  1. package/README.md +1 -0
  2. package/dist/accounting/invoice/invoice-pdf/invoice-pdf.service.js +18 -45
  3. package/dist/accounting/invoice/reports/excel/analysis-excel.service.js +17 -7
  4. package/dist/accounting/invoice/reports/excel/category-wise-item-excel.service.js +17 -7
  5. package/dist/accounting/invoice/reports/excel/cust-wise-sales-details.js +17 -7
  6. package/dist/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.js +17 -7
  7. package/dist/accounting/invoice/reports/excel/invoice-wise-excel.service.js +17 -7
  8. package/dist/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.js +17 -7
  9. package/dist/accounting/invoice/reports/excel/items-wise-sales-excel.service.js +17 -7
  10. package/dist/accounting/invoice/reports/excel/manf-wise-sales-excel.service.js +17 -7
  11. package/dist/accounting/invoice/reports/excel/operator-wise-details.js +17 -7
  12. package/dist/accounting/invoice/reports/excel/operator-wise-summary.js +17 -7
  13. package/dist/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.js +17 -7
  14. package/dist/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.js +17 -7
  15. package/dist/accounting/invoice/reports/excel/sale-summary-excel.service.js +17 -7
  16. package/dist/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.js +17 -7
  17. package/dist/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.js +17 -7
  18. package/dist/accounting/invoice/reports/excel/scheduled-drugs-excel.service.js +17 -7
  19. package/dist/accounting/invoice/unified-invoice-pdf.service.d.ts +1 -1
  20. package/dist/accounting/payment-receive/reports/excel/cust-balance-excel.service.js +17 -7
  21. package/dist/accounting/payment-receive/reports/excel/payment-receive-excel.service.js +17 -7
  22. package/dist/common/reports/excel/product-without-owner-excel.service.js +17 -7
  23. package/dist/gst/excel/GSTR-RO-excel.service.js +17 -7
  24. package/dist/gst/excel/GSTR1-excel.service.js +17 -7
  25. package/dist/gst/excel/GSTR2-excel.service.js +17 -7
  26. package/dist/gst/excel/hsn-summary.js +17 -7
  27. package/dist/gst/excel/tally-sales-import.service.js +17 -7
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +6 -6
  30. package/dist/inventory/items/reports/excel/expiring-drugs-excel.service.js +17 -7
  31. package/dist/inventory/items/reports/excel/item-wise-mout-details.js +17 -7
  32. package/dist/inventory/items/reports/excel/item-wise-mout-summary.js +17 -7
  33. package/dist/inventory/items/reports/excel/spares-issue-excel.service.js +17 -7
  34. package/dist/inventory/items/reports/excel/stock-excel.service.js +17 -7
  35. package/dist/purchases/payment-made/reports/excel/payments-made-excel.service.js +17 -7
  36. package/dist/purchases/payment-made/reports/excel/ven-balance-excel.service.js +17 -7
  37. package/dist/services/reports/excel/insurance-expire-excel.service.js +17 -7
  38. package/dist/services/reports/excel/next-service-date-excel.service.js +17 -7
  39. package/dist/services/reports/excel/repair-orders-excel.service.js +17 -7
  40. package/dist/shared/table-section/pdf-table.header.d.ts +1 -1
  41. package/dist/shared/table-section/pdf-table.header.js +14 -2
  42. package/dist/shared/table-section/pdf-table.section.js +6 -13
  43. package/dist/{accounting/invoice/invoice-pdf.service.js → shared/transactions-pdf.service.js} +15 -15
  44. package/package.json +1 -1
  45. package/src/accounting/counter-sales/auto-sales-receipt-pdf.service.ts +569 -0
  46. package/src/accounting/counter-sales/pos-receipt-pdf.ts +577 -0
  47. package/src/accounting/counter-sales/sales-receipt-pdf.service.ts +628 -0
  48. package/src/accounting/counter-sales/sales-receipt-print.service.ts +506 -0
  49. package/src/accounting/credit-note/cn-print.service.ts +264 -0
  50. package/src/accounting/credit-note/credit-note-pdf.service.ts +602 -0
  51. package/src/accounting/credit-note/credit-note-totals.service.ts +424 -0
  52. package/src/accounting/debit-note/debit-note-pdf.service.ts +681 -0
  53. package/src/accounting/debit-note/debit-note-print.service.ts +276 -0
  54. package/src/accounting/debit-note/debit-note-totals.service.ts +361 -0
  55. package/src/accounting/invoice/hc-inv-pdf.service.ts +880 -0
  56. package/src/accounting/invoice/inv-pdf.service.ts +812 -0
  57. package/src/accounting/invoice/inv-print.service.ts +532 -0
  58. package/src/accounting/invoice/invoice-landscape-pdf.service.ts +947 -0
  59. package/src/accounting/invoice/invoice-letterhead-pdf.service.ts +813 -0
  60. package/src/accounting/invoice/invoice-pdf/invoice-pdf.service.ts +359 -0
  61. package/src/accounting/invoice/invoice-portrait-pdf.ts +972 -0
  62. package/src/accounting/invoice/invoice-print.service.ts +2906 -0
  63. package/src/accounting/invoice/invoice-total.service.ts +834 -0
  64. package/src/accounting/invoice/reports/excel/analysis-excel.service.ts +291 -0
  65. package/src/accounting/invoice/reports/excel/category-wise-item-excel.service.ts +267 -0
  66. package/src/accounting/invoice/reports/excel/cust-wise-sales-details.ts +321 -0
  67. package/src/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.ts +300 -0
  68. package/src/accounting/invoice/reports/excel/invoice-wise-excel.service.ts +859 -0
  69. package/src/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.ts +255 -0
  70. package/src/accounting/invoice/reports/excel/items-wise-sales-excel.service.ts +312 -0
  71. package/src/accounting/invoice/reports/excel/manf-wise-sales-excel.service.ts +273 -0
  72. package/src/accounting/invoice/reports/excel/operator-wise-details.ts +258 -0
  73. package/src/accounting/invoice/reports/excel/operator-wise-summary.ts +259 -0
  74. package/src/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.ts +230 -0
  75. package/src/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.ts +231 -0
  76. package/src/accounting/invoice/reports/excel/sale-summary-excel.service.ts +326 -0
  77. package/src/accounting/invoice/reports/excel/sales-by-service-details-excel.service.ts +0 -0
  78. package/src/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.ts +432 -0
  79. package/src/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.ts +373 -0
  80. package/src/accounting/invoice/reports/excel/scheduled-drugs-excel.service.ts +372 -0
  81. package/src/accounting/invoice/reports/pdf/analysis-pdf.service.ts +113 -0
  82. package/src/accounting/invoice/reports/pdf/category-wise-item-pdf.service.ts +107 -0
  83. package/src/accounting/invoice/reports/pdf/cust-wise-sales-details-pdf.service.ts +125 -0
  84. package/src/accounting/invoice/reports/pdf/cust-wise-sales-summary-pdf.service.ts +119 -0
  85. package/src/accounting/invoice/reports/pdf/item-wise-doctor-sale-pdf.service.ts +180 -0
  86. package/src/accounting/invoice/reports/pdf/item-wise-sales-pdf.service.ts +193 -0
  87. package/src/accounting/invoice/reports/pdf/manf-wise-sales-pdf.service.ts +188 -0
  88. package/src/accounting/invoice/reports/pdf/operator-wise-details-pdf.service.ts +118 -0
  89. package/src/accounting/invoice/reports/pdf/operator-wise-summary-pdf.ts +116 -0
  90. package/src/accounting/invoice/reports/pdf/sales-by-service-pdf.service.ts +132 -0
  91. package/src/accounting/invoice/reports/pdf/scheduled-drug-pdf.service.ts +191 -0
  92. package/src/accounting/invoice/reports/pdf/scheduled-drug-summary-pdf.service.ts +202 -0
  93. package/src/accounting/invoice/shared-inv-pdf.service.ts +787 -0
  94. package/src/accounting/invoice/unified-invoice-pdf.service.ts +937 -0
  95. package/src/accounting/payment-receive/payment-pdf.service.ts +410 -0
  96. package/src/accounting/payment-receive/payment-receipt-pdf/receipt-pdf.service.ts +470 -0
  97. package/src/accounting/payment-receive/receipt-print.service.ts +71 -0
  98. package/src/accounting/payment-receive/reports/excel/cust-balance-excel.service.ts +298 -0
  99. package/src/accounting/payment-receive/reports/excel/payment-receive-excel.service.ts +221 -0
  100. package/src/accounting/payment-receive/reports/pdf/customer-balances-pdf.service.ts +182 -0
  101. package/src/accounting/payment-receive/reports/pdf/payment-report-pdf.service.ts +116 -0
  102. package/src/aggregation/aggregation.ts +58 -0
  103. package/src/appointments/appointments/appointment-total.service.ts +298 -0
  104. package/src/appointments/consultations/consultation-fee-receipt.service.ts +407 -0
  105. package/src/appointments/consultations/consultation-full-pdf.service.ts +238 -0
  106. package/src/appointments/consultations/consultation-letterhead-pdf.service.ts +430 -0
  107. package/src/appointments/consultations/consultation-pdf.service.ts +417 -0
  108. package/src/common/reports/excel/product-without-owner-excel.service.ts +308 -0
  109. package/src/common/reports/pdf/product-without-owner-pdf.service.ts +146 -0
  110. package/src/enums/cache-enums.ts +33 -0
  111. package/src/enums/code-enums.ts +291 -0
  112. package/src/enums/country-enums.ts +9 -0
  113. package/src/enums/enums.ts +364 -0
  114. package/src/enums/industry-enums.ts +26 -0
  115. package/src/enums/treatment-enums.ts +9 -0
  116. package/src/gst/excel/GSTR-RO-excel.service.ts +926 -0
  117. package/src/gst/excel/GSTR1-excel.service.ts +313 -0
  118. package/src/gst/excel/GSTR2-excel.service.ts +314 -0
  119. package/src/gst/excel/hsn-summary.ts +314 -0
  120. package/src/gst/excel/tally-sales-import.service.ts +767 -0
  121. package/src/gst/pdf/hsn-summary-pdf.ts +176 -0
  122. package/src/index.ts +194 -0
  123. package/src/inventory/items/adjustment-pdf.service.ts +177 -0
  124. package/src/inventory/items/issue-parts-pdf.service.ts +795 -0
  125. package/src/inventory/items/item-bar-code-label-pdf.ts +194 -0
  126. package/src/inventory/items/item-detais-pdf.ts +141 -0
  127. package/src/inventory/items/item-price-for-pricelist.ts +368 -0
  128. package/src/inventory/items/reports/excel/expiring-drugs-excel.service.ts +290 -0
  129. package/src/inventory/items/reports/excel/item-wise-mout-details.ts +284 -0
  130. package/src/inventory/items/reports/excel/item-wise-mout-summary.ts +279 -0
  131. package/src/inventory/items/reports/excel/spares-issue-excel.service.ts +494 -0
  132. package/src/inventory/items/reports/excel/stock-excel.service.ts +319 -0
  133. package/src/inventory/items/reports/pdf/expiring-drugs-pdf.service.ts +172 -0
  134. package/src/inventory/items/reports/pdf/item-wise-mout-details-pdf.ts +122 -0
  135. package/src/inventory/items/reports/pdf/item-wise-mout-summary-pdf.ts +115 -0
  136. package/src/inventory/items/reports/pdf/reorder-point-pdf.service.ts +163 -0
  137. package/src/inventory/material-out/mout-pdf.service.ts +545 -0
  138. package/src/inventory/transfer-order/transfer-order-pdf.service.ts +154 -0
  139. package/src/purchases/bills/bill-pdf/bill-pdf.service.ts +211 -0
  140. package/src/purchases/bills/bill-pdf.service.ts +21 -0
  141. package/src/purchases/payment-made/reports/excel/payments-made-excel.service.ts +313 -0
  142. package/src/purchases/payment-made/reports/excel/ven-balance-excel.service.ts +307 -0
  143. package/src/purchases/payment-made/reports/pdf/vendor-balances-pdf.service.ts +114 -0
  144. package/src/purchases/purchase-order/po-totals.service.ts +343 -0
  145. package/src/purchases/purchase-order/purchase-order-pdf.service.ts +1016 -0
  146. package/src/purchases/purchase-order/purchase-order-print.service.ts +279 -0
  147. package/src/purchases/purchase-order/purchase-order-totals.service.ts +637 -0
  148. package/src/purchases/vendor-credit-note/vendor-credit-note-pdf.service.ts +1055 -0
  149. package/src/purchases/vendor-credit-note/vendor-credit-note-print.service.ts +145 -0
  150. package/src/purchases/vendor-credit-note/vendor-credit-note-totals.service.ts +399 -0
  151. package/src/purchases/vendor-debit-note/vendor-debit-note-pdf.service.ts +582 -0
  152. package/src/purchases/vendor-debit-note/vendor-debit-note-print.service.ts +295 -0
  153. package/src/purchases/vendor-debit-note/vendor-debit-note-totals.service.ts +377 -0
  154. package/src/sales/delivery-challan/dc-landscape-pdf.service.ts +922 -0
  155. package/src/sales/delivery-challan/dc-landscape-without-price-pdf.service.ts +869 -0
  156. package/src/sales/delivery-challan/dc-without-price-pdf.service.ts +505 -0
  157. package/src/sales/delivery-challan/delivery-challan-pdf.service.ts +461 -0
  158. package/src/sales/delivery-challan/delivery-challan-print.service.ts +229 -0
  159. package/src/sales/delivery-challan/delivery-challan-totals.ts +466 -0
  160. package/src/sales/sales/equipment-design-pdf.service.ts +153 -0
  161. package/src/sales/sales/pack-ship-pdf.service.ts +128 -0
  162. package/src/sales/sales/pack-ship-print.service.ts +198 -0
  163. package/src/sales/sales/sales-pdf.service.ts +658 -0
  164. package/src/sales/sales/sales-print.service.ts +376 -0
  165. package/src/sales/sales/sales-totals.service.ts +500 -0
  166. package/src/sales-receive/sales-receive-pdf.service.ts +602 -0
  167. package/src/sales-receive/sales-receive-print.service.ts +242 -0
  168. package/src/sales-receive/sales-receive-totals.service.ts +651 -0
  169. package/src/services/checklist-pdf.ts +151 -0
  170. package/src/services/checklists-pdf.ts +133 -0
  171. package/src/services/est.print-service.ts +1155 -0
  172. package/src/services/reports/excel/insurance-expire-excel.service.ts +292 -0
  173. package/src/services/reports/excel/next-service-date-excel.service.ts +317 -0
  174. package/src/services/reports/excel/repair-orders-excel.service.ts +249 -0
  175. package/src/services/reports/pdf/insurance-expire-pdf.service.ts +115 -0
  176. package/src/services/reports/pdf/next-service-date-pdf.service.ts +198 -0
  177. package/src/services/reports/pdf/repair-orders-pdf.service.ts +184 -0
  178. package/src/services/ro-pdf.service.ts +1917 -0
  179. package/src/services/ro-print-service.ts +881 -0
  180. package/src/services/ro-totals.service.ts +1314 -0
  181. package/src/services/separate-wo-print.service.ts +396 -0
  182. package/src/services/service-history-pdf.service.ts +145 -0
  183. package/src/services/service-price-for-pricelist.ts +649 -0
  184. package/src/services/technician-pdf.service.ts +234 -0
  185. package/src/services/technician-print.service.ts +95 -0
  186. package/src/shared/header-footer-section/pdf-header-footer.section.ts +519 -0
  187. package/src/shared/header-footer-section/pdf-shared.utils.ts +46 -0
  188. package/src/shared/math-operations.ts +208 -0
  189. package/src/shared/party-details-section/pdf-party-details.section.ts +602 -0
  190. package/src/shared/shared-pdf.service.ts +3042 -0
  191. package/src/shared/shared-print.service.ts +879 -0
  192. package/src/shared/table-section/pdf-table.config.ts +8 -0
  193. package/src/shared/table-section/pdf-table.header.ts +396 -0
  194. package/src/shared/table-section/pdf-table.row.ts +248 -0
  195. package/src/shared/table-section/pdf-table.section.ts +447 -0
  196. package/src/shared/totals-section/pdf-totals.section.ts +921 -0
  197. package/src/shared/transactions-pdf.service.ts +191 -0
  198. package/src/shared/util.ts +101 -0
  199. package/src/tasks/meetings/meeting-pdf.ts +410 -0
  200. package/src/tasks/tasks/task-pdf.service.ts +238 -0
  201. package/src/tasks/tasks/task-reports-pdf.service.ts +313 -0
  202. package/src/tax/index.ts +86 -0
  203. package/src/tax/tax-calculator.ts +1025 -0
  204. package/src/tax/tax.types.ts +535 -0
  205. package/src/transaction-calculations/discounts-distribution.ts +343 -0
  206. package/src/transaction-calculations/index.ts +3 -0
  207. package/src/transaction-calculations/total-calculation.ts +443 -0
  208. package/src/transaction-calculations/transaction-calculation-engine.ts +903 -0
  209. package/src/utils/my-date.ts +111 -0
  210. package/src/utils/tr-utils.ts +104 -0
  211. package/tsconfig.json +2 -2
  212. /package/dist/{accounting/invoice/invoice-pdf.service.d.ts → shared/transactions-pdf.service.d.ts} +0 -0
@@ -0,0 +1,880 @@
1
+ import { SharedPDFService } from "../../shared/shared-pdf.service";
2
+ import { PrintSharedService } from "../../shared/shared-print.service";
3
+ import { TrUtils } from "../../utils/tr-utils";
4
+
5
+ export class HCInvoiceprintService {
6
+ FontSize: number = 8;
7
+
8
+ static GetInvoicePrint(ROPrintData: any, numberofCopies: any, isotherIndustry: boolean, withPass: boolean, isAuto: boolean, size: any, moreDiscDetails: boolean) {
9
+ ROPrintData.Entity.IsProforma = ROPrintData.IsProforma;
10
+ var contents = [];
11
+ if (TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
12
+ contents.push(
13
+ this.CommonHeaderDetails(ROPrintData, null, isotherIndustry),
14
+ this.PreparesparePartsTable(ROPrintData, isAuto),
15
+ this.CommonTotalDetails(ROPrintData, null, numberofCopies, withPass, isAuto, moreDiscDetails)
16
+ );
17
+ } else {
18
+ numberofCopies.forEach((text: any, index: any) => {
19
+ contents.push(
20
+ this.CommonHeaderDetails(ROPrintData, text, isotherIndustry),
21
+ this.PreparesparePartsTable(ROPrintData, isAuto),
22
+ this.CommonTotalDetails(ROPrintData, index, numberofCopies, withPass, isAuto, moreDiscDetails)
23
+ );
24
+ });
25
+ }
26
+ var dd = {
27
+ watermark: this.GetWatermark(ROPrintData),
28
+ info: {
29
+ title: this.GetFileName(ROPrintData),
30
+ },
31
+ background: function (currentPage: any, pageSize: any) {
32
+ if (size !== 'full') {
33
+ pageSize.height = pageSize.height - 435.945;
34
+ }
35
+ return SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
36
+ },
37
+ header: function (currentPage: any, pageCount: any) {
38
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
39
+ },
40
+ pageBreakBefore: function (currentNode: any, followingNodesOnPage: any, nodesOnNextPage: any, previousNodesOnPage: any) {
41
+ return currentNode.startPosition.top >= 700 && !TrUtils.IsNull(currentNode?.id) && currentNode?.id === '567';
42
+ },
43
+ // pageMargins: [10, 15, 10, 15],
44
+ pageMargins: this.GetMarginsBasedOnPaperSize(size),
45
+ pageSize: 'A4',
46
+ content: contents,
47
+ styles: SharedPDFService.GetStyles()
48
+ };
49
+ return dd;
50
+ }
51
+
52
+ static GetMarginsBasedOnPaperSize(size: any) {
53
+ if (size === 'full') {
54
+ return [25, 15, 15, 15];
55
+ } else {
56
+ return [25, 15, 15, 435.945];
57
+ }
58
+ }
59
+
60
+ static GetWatermark(ROPrintData: any) {
61
+ if (ROPrintData.IsProforma && ROPrintData.Entity.Wmark) {
62
+ return { text: 'Not a final invoice', opacity: 0.2 };
63
+ } else {
64
+ return '';
65
+ }
66
+ }
67
+
68
+ static GetFileName(ROPrintData: any) {
69
+ let fileName: string = ROPrintData.HeaderName;
70
+ if (!TrUtils.IsNull(ROPrintData.Product) && !TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
71
+ fileName = fileName + '-' + ROPrintData.Product.RegNo;
72
+ }
73
+ return fileName;
74
+ }
75
+
76
+ static CommonHeaderDetails(ROPrintData: any, text: any, isotherIndustry: boolean) {
77
+ return [
78
+ this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text),
79
+ SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
80
+ ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For,
81
+ ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp,
82
+ ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, null, ROPrintData.Location, isotherIndustry, ROPrintData.BL,
83
+ ROPrintData.ROCode, ROPrintData.TypeName, ROPrintData.AdmNo, ROPrintData.DoS, ROPrintData.Entity.PrCustBar),
84
+ SharedPDFService.GetOwnerDetails(ROPrintData.Cust, ROPrintData.Type, ROPrintData.For),
85
+ this.CustomerAndVehicleDetailsAfterLine(),
86
+ SharedPDFService.GetDisplayTable(),
87
+ ];
88
+ }
89
+
90
+ static CustomerAndVehicleDetailsAfterLine() {
91
+ return {
92
+ canvas: [
93
+ {
94
+ type: 'line',
95
+ lineColor: 'grey',
96
+ x1: 0,
97
+ y1: 0,
98
+ x2: 555,
99
+ y2: 0,
100
+ lineWidth: 1.5
101
+ }
102
+ ]
103
+ };
104
+ }
105
+
106
+ static GetMainHeaderDetails(Entity: any, HeaderName: any, Image: any, HColor: any, AColor: any, text: any) {
107
+ return [
108
+ // SharedPDFService.MainHeading(Entity.CName, Entity.Header, Image, HColor, text),
109
+ SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text),
110
+ this.GetPrintType(HeaderName, Entity.RegNo),
111
+ this.HeaderAfterLine()
112
+ ];
113
+ }
114
+
115
+ static HeaderAfterLine() {
116
+ return {
117
+ canvas: [
118
+ {
119
+ type: 'line',
120
+ lineColor: 'grey',
121
+ x1: 0,
122
+ y1: 0,
123
+ x2: 555,
124
+ y2: 0,
125
+ lineWidth: 1.5
126
+ }
127
+ ]
128
+ };
129
+ }
130
+
131
+ static GetPrintType(type: any, RegNo: any) {
132
+ return {
133
+ // marginLeft: 10,
134
+ columns: [{ text: '', width: 120 },
135
+ { text: type, alignment: 'center', style: 'Receiptheader1' }, { text: 'Regn.No : ' + RegNo, alignment: 'right', width: 140, fontSize: 7 }
136
+ ]
137
+ };
138
+ }
139
+
140
+ static PreparesparePartsTable(ROPrintData: any, isAuto: boolean) {
141
+ let List: any = [];
142
+ if (ROPrintData.Entity.Body === 1) {
143
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
144
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
145
+ ROPrintData.PrintInfo[i].Text = '';
146
+ }
147
+ List.push(ROPrintData.PrintInfo[i].Text,
148
+ this.GetLaborPartsTableForView(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), false)
149
+ );
150
+
151
+ }
152
+ } else {
153
+ if (ROPrintData.Entity.Body === 2) {
154
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
155
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
156
+ ROPrintData.PrintInfo[i].Text = '';
157
+ }
158
+ List.push(ROPrintData.PrintInfo[i].Text,
159
+ this.WithOutDiscountFieldTable(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn,
160
+ false, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn, isAuto, ROPrintData.Entity.DecimalsNumber)
161
+ );
162
+
163
+ }
164
+ } else {
165
+ if (ROPrintData.Summary) {
166
+ List.push('',
167
+ this.GetLaborPartsTableForView(ROPrintData.Items, ROPrintData.Ops, false)
168
+ );
169
+ } else {
170
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
171
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
172
+ ROPrintData.PrintInfo[i].Text = '';
173
+ }
174
+ List.push(ROPrintData.PrintInfo[i].Text,
175
+ this.GetWithOutDiscAndTaxFieldHeader(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops),
176
+ ROPrintData.ShowTaxColumn, false, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn, isAuto, ROPrintData.Entity.DecimalsNumber)
177
+ );
178
+
179
+ }
180
+ }
181
+ }
182
+ }
183
+ return List;
184
+ }
185
+
186
+ static GetLaborPartsTableForView(Parts: any, Ops: any, PrintPartNo: any) {
187
+ if (Parts.length !== 0 || Ops.length !== 0) {
188
+ if (PrintPartNo) {
189
+ return {
190
+ style: 'tableExample',
191
+ // marginLeft: 20,
192
+ table: {
193
+ widths: [25, 30, 170, 85, 15, 20, 50, 30, 30, 50],
194
+ // headerRows: 2,
195
+ body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false)
196
+ },
197
+ layout: PrintSharedService.LayOutStyleanother()
198
+ };
199
+ } else {
200
+ return {
201
+ style: 'tableExample',
202
+ // marginLeft: 20,
203
+ table: {
204
+ widths: [25, 200, 55, 25, 55, 55, 40, 15, 50],
205
+ // headerRows: 2,
206
+ body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false)
207
+ },
208
+ layout: PrintSharedService.LayOutStyleanother()
209
+ };
210
+ }
211
+ } else {
212
+ let a: any = '';
213
+ return a;
214
+ }
215
+ }
216
+
217
+
218
+ static WithOutDiscountFieldTable(Parts: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
219
+ if (Parts.length !== 0 || Ops.length !== 0) {
220
+ if (PrintPartNo) {
221
+ return {
222
+ style: 'tableExample',
223
+ marginLeft: 20,
224
+ table: {
225
+ widths: [25, 60, 155, 30, 50, 60, 30, 50],
226
+ headerRows: 1,
227
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
228
+ },
229
+ layout: PrintSharedService.LayOutStyleanother()
230
+ };
231
+ } else {
232
+ return {
233
+ style: 'tableExample',
234
+ marginLeft: 20,
235
+ table: {
236
+ widths: [25, 215, 25, 50, 60, 45, 50],
237
+ headerRows: 1,
238
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
239
+ },
240
+ layout: PrintSharedService.LayOutStyleanother()
241
+ };
242
+ }
243
+ } else {
244
+ let a: any = '';
245
+ return a;
246
+ }
247
+ }
248
+
249
+ static BuildTableBodyForLaborAndParts(Parts: any, Labor: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
250
+ var body: any = [];
251
+ let columns: any = PrintSharedService.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
252
+ // if (ShowTaxColumn) {
253
+ for (let i = 0; i < columns.length; i++) {
254
+ body.push(columns[i]);
255
+ }
256
+ columns = columns[1];
257
+ // } else {
258
+ // body.push(columns);
259
+ // }
260
+
261
+
262
+ let DummyOps: any = [];
263
+
264
+ if (Parts.length !== 0) {
265
+ // console.log('Parts', Parts);
266
+ if (isAuto) {
267
+ let Qty: number = 0;
268
+ let CGSTAMT: number = 0;
269
+ let SGSTAMT: number = 0;
270
+ let IGSTAMT: number = 0;
271
+ let Taxable: number = 0;
272
+ let FinalTotal: number = 0;
273
+ Parts.forEach((part: any) => {
274
+ // console.log('part', part);
275
+ Qty = Qty + part.Qty;
276
+ CGSTAMT = CGSTAMT + part.CGSTAmt;
277
+ SGSTAMT = SGSTAMT + part.SGSTAmt;
278
+ IGSTAMT = IGSTAMT + part.IGSTAmt;
279
+ Taxable = Taxable + part.AfterPartDisc;
280
+ FinalTotal = FinalTotal + part.AfterPartTax;
281
+ });
282
+ let dpartadding1: any = {};
283
+ dpartadding1.SNo = '';
284
+ dpartadding1.Desc = 'Medications Total';
285
+ dpartadding1.QtyAndUoM = TrUtils.FixedTo(Qty, DecimalsNumber);
286
+ dpartadding1.bold = true;
287
+ dpartadding1.UnPr = TrUtils.FixedTo(Taxable, DecimalsNumber);
288
+ dpartadding1.SGSTAmt = TrUtils.FixedTo(SGSTAMT, DecimalsNumber);
289
+ dpartadding1.IGSTAmt = TrUtils.FixedTo(IGSTAMT, DecimalsNumber);
290
+ dpartadding1.CGSTAmt = TrUtils.FixedTo(CGSTAMT, DecimalsNumber);
291
+ dpartadding1.TCode = ShowTaxColumn ? 114 : undefined;
292
+ dpartadding1.LineTotal = TrUtils.FixPriceValue(FinalTotal, DecimalsNumber);
293
+ Parts.push({ SNo: '' });
294
+ Parts.push(dpartadding1);
295
+ }
296
+
297
+
298
+ let dummypartadding1: any = {};
299
+ dummypartadding1.SNo = '';
300
+ dummypartadding1.Desc = ' ';
301
+ dummypartadding1.Qty = '';
302
+ dummypartadding1.UnPr = '';
303
+ dummypartadding1.LineTotal = '';
304
+ // Parts.unshift(dummypartadding1);
305
+ }
306
+
307
+ let SNo: number = 1;
308
+ Parts.forEach((part: any) => {
309
+ var dataRow: any = [];
310
+ columns.forEach((column: any) => {
311
+ if (
312
+ (!TrUtils.IsNull(part[column.Field]))
313
+ || (column.text === 'Line Total')) {
314
+ // if (part[column.Field] === 'Medications') {
315
+ // dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
316
+ // } else {
317
+ if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
318
+ && TrUtils.CheckInvalidSelect(part.TCode))) {
319
+ part[column.Field] = '';
320
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
321
+ } else {
322
+ if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'HSN' || column.Field === 'QtyAndUoM'
323
+ || column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
324
+ || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
325
+ if (column.Field === 'Disc') {
326
+ if (column.type === 'percentage') {
327
+ if (!TrUtils.IsEmpty(part[column.Field])) {
328
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true, alignment: 'right' });
329
+ } else {
330
+ dataRow.push({ text: '', noWrap: true });
331
+ }
332
+ } else {
333
+ if (!TrUtils.IsNull(part[column.Field])) {
334
+ dataRow.push({ text: TrUtils.FixPriceValue(part[column.Field]).toString(), alignment: 'right', noWrap: true });
335
+ } else {
336
+ dataRow.push({ text: '', noWrap: true });
337
+ }
338
+ }
339
+ } else {
340
+ if (!TrUtils.IsNull(part[column.Field])) {
341
+ dataRow.push({ text: part[column.Field].toString(), bold: part.bold, alignment: 'right', nowrap: true });
342
+ } else {
343
+ dataRow.push({ text: '', noWrap: true });
344
+ }
345
+ }
346
+ } else {
347
+ // dataRow.push(part[column.Field].toString());
348
+ if (column.Field === 'Desc') {
349
+ let DescData: any = [];
350
+ DescData.push({ text: part[column.Field].toString(), bold: part.bold });
351
+ if (!TrUtils.IsEmpty(part['EDesc'])) {
352
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
353
+ }
354
+ dataRow.push({ stack: DescData });
355
+ } else {
356
+ dataRow.push({ text: part[column.Field].toString() });
357
+ }
358
+ }
359
+ }
360
+ // }
361
+ } else {
362
+ if (column.Field === 'SNo') {
363
+ part[column.Field] = SNo;
364
+ SNo = SNo + 1;
365
+ } else {
366
+ if (TrUtils.IsNull(part[column.Field])) {
367
+ part[column.Field] = '';
368
+ }
369
+ }
370
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
371
+ }
372
+ });
373
+
374
+ body.push(dataRow);
375
+ });
376
+ SNo = 1;
377
+ if (Labor.length !== 0 && Parts.length !== 0) {
378
+ // let Qty: number = 0;
379
+ if (isAuto) {
380
+ let CGSTAMT: number = 0;
381
+ let SGSTAMT: number = 0;
382
+ let IGSTAMT: number = 0;
383
+ let Taxable: number = 0;
384
+ let FinalTotal: number = 0;
385
+ Labor.forEach((operation: any) => {
386
+ // console.log('operation', operation);
387
+ // Qty = Qty + operation.Qty;
388
+ CGSTAMT = CGSTAMT + operation.CGSTAmt;
389
+ SGSTAMT = SGSTAMT + operation.SGSTAmt;
390
+ IGSTAMT = IGSTAMT + operation.IGSTAmt;
391
+ Taxable = Taxable + operation.AfterLaborDisc;
392
+ FinalTotal = FinalTotal + operation.AfterLaborTax;
393
+ });
394
+ let dpartadding1: any = {};
395
+ dpartadding1.SNo = '';
396
+ dpartadding1.Desc = 'Procedures Total';
397
+ // dpartadding1.QtyAndUoM = Qty;
398
+ dpartadding1.UnPr = TrUtils.FixedTo(Taxable, DecimalsNumber);
399
+ dpartadding1.SGSTAmt = TrUtils.FixedTo(SGSTAMT, DecimalsNumber);
400
+ dpartadding1.IGSTAmt = TrUtils.FixedTo(IGSTAMT, DecimalsNumber);
401
+ dpartadding1.CGSTAmt = TrUtils.FixedTo(CGSTAMT, DecimalsNumber);
402
+ dpartadding1.TCode = ShowTaxColumn ? 114 : undefined;
403
+ dpartadding1.bold = true;
404
+ dpartadding1.LineTotal = TrUtils.FixPriceValue(FinalTotal, DecimalsNumber);
405
+ Labor.push({ SNo: '' });
406
+ Labor.push(dpartadding1);
407
+ }
408
+ let dummypartadding1: any = {};
409
+ dummypartadding1.SNo = '';
410
+ dummypartadding1.Desc = ' ';
411
+ dummypartadding1.Qty = '';
412
+ dummypartadding1.UnPr = '';
413
+ dummypartadding1.LineTotal = '';
414
+ Labor.unshift(dummypartadding1);
415
+ // DummyOps.unshift(dummypartadding1);
416
+ }
417
+ if (Body === 2) {
418
+ for (let i = 0; i < Labor.length; i++) {
419
+ Labor[i].UnPr = '';
420
+ }
421
+ }
422
+
423
+ Labor.forEach((Ops: any) => {
424
+ var dataRow: any = [];
425
+ columns.forEach((column: any) => {
426
+ if ((!TrUtils.IsNull(Ops[column.Field]))
427
+ || (column.text === 'Line Total')) {
428
+ if (Ops[column.Field] === 'Procedures') {
429
+ dataRow.push({ text: Ops[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
430
+ } else {
431
+ if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
432
+ && TrUtils.CheckInvalidSelect(Ops.TCode))) {
433
+ Ops[column.Field] = '';
434
+ dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
435
+ } else {
436
+ if (column.text === 'Line Total' || column.Field === 'Price' || column.Field === 'HSN' || column.text === 'Tax' || column.Field === 'UnPr'
437
+ || column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
438
+ || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
439
+ if (column.Field === 'Disc') {
440
+ if (column.type === 'percentage') {
441
+ if (!TrUtils.IsEmpty(Ops[column.Field])) {
442
+ dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', noWrap: true });
443
+ } else {
444
+ dataRow.push({ text: '', noWrap: true });
445
+ }
446
+ } else {
447
+ if (!TrUtils.IsNull(Ops[column.Field])) {
448
+ dataRow.push({ text: TrUtils.FixPriceValue(Ops[column.Field]).toString(), alignment: 'right', noWrap: true });
449
+ } else {
450
+ dataRow.push({ text: '', noWrap: true });
451
+ }
452
+ }
453
+ } else {
454
+ if (!TrUtils.IsNull(Ops[column.Field])) {
455
+ dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', nowrap: true, bold: Ops.bold });
456
+ } else {
457
+ dataRow.push({ text: '', noWrap: true });
458
+ }
459
+ }
460
+
461
+ } else {
462
+ if (column.Field === 'Desc') {
463
+ let DescData: any = [];
464
+ DescData.push({ text: Ops[column.Field].toString(), bold: Ops.bold });
465
+ if (!TrUtils.IsEmpty(Ops['EDesc'])) {
466
+ DescData.push({ text: Ops['EDesc'].toString(), color: 'grey' });
467
+ }
468
+ dataRow.push({ stack: DescData });
469
+ } else {
470
+ dataRow.push({ text: Ops[column.Field].toString(), bold: Ops.bold });
471
+ }
472
+ }
473
+ }
474
+ }
475
+ } else {
476
+ if (column.Field === 'SNo') {
477
+ Ops[column.Field] = SNo;
478
+ SNo = SNo + 1;
479
+ } else {
480
+ if (TrUtils.IsNull(Ops[column.Field])) {
481
+ Ops[column.Field] = '';
482
+ }
483
+
484
+ }
485
+ dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
486
+ }
487
+ });
488
+ body.push(dataRow);
489
+ });
490
+ return body;
491
+ }
492
+
493
+ static GetWithOutDiscAndTaxFieldHeader(Parts: any, Ops: any, ShowTaxColumn: any, PrintPartNo: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
494
+ if (Parts.length !== 0 || Ops.length !== 0) {
495
+ if (ShowTaxColumn) {
496
+ return this.TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber);
497
+ } else {
498
+ if (ConsolidateGST) {
499
+ return this.ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber);
500
+ } else {
501
+ return this.NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber);
502
+ }
503
+ }
504
+ } else {
505
+ let a: any = '';
506
+ return a;
507
+ }
508
+ }
509
+
510
+ static TaxTableWidths(PrintPartNo: any, ShowIGST: any, ShowDiscountColumn: any) {
511
+ if (PrintPartNo) {
512
+ if (ShowIGST) {
513
+ if (ShowDiscountColumn) {
514
+ return [22, 50, 143, 35, 25, 40, 17, 35, 17, 35, 45];
515
+ } else {
516
+ return [22, 50, 207, 37, 25, 40, 17, 35, 51];
517
+ }
518
+ } else {
519
+ if (ShowDiscountColumn) {
520
+ return [22, 40, 90, 35, 22, 40, 17, 34, 17, 32, 17, 32, 48];
521
+ } else {
522
+ return [22, 50, 135, 40, 22, 40, 17, 32, 17, 32, 54];
523
+ }
524
+ }
525
+ } else {
526
+ if (ShowIGST) {
527
+ if (ShowDiscountColumn) {
528
+ return [22, 200, 40, 25, 40, 17, 35, 17, 35, 41];
529
+ } else {
530
+ return [22, 255, 40, 25, 40, 20, 40, 50];
531
+ }
532
+ } else {
533
+ if (ShowDiscountColumn) {
534
+ return [22, 135, 34, 22, 40, 17, 34, 17, 35, 17, 35, 45];
535
+ } else {
536
+ return [22, 195, 35, 22, 40, 17, 35, 17, 35, 50];
537
+ }
538
+ }
539
+ }
540
+ }
541
+
542
+ static TaxDataTable(Parts: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
543
+ if (PrintPartNo) {
544
+ if (ShowIGST) {
545
+ return {
546
+ style: 'tableExample',
547
+ table: {
548
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
549
+ // headerRows: 2,
550
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
551
+ },
552
+ layout: PrintSharedService.LayOutStyle1()
553
+ };
554
+ } else {
555
+ return {
556
+ style: 'tableExample',
557
+ table: {
558
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
559
+ // headerRows: 2,
560
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
561
+ },
562
+ layout: PrintSharedService.LayOutStyle1()
563
+ };
564
+ }
565
+
566
+ } else {
567
+ if (ShowIGST) {
568
+ return {
569
+ style: 'tableExample',
570
+ table: {
571
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
572
+ // headerRows: 2,
573
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
574
+ },
575
+ layout: PrintSharedService.LayOutStyle1()
576
+ };
577
+ } else {
578
+ return {
579
+ style: 'tableExample',
580
+ table: {
581
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
582
+ // headerRows: 2,
583
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
584
+ },
585
+ layout: PrintSharedService.LayOutStyle1()
586
+ };
587
+ }
588
+
589
+ }
590
+ }
591
+
592
+ static ConsolidateDataTable(Parts: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
593
+ if (PrintPartNo) {
594
+ return {
595
+ style: 'tableExample',
596
+ table: {
597
+ widths: [25, 70, 263, 25, 60, 80, 10, 40],
598
+ // headerRows: 1,
599
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
600
+ },
601
+ layout: PrintSharedService.LayOutStyle1()
602
+ };
603
+ } else {
604
+ return {
605
+ style: 'tableExample',
606
+ table: {
607
+ widths: [25, 295, 50, 80, 80, 10, 40],
608
+ // headerRows: 1,
609
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
610
+ },
611
+ layout: PrintSharedService.LayOutStyle1()
612
+ };
613
+ }
614
+ }
615
+
616
+ static NoTaxDataTable(Parts: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
617
+ if (PrintPartNo) {
618
+ return {
619
+ style: 'tableExample',
620
+ table: {
621
+ widths: PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
622
+ // headerRows: 1,
623
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
624
+ },
625
+ layout: PrintSharedService.LayOutStyle1()
626
+ };
627
+ } else {
628
+ return {
629
+ style: 'tableExample',
630
+ table: {
631
+ widths: PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
632
+ // headerRows: 1,
633
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
634
+ },
635
+ layout: PrintSharedService.LayOutStyle1()
636
+ };
637
+ }
638
+ }
639
+
640
+ static buildTableForCustomerLabor(Parts: any, Ops: any, PrintPartNo: any, customerorInsurance: any) {
641
+ var body: any = [];
642
+ let columns: any;
643
+ columns = this.getSummaryHeaders(PrintPartNo);
644
+ body.push(columns);
645
+ if (Parts.length !== 0) {
646
+ let dummypartadding1: any = {};
647
+ dummypartadding1.SNo = '';
648
+ dummypartadding1.Desc = ' ';
649
+ dummypartadding1.Qty = '';
650
+ dummypartadding1.UnPr = '';
651
+ dummypartadding1.Price = '';
652
+ dummypartadding1.DiscountedPrice = '';
653
+ dummypartadding1.LineTotal = '';
654
+ dummypartadding1.QtyAndUoM = '';
655
+ dummypartadding1.HSN = '';
656
+ dummypartadding1.MPN = '';
657
+ // Parts.unshift(dummypartadding1);
658
+ }
659
+
660
+ let SNo: number = 1;
661
+ Parts.forEach((part: any) => {
662
+ var dataRow: any = [];
663
+ columns.forEach((column: any) => {
664
+ if (!TrUtils.IsNull(part[column.Field])
665
+ || column.text === 'Line Total') {
666
+ // if (part[column.Field] === 'Medications') {
667
+ // dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
668
+ // } else {
669
+ // tslint:disable-next-line:max-line-length
670
+ if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'CustPrice' || column.Field === 'InsPrice' ||
671
+ column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount' || column.Field === 'UnPr') {
672
+ if (column.Field === 'Disc Amt') {
673
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', noWrap: true });
674
+
675
+ } else {
676
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
677
+ }
678
+
679
+ } else {
680
+ if (column.Field === 'Desc') {
681
+ let DescData: any = [];
682
+ DescData.push(part[column.Field].toString());
683
+ if (!TrUtils.IsEmpty(part['EDesc'])) {
684
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
685
+ }
686
+ dataRow.push({ stack: DescData });
687
+ } else {
688
+ dataRow.push({ text: part[column.Field].toString() });
689
+ }
690
+ }
691
+ // }
692
+ } else {
693
+ if (column.Field === 'SNo') {
694
+ part[column.Field] = SNo;
695
+ SNo = SNo + 1;
696
+ } else {
697
+ if (TrUtils.IsNull(part[column.Field])) {
698
+ part[column.Field] = '';
699
+ }
700
+ }
701
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
702
+ }
703
+ });
704
+
705
+ body.push(dataRow);
706
+ });
707
+ SNo = 1;
708
+ if (Ops.length !== 0 && Parts.length !== 0) {
709
+ let dummypartadding1: any = {};
710
+ dummypartadding1.SNo = '';
711
+ dummypartadding1.Desc = ' ';
712
+ dummypartadding1.Qty = '';
713
+ dummypartadding1.UnPr = '';
714
+ dummypartadding1.Price = '';
715
+ dummypartadding1.DiscountedPrice = '';
716
+ dummypartadding1.LineTotal = '';
717
+ dummypartadding1.QtyAndUoM = '';
718
+ dummypartadding1.HSN = '';
719
+ Ops.unshift(dummypartadding1);
720
+ }
721
+
722
+ Ops.forEach((labor: any) => {
723
+ var dataRow: any = [];
724
+ columns.forEach((column: any) => {
725
+ if (!TrUtils.IsNull(labor[column.Field])
726
+ || column.text === 'Line Total') {
727
+ if (labor[column.Field] === 'Procedures') {
728
+ dataRow.push({ text: labor[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
729
+ } else {
730
+ if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount'
731
+ || column.Field === 'UnPr' || column.Field === 'CustPrice' || column.Field === 'InsPrice') {
732
+ if (column.Field === 'Disc Amt') {
733
+ dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', noWrap: true });
734
+ } else {
735
+ dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', nowrap: true });
736
+ }
737
+
738
+ } else {
739
+ // dataRow.push({ text: labor[column.Field].toString() });
740
+ if (column.Field === 'Desc') {
741
+ let DescData: any = [];
742
+ DescData.push(labor[column.Field].toString());
743
+ if (!TrUtils.IsEmpty(labor['EDesc'])) {
744
+ DescData.push({ text: labor['EDesc'].toString(), color: 'grey' });
745
+ }
746
+ dataRow.push({ stack: DescData });
747
+ } else {
748
+ dataRow.push({ text: labor[column.Field].toString() });
749
+ }
750
+ }
751
+ }
752
+ } else {
753
+ if (column.Field === 'SNo') {
754
+ labor[column.Field] = SNo;
755
+ SNo = SNo + 1;
756
+ } else {
757
+ if (TrUtils.IsNull(labor[column.Field])) {
758
+ labor[column.Field] = '';
759
+ }
760
+ }
761
+ dataRow.push({ text: labor[column.Field].toString(), alignment: 'center' });
762
+ }
763
+ });
764
+ body.push(dataRow);
765
+ });
766
+ return body;
767
+ }
768
+
769
+ static getSummaryHeaders(permission: boolean) {
770
+ let headersNames: any = [{ text: 'Description', style: 'tableheader', Field: 'Desc' },
771
+ { text: 'HSN / SAC', style: 'tableheader', Field: 'SAC' },
772
+ { text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
773
+ // { text: 'Rate / Unit', style: 'tableheader', Field: 'UnPr' },
774
+ { text: 'Ins. Amt', style: 'tableheader', Field: 'AssPr' },
775
+ { text: 'Cust. Amt', style: 'tableheader', Field: 'Pr' },
776
+ { text: 'Disc.(Rs)', style: 'tableheader', Field: 'DiscountedPrice' },
777
+ { text: 'Tax %', style: 'tableheader', Field: 'TaxAmount' },
778
+ { text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }];
779
+ if (permission) {
780
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
781
+ let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
782
+ headersNames.unshift(sno, MPN);
783
+ } else {
784
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
785
+ headersNames.unshift(sno);
786
+ }
787
+
788
+
789
+ return headersNames;
790
+ }
791
+
792
+ static CommonTotalDetails(ROPrintData: any, index: any, numberofCopies: any, withPass: boolean, isAuto: boolean, moreDiscDetails: boolean) {
793
+ // console.log('ROPrintData', ROPrintData);
794
+ let CommonDetails = [
795
+ SharedPDFService.GetFinalTotalDetails1(ROPrintData, ROPrintData.CustLaborTotalAfterDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST,
796
+ ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
797
+ ROPrintData.CustPartsTotalAfterDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
798
+ ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupDataByPerc, ROPrintData.ShowAccParts,
799
+ ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For,
800
+ ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal,
801
+ ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn,
802
+ TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.CustLaborITax,
803
+ ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, ROPrintData.Adj, ROPrintData.TaxSummary, ROPrintData.STotal, isAuto, moreDiscDetails),
804
+
805
+ this.GetNumberInWords(ROPrintData.CustRoundedTotal),
806
+ this.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, ROPrintData.isCountersale, ROPrintData.Entity.DecimalsNumber),
807
+ SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
808
+ SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
809
+ // SharedPDFService.GetUnderLine(),
810
+ SharedPDFService.GetHCInvSignatures(ROPrintData.Entity.CName, ROPrintData.isCountersale),
811
+ // this.PageBrake(ROPrintData, withPass),
812
+ // SharedPDFService.GetUnderLine1(withPass),
813
+ // this.GetGatePass(withPass, ROPrintData)
814
+ ];
815
+ if (ROPrintData.Type !== 'Invoice') {
816
+ CommonDetails.splice(2, 0, SharedPDFService.GetUnderLine());
817
+ }
818
+ if (!TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
819
+ CommonDetails.push({ text: '', pageBreak: 'after' })
820
+ }
821
+ return CommonDetails;
822
+ }
823
+
824
+ static InvoiceDueStatus(Type: any, Paid: any, Due: any, Status: any, isCounter: boolean, DecimalsNumber: number) {
825
+ if (Type === 'Invoice' && !isCounter) {
826
+ return {
827
+ // lineHeight: 0.7,
828
+ fontSize: 9,
829
+ marginTop: 3,
830
+ marginBottom: 5,
831
+ table: {
832
+ widths: ['*', 'auto'],
833
+ body: [[{ text: 'Paid : Rs.' + TrUtils.FixPriceValue(Paid, DecimalsNumber), marginLeft: 20 },
834
+ { text: 'Due : Rs.' + TrUtils.FixPriceValue(Due, DecimalsNumber), marginRight: 20 }]]
835
+ },
836
+ layout: SharedPDFService.LayOutLineStyle(),
837
+ };
838
+ } else {
839
+ return SharedPDFService.emptyObject();
840
+ }
841
+ }
842
+
843
+ static GetNumberInWords(TotalAmount: any) {
844
+ var rupee = SharedPDFService.convertNumberToWords(TotalAmount);
845
+ // console.log('rupee', rupee);
846
+ return { columns: [{ text: 'In Words :', fontSize: 7, width: 35 }, { text: rupee, fontSize: 7, width: '*' }] }
847
+ }
848
+
849
+ static GetCustomerDetails(ROPrintData: any, isOtherIndustry: boolean) {
850
+ let CustomerData = [
851
+ { name: 'Customer Name', value: ROPrintData.Customer.Name },
852
+ { name: 'Service Advisor', value: ROPrintData.Name },
853
+ ];
854
+ return SharedPDFService.GetVehicleDataTable(CustomerData);
855
+ }
856
+
857
+ static GetVehicleDetails(Vehicle: any, isOtherIndustry: boolean) {
858
+ let vehicleData: any;
859
+ vehicleData = [
860
+ ];
861
+ if (isOtherIndustry) {
862
+ vehicleData.push({ name: 'Serial No', value: SharedPDFService.CheckAndSetString(Vehicle.SNo) });
863
+ }
864
+ let a: any = [
865
+ { name: 'Vehicle Model', value: SharedPDFService.CheckAndSetString(Vehicle.Model) },
866
+ ];
867
+ if (!isOtherIndustry) {
868
+ a.unshift({ name: 'Regn. No', value: SharedPDFService.CheckAndSetString(Vehicle.RegNo) });
869
+ if (!TrUtils.IsEmpty(Vehicle.VIN)) {
870
+ a.unshift({ name: 'Chassis No', value: SharedPDFService.CheckAndSetString(Vehicle.VIN) });
871
+ }
872
+ }
873
+ for (let i = 0; i < a.length; i++) {
874
+ vehicleData.push(a[i]);
875
+ }
876
+
877
+ return SharedPDFService.GetVehicleDataTable(vehicleData);
878
+ }
879
+
880
+ }