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,3042 @@
1
+ import JsBarcode from "jsbarcode";
2
+ import { PayTypeEnum } from "../enums/enums";
3
+ import { MyDate } from '../utils/my-date';
4
+ import { TrUtils } from '../utils/tr-utils';
5
+ import { Add } from "./math-operations";
6
+
7
+ declare var pdfMake: any;
8
+ declare var document: any;
9
+
10
+ export class SharedPDFService {
11
+
12
+ static BodySize: number = 8;
13
+ static TableHeaders: number = 9;
14
+ static SubHeaderSize: number = 9;
15
+ static TermsandCond: number = 6;
16
+
17
+
18
+ static MainHeading(CName: any, Entity: any, Image: any, HColor: any, CopyName: any) {
19
+ let headerstyle: string;
20
+ let MainHeaderStyle: any = this.GetMainHeaderStyleForLeftAlignHeader(CName);
21
+ if (Entity.Header === 1) {
22
+ headerstyle = 'header';
23
+ } else {
24
+ headerstyle = 'temp2header';
25
+ }
26
+ return this.HeaderAlignmentBasedOnCondition(CName, Image, HColor, headerstyle, MainHeaderStyle, Entity, CopyName);
27
+ }
28
+
29
+ static HeaderAlignmentBasedOnCondition(CName: any, Image: any, HColor: any, headerstyle: any, MainHeaderStyle: any, Entity: any, CopyName: any) {
30
+ let HeaderDetails: any = [];
31
+ // HeaderDetails.push({ text: 'Original', color: 'grey', alignment: 'right' });
32
+ if (!TrUtils.IsNull(Image) && Entity.PrLogo) {
33
+ if (Entity.Header === 1) {
34
+ HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor, alignment: this.GetLeftMArgin(CName) })
35
+ } else {
36
+ HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor, alignment: 'left', margin: [10, 0, 0, 0] })
37
+ }
38
+ } else {
39
+ HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor })
40
+ }
41
+ // if (!TrUtils.IsNull(CopyName)) {
42
+ // HeaderDetails.push({ text: CopyName, color: 'grey', alignment: 'right', width: 100, marginTop: -15, fontSize: 10 });
43
+ // }
44
+ return HeaderDetails;
45
+ }
46
+
47
+ static GetLeftMArgin(WorkShopName: any) {
48
+
49
+ if (WorkShopName.length < 28) {
50
+ return 'center';
51
+ } else {
52
+ return 'left';
53
+ }
54
+
55
+ }
56
+
57
+ static GetMainHeader(Entity: any, Image: any, AColor: any, HColor: any, text: any) {
58
+ if (Entity.Header === 1) {
59
+ return {
60
+ columns: this.GetAddresDetailsAndLogo(Entity, Image, AColor, HColor, text)
61
+ };
62
+ } else {
63
+ return {
64
+ columns: this.GetLeftAlignmentHeader(Entity, Image, AColor, HColor, text)
65
+ };
66
+ }
67
+ }
68
+
69
+ static GetConsultationMainHeader(Entity: any, Image: any, AColor: any, HColor: any, text: any) {
70
+
71
+ return {
72
+ columns: this.GetConsultationLeftAlignmentHeader(Entity, Image, AColor, HColor, text), width: '60%'
73
+ };
74
+ }
75
+
76
+ static ConsultationMainHeading(CName: any, Entity: any, Image: any, HColor: any, CopyName: any) {
77
+ let headerstyle: string;
78
+ let MainHeaderStyle: any = {
79
+ fontSize: 15,
80
+ bold: true,
81
+ };
82
+ // if (Entity.Header === 1) {
83
+ // headerstyle = 'header';
84
+ // } else {
85
+ headerstyle = 'temp2header';
86
+ // }
87
+ return this.ConsultHeaderAlignmentBasedOnCondition(CName, Image, HColor, headerstyle, MainHeaderStyle, Entity, CopyName);
88
+ }
89
+
90
+ static ConsultHeaderAlignmentBasedOnCondition(CName: any, Image: any, HColor: any, headerstyle: any, MainHeaderStyle: any, Entity: any, CopyName: any) {
91
+ let HeaderDetails: any = [];
92
+ // HeaderDetails.push({ text: 'Original', color: 'grey', alignment: 'right' });
93
+ if (!TrUtils.IsNull(Image) && Entity.PrLogo) {
94
+ // if (Entity.Header === 1) {
95
+ // HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor, alignment: this.GetLeftMArgin(CName) })
96
+ // } else {
97
+ HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor, alignment: 'left', margin: [10, 0, 0, 0] })
98
+ // }
99
+ } else {
100
+ HeaderDetails.push({ text: '' + CName + '', style: [headerstyle, MainHeaderStyle], color: HColor })
101
+ }
102
+ // if (!TrUtils.IsNull(CopyName)) {
103
+ // HeaderDetails.push({ text: CopyName, color: 'grey', alignment: 'right', width: 100, marginTop: -15, fontSize: 10 });
104
+ // }
105
+ return HeaderDetails;
106
+ }
107
+
108
+ static GetConsultationLeftAlignmentHeader(Entity: any, Image: any, AColor: any, HColor: any, text: any) {
109
+ let Details: any = [
110
+ {
111
+ stack: [{ columns: [this.ConsultationMainHeading(Entity.CName, Entity, Image, HColor, text)], marginTop: 15 },
112
+ {
113
+ columns: [
114
+ this.GetEntityDetails(Entity)]
115
+ }
116
+ ]
117
+ }];
118
+ if (!TrUtils.IsNull(Image) && Entity.PrLogo) {
119
+ Details[0].stack[1].columns.unshift({
120
+ width: 290,
121
+ margin: [10, 0, 0, 5],
122
+ stack: this.GetHeader(Entity, HColor),
123
+ color: AColor,
124
+ style: 'temp2header'
125
+ });
126
+ if (!TrUtils.IsNull(text)) {
127
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
128
+ }
129
+ Details.unshift({ image: Image, width: 120, height: 80 });
130
+ } else {
131
+ Details[0].stack[1].columns.unshift({
132
+ width: 420,
133
+ margin: [0, 0, 0, 5],
134
+ stack: this.GetHeader(Entity, HColor),
135
+ color: AColor,
136
+ style: 'temp2header'
137
+ });
138
+ if (!TrUtils.IsNull(text)) {
139
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
140
+ }
141
+ }
142
+
143
+ return Details;
144
+ }
145
+
146
+ static GetWatermarkImage(Image: any, pageSize: any, Wmark: boolean) {
147
+ if (!TrUtils.IsNull(Image) && Wmark) {
148
+ return {
149
+ margun: [10, 15, 10, 15],
150
+ image: Image,
151
+ width: pageSize.width,
152
+ alignment: 'center',
153
+ height: pageSize.height,
154
+ opacity: 0.04,
155
+ }
156
+ } else {
157
+ return this.emptyObject();
158
+ }
159
+
160
+ }
161
+
162
+ static GetLeftAlignmentHeader(Entity: any, Image: any, AColor: any, HColor: any, text: any) {
163
+ let Details: any = [
164
+ {
165
+ stack: [{ columns: [this.MainHeading(Entity.CName, Entity, Image, HColor, text)] },
166
+ {
167
+ columns: [
168
+ this.emptyObject()]
169
+ }
170
+ ]
171
+ }];
172
+ if (!TrUtils.IsNull(Image) && Entity.PrLogo) {
173
+ Details[0].stack[1].columns.unshift({
174
+ width: 290,
175
+ margin: [10, 0, 0, 5],
176
+ stack: this.GetHeader(Entity, HColor),
177
+ color: AColor,
178
+ style: 'temp2header'
179
+ });
180
+ if (!TrUtils.IsNull(text)) {
181
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
182
+ }
183
+ Details.unshift({ image: Image, width: 120, height: 80 });
184
+ } else {
185
+ Details[0].stack[1].columns.unshift({
186
+ width: 420,
187
+ margin: [0, 0, 0, 5],
188
+ stack: this.GetHeader(Entity, HColor),
189
+ color: AColor,
190
+ style: 'temp2header'
191
+ });
192
+ if (!TrUtils.IsNull(text)) {
193
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
194
+ }
195
+ }
196
+
197
+ return Details;
198
+ }
199
+
200
+ static GetAddresDetailsAndLogo(Entity: any, Image: any, AColor: any, HColor: any, text: any) {
201
+ let Details: any = [
202
+ {
203
+ stack: [
204
+ { columns: [this.MainHeading(Entity.CName, Entity, Image, HColor, text)] },
205
+ {
206
+ columns: [{
207
+ width: 300,
208
+ margin: [0, 0, 0, 5],
209
+ stack: this.GetHeader(Entity, HColor),
210
+ color: AColor,
211
+ style: 'header'
212
+ },
213
+ this.emptyObject()]
214
+ }
215
+ ]
216
+ }
217
+ ]
218
+ if (!TrUtils.IsNull(Image) && Entity.PrLogo) {
219
+ // Details.unshift({ text: '', width: 120 });
220
+ if (Entity.CName.length < 28) {
221
+ Details[0].stack[0].columns.push({ text: '', width: 150 });
222
+ }
223
+ if (!TrUtils.IsNull(text)) {
224
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 7 });
225
+ }
226
+ Details.unshift({ image: Image, width: 120, height: 80 });
227
+ } else {
228
+ Details[0].stack[1].columns.unshift({ text: '', width: 130 });
229
+ if (!TrUtils.IsNull(text)) {
230
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 7 });
231
+ }
232
+ }
233
+
234
+ return Details;
235
+ }
236
+
237
+ static GetHeader(Entity: any, HColor: string) {
238
+ let headerstyle: string;
239
+ if (Entity.Header === 1) {
240
+ headerstyle = 'ws_adrs_center';
241
+ } else {
242
+ headerstyle = 'ws_adrs_left';
243
+ }
244
+ let SubHeader: any = [
245
+ { text: '' + Entity.Adrs1 + '', style: [headerstyle] },
246
+ { text: '' + Entity.City + this.getPinCode(Entity.PIN) + ', ' + 'Ph: ' + Entity.Phone, style: headerstyle },
247
+ { text: '' + this.GetEmail(Entity.Email) + '', style: headerstyle },
248
+ // { text: 'GSTIN:' + Entity.GSTIN + ', ' + 'PAN: ' + Entity.PAN, style: headerstyle },
249
+
250
+ ];
251
+ if (!TrUtils.IsEmpty(Entity.Adrs2)) {
252
+ SubHeader.splice(1, 0, { text: '' + Entity.Adrs2 + '', style: [headerstyle] });
253
+ }
254
+ if (!TrUtils.IsEmpty(Entity.TLine)) {
255
+ SubHeader.unshift({ text: this.GetTagLine(Entity.TLine), fontSize: 10, bold: true, color: HColor, margin: [0, 0, 0, 2] });
256
+ }
257
+
258
+ if (!TrUtils.IsEmpty(Entity.GSTIN) || !TrUtils.IsEmpty(Entity.PAN)) {
259
+ let Data: any = '';
260
+ if (!TrUtils.IsEmpty(Entity.GSTIN)) {
261
+ Data = 'GSTIN:' + Entity.GSTIN;
262
+ }
263
+ if (!TrUtils.IsEmpty(Entity.GSTIN) && !TrUtils.IsEmpty(Entity.PAN)) {
264
+ Data = Data + ', ';
265
+ }
266
+ if (!TrUtils.IsEmpty(Entity.PAN)) {
267
+ Data = Data + 'PAN:' + Entity.PAN;
268
+ }
269
+ SubHeader.push({ text: Data, style: headerstyle, fontSize: this.TermsandCond });
270
+ }
271
+ if (Entity.GSTType === 2) {
272
+ SubHeader.push({ text: '* under composition scheme', fontSize: this.TermsandCond });
273
+ }
274
+ return SubHeader;
275
+ }
276
+
277
+ static GetMainHeaderStyleForLeftAlignHeader(WorkShopName: string) {
278
+ var wsname_fontSize: any;
279
+
280
+ if (TrUtils.IsNull(WorkShopName)) {
281
+ WorkShopName = '';
282
+ }
283
+
284
+ switch (true) {
285
+ case (WorkShopName.length < 30):
286
+ wsname_fontSize = 20;
287
+ break;
288
+ case (WorkShopName.length < 35):
289
+ wsname_fontSize = 20;
290
+ break;
291
+ case (WorkShopName.length < 50):
292
+ wsname_fontSize = 17;
293
+ break;
294
+ default:
295
+ wsname_fontSize = 14;
296
+ }
297
+
298
+ var HeaderSize: any = {
299
+ fontSize: wsname_fontSize,
300
+ bold: true,
301
+ };
302
+
303
+ return HeaderSize;
304
+
305
+ }
306
+
307
+ static GetEntityDetails(Entity: any) {
308
+ let SetData: any = [];
309
+ if (Entity.PrUPI && !Entity.IsProforma && !TrUtils.IsEmpty(Entity.UPI)) {
310
+ SetData.push({ qr: Entity.UPI, fit: '125', marginLeft: 150 });
311
+ SetData.push({ text: 'Scan To Pay', fontSize: this.TermsandCond, marginLeft: 151, bold: true, marginTop: 2 });
312
+ // SetData.push({ text: 'UPI Number: ' + Entity.UPIPhone, fontSize: 9, marginLeft: 151, bold: true, marginTop: 5 });
313
+ if (!TrUtils.IsNull(Entity.UPIPhone)) {
314
+ SetData.push({ text: 'UPI Number: ' + Entity.UPIPhone, fontSize: 9, marginLeft: 151, bold: true, marginTop: 5 });
315
+ }
316
+ }
317
+ // SetData.push({ columns: [this.GetEntityTax(Entity)] })
318
+ return {
319
+ lineHeight: 0.7,
320
+ stack: SetData
321
+ };
322
+
323
+ }
324
+
325
+ static GetEntityTax(Entity: any) {
326
+ let EntityData: any = [];
327
+ if (!TrUtils.IsEmpty(Entity.GSTIN)) {
328
+ EntityData.push({ name: 'GSTIN', value: Entity.GSTIN });
329
+ }
330
+ if (!TrUtils.IsEmpty(Entity.PAN)) {
331
+ EntityData.push({ name: 'PAN No', value: Entity.PAN });
332
+ }
333
+ if (EntityData.length !== 0) {
334
+ return this.GetEntityeDataTable(EntityData, Entity);
335
+ } else {
336
+ return this.emptyObject();
337
+ }
338
+ }
339
+
340
+ static GetEntityeDataTable(EntityFields: any, Entity: any) {
341
+ return {
342
+ lineHeight: 0.7,
343
+ marginTop: 5,
344
+ marginLeft: 10,
345
+ fontSize: this.TermsandCond,
346
+ // fontSize: this.SubHeaderSize,
347
+ table: {
348
+ body: [
349
+ [{
350
+ table: {
351
+ fontSize: this.TermsandCond,
352
+ widths: ['auto', 'auto', '*'],
353
+
354
+ body: this.EntityTableDataDetails(EntityFields, Entity)
355
+ },
356
+ layout: 'noBorders',
357
+ }]
358
+ ]
359
+ },
360
+ layout: 'noBorders',
361
+ };
362
+ }
363
+
364
+ static EntityTableDataDetails(EntityFields: any, Entity: any) {
365
+ var body: any = [];
366
+ EntityFields.forEach((row: any) => {
367
+ if (!TrUtils.IsFixedZero(row.value) && !TrUtils.IsEmpty(row.value)) {
368
+ var dataRow: any = [];
369
+ dataRow.push({ text: (row.name).toString(), noWrap: true, fontSize: 8 });
370
+ dataRow.push(':');
371
+ dataRow.push({ text: (row.value).toString(), noWrap: true, fontSize: 9 });
372
+ body.push(dataRow);
373
+ if (row.name === 'GSTIN' && Entity.GSTType === 2) {
374
+ let data: any = [];
375
+ data.push({ text: '* under composition scheme', colSpan: 3, fontSize: 7, marginLeft: 10 }, {}, {});
376
+ body.push(data);
377
+ }
378
+ }
379
+ // else {
380
+ // var a: any = [];
381
+ // a.push({ text: '', lineHeight: 0.1 });
382
+ // a.push({ text: '', lineHeight: 0.1 });
383
+ // a.push({ text: '', lineHeight: 0.1 });
384
+ // body.push(a);
385
+ // }
386
+ });
387
+ return body;
388
+ }
389
+
390
+ static GetTagLine(TLine: any) {
391
+ if (!TrUtils.IsEmpty(TLine)) {
392
+ return TLine;
393
+ } else {
394
+ let TagLine: any = '';
395
+ return TagLine;
396
+ }
397
+ }
398
+
399
+ static GetEmail(email: any) {
400
+ let Email: any = '';
401
+ if (!TrUtils.IsNull(email)) {
402
+ return 'Email: ' + email;
403
+ } else {
404
+ return Email;
405
+ }
406
+ }
407
+
408
+ static getPinCode(pin: any) {
409
+ let code: any = '';
410
+ if (!TrUtils.IsNull(pin)) {
411
+ return ' - ' + pin;
412
+ } else {
413
+ return code;
414
+ }
415
+
416
+ }
417
+
418
+ static GetPrintType(type: any) {
419
+ return {
420
+ // marginLeft: 10,
421
+ columns: [{ text: '', width: 120 },
422
+ { text: type, alignment: 'center' }, { text: '', width: 140 }
423
+ ],
424
+ style: 'Receiptheader1'
425
+ };
426
+ }
427
+
428
+ static GetNewUnderLine(orientation: 'portrait' | 'landscape' = 'portrait') {
429
+ const lineWidth = orientation === 'landscape' ? 820 : 575;
430
+ return {
431
+ marginTop: 10,
432
+ canvas: [
433
+ {
434
+ type: 'line',
435
+ color: 'grey',
436
+ x1: 0,
437
+ y1: 0,
438
+ x2: lineWidth,
439
+ y2: 0,
440
+ lineWidth: 0.9
441
+ }
442
+ ]
443
+ };
444
+ }
445
+
446
+ static GetNewUnderLine1(withPass: boolean, orientation: 'portrait' | 'landscape' = 'portrait') {
447
+
448
+ if (withPass) {
449
+ const lineWidth = orientation === 'landscape' ? 820 : 575;
450
+ return {
451
+ marginTop: 10,
452
+ canvas: [
453
+ {
454
+ type: 'line',
455
+ color: 'grey',
456
+ x1: 0,
457
+ y1: 0,
458
+ x2: lineWidth,
459
+ y2: 0,
460
+ dash: { length: 5, space: 10 },
461
+ lineWidth: 0.9
462
+ }
463
+ ]
464
+ };
465
+ } else {
466
+ return this.emptyObject();
467
+ }
468
+
469
+ }
470
+ static GetNewMainHeader(Entity: any, Image: any, AColor: any, HColor: any, text: any, orientation: 'portrait' | 'landscape' = 'portrait') {
471
+ if (Entity.Header === 1) {
472
+ return {
473
+ columns: this.GetNewAddresDetailsAndLogo(Entity, Image, AColor, HColor, text, orientation)
474
+ };
475
+ } else {
476
+ return {
477
+ columns: this.GetNewLeftAlignmentHeader(Entity, Image, AColor, HColor, text, orientation)
478
+ };
479
+ }
480
+ }
481
+
482
+ static GetNewLeftAlignmentHeader(Entity: any, Image: any, AColor: any, HColor: any, text: any, orientation: 'portrait' | 'landscape' = 'portrait') {
483
+ const headerWidth = orientation === 'landscape' ? 420 : 290;
484
+ const noImageWidth = orientation === 'landscape' ? 550 : 420;
485
+
486
+ let Details: any = [
487
+ {
488
+ stack: [{ columns: [this.MainHeading(Entity.CName, Entity, Image, HColor, text)] },
489
+ {
490
+ columns: [
491
+ this.emptyObject()]
492
+ }
493
+ ]
494
+ }];
495
+ if (!TrUtils.IsNull(Image) && Entity.PrLogo) {
496
+ Details[0].stack[1].columns.unshift({
497
+ width: headerWidth,
498
+ margin: [10, 0, 0, 5],
499
+ stack: this.GetHeader(Entity, HColor),
500
+ color: AColor,
501
+ style: 'temp2header'
502
+ });
503
+ if (!TrUtils.IsNull(text)) {
504
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
505
+ }
506
+ Details.unshift({ image: Image, width: 120, height: 80 });
507
+ } else {
508
+ Details[0].stack[1].columns.unshift({
509
+ width: noImageWidth,
510
+ margin: [0, 0, 0, 5],
511
+ stack: this.GetHeader(Entity, HColor),
512
+ color: AColor,
513
+ style: 'temp2header'
514
+ });
515
+ if (!TrUtils.IsNull(text)) {
516
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
517
+ }
518
+ }
519
+
520
+ return Details;
521
+ }
522
+
523
+ static GetNewAddresDetailsAndLogo(Entity: any, Image: any, AColor: any, HColor: any, text: any, orientation: 'portrait' | 'landscape' = 'portrait') {
524
+ const logoWidth = 120;
525
+ const logoHeight = 80;
526
+ const headerStyle = this.GetMainHeaderStyleForLeftAlignHeader(Entity.CName || '');
527
+
528
+ const extras: any[] = [];
529
+ if (!TrUtils.IsNull(Entity.PageCount)) {
530
+ extras.push({ text: 'Page: ' + Entity.PageCount, color: 'grey', alignment: 'center', fontSize: this.TermsandCond, margin: [0, 1, 0, 0] });
531
+ }
532
+ if (!TrUtils.IsEmpty(Entity.Extra1)) {
533
+ extras.push({ text: Entity.Extra1, color: 'grey', alignment: 'center', fontSize: this.TermsandCond, margin: [0, 1, 0, 0] });
534
+ }
535
+ if (!TrUtils.IsEmpty(Entity.Extra2)) {
536
+ extras.push({ text: Entity.Extra2, color: 'grey', alignment: 'center', fontSize: this.TermsandCond, margin: [0, 1, 0, 0] });
537
+ }
538
+
539
+ const centerStack: any[] = [
540
+ { text: '' + (Entity.CName || '') + '', color: HColor, fontSize: headerStyle.fontSize, bold: true, alignment: 'center' },
541
+ {
542
+ stack: this.GetHeader(Entity, HColor),
543
+ color: AColor,
544
+ style: 'header',
545
+ alignment: 'center',
546
+ margin: [0, 0, 0, 2]
547
+ }
548
+ ];
549
+
550
+ if (!TrUtils.IsNull(text)) {
551
+ centerStack.push({ text: text, color: 'grey', alignment: 'center', fontSize: 7, margin: [0, 0, 0, 1] });
552
+ }
553
+
554
+ extras.forEach((row: any) => centerStack.push(row));
555
+
556
+ let Details: any = [
557
+ !TrUtils.IsNull(Image) && Entity.PrLogo ? { image: Image, width: logoWidth, height: logoHeight } : { text: '', width: logoWidth },
558
+ { width: '*', stack: centerStack },
559
+ { text: '', width: logoWidth }
560
+ ];
561
+
562
+ return Details;
563
+ }
564
+
565
+ static GetUnderLine() {
566
+ return {
567
+ marginTop: 10,
568
+ canvas: [
569
+ {
570
+ type: 'line',
571
+ color: 'grey',
572
+ x1: 0,
573
+ y1: 0,
574
+ x2: 575,
575
+ y2: 0,
576
+ lineWidth: 0.9
577
+ }
578
+ ]
579
+ };
580
+ }
581
+
582
+ static GetUnderLine1(withPass: boolean) {
583
+
584
+ if (withPass) {
585
+ return {
586
+ marginTop: 10,
587
+ canvas: [
588
+ {
589
+ type: 'line',
590
+ color: 'grey',
591
+ x1: 0,
592
+ y1: 0,
593
+ x2: 575,
594
+ y2: 0,
595
+ dash: { length: 5, space: 10 },
596
+ lineWidth: 0.9
597
+ }
598
+ ]
599
+ };
600
+ } else {
601
+ return this.emptyObject();
602
+ }
603
+
604
+ }
605
+
606
+ static GetLightUnderLine(width: number, color: string) {
607
+ return {
608
+ canvas: [
609
+ {
610
+ type: 'line',
611
+ color: color,
612
+ x1: 0,
613
+ y1: 0,
614
+ x2: width,
615
+ y2: 0,
616
+ lineWidth: 0.3
617
+ }
618
+ ]
619
+ };
620
+ }
621
+
622
+ static HeaderAfterLine() {
623
+ return {
624
+ canvas: [
625
+ {
626
+ type: 'line',
627
+ lineColor: 'grey',
628
+ x1: 0,
629
+ y1: 0,
630
+ x2: 575,
631
+ y2: 0,
632
+ lineWidth: 1.5
633
+ }
634
+ ]
635
+ };
636
+ }
637
+
638
+ static HeaderAfterLine2() {
639
+ return {
640
+ canvas: [
641
+ {
642
+ type: 'line',
643
+ lineColor: 'grey',
644
+ x1: 0,
645
+ y1: 0,
646
+ x2: 545,
647
+ y2: 0,
648
+ lineWidth: 1.5
649
+ }
650
+ ]
651
+ };
652
+ }
653
+
654
+ static HeaderAfterLine1() {
655
+ return {
656
+ canvas: [
657
+ {
658
+ type: 'line',
659
+ lineColor: 'grey',
660
+ x1: 0,
661
+ y1: 0,
662
+ x2: 545,
663
+ y2: 0,
664
+ lineWidth: 1.5
665
+ }
666
+ ]
667
+ };
668
+ }
669
+
670
+ static CustomerAndVehicleDetailsAfterLine() {
671
+ return {
672
+ canvas: [
673
+ {
674
+ type: 'line',
675
+ lineColor: 'grey',
676
+ x1: 0,
677
+ y1: 0,
678
+ x2: 575,
679
+ y2: 0,
680
+ lineWidth: 1
681
+ }
682
+ ]
683
+ };
684
+ }
685
+
686
+ static convertImgToBase64URL(url: any, callback: any, outputFormat: any) {
687
+ var canvas = document.createElement('CANVAS'),
688
+ ctx = canvas.getContext('2d'),
689
+ img = new Image;
690
+ img.crossOrigin = 'Anonymous';
691
+ img.onload = function () {
692
+ var dataURL;
693
+ canvas.height = img.height;
694
+ canvas.width = img.width;
695
+ ctx.drawImage(img, 0, 0);
696
+ dataURL = canvas.toDataURL(outputFormat);
697
+ callback(dataURL);
698
+ canvas = null;
699
+ };
700
+ img.onerror = outputFormat;
701
+ img.src = url;
702
+ }
703
+
704
+ static GetShowLine(ROData: any) {
705
+ if (ROData.Parts.length !== 0 || ROData.Ops.length !== 0) {
706
+ return this.GetUnderLine();
707
+ } else {
708
+ return this.emptyObject();
709
+ }
710
+ }
711
+
712
+ static GetTemsAndConditions(Terms: any) {
713
+ if (!TrUtils.IsNull(Terms)) {
714
+ return {
715
+ text: '' + Terms + '', marginTop: 5, marginBottom: 5,
716
+ fontSize: this.TermsandCond, alignment: 'justify'
717
+ };
718
+ } else {
719
+ return this.emptyObject();
720
+ }
721
+ }
722
+
723
+ static GetSearchValueDetails(searchValue: any) {
724
+ let showSearch: any = [];
725
+ for (const key in searchValue) {
726
+ if (!TrUtils.IsNull(searchValue[key]) && !TrUtils.CheckInvalidSelect(searchValue[key]) && key !== 'Date' && key !== 'CustCntrlId' && key !== 'DescCntrlId' && key !== 'ManfCntrlId' && key !== 'VenCntrlId') {
727
+ showSearch.push({
728
+ name: (key === 'StDate') ? 'Start Date' : (key === 'EnDate') ? 'End Date' : (key === 'CustCntrl') ? 'Customer' : (key === 'DescCntrl') ? 'Item' : (key === 'ManfCntrl') ? 'Manufacturer' : (key === 'VenCntrl') ? 'Vendor' : key,
729
+
730
+ value: (key === 'StDate') ? MyDate.ConvertUTCDateToReadable(searchValue[key]) : (key === 'EnDate') ? MyDate.ConvertUTCDateToReadable(searchValue[key]) : searchValue[key],
731
+
732
+ });
733
+ }
734
+ // console.log('showSearch', showSearch);
735
+ // console.log(`${key}: ${searchValue[key]}`);
736
+ }
737
+ return {
738
+ style: ['columnheader', 'TotalsStyles'],
739
+ lineHeight: 1,
740
+ fontSize: this.SubHeaderSize,
741
+ marginBottom: 5,
742
+ table: {
743
+ body: this.GetBankDataTable(showSearch, false)
744
+ },
745
+ layout: 'noBorders',
746
+ };
747
+ }
748
+
749
+ static GetBankDetials(Bankinfo: any, isPrint: boolean, UPIPhone: string) {
750
+ if (isPrint && !TrUtils.IsNull(Bankinfo)) {
751
+ let AccountFields = [];
752
+ let BANK = { name: 'BANK', value: Bankinfo.Name };
753
+ let Acc = { name: 'A/C NO', value: Bankinfo.ACNo };
754
+ let AccHolderName = { name: 'Account Holder Name', value: Bankinfo.ACName };
755
+ let Branch = { name: 'Branch', value: TrUtils.IsNull(Bankinfo.Bran) ? '' : Bankinfo.Bran };
756
+
757
+ let IFSC = { name: 'IFSC NO', value: Bankinfo.IFSC };
758
+
759
+ // let UPIPh = { name: 'Phone Pay / Google Pay', value: UPIPhone };
760
+ // let TotalPartsAmount = { name: 'Final Labor Amount', value: this.LabourtotalAmount(ROPrintData.LaborInsTotal) };
761
+ AccountFields.push(BANK);
762
+ // if (!TrUtils.IsNull(ROPrintData.OverAllLaborDiscount) && ROPrintData.OverAllLaborDiscount !== 0) {
763
+ AccountFields.push(Acc);
764
+ AccountFields.push(AccHolderName);
765
+ // }
766
+ AccountFields.push(Branch);
767
+
768
+ AccountFields.push(IFSC);
769
+ // if (!TrUtils.IsNull(UPIPhone)) {
770
+ // AccountFields.push(UPIPh);
771
+ // } // AccountFields.push(TotalPartsAmount);
772
+
773
+ return {
774
+ style: ['columnheader', 'TotalsStyles'],
775
+ lineHeight: 1,
776
+ fontSize: this.SubHeaderSize,
777
+ marginBottom: 5,
778
+ table: {
779
+ body: this.GetBankDataTable(AccountFields, true)
780
+ },
781
+ layout: 'noBorders',
782
+ };
783
+ } else {
784
+ return this.emptyObject();
785
+ }
786
+ }
787
+
788
+ static GetBankDataTable(data: any, isBank: boolean) {
789
+ var body: any = [];
790
+ if (isBank) {
791
+ body = [[{ text: 'Bank Details', bold: true, colSpan: 3 }, {}, {}]];;
792
+ }
793
+ data.forEach((row: any) => {
794
+ // if ((!TrUtils.IsFixedZero(row.value) && !TrUtils.IsNull(row.value)) || row.name === 'Total') {
795
+ var dataRow: any = [];
796
+
797
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
798
+ dataRow.push(':');
799
+
800
+ dataRow.push({ text: (row.value).toString(), noWrap: true, });
801
+ body.push(dataRow);
802
+ // }
803
+ // else {
804
+ // var a: any = [];
805
+ // a.push({ text: '', lineHeight: 0.1 });
806
+ // a.push({ text: '', lineHeight: 0.1 });
807
+ // a.push({ text: '', lineHeight: 0.1 });
808
+ // body.push(a);
809
+ // }
810
+ });
811
+ return body;
812
+ }
813
+
814
+ //Not Use This Function any where
815
+ static LaborTotalTable(ROPrintData: any) {
816
+ let AccountFields = [];
817
+ if (ROPrintData.For === PayTypeEnum.Insurance) {
818
+ let LaborTotal = { name: 'Labor Total', value: ROPrintData.BasicLaborTotal };
819
+ let Disc = { name: 'Labor Discount', value: ROPrintData.OverAllLaborDiscount };
820
+ let VAT = { name: 'Service Tax', value: ROPrintData.OverAllLaborTaxAmount };
821
+ // let TotalPartsAmount = { name: 'Final Labor Amount', value: this.LabourtotalAmount(ROPrintData.LaborInsTotal) };
822
+ AccountFields.push(LaborTotal);
823
+ // if (!TrUtils.IsNull(ROPrintData.OverAllLaborDiscount) && ROPrintData.OverAllLaborDiscount !== 0) {
824
+ AccountFields.push(Disc);
825
+ // }
826
+ AccountFields.push(VAT);
827
+ // AccountFields.push(TotalPartsAmount);
828
+ } else {
829
+ let LaborTotal = { name: 'Labor Total', value: ROPrintData.BasicLaborTotal };
830
+ let Disc = { name: 'Labor Discount', value: ROPrintData.OverAllLaborDiscount };
831
+ let VAT = { name: 'Service Tax ', value: ROPrintData.OverAllLaborTaxAmount };
832
+ // let TotalPartsAmount = { name: 'Final Labor Amount', value: this.LabourtotalAmount(ROPrintData.LaborTotal) }
833
+ AccountFields.push(LaborTotal);
834
+ // if (!TrUtils.IsNull(ROPrintData.OverAllLaborDiscount) && ROPrintData.OverAllLaborDiscount !== 0) {
835
+ AccountFields.push(Disc);
836
+ // }
837
+ AccountFields.push(VAT);
838
+ // AccountFields.push(TotalPartsAmount);
839
+ }
840
+ return {
841
+ style: ['columnheader', 'TotalsStyles'],
842
+ lineHeight: 1,
843
+ fontSize: this.SubHeaderSize,
844
+ marginBottom: 5,
845
+ table: {
846
+ body: this.GetDataTable(AccountFields, true)
847
+ },
848
+ layout: 'noBorders',
849
+ };
850
+ }
851
+
852
+ //Not Use This Function any where
853
+ static PartsTotalTables(ROPrintData: any) {
854
+ let AccountFields = [];
855
+ if (ROPrintData.For === PayTypeEnum.Insurance) {
856
+ let PartsTotal = { name: 'Parts Total', value: ROPrintData.BasicPartsTotal };
857
+ let Disc = { name: 'Parts Discount', value: ROPrintData.OverAllPartsDiscount };
858
+ let VAT = { name: 'Parts Tax', value: ROPrintData.OverAllPartsTaxAmount };
859
+ // let TotalPartsAmount = { name: 'Final Parts Amount', value: this.PartstotalAmount(ROPrintData.PartsInsTotal)};
860
+ AccountFields.push(PartsTotal);
861
+ AccountFields.push(Disc);
862
+ AccountFields.push(VAT);
863
+ // AccountFields.push(TotalPartsAmount);
864
+ } else {
865
+ let PartsTotal = { name: 'Parts Total', value: ROPrintData.BasicPartsTotal };
866
+ let Disc = { name: 'Parts Discount', value: ROPrintData.OverAllPartsDiscount };
867
+ let VAT = { name: 'Parts Tax', value: ROPrintData.OverAllPartsTaxAmount };
868
+ // let TotalPartsAmount = { name: 'Final Parts Amount', value: this.PartstotalAmount(ROPrintData.PartsTotal) }
869
+ AccountFields.push(PartsTotal);
870
+ AccountFields.push(Disc);
871
+ AccountFields.push(VAT);
872
+ // AccountFields.push(TotalPartsAmount);
873
+ }
874
+ return {
875
+ style: ['columnheader', 'TotalsStyles'],
876
+ lineHeight: 1,
877
+ fontSize: this.SubHeaderSize,
878
+ marginBottom: 5,
879
+ table: {
880
+ body: this.GetDataTable(AccountFields, true)
881
+ },
882
+ layout: 'noBorders',
883
+ };
884
+ }
885
+
886
+ static GetDataTable(data: any, istotal: boolean) {
887
+ var body: any = [];
888
+ data.forEach((row: any) => {
889
+ // if ((!TrUtils.IsFixedZero(row.value) && !TrUtils.IsNull(row.value)) || row.name === 'Total') {
890
+ if (TrUtils.IsNull(row.value)) {
891
+ row.value = '';
892
+ }
893
+ var dataRow: any = [];
894
+ if (row.name === 'Labor' || row.name === 'Parts') {
895
+ dataRow.push({ text: [{ text: row.name, bold: 'true' }, ' Total(Before Tax)'] });
896
+ } else {
897
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
898
+ }
899
+ dataRow.push(':');
900
+ if (row.name === 'Vehicle') {
901
+ dataRow.push({ text: (row.value).toString(), width: 'auto', lineHeight: 1 });
902
+ } else {
903
+ if (istotal) {
904
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right' });
905
+ } else {
906
+ dataRow.push({ text: (row.value).toString(), noWrap: true, bold: row.bold });
907
+ }
908
+ }
909
+ body.push(dataRow);
910
+ // }
911
+ // else {
912
+ // var a: any = [];
913
+ // a.push({ text: '', lineHeight: 0.1 });
914
+ // a.push({ text: '', lineHeight: 0.1 });
915
+ // a.push({ text: '', lineHeight: 0.1 });
916
+ // body.push(a);
917
+ // }
918
+ });
919
+ return body;
920
+ }
921
+
922
+ static GetCustomerAndVehicleDetails(Id: any, CrDate: any, PrDate: any, MOut: any,
923
+ MIn: any, Vehicle: any, PrintType: any, For: any, SurName: any, SurPhone: any, Type: any,
924
+ SurEmail: any, InsComp: any, PolNo: any, PolType: any, Customer: any, IsProforma: boolean, Settings: any, Location: any,
925
+ isOtherIndustry: boolean, BL: any, ROCode: any, TypeName: any, AdmNo: any, DoS: any, PrCustBar: boolean = false) {
926
+ return {
927
+ style: 'textcust',
928
+ marginLeft: 5,
929
+ columns: [
930
+ this.GetCustomer(Customer, Type, For, Vehicle, Settings, 'Bill To', isOtherIndustry),
931
+ this.GetInsurence(For, SurName, SurPhone, Type, SurEmail, InsComp, PolNo, PolType, Location, isOtherIndustry, Customer.Code, PrCustBar),
932
+ this.GetVehicle(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, For, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo, DoS)
933
+ ],
934
+ };
935
+ }
936
+
937
+ static GetNewCustomerAndVehicleDetails(Id: any, CrDate: any, PrDate: any, MOut: any,
938
+ MIn: any, Vehicle: any, PrintType: any, For: any, SurName: any, SurPhone: any, Type: any,
939
+ SurEmail: any, InsComp: any, PolNo: any, PolType: any, Customer: any, IsProforma: boolean, Settings: any, Location: any,
940
+ isOtherIndustry: boolean, BL: any, ROCode: any, TypeName: any, AdmNo: any, DoS: any, PrCustBar: boolean = false, orientation: 'portrait' | 'landscape' = 'portrait') {
941
+ return {
942
+ style: 'textcust',
943
+ marginLeft: 5,
944
+ columns: [
945
+ this.GetNewCustomer(Customer, Type, For, Vehicle, Settings, 'Bill To', isOtherIndustry, orientation),
946
+ this.GetNewInsurence(For, SurName, SurPhone, Type, SurEmail, InsComp, PolNo, PolType, Location, isOtherIndustry, Customer.Code, PrCustBar, orientation),
947
+ this.GetNewVehicle(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, For, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo, DoS, orientation)
948
+ ],
949
+ };
950
+ }
951
+
952
+ static GetNewCustomer(Customer: any, Type: any, For: any, Vehicle: any, Settings: any, Headding: any, isOtherIndustry: boolean, orientation: 'portrait' | 'landscape' = 'portrait') {
953
+ const insuranceWidth = orientation === 'landscape' ? 220 : 170;
954
+ const normalWidth = orientation === 'landscape' ? 280 : 230;
955
+
956
+ if (For === PayTypeEnum.Insurance || isOtherIndustry) {
957
+ return { stack: [this.GetCustomerDetails(Customer, Type, Vehicle, Settings, Headding)], width: insuranceWidth, marginLeft: 2 };
958
+ } else {
959
+ return { stack: [this.GetCustomerDetails(Customer, Type, Vehicle, Settings, Headding)], width: normalWidth, marginLeft: 4 };
960
+ }
961
+ }
962
+
963
+ static GetNewInsurence(For: any, SurName: any, SurPhone: any, Type: any, SurEmail: any, InsComp: any, PolNo: any, PolType: any, Location: any, isOtherIndustry: boolean, Code: any = null, PrCustBar: boolean = false, orientation: 'portrait' | 'landscape' = 'portrait') {
964
+ const insuranceWidth = orientation === 'landscape' ? 260 : 210;
965
+ const emptyWidth = orientation === 'landscape' ? 100 : 70;
966
+
967
+ if (isOtherIndustry || ((For === PayTypeEnum.Insurance) && Type !== 'Invoice')) {
968
+ return { stack: [this.GetInsurenceDetails(For, SurName, SurPhone, SurEmail, InsComp, PolNo, PolType, Type, Location, isOtherIndustry)], width: insuranceWidth, marginRight: 2 };
969
+ } else if (!TrUtils.IsNull(Code)) {
970
+ return { stack: [this.GetBarCode(Code, PrCustBar)], width: insuranceWidth, marginRight: 2 };
971
+ } else {
972
+ return { text: '', width: emptyWidth };
973
+ }
974
+ }
975
+
976
+ static GetNewVehicle(Type: any, Id: any, CrDate: any, PrDate: any, MOut: any, MIn: any, Vehicle: any, PrintType: any,
977
+ For: any, IsProforma: boolean, Settings: any, isOtherIndustry: boolean, BL: any, ROCode: any, TypeName: any, AdmNo: any, DoS: any, orientation: 'portrait' | 'landscape' = 'portrait') {
978
+ const insuranceWidth = orientation === 'landscape' ? 250 : 200;
979
+ const normalWidth = orientation === 'landscape' ? 300 : 250;
980
+
981
+ if (For === PayTypeEnum.Insurance) {
982
+ return { stack: [this.GetVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo, DoS)], width: insuranceWidth };
983
+ } else {
984
+ return { stack: [this.GetVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo, DoS)], width: normalWidth };
985
+ }
986
+
987
+ }
988
+
989
+ static GetReceiptCustomerAndVehicleDetails(Id: any, CrDate: any, PrDate: any, MOut: any,
990
+ MIn: any, Vehicle: any, PrintType: any, For: any, SurName: any, SurPhone: any, Type: any,
991
+ SurEmail: any, InsComp: any, PolNo: any, PolType: any, Customer: any, IsProforma: boolean, Settings: any, Location: any, isOtherIndustry: boolean) {
992
+ return {
993
+ style: 'textcust',
994
+ marginLeft: 5,
995
+ columns: [
996
+ this.GetReceiptCustomer(Customer, Type, For, Vehicle, Settings, 'Patient Name & Address', isOtherIndustry),
997
+ this.GetInsurence(For, SurName, SurPhone, Type, SurEmail, InsComp, PolNo, PolType, Location, isOtherIndustry),
998
+ this.GetReceiptVehicle(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, For, IsProforma, Settings, isOtherIndustry)
999
+ ],
1000
+ };
1001
+ }
1002
+
1003
+ static GetSOCustomerAndOthDetails(Id: any, CrDate: any, PrDate: any,
1004
+ PrintType: any, For: any, SurName: any, SurPhone: any, Type: any,
1005
+ SurEmail: any, Shipment: any, PolNo: any, PolType: any, Customer: any, DoS: any, RefNo: any, IsPackage: any, PackId: any, PackedDate: any, ShipId: any, ShippedDate: any) {
1006
+ return {
1007
+ style: 'textcust',
1008
+ marginLeft: 5,
1009
+ stack: [{
1010
+ columns: [{ text: 'SO# : ' + this.CheckAndSetString(Id) },
1011
+ { text: 'Date : ' + this.CheckAndSetString(CrDate) },
1012
+ { text: 'Place Of Supply : ' + this.GetStateName(DoS) }]
1013
+ },
1014
+ this.CustomerDetails(Customer, Type, For, null, null, Shipment)],
1015
+ };
1016
+ }
1017
+
1018
+ static CustomerDetails(Customer: any, Type: any, For: any, Vehicle: any, Settings: any, Shipment: any) {
1019
+ return {
1020
+ columns: [
1021
+ this.GetCustomerSO(Customer, Type, For, null, null, 'Bill To'),
1022
+ this.GetCustomerSO(Shipment, Type, For, null, null, 'Ship To'),
1023
+ // this.GetInsurence(For, SurName, SurPhone, Type, SurEmail, InsComp, PolNo, PolType),
1024
+ // this.GetOtherDtails(Type, Id, CrDate, PrDate, PrintType, Settings, RefNo, IsPackage, PackId, PackedDate, ShipId, ShippedDate)
1025
+ ], marginTop: 10
1026
+ }
1027
+ }
1028
+
1029
+ static GetCustomerSO(Customer: any, Type: any, For: any, Vehicle: any, Settings: any, Headding: any) {
1030
+ return { stack: [this.GetCustomerDetails(Customer, Type, Vehicle, Settings, Headding)], width: 300, marginLeft: 4 };
1031
+ }
1032
+
1033
+ static GetOwnerDetails(Customer: any, Type: any, For: any) {
1034
+ if (For === PayTypeEnum.Insurance && Type === 'Invoice') {
1035
+ return {
1036
+ style: 'colum1',
1037
+ stack: [this.GetUnderLine(),
1038
+ {
1039
+ columns: [{ text: 'Owner Details : ', style: 'hed', width: 70 },
1040
+ { text: Customer.Name },
1041
+ { text: this.GetAddress(Customer), },
1042
+ this.GetCustPhoneNumber(Customer, Type), this.GetCustomerGSTIN(Customer)], margin: [0, 5, 0, 5],
1043
+ }
1044
+ ]
1045
+ }
1046
+ } else {
1047
+ return this.emptyObject();
1048
+ }
1049
+ }
1050
+
1051
+ static GetReceiptCustomer(Customer: any, Type: any, For: any, Vehicle: any, Settings: any, Headding: any, isOtherIndustry: boolean) {
1052
+ return { stack: [this.GetReceiptCustomerDetails(Customer, Type, Vehicle, Settings, Headding)], width: 170, marginLeft: 2 };
1053
+
1054
+ }
1055
+
1056
+ static GetReceiptCustomerDetails(Customer: any, Type: any, Vehicle: any, Settings: any, CustHeader: string) {
1057
+ if (TrUtils.IsNull(Customer)) {
1058
+ return this.emptyObject();
1059
+ }
1060
+
1061
+ return {
1062
+ style: 'colum1',
1063
+ stack: [{ text: CustHeader + ':', style: 'hed' },
1064
+ { text: Customer.Name, marginTop: 2 },
1065
+ { text: this.GetAddress(Customer), marginTop: 3 },
1066
+ this.GetCustPhoneNumber(Customer, Type), this.GetCustomerGSTIN(Customer),
1067
+ { text: 'Doctor : ' + Customer.Doctor, marginTop: 2 },]
1068
+ };
1069
+ }
1070
+
1071
+ static GetCustomer(Customer: any, Type: any, For: any, Vehicle: any, Settings: any, Headding: any, isOtherIndustry: boolean) {
1072
+ if (For === PayTypeEnum.Insurance || isOtherIndustry) {
1073
+ return { stack: [this.GetCustomerDetails(Customer, Type, Vehicle, Settings, Headding)], width: 170, marginLeft: 2 };
1074
+ } else {
1075
+ return { stack: [this.GetCustomerDetails(Customer, Type, Vehicle, Settings, Headding)], width: 230, marginLeft: 4 };
1076
+ }
1077
+ }
1078
+
1079
+ static GetInsurence(For: any, SurName: any, SurPhone: any, Type: any, SurEmail: any, InsComp: any, PolNo: any, PolType: any, Location: any, isOtherIndustry: boolean, Code: any = null, PrCustBar: boolean = false) {
1080
+ if (isOtherIndustry || ((For === PayTypeEnum.Insurance) && Type !== 'Invoice')) {
1081
+ return { stack: [this.GetInsurenceDetails(For, SurName, SurPhone, SurEmail, InsComp, PolNo, PolType, Type, Location, isOtherIndustry)], width: 210, marginRight: 2 };
1082
+ } else if (!TrUtils.IsNull(Code)) {
1083
+ return { stack: [this.GetBarCode(Code, PrCustBar)], width: 210, marginRight: 2 };
1084
+ } else {
1085
+ return { text: '', width: 70 };
1086
+ }
1087
+ }
1088
+
1089
+ static GetBarCode(code: string, PrCustBar: boolean) {
1090
+ if (!TrUtils.IsNull(code) && PrCustBar) {
1091
+ return { svg: this.textToSvgBarcode(code).svg }
1092
+ } else {
1093
+ return {};
1094
+ }
1095
+ }
1096
+
1097
+ static textToSvgBarcode(text: string): any {
1098
+ const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
1099
+ JsBarcode(svgElement, text, {
1100
+ format: "CODE128", width: 1.25, height: 20, margin: 0, marginTop: 8,
1101
+ displayValue: true, fontSize: 7, textMargin: 0, fontOptions: 'bold'
1102
+ });
1103
+ return { svg: svgElement.outerHTML };
1104
+ }
1105
+
1106
+ static GetVehicle(Type: any, Id: any, CrDate: any, PrDate: any, MOut: any, MIn: any, Vehicle: any, PrintType: any,
1107
+ For: any, IsProforma: boolean, Settings: any, isOtherIndustry: boolean, BL: any, ROCode: any, TypeName: any, AdmNo: any, DoS: any) {
1108
+ if (For === PayTypeEnum.Insurance) {
1109
+ return { stack: [this.GetVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo, DoS)], width: 200 };
1110
+ } else {
1111
+ return { stack: [this.GetVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry, BL, ROCode, TypeName, AdmNo, DoS)], width: 250 };
1112
+ }
1113
+
1114
+ }
1115
+
1116
+ static GetReceiptVehicle(Type: any, Id: any, CrDate: any, PrDate: any, MOut: any, MIn: any, Vehicle: any, PrintType: any,
1117
+ For: any, IsProforma: boolean, Settings: any, isOtherIndustry: boolean) {
1118
+ // if (For === PayTypeEnum.Insurance) {
1119
+ // return { stack: [this.GetVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry)], width: 200 };
1120
+ // } else {
1121
+ return { stack: [this.GetReceiptVehicleDetails(Type, Id, CrDate, PrDate, MOut, MIn, Vehicle, PrintType, IsProforma, Settings, isOtherIndustry)], width: 250 };
1122
+ // }
1123
+
1124
+ }
1125
+
1126
+ static GetReceiptVehicleDetails(Type: any, Id: any, CrDate: any, PrDate: any, MOut: any, MIn: any, Vehicle: any,
1127
+ PrintType: any, IsProforma: boolean, Settings: any, isOtherIndustry: boolean) {
1128
+ let id: any;
1129
+ let vehicleData: any;
1130
+ vehicleData = [
1131
+ { name: 'Bill#', value: this.CheckAndSetString(Id) },
1132
+ { name: 'Date', value: this.CheckAndSetString(CrDate) }
1133
+ ];
1134
+ return this.GetVehicleDataTable(vehicleData);
1135
+ }
1136
+
1137
+ static GetInsurenceDetails(For: any, SurName: any, SurPhone: any, SurEmail: any, InsComp: any, PolNo: any, PolType: any, Type: any,
1138
+ Location: any, isOtherIndustry: boolean) {
1139
+ let InsuranceFields = [
1140
+ { name: 'Name', value: SurName },
1141
+ { name: 'Phone', value: SurPhone },
1142
+ { name: 'Email', value: SurEmail }
1143
+ ];
1144
+ if (!isOtherIndustry && For === PayTypeEnum.Insurance) {
1145
+ return {
1146
+ columns: [
1147
+ {
1148
+ stack: [
1149
+ this.GetInsuranceDetailsTable(InsuranceFields, SurName, SurPhone, SurEmail, InsComp, PolNo, PolType),
1150
+ // this.getServeyorEmail(RepairOrder),
1151
+ ]
1152
+ }
1153
+ ]
1154
+ };
1155
+ } else if (isOtherIndustry) {
1156
+ let Head: any = (Type !== 'Invoice' && Type !== 'SalesReceipt') ? 'Service Location' : 'Ship To';
1157
+ return {
1158
+ columns: [
1159
+ {
1160
+ stack: [
1161
+ this.GetCustomerDetails(Location, 'Sales Order', null, null, Head),
1162
+ ]
1163
+ }
1164
+ ]
1165
+ };
1166
+ } else {
1167
+ return this.emptyObject();
1168
+ }
1169
+ }
1170
+
1171
+ static GetInsuranceDetailsTable(InsuranceFields: any, SurName: any, SurPhone: any, SurEmail: any, InsComp: any, PolNo: any, PolType: any) {
1172
+ var List: any = [];
1173
+ if (TrUtils.CheckInvalidSelect(PolType)) {
1174
+ PolType = null;
1175
+ }
1176
+ List.push(this.InsCompany(InsComp), { text: InsComp, marginTop: 5 }, this.GetPolicyInfo(PolNo, PolType),
1177
+ this.GetSurveyor(SurName, SurPhone, SurEmail), this.GetInsuranceDetails(InsuranceFields));
1178
+ return List;
1179
+
1180
+ }
1181
+
1182
+ static GetPolicyInfo(PolNo: any, PolType: any) {
1183
+ let isFieldThere: boolean = false;
1184
+ let InsuranceFields = [
1185
+ { name: 'Policy No', value: PolNo },
1186
+ { name: 'Policy Type', value: PolType },
1187
+ ];
1188
+ for (let i = 0; i < InsuranceFields.length; i++) {
1189
+ if (!TrUtils.IsEmpty(InsuranceFields[i].value)) {
1190
+ isFieldThere = true;
1191
+ }
1192
+ }
1193
+ if (isFieldThere) {
1194
+ return {
1195
+ fontSize: this.BodySize,
1196
+ lineHeight: 0.7,
1197
+ table: {
1198
+ body: this.GetInsuranceTable(InsuranceFields)
1199
+ },
1200
+ layout: 'noBorders',
1201
+ };
1202
+ } else {
1203
+ return this.emptyObject();
1204
+ }
1205
+ }
1206
+
1207
+ static GetSurveyor(SurName: any, SurPhone: any, SurEmail: any) {
1208
+ if (SurName || SurEmail || SurName) {
1209
+ return { text: 'Surveyor :', bold: true, fontSize: this.SubHeaderSize, marginTop: 2 };
1210
+ } else {
1211
+ return this.emptyObject();
1212
+ }
1213
+
1214
+ }
1215
+
1216
+ static emptyObject() {
1217
+ let a: any = {};
1218
+ return a;
1219
+ }
1220
+
1221
+ static InsCompany(InsComp: any) {
1222
+ if (InsComp) {
1223
+ return { text: 'Insurance Company :', bold: true, fontSize: this.SubHeaderSize };
1224
+ } else {
1225
+ return this.emptyObject();
1226
+ }
1227
+ }
1228
+
1229
+ static GetInsuranceDetails(data: any) {
1230
+ return {
1231
+ fontSize: this.BodySize,
1232
+ lineHeight: 0.7,
1233
+ // widths:['*','*',10],
1234
+ table: {
1235
+ body: this.GetInsuranceTable(data)
1236
+ },
1237
+ layout: 'noBorders',
1238
+ };
1239
+ }
1240
+
1241
+ static GetInsuranceTable(data: any) {
1242
+ var body: any = [];
1243
+ data.forEach((row: any) => {
1244
+ if (!TrUtils.IsEmpty(row.value)) {
1245
+ var dataRow: any = [];
1246
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
1247
+ dataRow.push(':');
1248
+ dataRow.push({ text: (row.value).toString(), lineHeight: 0.8 });
1249
+ body.push(dataRow);
1250
+ } else {
1251
+ var a: any = [];
1252
+ a.push('');
1253
+ a.push('');
1254
+ a.push('');
1255
+ body.push(a);
1256
+ }
1257
+ });
1258
+ return body;
1259
+ }
1260
+
1261
+ static GetCustomerDetails(Customer: any, Type: any, Vehicle: any, Settings: any, CustHeader: string) {
1262
+ if (TrUtils.IsNull(Customer)) {
1263
+ return this.emptyObject();
1264
+ }
1265
+
1266
+ let Data: any = [{ text: CustHeader + ':', fontSize: 7 },
1267
+ { text: Customer.Code, fontSize: 11, bold: true },
1268
+ { text: Customer.Name, fontSize: 10 },
1269
+ { text: this.GetAddress(Customer), marginTop: 2 },
1270
+ this.GetCustPhoneNumber(Customer, Type), this.GetCustomerGSTIN(Customer), this.GetCustomerDLNo(Customer),
1271
+ , this.GetCustomerName(Customer.CustName)]
1272
+ .filter(item => {
1273
+ if (item === null || item === undefined) {
1274
+ return false;
1275
+ }
1276
+ if (typeof item === 'string') {
1277
+ return item.trim() !== '';
1278
+ }
1279
+ if (typeof item === 'object') {
1280
+ if (Object.keys(item).length === 0) {
1281
+ return false;
1282
+ }
1283
+ if (Object.prototype.hasOwnProperty.call(item, 'text')) {
1284
+ return !TrUtils.IsEmpty(item.text);
1285
+ }
1286
+ }
1287
+ return true;
1288
+ })
1289
+ // if(!TrUtils.IsNull(Customer.CustName)){
1290
+ // Data.splice(1,0,{ text: Customer.CustName, marginTop: 2 });
1291
+ // Data.splice(2,0,{ text: 'Bill To :', style: 'hed', marginTop: 2 });
1292
+ // }
1293
+ return {
1294
+ style: 'colum1',
1295
+ stack: Data
1296
+ };
1297
+ }
1298
+
1299
+ static GetNameAndAddress(RepairOrder: any) {
1300
+ if (RepairOrder.Type === 'Invoice' || RepairOrder.Type === 'SalesReceipt') {
1301
+ if (RepairOrder.AsInsuranceBilling) {
1302
+ return 'Insurance Company Name & Address:';
1303
+ } else {
1304
+ return 'Customer Name & Address:';
1305
+ }
1306
+ } else {
1307
+ if (RepairOrder.Type === 'Sales Order') {
1308
+ return 'Location:';
1309
+ } else {
1310
+ return 'Customer Name & Address:';
1311
+ }
1312
+ }
1313
+ }
1314
+
1315
+ static GetCustomerName(Customer: any) {
1316
+ if (!TrUtils.IsEmpty(Customer)) {
1317
+ let GSTIN = { columns: [{ text: 'Customer Name :', width: 65, bold: true }, { text: Customer }] };
1318
+ return GSTIN;
1319
+ } else {
1320
+ return this.emptyObject();
1321
+ }
1322
+
1323
+ }
1324
+
1325
+ static GetCustomerGSTIN(Customer: any) {
1326
+ if (!TrUtils.IsEmpty(Customer.GSTIN)) {
1327
+ let GSTIN = { columns: [{ text: 'GSTIN :', width: 33, style: 'hed' }, { text: Customer.GSTIN, marginTop: 1.5 }] };
1328
+ return GSTIN;
1329
+ } else {
1330
+ return this.emptyObject();
1331
+ }
1332
+
1333
+ }
1334
+
1335
+ static GetCustomerDLNo(Customer: any) {
1336
+ if (!TrUtils.IsEmpty(Customer.DLNo)) {
1337
+ let GSTIN = { columns: [{ text: 'DL No :', width: 33, style: 'hed' }, { text: Customer.DLNo, marginTop: 1.5 }] };
1338
+ return GSTIN;
1339
+ } else {
1340
+ return this.emptyObject();
1341
+ }
1342
+
1343
+ }
1344
+
1345
+ // static GetPlaceofSupply(Vehicle: any, Settings: any) {
1346
+ // if (!TrUtils.IsNull(Vehicle) && !TrUtils.IsNull(Settings) && Settings.Tax === 'TI' &&
1347
+ // !TrUtils.IsNull(Settings.PoS) && !TrUtils.IsEmpty(Settings.PoS.Name)) {
1348
+ // let PoS = { columns: [{ text: 'Place Of Supply :', width: 75, style: 'hed' }, { text: this.GetStateName(Settings.PoS), marginTop: 1.5 }] };
1349
+ // return PoS;
1350
+ // } else {
1351
+ // return this.emptyObject();
1352
+ // }
1353
+ // }
1354
+
1355
+ static GetCustPhoneNumber(Customer: any, Type: any) {
1356
+ if (Type !== 'Technician Copy') {
1357
+ var contact = this.GetFormatContact(Customer);
1358
+ if (contact.length !== 0) {
1359
+ return { columns: [{ text: 'Phone', width: 'auto', style: 'hed' }, { text: contact, width: '*' }] };
1360
+ } else {
1361
+ return this.emptyObject();
1362
+ }
1363
+
1364
+ } else {
1365
+ return this.emptyObject();
1366
+ }
1367
+ }
1368
+
1369
+ static GetAddress(Customer: any) {
1370
+ var Address = this.GetFormatAddress(Customer);
1371
+ if (Address.length !== 5) {
1372
+ return Address;
1373
+ } else {
1374
+ let a: any = '';
1375
+ return a;
1376
+ }
1377
+ }
1378
+
1379
+ static GetVehicleDetails(Type: any, Id: any, CrDate: any, PrDate: any, MOut: any, MIn: any, Vehicle: any,
1380
+ PrintType: any, IsProforma: boolean, Settings: any, isOtherIndustry: boolean, BL: any, ROCode: any, TypeName: any, AdmNo: any, DoS: any) {
1381
+ let id: any;
1382
+ let vehicleData: any;
1383
+ if (Type === 'Work Order' || Type === 'Technician Copy') {
1384
+ id = 'WO#';
1385
+ } else if (Type === 'SalesOrder') {
1386
+ id = 'SO#';
1387
+ } else if (Type === 'Sales Estimate') {
1388
+ id = 'Estimate#';
1389
+ } else if (Type === 'Debit Notes') {
1390
+ id = 'Debit Note#';
1391
+ } else if (Type === 'Credit Notes') {
1392
+ id = 'Credit Note#';
1393
+ } else if (Type === 'Delivery Challan') {
1394
+ id = 'Delivery Challan#';
1395
+ } else if (Type === 'Invoice' || Type === 'Tax Invoice' || Type === 'SalesReceipt') {
1396
+ id = 'Invoice#';
1397
+ } else {
1398
+ id = 'Estimate#';
1399
+ }
1400
+
1401
+ if (PrintType === 'Parts Order' || TrUtils.IsNull(Vehicle)) {
1402
+
1403
+ vehicleData = [
1404
+ { name: id, value: this.CheckAndSetString(Id), bold: true },
1405
+ { name: 'Date', value: this.CheckAndSetString(CrDate) }
1406
+ ];
1407
+ if (!TrUtils.IsNull(AdmNo)) {
1408
+ vehicleData.push({ name: 'Admission No', value: AdmNo });
1409
+ }
1410
+ if (!TrUtils.IsNull(Settings) && Settings.Tax === 'TI' && !TrUtils.IsNull(DoS) && !TrUtils.IsEmpty(DoS.Name)) {
1411
+ vehicleData.push({ name: 'Place Of Supply', value: this.GetStateName(DoS) });
1412
+ }
1413
+ if (Type === 'Delivery Challan' || isOtherIndustry) {
1414
+ if (Type === 'Delivery Challan') {
1415
+ vehicleData.push({ name: 'Challan Type', value: '' });
1416
+ } else {
1417
+ vehicleData.push({ name: 'Ref. No', value: BL?.RefNo });
1418
+ }
1419
+ vehicleData.push({ name: 'Carrier Name/Agent', value: BL?.Cour });
1420
+ vehicleData.push({ name: 'Bill of Lading/LR-RR No', value: BL?.No });
1421
+ vehicleData.push({ name: 'Motor Vehicle No ', value: BL?.VNo });
1422
+ vehicleData.push({ name: 'E-Way Bill No', value: BL?.EWay });
1423
+ }
1424
+
1425
+ } else {
1426
+ vehicleData = [
1427
+ { name: id, value: this.CheckAndSetString(Id) },
1428
+ { name: 'Date', value: this.CheckAndSetString(CrDate) }
1429
+ ];
1430
+
1431
+
1432
+ if (!TrUtils.IsNull(PrDate) && Type !== 'Invoice' && Type !== 'Estimate' && Type !== 'Supplementary Estimate' && Type !== 'Tax Invoice') {
1433
+ vehicleData.push({ name: 'Delivery Date', value: this.CheckAndSetString(PrDate) });
1434
+ }
1435
+ // if (!TrUtils.IsNull(Settings) && Settings.Tax === 'TI' && !TrUtils.IsNull(Settings.PoS) && !TrUtils.IsEmpty(Settings.PoS.Name)) {
1436
+ // vehicleData.push({ name: 'Place Of Supply', value: this.GetStateName(Settings.PoS) });
1437
+ // }
1438
+ if (isOtherIndustry) {
1439
+ vehicleData.push({ name: 'Serial No', value: this.CheckAndSetString(Vehicle.SNo) });
1440
+ } else {
1441
+ vehicleData.push({ name: 'Regn. No', value: this.CheckAndSetString(Vehicle.RegNo) });
1442
+ if (Type === 'Invoice' && !IsProforma) {
1443
+ vehicleData.push({ name: 'Mileage', value: this.CheckAndSetString(MOut) });
1444
+
1445
+ } else {
1446
+
1447
+ vehicleData.push({ name: 'Mileage', value: this.CheckAndSetString(MIn) });
1448
+ }
1449
+ if (Type === 'Invoice' && !TrUtils.IsNull(TypeName)) {
1450
+ vehicleData.push({ name: 'RO Type', value: TypeName });
1451
+ }
1452
+ if (Type === 'Invoice' && !TrUtils.IsNull(ROCode)) {
1453
+ vehicleData.push({ name: 'RO#', value: ROCode });
1454
+ }
1455
+ }
1456
+
1457
+ let Product: string;
1458
+ let ProdType: string = 'Equipment';
1459
+ Product = this.CheckAndSetString(Vehicle.Make) + ' ' + this.CheckAndSetString(Vehicle.Model);
1460
+ if (!isOtherIndustry) {
1461
+ ProdType = 'Vehicle';
1462
+ Product = Product + ' ' + this.CheckAndSetString(Vehicle.Var);
1463
+ }
1464
+ let a: any = [
1465
+ { name: ProdType, value: Product },
1466
+ ];
1467
+ if (!isOtherIndustry) {
1468
+ if (!TrUtils.IsEmpty(Vehicle.VIN)) {
1469
+ a.push({ name: 'Chassis No', value: this.CheckAndSetString(Vehicle.VIN) });
1470
+ }
1471
+ if (!TrUtils.IsEmpty(Vehicle.EngNo)) {
1472
+ a.push({ name: 'Engine No', value: this.CheckAndSetString(Vehicle.EngNo) });
1473
+ }
1474
+ }
1475
+ for (let i = 0; i < a.length; i++) {
1476
+ vehicleData.push(a[i]);
1477
+ }
1478
+
1479
+ }
1480
+ return this.GetVehicleDataTable(vehicleData);
1481
+ }
1482
+
1483
+ static GetStateName(PlaceofSupply: any) {
1484
+ if (TrUtils.IsNull(PlaceofSupply)) {
1485
+ return ''
1486
+ }
1487
+ let supplyName: any = PlaceofSupply.Name + ' (' + PlaceofSupply.GCode + ')';
1488
+ return supplyName;
1489
+ }
1490
+
1491
+ static GetOtherDtails(Type: any, Id: any, CrDate: any, PrDate: any, PrintType: any, Settings: any, RefNo: any, IsPackage: any,
1492
+ PackId: any, PackedDate: any, ShipId: any, ShippedDate: any) {
1493
+ let id: any;
1494
+ let vehicleData: any;
1495
+ if (Type === 'SalesOrder') {
1496
+ id = 'SO#';
1497
+ } else {
1498
+ id = 'Estimate#';
1499
+ }
1500
+ if (PrintType === 'Parts Order') {
1501
+ vehicleData = [
1502
+ { name: id, value: this.CheckAndSetString(Id) },
1503
+ { name: 'Date', value: this.CheckAndSetString(CrDate) }
1504
+ ];
1505
+ } else {
1506
+ vehicleData = [
1507
+ { name: id, value: this.CheckAndSetString(Id) },
1508
+ { name: 'Date', value: this.CheckAndSetString(CrDate) }
1509
+ ];
1510
+ if (!TrUtils.IsNull(Settings) && Settings.Tax === 'TI' && !TrUtils.IsNull(Settings.PoS) && !TrUtils.IsEmpty(Settings.PoS.Name)) {
1511
+ vehicleData.push({ name: 'Place Of Supply', value: this.GetStateName(Settings.PoS) });
1512
+ }
1513
+ if (!TrUtils.IsNull(RefNo)) {
1514
+ vehicleData.push({ name: 'Reference#', value: RefNo });
1515
+ }
1516
+ if (IsPackage) {
1517
+ if (!TrUtils.IsNull(PackId)) {
1518
+ vehicleData.push({ name: 'Package#', value: PackId });
1519
+ }
1520
+ if (!TrUtils.IsNull(PackedDate)) {
1521
+ vehicleData.push({ name: 'Packed Date', value: this.CheckAndSetString(PackedDate) });
1522
+ }
1523
+ } else {
1524
+ if (!TrUtils.IsNull(ShipId)) {
1525
+ vehicleData.push({ name: 'Shipment#', value: ShipId });
1526
+ }
1527
+ if (!TrUtils.IsNull(ShippedDate)) {
1528
+ vehicleData.push({ name: 'Shipped Date', value: this.CheckAndSetString(ShippedDate) });
1529
+ }
1530
+ }
1531
+
1532
+ // if (!TrUtils.IsNull(PrDate) && Type !== 'Invoice' && Type !== 'Tax Invoice') {
1533
+ // vehicleData.push({ name: 'Delivery Date', value: this.CheckAndSetString(PrDate) });
1534
+ // }
1535
+
1536
+ }
1537
+ return this.GetVehicleDataTable(vehicleData);
1538
+ }
1539
+
1540
+ static CheckAndSetString(Value: any) {
1541
+ if (TrUtils.IsNull(Value)) {
1542
+ Value = '';
1543
+ }
1544
+ return Value;
1545
+ }
1546
+
1547
+ static GetVehicleDataTable(vehicleData: any) {
1548
+ return {
1549
+ lineHeight: 0.7,
1550
+ fontSize: this.BodySize,
1551
+ table: {
1552
+ body: this.GetDataTable(vehicleData, false)
1553
+ },
1554
+ layout: 'noBorders',
1555
+ };
1556
+ }
1557
+
1558
+ static GetFormatContact(CustomerObj: any) {
1559
+ var contactnew = '';
1560
+ if (!TrUtils.IsNull(CustomerObj.Cons)) {
1561
+ CustomerObj.Cons.forEach((Contact: any) => {
1562
+ contactnew = contactnew + '(' + Contact.Type + '):' + Contact.No + '\n';
1563
+ });
1564
+ }
1565
+
1566
+ return contactnew;
1567
+ }
1568
+
1569
+ static GetFormatAddress(CustomerObj: any) {
1570
+ var Addressnew = '';
1571
+ if (!TrUtils.IsNull(CustomerObj.Adrs)) {
1572
+ CustomerObj.Adrs.forEach((Adrs: any) => {
1573
+ Addressnew = Addressnew + Adrs + '\n';
1574
+ });
1575
+ }
1576
+
1577
+ return Addressnew;
1578
+ }
1579
+
1580
+ static GetDisplayTable() {
1581
+ return { text: '', fontSize: 10, bold: true, margin: [0, 0, 0, 5] };
1582
+ }
1583
+
1584
+ static GetHeaders(PrintPartNumber: any) {
1585
+ let headersNames: any;
1586
+ if (PrintPartNumber) {
1587
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
1588
+ { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
1589
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
1590
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
1591
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'right', },
1592
+ { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 }, {},
1593
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
1594
+ ],
1595
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'MPN', lineHeight: 0.5 },
1596
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
1597
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: 'Unit Price', Field: 'UnPr', Field1: 'UnCo', lineHeight: 0.5 },
1598
+ { text: '%', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'percentage', lineHeight: 0.5 },
1599
+ { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 },
1600
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
1601
+ ]];
1602
+ } else {
1603
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 },
1604
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.6 },
1605
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.6 },
1606
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, alignment: 'right', lineHeight: 0.6 },
1607
+ { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.6 }, {},
1608
+ { text: 'Line Total', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 }
1609
+ ],
1610
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'Desc', lineHeight: 0.5 },
1611
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: 'Unit Price', Field: 'UnPr', Field1: 'UnCo', lineHeight: 0.5 },
1612
+ { text: '%', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'percentage', lineHeight: 0.5 },
1613
+ { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 },
1614
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
1615
+ ]];
1616
+ }
1617
+ return headersNames;
1618
+ }
1619
+
1620
+ static PartsTaxAmounts1(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
1621
+ if (ShowTaxColumn && !TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length > 0) {
1622
+ return {
1623
+ stack: [this.AllHSNPartCGSTTaxListTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
1624
+ };
1625
+ } else {
1626
+ return '';
1627
+ }
1628
+ }
1629
+
1630
+ static PartsTaxAmounts(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
1631
+ if (ShowTaxColumn && !TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length > 0) {
1632
+ return {
1633
+ stack: [this.AllHSNPartCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
1634
+ };
1635
+ } else {
1636
+ return '';
1637
+ }
1638
+ }
1639
+
1640
+ static AllHSNPartCGSTTaxListTable1(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
1641
+
1642
+ if (ShowIGST) {
1643
+ return {
1644
+ style: 'tableExample',
1645
+ table: {
1646
+ widths: [25, 60, 50],
1647
+ headerRows: 1,
1648
+ body: this.CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1649
+ },
1650
+ layout: this.HeaderLineStyle(),
1651
+ };
1652
+ } else {
1653
+ return {
1654
+ style: 'tableExample',
1655
+ table: {
1656
+ widths: [25, 60, 40, 40],
1657
+ headerRows: 1,
1658
+ body: this.CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1659
+ },
1660
+ layout: this.HeaderLineStyle(),
1661
+ };
1662
+ }
1663
+ }
1664
+
1665
+ static AllHSNPartCGSTTaxListTable(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
1666
+
1667
+ if (ShowIGST) {
1668
+ return {
1669
+ style: 'tableExample',
1670
+ table: {
1671
+ widths: [40, 'auto', 50],
1672
+ headerRows: 1,
1673
+ body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1674
+ },
1675
+ layout: this.HeaderLineStyle(),
1676
+ };
1677
+ } else {
1678
+ return {
1679
+ style: 'tableExample',
1680
+ table: {
1681
+ widths: [50, 65, 50, 50],
1682
+ headerRows: 1,
1683
+ body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
1684
+ },
1685
+ layout: this.HeaderLineStyle(),
1686
+ };
1687
+ }
1688
+ }
1689
+
1690
+ static AllPartCGSTTaxListTable(PartsTaxInfo: any, ShowAccParts: any, ShowTaxColumn: any) {
1691
+ return {
1692
+ style: 'tableExample',
1693
+ table: {
1694
+ widths: [20, 60, 40, 40],
1695
+ body: this.ALLPartsCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowTaxColumn)
1696
+ },
1697
+ layout: this.HeaderLineStyle(),
1698
+ };
1699
+ }
1700
+
1701
+ static HeaderLineStyle() {
1702
+ return {
1703
+ hLineWidth: function (i: any, node: any) {
1704
+ return (i === 1) ? 0.1 : 0;
1705
+ },
1706
+ vLineWidth: function (i: any, node: any) {
1707
+ return (i === 0 || i === node.table.widths.length) ? 0 : 0;
1708
+ },
1709
+ hLineColor: function (i: any, node: any) {
1710
+ let color;
1711
+ if (i === 0 || i === node.table.body.length) {
1712
+ color = 'black';
1713
+ } else {
1714
+ if (i === 1) {
1715
+ color = 'lightgray';
1716
+ } else {
1717
+ color = 'lightgray';
1718
+ }
1719
+ }
1720
+
1721
+ return color;
1722
+ },
1723
+ };
1724
+ }
1725
+
1726
+ static CreateHeadingAllPartCGSTTaxList() {
1727
+ let HeaderNames = [{ text: 'GST(%)', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CombinedTaxPercentage' },
1728
+ // { text: 'SGST', style: 'tableheader', fontSize: 6,lineHeight:0.3, Field: 'SGST' },
1729
+ { text: 'Count', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'PartsCount' },
1730
+ { text: 'Taxble Value', style: 'tableheader', alignment: 'right', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount' },
1731
+ { text: 'Amount', style: 'tableheader', alignment: 'right', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
1732
+ ];
1733
+ return HeaderNames;
1734
+ }
1735
+
1736
+ static ALLPartsCGSTTaxListTable(PartsTaxInfo: any, ShowAccParts: any, ShowTaxColumn: any) {
1737
+ if (!TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
1738
+ var body: any = [];
1739
+ let columns: any = this.CreateHeadingAllPartCGSTTaxList();
1740
+ body.push(columns);
1741
+ PartsTaxInfo.forEach((part: any) => {
1742
+
1743
+ var dataRow: any = [];
1744
+ columns.forEach((column: any) => {
1745
+ if (!TrUtils.IsNull(part[column.Field]) && !TrUtils.IsNull(part[column.Field])) {
1746
+ if (column.Field === 'TotalTaxAmount' || column.Field === 'TotalTaxableAmount') {
1747
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
1748
+ } else {
1749
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center', nowrap: true });
1750
+ }
1751
+ } else {
1752
+ part[column.Field] = '';
1753
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
1754
+ }
1755
+ });
1756
+
1757
+ body.push(dataRow);
1758
+ });
1759
+ return body;
1760
+ } else {
1761
+ return [{}];
1762
+ }
1763
+ }
1764
+
1765
+ static CreateHeadingAllHSNTaxList(ShowIGST: any) {
1766
+ let HeaderNames = [{ text: 'HSN', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'HSN' },
1767
+ // { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' },
1768
+ // { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' },
1769
+ // { text: 'Count', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'PartsCount' },
1770
+ { text: 'Taxable Value', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount' },
1771
+ { text: 'Amount', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
1772
+ ];
1773
+ if (ShowIGST) {
1774
+ HeaderNames.splice(1, 0, { text: 'IGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'IGST' })
1775
+ } else {
1776
+ HeaderNames.splice(1, 0, { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' })
1777
+ HeaderNames.splice(2, 0, { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' })
1778
+ }
1779
+ return HeaderNames;
1780
+ }
1781
+
1782
+ static CreateHeadingAllTaxList(ShowIGST: any) {
1783
+ let HeaderNames = [
1784
+ // { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' },
1785
+ // { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' },
1786
+ // { text: 'Count', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'PartsCount' },
1787
+ { text: 'Tax Rate', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CombinedTaxPercentage', alignment: 'left' },
1788
+ { text: 'Taxable Amount', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount', alignment: 'right' },
1789
+ // { text: 'Tax Amount', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
1790
+ ];
1791
+ if (ShowIGST) {
1792
+ // HeaderNames.splice(1, 0, { text: 'IGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'IGST' });
1793
+ HeaderNames.splice(2, 0, { text: 'IGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'IGSTAmt', alignment: 'right' });
1794
+ } else {
1795
+ // HeaderNames.splice(1, 0, { text: 'CGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1796
+ HeaderNames.splice(2, 0, { text: 'CGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGSTAmt', alignment: 'right' });
1797
+ // HeaderNames.splice(3, 0, { text: 'SGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
1798
+ HeaderNames.splice(3, 0, { text: 'SGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'SGSTAmt', alignment: 'right' });
1799
+ }
1800
+ return HeaderNames;
1801
+ }
1802
+
1803
+ static CreateHSNTaxTable1(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
1804
+ if (!TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
1805
+ var body: any = [];
1806
+ let columns: any = this.CreateHeadingAllTaxList(ShowIGST);
1807
+ body.push(columns);
1808
+ PartsTaxInfo.forEach((part: any) => {
1809
+ var dataRow: any = [];
1810
+ columns.forEach((column: any) => {
1811
+ if (!TrUtils.IsFixedZero(part[column.Field]) &&
1812
+ !TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt'
1813
+ || column.Field === 'TotalTaxableAmount') {
1814
+ if (column.Field === 'TotalTaxableAmount' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt' || column.Field === 'IGSTAmt') {
1815
+ dataRow.push({ text: TrUtils.FixPriceValue(part[column.Field]), alignment: 'right', opacity: 0.7, nowrap: true, fontSize: 6 });
1816
+ } else if (column.Field === 'CombinedTaxPercentage') {
1817
+ dataRow.push({ text: part[column.Field].toString() + '%', alignment: 'left', opacity: 0.7, nowrap: true, fontSize: 6 });
1818
+ } else {
1819
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'left', opacity: 0.7, nowrap: true, fontSize: 6 });
1820
+ }
1821
+ } else {
1822
+ part[column.Field] = '';
1823
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'left', opacity: 0.7, fontSize: 6 });
1824
+ }
1825
+ });
1826
+
1827
+ body.push(dataRow);
1828
+ });
1829
+ return body;
1830
+ } else {
1831
+ return [{}];
1832
+ }
1833
+ }
1834
+
1835
+ static CreateHSNTaxTable(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
1836
+ if (!TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
1837
+ var body: any = [];
1838
+ let columns: any = this.CreateHeadingAllHSNTaxList(ShowIGST);
1839
+ body.push(columns);
1840
+ PartsTaxInfo.forEach((part: any) => {
1841
+ var dataRow: any = [];
1842
+ columns.forEach((column: any) => {
1843
+ if (!TrUtils.IsFixedZero(part[column.Field]) &&
1844
+ !TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST'
1845
+ || column.Field === 'TotalTaxAmount') {
1846
+ if (column.Field === 'SGSTLaborAmt') {
1847
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
1848
+ } else {
1849
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center', nowrap: true });
1850
+ }
1851
+ } else {
1852
+ part[column.Field] = '';
1853
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
1854
+ }
1855
+ });
1856
+
1857
+ body.push(dataRow);
1858
+ });
1859
+ return body;
1860
+ } else {
1861
+ return [{}];
1862
+ }
1863
+ }
1864
+
1865
+ // static GetHCFinalTotalDetails(RecordData: any, BasicLaborTotal: any, OverAllMainLaborDiscount: any, LCGST: any, LSGST: any, LIGST: any, PIGST: any, ShowIGST: any, ShowTaxColumn: any,
1866
+ // BasicPartsTotal: any, OverAllMainPartsDiscount: any, PCGST: any, PSGST: any, PartsTaxInfo: any,
1867
+ // ShowAccParts: any, LaborAfterGST: any, PartsAfterGST: any, OverAllRecordDiscount: any, For: any,
1868
+ // OverAllRecordTotal: any, Rounded: any, GrandTotal: any, ShowDetailedLaborTaxInfo: any,
1869
+ // ShowDetailedPartTaxInfo: any, istaxable: boolean, LaborTotalTax: any, PartTotalTax: any, Consolidate: boolean, From: string, Adj: any, STotal: any, moreDiscDetails: boolean) {
1870
+ // let totalDisc: any;
1871
+ // let totalTax: any;
1872
+ // if (!Consolidate) {
1873
+ // totalTax = TrUtils.FixPriceValue(Number(LaborTotalTax) + Number(PartTotalTax));
1874
+ // if (istaxable) {
1875
+ // totalDisc = TrUtils.FixPriceValue(Number(OverAllMainLaborDiscount) + Number(OverAllMainPartsDiscount));
1876
+ // } else {
1877
+ // totalDisc = TrUtils.FixPriceValue(Number(OverAllMainLaborDiscount) + Number(OverAllMainPartsDiscount) + Number(OverAllRecordDiscount));
1878
+ // }
1879
+ // }
1880
+
1881
+ // return {
1882
+ // columns: [
1883
+ // // this.GetTaxOnLabor(BasicLaborTotal, OverAllMainLaborDiscount, LCGST,
1884
+ // // LSGST, LIGST, ShowIGST, ShowTaxColumn, ShowDetailedLaborTaxInfo),
1885
+ // { text: '', width: 225 },
1886
+ // // {
1887
+ // // stack: [
1888
+ // // this.GetTaxOnParts(BasicPartsTotal, OverAllMainPartsDiscount, PCGST,
1889
+ // // PSGST, ShowAccParts, PIGST, ShowIGST, ShowTaxColumn, ShowDetailedPartTaxInfo, From),
1890
+ // // this.PartsTaxAmounts(PartsTaxInfo, ShowAccParts, ShowIGST,
1891
+ // // ShowTaxColumn)
1892
+ // // ]
1893
+ // // },
1894
+ // { text: '', width: 230 },
1895
+ // // this.GrandTotal(LaborAfterGST, PartsAfterGST, totalDisc, For, OverAllRecordTotal, Rounded, GrandTotal)
1896
+ // this.GrandTotal(RecordData, BasicLaborTotal, BasicPartsTotal, totalDisc, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, STotal, moreDiscDetails)
1897
+
1898
+ // ]
1899
+ // // columnGap: 40
1900
+ // , marginLeft: 10
1901
+ // };
1902
+ // }
1903
+
1904
+ static GetFinalTotalDetails1(RecordData: any, BasicLaborTotal: any, OverAllMainLaborDiscount: any, LCGST: any, LSGST: any, LIGST: any, PIGST: any, ShowIGST: any, ShowTaxColumn: any,
1905
+ BasicPartsTotal: any, OverAllMainPartsDiscount: any, PCGST: any, PSGST: any, PartsTaxInfo: any,
1906
+ ShowAccParts: any, LaborAfterGST: any, PartsAfterGST: any, OverAllRecordDiscount: any, For: any,
1907
+ OverAllRecordTotal: any, Rounded: any, GrandTotal: any, ShowDetailedLaborTaxInfo: any,
1908
+ ShowDetailedPartTaxInfo: any, istaxable: boolean, LaborTotalTax: any, PartTotalTax: any, Consolidate: boolean, From: string, Adj: any, CustLaborTaxGroupDataByPerc: any, STotal: any, isAuto: boolean, moreDiscDetails: boolean) {
1909
+ let totalDisc: any;
1910
+ let totalTax: any;
1911
+ if (!Consolidate) {
1912
+ totalTax = TrUtils.FixPriceValue(Add(Number(LaborTotalTax), Number(PartTotalTax)), RecordData.Entity.DecimalsNumber);
1913
+ if (istaxable) {
1914
+ totalDisc = TrUtils.FixPriceValue(Add(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
1915
+ } else {
1916
+ totalDisc = TrUtils.FixPriceValue(Add(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
1917
+ }
1918
+ }
1919
+
1920
+ // let serviceName: string;
1921
+ // let itemName: string;
1922
+
1923
+ // if (isAuto) {
1924
+ // serviceName = 'Labor Tax';
1925
+ // itemName = 'Parts Tax';
1926
+ // } else {
1927
+ // serviceName = 'Service Tax';
1928
+ // itemName = 'Items Tax';
1929
+ // }
1930
+
1931
+ return {
1932
+ columns: [
1933
+ // this.GetTaxOnLabor(BasicLaborTotal, OverAllMainLaborDiscount, LCGST,
1934
+ // LSGST, LIGST, ShowIGST, ShowTaxColumn, ShowDetailedLaborTaxInfo),
1935
+ // { text: '', width: 10 },
1936
+ {
1937
+ stack: [
1938
+ // this.GetTaxOnParts(BasicPartsTotal, OverAllMainPartsDiscount, PCGST,
1939
+ // PSGST, ShowAccParts, PIGST, ShowIGST, ShowTaxColumn, ShowDetailedPartTaxInfo, From),
1940
+ // { text: (istaxable && CustLaborTaxGroupDataByPerc.length !== 0) ? serviceName : '', fontSize: 7, opacity: 0.8 },
1941
+ this.PartsTaxAmounts1(CustLaborTaxGroupDataByPerc, ShowAccParts, ShowIGST,
1942
+ ShowTaxColumn),
1943
+ // { text: (istaxable && PartsTaxInfo.length !== 0) ? itemName : '', fontSize: 7, opacity: 0.8 },
1944
+ // this.PartsTaxAmounts1(PartsTaxInfo, ShowAccParts, ShowIGST,
1945
+ // ShowTaxColumn)
1946
+ this.GetNotes(RecordData)
1947
+ ]
1948
+ },
1949
+ // { text: '', width: 60 },
1950
+ // this.GrandTotal(LaborAfterGST, PartsAfterGST, totalDisc, For, OverAllRecordTotal, Rounded, GrandTotal)
1951
+ this.GrandTotal1(RecordData, BasicLaborTotal, BasicPartsTotal, totalDisc, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, STotal, moreDiscDetails)
1952
+
1953
+ ]
1954
+ // columnGap: 40
1955
+ // , marginLeft: 10
1956
+ };
1957
+ }
1958
+
1959
+ static GetNotes(RecordData: any) {
1960
+ console.log('RecordData.Notes shared', RecordData.Notes);
1961
+ if (!TrUtils.IsNull(RecordData.Notes)) {
1962
+ return {
1963
+ stack: [
1964
+ { text: 'Notes:', bold: true, fontSize: 9, margin: [0, 5, 0, 0] },
1965
+ {
1966
+ text: RecordData.Notes,
1967
+ fontSize: 7,
1968
+ margin: [0, 2, 0, 5],
1969
+ italics: true,
1970
+ opacity: 0.7
1971
+ }
1972
+
1973
+ ],
1974
+ margin: [0, 5, 0, 0]
1975
+ }
1976
+ } else {
1977
+ return '';
1978
+ }
1979
+
1980
+ }
1981
+
1982
+ static GrandTotal1(RecordData: any, LaborAfterGST: any, PartsAfterGST: any, OverAllRecordDiscount: any, totalTax: any, For: any, OverAllRecordTotal: any,
1983
+ Rounded: any, GrandTotal: any, Adj: any, Consolidate: any, STotal: any, moreDiscDetails: boolean) {
1984
+ let AccountFields = [
1985
+ // { name: 'Labor Total', value: LaborAfterGST },
1986
+ // { name: 'Part Total', value: PartsAfterGST },
1987
+ // { name: 'Total Disc.', value: OverAllRecordDiscount },
1988
+ ];
1989
+ if (moreDiscDetails) {
1990
+ if (!TrUtils.IsZero(RecordData.PDisc)) {
1991
+ AccountFields.push({ name: 'Items Discount', value: TrUtils.FixPriceValue(RecordData.PDisc, RecordData.Entity.DecimalsNumber) });
1992
+ }
1993
+
1994
+ if (!TrUtils.IsZero(RecordData.LDisc)) {
1995
+ AccountFields.push({ name: 'Services Discount', value: TrUtils.FixPriceValue(RecordData.LDisc, RecordData.Entity.DecimalsNumber) });
1996
+ }
1997
+
1998
+ if (!TrUtils.IsZero(RecordData.Disc)) {
1999
+ AccountFields.push({ name: 'Overall Discount', value: TrUtils.FixPriceValue(RecordData.Disc, RecordData.Entity.DecimalsNumber) });
2000
+ }
2001
+ } else {
2002
+ AccountFields.push({ name: 'Discount', value: OverAllRecordDiscount });
2003
+ }
2004
+ if (!Consolidate) {
2005
+ AccountFields.unshift({ name: 'SubTotal', value: TrUtils.FixPriceValue(STotal, RecordData.Entity.DecimalsNumber) });
2006
+ }
2007
+ if (!TrUtils.IsEmpty(totalTax)) {
2008
+ AccountFields.push({ name: 'Total Tax', value: totalTax });
2009
+ }
2010
+ if (!TrUtils.IsEmpty(Adj)) {
2011
+ if (Adj > 0) {
2012
+ Adj = '+' + TrUtils.FixPriceValue(Adj, RecordData.Entity.DecimalsNumber);
2013
+ }
2014
+ AccountFields.push({ name: 'Adjust', value: Adj });
2015
+ }
2016
+ if (For === PayTypeEnum.Insurance) {
2017
+ let total = {
2018
+ name: 'Total',
2019
+ value: OverAllRecordTotal
2020
+ };
2021
+ let Rounding = { name: 'Rounding', value: Rounded };
2022
+ if (Rounding.value > 0) {
2023
+ Rounding.value = '+' + Rounding.value;
2024
+ }
2025
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
2026
+ AccountFields.push(total);
2027
+ AccountFields.push(Rounding);
2028
+ if (!TrUtils.IsFixedZero(Rounded)) {
2029
+ AccountFields.push(FinalTotal);
2030
+ }
2031
+
2032
+ } else {
2033
+ let total = {
2034
+ name: 'Total',
2035
+ value: OverAllRecordTotal
2036
+ };
2037
+ let Rounding = { name: 'Rounding', value: Rounded };
2038
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
2039
+ if (Rounding.value > 0) {
2040
+ Rounding.value = '+' + Rounding.value;
2041
+ }
2042
+ AccountFields.push(total);
2043
+ AccountFields.push(Rounding);
2044
+ if (!TrUtils.IsFixedZero(Rounded)) {
2045
+ AccountFields.push(FinalTotal);
2046
+ }
2047
+ }
2048
+ return {
2049
+ style: ['columnheader', 'TotalsStyles'],
2050
+ lineHeight: 0.7,
2051
+ marginBottom: 5,
2052
+ width: 'auto',
2053
+ table: {
2054
+ body: this.GrandTotalTable(AccountFields)
2055
+ },
2056
+ layout: 'noBorders'
2057
+ // layout: {
2058
+ // hLineWidth: function (i: any, node: any) {
2059
+ // return (i === 0) ? 1 : 0;
2060
+ // },
2061
+ // vLineWidth: function (i: any, node: any) {
2062
+ // return (i === 0 || i === node.table.body.length) ? 0 : 0;
2063
+ // }
2064
+ // },
2065
+ };
2066
+ }
2067
+
2068
+ static GetFinalTotalDetails(RecordData: any, BasicLaborTotal: any, OverAllMainLaborDiscount: any, LCGST: any, LSGST: any, LIGST: any, PIGST: any, ShowIGST: any, ShowTaxColumn: any,
2069
+ BasicPartsTotal: any, OverAllMainPartsDiscount: any, PCGST: any, PSGST: any, PartsTaxInfo: any,
2070
+ ShowAccParts: any, LaborAfterGST: any, PartsAfterGST: any, OverAllRecordDiscount: any, For: any,
2071
+ OverAllRecordTotal: any, Rounded: any, GrandTotal: any, ShowDetailedLaborTaxInfo: any,
2072
+ ShowDetailedPartTaxInfo: any, istaxable: boolean, LaborTotalTax: any, PartTotalTax: any, Consolidate: boolean, From: string, Adj: any, STotal: any, moreDiscDetails: boolean) {
2073
+ let totalDisc: any;
2074
+ let totalTax: any;
2075
+ if (!Consolidate) {
2076
+ totalTax = TrUtils.FixPriceValue(Add(Number(LaborTotalTax), Number(PartTotalTax)), RecordData.Entity.DecimalsNumber);
2077
+ if (istaxable) {
2078
+ totalDisc = TrUtils.FixPriceValue(Add(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
2079
+ } else {
2080
+ totalDisc = TrUtils.FixPriceValue(Add(Number(OverAllMainLaborDiscount), Number(OverAllMainPartsDiscount)), RecordData.Entity.DecimalsNumber);
2081
+ }
2082
+ }
2083
+
2084
+ return {
2085
+ columns: [
2086
+ this.GetTaxOnLabor(BasicLaborTotal, OverAllMainLaborDiscount, LCGST,
2087
+ LSGST, LIGST, ShowIGST, ShowTaxColumn, ShowDetailedLaborTaxInfo, Consolidate),
2088
+ { text: '', width: 10 },
2089
+ {
2090
+ stack: [
2091
+ this.GetTaxOnParts(BasicPartsTotal, OverAllMainPartsDiscount, PCGST,
2092
+ PSGST, ShowAccParts, PIGST, ShowIGST, ShowTaxColumn, ShowDetailedPartTaxInfo, From, Consolidate),
2093
+ this.PartsTaxAmounts1(PartsTaxInfo, ShowAccParts, ShowIGST,
2094
+ ShowTaxColumn)
2095
+ ]
2096
+ },
2097
+ { text: '', width: moreDiscDetails ? 40 : 60 },
2098
+ // this.GrandTotal(LaborAfterGST, PartsAfterGST, totalDisc, For, OverAllRecordTotal, Rounded, GrandTotal)
2099
+ this.GrandTotal(RecordData, BasicLaborTotal, BasicPartsTotal, totalDisc, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, Adj, Consolidate, STotal, moreDiscDetails, RecordData.Entity.DecimalsNumber)
2100
+
2101
+ ]
2102
+ // columnGap: 40
2103
+ , marginLeft: 10
2104
+ };
2105
+ }
2106
+
2107
+ static GetDebitTotalDetails(RecordData: any, BasicLaborTotal: any, OverAllMainLaborDiscount: any, LCGST: any, LSGST: any, LIGST: any, PIGST: any, ShowIGST: any, ShowTaxColumn: any,
2108
+ BasicPartsTotal: any, OverAllMainPartsDiscount: any, PCGST: any, PSGST: any, PartsTaxInfo: any,
2109
+ ShowAccParts: any, LaborAfterGST: any, PartsAfterGST: any, OverAllRecordDiscount: any, For: any,
2110
+ OverAllRecordTotal: any, Rounded: any, GrandTotal: any, ShowDetailedLaborTaxInfo: any,
2111
+ ShowDetailedPartTaxInfo: any, istaxable: boolean, LaborTotalTax: any, PartTotalTax: any, Consolidate: boolean, From: string, moreDiscDetails: boolean) {
2112
+ let totalDisc: any;
2113
+ let totalTax: any;
2114
+ if (!Consolidate) {
2115
+ totalTax = TrUtils.FixPriceValue(Number(PartTotalTax), RecordData.Entity.DecimalsNumber);
2116
+ if (istaxable) {
2117
+ totalDisc = TrUtils.FixPriceValue(Number(OverAllMainPartsDiscount), RecordData.Entity.DecimalsNumber);
2118
+ } else {
2119
+ totalDisc = TrUtils.FixPriceValue(Number(OverAllMainPartsDiscount), RecordData.Entity.DecimalsNumber);
2120
+ }
2121
+ }
2122
+
2123
+ return {
2124
+ columns: [
2125
+ // this.GetTaxOnLabor(BasicLaborTotal, OverAllMainLaborDiscount, LCGST,
2126
+ // LSGST, LIGST, ShowIGST, ShowTaxColumn, ShowDetailedLaborTaxInfo),
2127
+ { text: '', width: 100 },
2128
+ {
2129
+ stack: [
2130
+ this.GetTaxOnParts(BasicPartsTotal, OverAllMainPartsDiscount, PCGST,
2131
+ PSGST, ShowAccParts, PIGST, ShowIGST, ShowTaxColumn, ShowDetailedPartTaxInfo, From, Consolidate),
2132
+ this.PartsTaxAmounts(PartsTaxInfo, ShowAccParts, ShowIGST,
2133
+ ShowTaxColumn)
2134
+ ]
2135
+ },
2136
+ { text: '', width: 100 },
2137
+ { text: '', width: 80 },
2138
+ this.DebitGrandTotal(RecordData, BasicLaborTotal, BasicPartsTotal, totalDisc, totalTax, For, OverAllRecordTotal, Rounded, GrandTotal, moreDiscDetails, RecordData.Entity.DecimalsNumber)
2139
+
2140
+ ]
2141
+ // columnGap: 40
2142
+ , marginLeft: 10
2143
+ };
2144
+ }
2145
+
2146
+ static DebitGrandTotal(RecordData: any, LaborAfterGST: any, PartsAfterGST: any, OverAllRecordDiscount: any, totalTax: any, For: any, OverAllRecordTotal: any,
2147
+ Rounded: any, GrandTotal: any, moreDiscDetails: boolean, DecimalsNumber: number) {
2148
+ let AccountFields = [
2149
+ // { name: 'Labor Total', value: LaborAfterGST },
2150
+ // { name: 'Part Total', value: PartsAfterGST },
2151
+ { name: 'SubTotal', value: TrUtils.FixPriceValue(TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST)), DecimalsNumber) },
2152
+ ];
2153
+ if (moreDiscDetails) {
2154
+ AccountFields.push({ name: 'Overall Discount', value: TrUtils.FixPriceValue(RecordData.Disc, DecimalsNumber) });
2155
+ } else {
2156
+ AccountFields.push({ name: 'Discount', value: OverAllRecordDiscount });
2157
+ }
2158
+ if (!TrUtils.IsEmpty(totalTax)) {
2159
+ AccountFields.push({ name: 'Total Tax', value: totalTax });
2160
+ }
2161
+ if (For === PayTypeEnum.Insurance) {
2162
+ let total = {
2163
+ name: 'Total',
2164
+ value: OverAllRecordTotal
2165
+ };
2166
+ let Rounding = { name: 'Rounding', value: Rounded };
2167
+ if (Rounding.value > 0) {
2168
+ Rounding.value = '+' + Rounding.value;
2169
+ }
2170
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
2171
+ AccountFields.push(total);
2172
+ AccountFields.push(Rounding);
2173
+ if (!TrUtils.IsFixedZero(Rounded)) {
2174
+ AccountFields.push(FinalTotal);
2175
+ }
2176
+
2177
+ } else {
2178
+ let total = {
2179
+ name: 'Total',
2180
+ value: OverAllRecordTotal
2181
+ };
2182
+ let Rounding = { name: 'Rounding', value: Rounded };
2183
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
2184
+ if (Rounding.value > 0) {
2185
+ Rounding.value = '+' + Rounding.value;
2186
+ }
2187
+ AccountFields.push(total);
2188
+ AccountFields.push(Rounding);
2189
+ if (!TrUtils.IsFixedZero(Rounded)) {
2190
+ AccountFields.push(FinalTotal);
2191
+ }
2192
+ }
2193
+ return {
2194
+ style: ['columnheader', 'TotalsStyles'],
2195
+ lineHeight: 0.7,
2196
+ marginBottom: 5,
2197
+ fontSize: 7,
2198
+ table: {
2199
+ body: this.GrandTotalTable(AccountFields)
2200
+ },
2201
+ layout: 'noBorders'
2202
+ // layout: {
2203
+ // hLineWidth: function (i: any, node: any) {
2204
+ // return (i === 0) ? 1 : 0;
2205
+ // },
2206
+ // vLineWidth: function (i: any, node: any) {
2207
+ // return (i === 0 || i === node.table.body.length) ? 0 : 0;
2208
+ // }
2209
+ // },
2210
+ };
2211
+ }
2212
+
2213
+ static GetPOTotalDetails(ROPrintData: any, moreDiscDetails: boolean) {
2214
+ return {
2215
+ columns: [
2216
+ {
2217
+ stack: [
2218
+ this.GetTaxOnParts(ROPrintData.BasicPartsTotal, ROPrintData.OverAllMainPartsDiscount,
2219
+ ROPrintData.PCGST, ROPrintData.PSGST, ROPrintData.PIGST, ROPrintData.ShowIGST,
2220
+ ROPrintData.ShowAccParts, ROPrintData.ShowTaxColumn, ROPrintData.ShowDetailedPartTaxInfo, ROPrintData.Type, ROPrintData.Consolidate),
2221
+ this.PartsTaxAmounts(ROPrintData.PartsTaxInfo, ROPrintData.ShowAccParts,
2222
+ ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn)
2223
+ ]
2224
+ }, { text: '', width: 200 }, this.GrandTotal(ROPrintData, ROPrintData.LaborAfterGST, ROPrintData.PartsAfterGST,
2225
+ ROPrintData.OverAllRecordDiscount, null, ROPrintData.For, ROPrintData.OverAllRecordTotal, ROPrintData.Rounded, ROPrintData.GrandTotal, ROPrintData.Adj, ROPrintData.Consolidate, null, moreDiscDetails, ROPrintData.Entity.DecimalsNumber)]
2226
+ // columnGap: 40
2227
+ , marginLeft: 10
2228
+ };
2229
+ }
2230
+
2231
+ static GetTaxOnParts(BasicPartsTotal: any, OverAllMainPartsDiscount: any, PCGST: any, PSGST: any, ShowAccParts: any,
2232
+ PIGST: any, ShowIGST: any, ShowTaxColumn: any, ShowDetailedPartTaxInfo: any, From: string, Consolidate: boolean) {
2233
+ let istheretax = false;
2234
+ let PartsTotal = [];
2235
+ // if (!TrUtils.IsFixedZero(OverAllMainPartsDiscount)) {
2236
+ // PartsTotal.push({ name: 'Discount On Parts', value: OverAllMainPartsDiscount });
2237
+ // }
2238
+ if (!Consolidate) {
2239
+ if (!TrUtils.IsFixedZero(BasicPartsTotal) && (From !== 'Countersale')) {
2240
+ PartsTotal.unshift({ name: 'Parts Total', value: BasicPartsTotal });
2241
+ }
2242
+ }
2243
+ if (!ShowAccParts && ShowTaxColumn && ShowDetailedPartTaxInfo) {
2244
+ if (From === 'Sales' || From === 'Countersale') {
2245
+ if (ShowIGST) {
2246
+ PartsTotal.push({ name: 'IGST', value: PIGST });
2247
+ } else {
2248
+ PartsTotal.push({ name: 'CGST', value: PCGST });
2249
+ PartsTotal.push({ name: 'SGST', value: PSGST });
2250
+ }
2251
+ } else {
2252
+ if (ShowIGST) {
2253
+ PartsTotal.push({ name: 'IGST On Parts', value: PIGST });
2254
+ } else {
2255
+ PartsTotal.push({ name: 'CGST On Parts', value: PCGST });
2256
+ PartsTotal.push({ name: 'SGST On Parts', value: PSGST });
2257
+ }
2258
+ }
2259
+ }
2260
+ if (PartsTotal.length !== 0) {
2261
+ return {
2262
+ style: ['columnheader', 'TotalsStyles'],
2263
+ lineHeight: 0.7,
2264
+ fontSize: 7,
2265
+ marginBottom: 5,
2266
+ table: {
2267
+ body: this.GetDataTable(PartsTotal, true)
2268
+ },
2269
+ layout: 'noBorders',
2270
+ };
2271
+ } else {
2272
+ return this.emptyObject();
2273
+ }
2274
+ }
2275
+
2276
+ static GetTaxOnLabor(BasicLaborTotal: any, OverAllMainLaborDiscount: any, LCGST: any, LSGST: any, LIGST: any,
2277
+ ShowIGST: any, ShowTaxColumn: any, ShowDetailedLaborTaxInfo: any, Consolidate: boolean) {
2278
+ let istheretax = false;
2279
+ let LaborTotal = [];
2280
+ // if (!TrUtils.IsFixedZero(OverAllMainLaborDiscount)) {
2281
+ // LaborTotal.push({ name: 'Discount On Labor', value: OverAllMainLaborDiscount });
2282
+ // }
2283
+ //consolidate and no-tax i want show labor discount
2284
+ if (!Consolidate) {
2285
+ if (!TrUtils.IsFixedZero(BasicLaborTotal)) {
2286
+ LaborTotal.unshift({ name: 'Labor Total', value: BasicLaborTotal });
2287
+ }
2288
+ }
2289
+
2290
+ if (ShowTaxColumn && ShowDetailedLaborTaxInfo
2291
+ && (!TrUtils.IsFixedZero(LIGST) || (!TrUtils.IsFixedZero(LCGST) || !TrUtils.IsFixedZero(LSGST)))) {
2292
+ if (ShowIGST) {
2293
+ LaborTotal.push({ name: 'IGST On Labor', value: LIGST });
2294
+ } else {
2295
+ LaborTotal.push({ name: 'CGST On Labor', value: LCGST });
2296
+ LaborTotal.push({ name: 'SGST On Labor', value: LSGST });
2297
+ }
2298
+ }
2299
+
2300
+ if (LaborTotal.length !== 0) {
2301
+ return {
2302
+ style: ['columnheader', 'TotalsStyles'],
2303
+ lineHeight: 0.7,
2304
+ fontSize: 7,
2305
+ marginBottom: 5,
2306
+ table: {
2307
+ body: this.GetDataTable(LaborTotal, true)
2308
+ },
2309
+ layout: 'noBorders',
2310
+ };
2311
+ } else {
2312
+ return this.emptyObject();
2313
+ }
2314
+ }
2315
+
2316
+ static GrandTotal(RecordData: any, LaborAfterGST: any, PartsAfterGST: any, OverAllRecordDiscount: any, totalTax: any, For: any, OverAllRecordTotal: any,
2317
+ Rounded: any, GrandTotal: any, Adj: any, Consolidate: any, subTotal: any, moreDiscDetails: boolean, DecimalsNumber: number) {
2318
+ let AccountFields = [
2319
+ // { name: 'Labor Total', value: LaborAfterGST },
2320
+ // { name: 'Part Total', value: PartsAfterGST },
2321
+ ];
2322
+ if (moreDiscDetails) {
2323
+ if (!TrUtils.IsZero(RecordData.PDisc)) {
2324
+ AccountFields.push({ name: 'Items Discount', value: TrUtils.FixPriceValue(RecordData.PDisc, DecimalsNumber) });
2325
+ }
2326
+
2327
+ if (!TrUtils.IsZero(RecordData.LDisc)) {
2328
+ AccountFields.push({ name: 'Services Discount', value: TrUtils.FixPriceValue(RecordData.LDisc, DecimalsNumber) });
2329
+ }
2330
+
2331
+ if (!TrUtils.IsZero(RecordData.Disc)) {
2332
+ AccountFields.push({ name: 'Overall Discount', value: TrUtils.FixPriceValue(RecordData.Disc, DecimalsNumber) });
2333
+ }
2334
+ } else {
2335
+ AccountFields.push({ name: 'Discount', value: OverAllRecordDiscount });
2336
+ }
2337
+ if (!Consolidate && !TrUtils.IsNull(subTotal)) {
2338
+ AccountFields.unshift({ name: 'SubTotal', value: TrUtils.FixPriceValue(TrUtils.SetValueToZeroIfNull(Number(subTotal)), DecimalsNumber) });
2339
+ } else {
2340
+ if (!Consolidate) {
2341
+ AccountFields.unshift({ name: 'SubTotal', value: TrUtils.FixPriceValue(Add(TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)), TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST))), DecimalsNumber) });
2342
+ } else {
2343
+ console.log('Test', TrUtils.FixPriceValue(Add(TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)), TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST)), TrUtils.SetValueToZeroIfNull(Number(totalTax))), DecimalsNumber));
2344
+ AccountFields.unshift({ name: 'SubTotal', value: TrUtils.FixPriceValue(Add(TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)), TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST)), TrUtils.SetValueToZeroIfNull(Number(totalTax))), DecimalsNumber) });
2345
+ }
2346
+ }
2347
+
2348
+ if (!TrUtils.IsEmpty(totalTax) && !Consolidate) {
2349
+ AccountFields.push({ name: 'Total Tax', value: totalTax });
2350
+ }
2351
+ if (!TrUtils.IsEmpty(Adj)) {
2352
+ if (Adj > 0) {
2353
+ Adj = '+' + TrUtils.FixPriceValue(Adj, DecimalsNumber);
2354
+ }
2355
+ AccountFields.push({ name: 'Adjust', value: Adj });
2356
+ }
2357
+ if (For === PayTypeEnum.Insurance) {
2358
+ let total = {
2359
+ name: 'Total',
2360
+ value: OverAllRecordTotal
2361
+ };
2362
+ let Rounding = { name: 'Rounding', value: Rounded };
2363
+ if (Rounding.value > 0) {
2364
+ Rounding.value = '+' + Rounding.value;
2365
+ }
2366
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
2367
+ AccountFields.push(total);
2368
+ AccountFields.push(Rounding);
2369
+ if (!TrUtils.IsFixedZero(Rounded)) {
2370
+ AccountFields.push(FinalTotal);
2371
+ }
2372
+
2373
+ } else {
2374
+ let total = {
2375
+ name: 'Total',
2376
+ value: OverAllRecordTotal
2377
+ };
2378
+ let Rounding = { name: 'Rounding', value: Rounded };
2379
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
2380
+ if (Rounding.value > 0) {
2381
+ Rounding.value = '+' + Rounding.value;
2382
+ }
2383
+ AccountFields.push(total);
2384
+ AccountFields.push(Rounding);
2385
+ if (!TrUtils.IsFixedZero(Rounded)) {
2386
+ AccountFields.push(FinalTotal);
2387
+ }
2388
+ }
2389
+ return {
2390
+ style: ['columnheader', 'TotalsStyles'],
2391
+ lineHeight: 0.7,
2392
+ marginBottom: 5,
2393
+ width: 'auto',
2394
+ table: {
2395
+ body: this.GrandTotalTable(AccountFields)
2396
+ },
2397
+ layout: 'noBorders'
2398
+ // layout: {
2399
+ // hLineWidth: function (i: any, node: any) {
2400
+ // return (i === 0) ? 1 : 0;
2401
+ // },
2402
+ // vLineWidth: function (i: any, node: any) {
2403
+ // return (i === 0 || i === node.table.body.length) ? 0 : 0;
2404
+ // }
2405
+ // },
2406
+ };
2407
+ }
2408
+
2409
+ static SalesGrandTotal(LaborAfterGST: any, PartsAfterGST: any, OverAllRecordDiscount: any, For: any, OverAllRecordTotal: any,
2410
+ Rounded: any, GrandTotal: any) {
2411
+ let AccountFields = [
2412
+ // { name: 'Labor Total', value: LaborAfterGST },
2413
+ // { name: 'Part Total', value: PartsAfterGST },
2414
+ { name: 'Disc.', value: OverAllRecordDiscount }];
2415
+ if (For === PayTypeEnum.Insurance) {
2416
+ let total = {
2417
+ name: 'Total',
2418
+ value: OverAllRecordTotal
2419
+ };
2420
+ let Rounding = { name: 'Rounding', value: Rounded };
2421
+ if (Rounding.value > 0) {
2422
+ Rounding.value = '+' + Rounding.value;
2423
+ }
2424
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
2425
+ AccountFields.push(total);
2426
+ AccountFields.push(Rounding);
2427
+ if (!TrUtils.IsFixedZero(Rounded)) {
2428
+ AccountFields.push(FinalTotal);
2429
+ }
2430
+
2431
+ } else {
2432
+ let total = {
2433
+ name: 'Total',
2434
+ value: OverAllRecordTotal
2435
+ };
2436
+ let Rounding = { name: 'Rounding', value: Rounded };
2437
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
2438
+ if (Rounding.value > 0) {
2439
+ Rounding.value = '+' + Rounding.value;
2440
+ }
2441
+ AccountFields.push(total);
2442
+ AccountFields.push(Rounding);
2443
+ if (!TrUtils.IsFixedZero(Rounded)) {
2444
+ AccountFields.push(FinalTotal);
2445
+ }
2446
+ }
2447
+ return {
2448
+ style: ['columnheader', 'TotalsStyles'],
2449
+ lineHeight: 0.7,
2450
+ marginBottom: 5,
2451
+ table: {
2452
+ body: this.GrandTotalTable(AccountFields)
2453
+ },
2454
+ layout: 'noBorders'
2455
+ };
2456
+ }
2457
+
2458
+ static GrandTotalTable(data: any) {
2459
+ var body: any = [];
2460
+ data.forEach((row: any) => {
2461
+ if (!TrUtils.IsFixedZero(row.value) || row.name === 'Total') {
2462
+ var dataRow: any = [];
2463
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
2464
+ dataRow.push(':');
2465
+ if (!TrUtils.IsNull(row.value)) {
2466
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right' });
2467
+ } else {
2468
+ dataRow.push({ text: '', noWrap: true, alignment: 'right' });
2469
+ }
2470
+ body.push(dataRow);
2471
+ }
2472
+ });
2473
+ return body;
2474
+ }
2475
+
2476
+ static InvoiceDueStatus(Type: any, Paid: any, Due: any, Status: any, isCounter: boolean, DecimalsNumber: number) {
2477
+ if (Type === 'Invoice' && !isCounter) {
2478
+ return {
2479
+ // lineHeight: 0.7,
2480
+ fontSize: this.TableHeaders,
2481
+ marginTop: 3,
2482
+ marginBottom: 5,
2483
+ table: {
2484
+ widths: ['*', 'auto'],
2485
+ body: [[{ text: 'Paid : Rs.' + TrUtils.FixPriceValue(Paid, DecimalsNumber), marginLeft: 20 },
2486
+ { text: 'Due : Rs.' + TrUtils.FixPriceValue(Due, DecimalsNumber), marginRight: 20 }]]
2487
+ },
2488
+ layout: this.LayOutLineStyle(),
2489
+ };
2490
+ } else {
2491
+ return this.emptyObject();
2492
+ }
2493
+ }
2494
+
2495
+ static DebitDueStatus(Type: any, Paid: any, Due: any, Status: any) {
2496
+ // if (Type === 'Invoice') {
2497
+ return {
2498
+ // lineHeight: 0.7,
2499
+ fontSize: this.TableHeaders,
2500
+ marginTop: 10,
2501
+ marginBottom: 5,
2502
+ table: {
2503
+ widths: ['*', 'auto'],
2504
+ body: [[{ text: 'Paid : Rs.' + Paid, marginLeft: 20 },
2505
+ { text: 'Due : Rs.' + Due, marginRight: 20 }]]
2506
+ },
2507
+ layout: this.LayOutStyle(),
2508
+ };
2509
+ // } else {
2510
+ // return this.emptyObject();
2511
+ // }
2512
+ }
2513
+
2514
+ static LayOutStyle() {
2515
+ return {
2516
+ hLineColor: function (i: any, node: any) {
2517
+ return (i === 0 || i === 1 || i === 2 || i === node.table.body.length) ? 'gray' : 'white';
2518
+ },
2519
+ vLineColor: function (i: any, node: any) {
2520
+ return (i === 0 || i === node.table.widths.length) ? 'gray' : 'white';
2521
+ }
2522
+ };
2523
+ }
2524
+
2525
+
2526
+ static LayOutLineStyle() {
2527
+ return {
2528
+ hLineWidth: function (i: any, node: any) {
2529
+ return (i === 0 || i === node.table.body.length) ? 0.7 : 0.7;
2530
+ },
2531
+ vLineWidth: function (i: any, node: any) {
2532
+ return (i === 0 || i === node.table.widths.length) ? 0.7 : 0.7;
2533
+ },
2534
+ hLineColor: function (i: any, node: any) {
2535
+ return (i === 0 || i === 1 || i === 2 || i === node.table.body.length) ? 'lightgray' : 'white';
2536
+ },
2537
+ vLineColor: function (i: any, node: any) {
2538
+ return (i === 0 || i === node.table.widths.length) ? 'lightgray' : 'white';
2539
+ }
2540
+ };
2541
+ }
2542
+
2543
+ //Not use this function any where
2544
+ static LayOutStyle1() {
2545
+ return {
2546
+ hLineColor: function (i: any, node: any) {
2547
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 'gray' : 'white';
2548
+ },
2549
+ vLineColor: function (i: any, node: any) {
2550
+ return (i === 0 || i === node.table.widths.length) ? 'gray' : 'white';
2551
+ }
2552
+ };
2553
+ }
2554
+
2555
+ static GetImage(Image: any, PrLogo: boolean) {
2556
+ if (!TrUtils.IsNull(Image) && PrLogo) {
2557
+ return { image: Image, width: 120, height: 80 };
2558
+ } else {
2559
+ return { text: '', width: 150, height: 100 };
2560
+ }
2561
+ }
2562
+
2563
+ static FooterContent(CnstData: any) {
2564
+ if (CnstData.Entity.Header === 2) {
2565
+ if (!TrUtils.IsEmpty(CnstData.Entity.FootText)) {
2566
+ return {
2567
+
2568
+ table: {
2569
+ widths: ['auto'],
2570
+ body: [
2571
+ [{
2572
+ text: CnstData.Entity.FootText, alignment: 'center', fontSize: 9
2573
+ }]
2574
+ ]
2575
+ },
2576
+ margin: [35, 0, 15, 10]
2577
+ }
2578
+ } else {
2579
+ return this.emptyObject();
2580
+ }
2581
+
2582
+ } else {
2583
+ return {
2584
+
2585
+ stack: [{ text: CnstData.Doc?.Sltn + ' ' + CnstData.Doc?.Name, bold: true, alignment: 'right', marginBottom: 10 }, SharedPDFService.HeaderAfterLine1(), { columns: [this.GetEntityAddress(CnstData.Entity)] }],
2586
+
2587
+ margin: [35, 0, 15, 10]
2588
+ }
2589
+ }
2590
+ }
2591
+
2592
+ static GetEntityAddress(Entity: any) {
2593
+
2594
+ let Addres: string = Entity.CName + ', ' + Entity.Adrs1;
2595
+ if (!TrUtils.IsEmpty(Entity.Adrs2)) {
2596
+ Addres = Addres + ',' + Entity.Adrs2;
2597
+ }
2598
+ Addres = Addres + ',' + Entity.City + SharedPDFService.getPinCode(Entity.PIN);
2599
+ return {
2600
+ style: 'tableExample',
2601
+ table: {
2602
+ widths: [80, '*'],
2603
+ body: [
2604
+ [{ text: 'Address -', bold: true }, { text: Addres, marginLeft: -45 }],
2605
+ [{ text: 'For Appointments' }, { text: 'Call: ' + Entity.Phone + ', ' + this.GetEmail(Entity.Email), marginLeft: -12 }],
2606
+ ]
2607
+ }, layout: 'noBorders',
2608
+ }
2609
+
2610
+ }
2611
+
2612
+ static GetSignatures(CName: any, For: any, Type: any) {
2613
+ return {
2614
+ columns: [{
2615
+ marginTop: 3,
2616
+ stack: [
2617
+ { text: this.CompanyName(CName), alignment: 'right' },
2618
+ { columns: [this.CustomerSignature(), this.SurveyorSignature(For, Type), this.Authorizedsignature()] }
2619
+ ]
2620
+ }],
2621
+ };
2622
+ }
2623
+
2624
+ static GetInvSignatures(CName: any, isCounterSale: boolean) {
2625
+ return {
2626
+ columns: [{
2627
+ marginTop: 5,
2628
+ stack: [
2629
+ { text: this.CompanyName(CName), alignment: 'right' },
2630
+ { columns: [this.CustomerSignature(), this.SparesSignature(isCounterSale), this.Authorizedsignature()] }
2631
+ ]
2632
+ }],
2633
+ };
2634
+ }
2635
+
2636
+ static GetHCInvSignatures(CName: any, isCounterSale: boolean) {
2637
+ return {
2638
+ columns: [{
2639
+ marginTop: 5,
2640
+ stack: [
2641
+ { text: this.CompanyName(CName), alignment: 'right' },
2642
+ { columns: [this.PatientSignature(), this.SparesSignature(isCounterSale), this.Authorizedsignature()] }
2643
+ ]
2644
+ }],
2645
+ };
2646
+ }
2647
+
2648
+ static SparesSignature(CounterSale: boolean) {
2649
+ if (CounterSale) {
2650
+ return {
2651
+ style: 'Sign',
2652
+ text: ['Parts Incharge Signature'], width: '*'
2653
+ };
2654
+ } else {
2655
+ let Sur: any = [];
2656
+ return Sur;
2657
+ }
2658
+ }
2659
+
2660
+ static CompanyName(CName: any) {
2661
+ return {
2662
+ text: [{ text: 'For ', fontSize: 9 }, { text: CName, bold: 'true', fontSize: 9 }],
2663
+ };
2664
+ }
2665
+
2666
+ static Authorizedsignature() {
2667
+ return {
2668
+ style: 'Sign',
2669
+ text: ['Authorised Signatory'], width: 'auto'
2670
+ };
2671
+ }
2672
+
2673
+ static Accountantsignature() {
2674
+ return {
2675
+ style: 'Sign',
2676
+ text: ['Accountant Signature'],
2677
+ width: '*'
2678
+ };
2679
+ }
2680
+
2681
+ static CustomerSignature() {
2682
+ return {
2683
+ style: 'Sign',
2684
+ text: ['Customer Signature'], width: '*'
2685
+ };
2686
+ }
2687
+
2688
+ static PatientSignature() {
2689
+ return {
2690
+ style: 'Sign',
2691
+ text: ['Patient / Guardian Signature'], width: '*'
2692
+ };
2693
+ }
2694
+
2695
+ static SurveyorSignature(For: any, Type: any) {
2696
+ if (For === PayTypeEnum.Insurance && Type === 'Estimate') {
2697
+ return {
2698
+ style: 'Sign',
2699
+ text: ['Surveyor Signature'], width: '*'
2700
+ };
2701
+ } else {
2702
+ let Sur: any = [];
2703
+ return Sur;
2704
+ }
2705
+ }
2706
+
2707
+ //Not Use this function any where
2708
+ static GetHeadersWithDiffDisc(ROData: any, PrintPartNumber: any) {
2709
+ let headersNames: any;
2710
+ if (PrintPartNumber) {
2711
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
2712
+ { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
2713
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
2714
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
2715
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'right', },
2716
+ { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 }, {},
2717
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
2718
+ ],
2719
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'MPN', lineHeight: 0.5 },
2720
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
2721
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: 'Unit Price', Field: 'UnPr', Field1: 'UnCo', lineHeight: 0.5 },
2722
+ { text: '%', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'percentage', lineHeight: 0.5 },
2723
+ { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 },
2724
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
2725
+ ]];
2726
+ } else {
2727
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
2728
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
2729
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
2730
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, alignment: 'right', lineHeight: 0.5 },
2731
+ { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 }, {},
2732
+ { text: 'Line Total', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 }
2733
+ ],
2734
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'Desc', lineHeight: 0.5 },
2735
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: 'Unit Price', Field: 'UnPr', Field1: 'UnCo', lineHeight: 0.5 },
2736
+ { text: '%', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'percentage', lineHeight: 0.5 },
2737
+ { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 },
2738
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
2739
+ ]];
2740
+ }
2741
+ return headersNames;
2742
+ }
2743
+
2744
+ static GetStyles() {
2745
+ return {
2746
+ temp2header: {
2747
+ fontSize: 23,
2748
+ bold: true,
2749
+ alignment: 'left',
2750
+ // margin: [0, 10, 0, 0],
2751
+ },
2752
+ tableheader1: {
2753
+ bold: true,
2754
+ fontFamily: 'Calibri',
2755
+ margin: [0, 2, 0, 2],
2756
+ alignment: 'center'
2757
+ },
2758
+ header: {
2759
+ fontSize: 26,
2760
+ bold: true,
2761
+ alignment: 'center',
2762
+ // margin: [0, 10, 0, 0],
2763
+ },
2764
+ // header2: {
2765
+ // fontSize: 13,
2766
+ // bold: true,
2767
+ // alignment: 'center',
2768
+ // // margin: [0, 10, 0, 0],
2769
+ // },
2770
+ meetingHeader: {
2771
+ fontSize: 16,
2772
+ bold: true,
2773
+ // alignment: 'center',
2774
+ },
2775
+ Receiptheader: {
2776
+ fontSize: 26,
2777
+ bold: true,
2778
+ alignment: 'center',
2779
+ margin: [0, 10, 0, 0],
2780
+ },
2781
+ InlineHeader: {
2782
+ fontSize: this.TableHeaders,
2783
+ bold: true,
2784
+ alignment: 'center',
2785
+ // decoration: 'underline',
2786
+ margin: [100, 2, 0, 2],
2787
+ },
2788
+ TaskHeading: {
2789
+ fontSize: 10,
2790
+ bold: true,
2791
+ margin: [30, 10, 0, 0],
2792
+ },
2793
+ lettersSize: {
2794
+ fontSize: this.SubHeaderSize,
2795
+ margin: [30, 0, 0, 0],
2796
+ },
2797
+ tablexample: {
2798
+ margin: [0, 5, 0, 0]
2799
+ },
2800
+ hedstyl: {
2801
+ margin: [0, 0, 0, 0]
2802
+ },
2803
+ header2: {
2804
+ fontSize: 12,
2805
+ bold: true,
2806
+ alignment: 'center',
2807
+ margin: [0, 0, 0, 0],
2808
+ },
2809
+ header1: {
2810
+ fontSize: 18,
2811
+ bold: true,
2812
+ alignment: 'center',
2813
+ decoration: 'underline',
2814
+ margin: [0, 0, 0, 0]
2815
+ },
2816
+ ws_adrs_center: {
2817
+ fontSize: this.BodySize,
2818
+ alignment: 'center',
2819
+ },
2820
+ ws_adrs_center1: {
2821
+ fontSize: 10,
2822
+ alignment: 'center',
2823
+ },
2824
+ ws_adrs_left: {
2825
+ fontSize: this.BodySize,
2826
+ alignment: 'left',
2827
+ },
2828
+ ws_adrs_left1: {
2829
+ fontSize: 10,
2830
+ alignment: 'left',
2831
+ },
2832
+ columnheader: {
2833
+ margin: [0, 5, 0, 0],
2834
+ },
2835
+ tableExample: {
2836
+ margin: [0, 0.5, 0, 5],
2837
+ fontSize: this.BodySize
2838
+ },
2839
+ tableExamplemargin: {
2840
+ margin: [25, 10, 20, 0],
2841
+ fontSize: this.BodySize
2842
+ },
2843
+ textcust: {
2844
+ fontSize: this.BodySize,
2845
+ margin: [0, 2, 0, 2],
2846
+ },
2847
+ column: {
2848
+ margin: [15, 0, 0, 0]
2849
+ },
2850
+ tableheader: {
2851
+ bold: true,
2852
+ fontSize: this.TableHeaders,
2853
+ margin: [0, 1, 0, 5],
2854
+ alignment: 'center'
2855
+ },
2856
+ tableheader2: {
2857
+ fontSize: this.TableHeaders,
2858
+ margin: [0, 1, 0, 5],
2859
+ alignment: 'center',
2860
+ // color: 'grey'
2861
+ opacity: 0.7
2862
+ },
2863
+ hed: {
2864
+ fontSize: this.SubHeaderSize,
2865
+ bold: true
2866
+ },
2867
+ hed2: {
2868
+ fontSize: this.SubHeaderSize,
2869
+ // bold: true
2870
+ },
2871
+ TotalsStyles: {
2872
+ marginTop: 15,
2873
+ lineHeight: 1.4,
2874
+ fontSize: this.BodySize,
2875
+ margin: [15, 0, 0, 0],
2876
+ },
2877
+ colum1: {
2878
+ fontSize: this.BodySize,
2879
+ lineHeight: 1.2,
2880
+ },
2881
+ colum2: {
2882
+ fontSize: this.BodySize,
2883
+ lineHeight: 1.4,
2884
+ margin: [10, 0, 0, 0],
2885
+ },
2886
+ colum3: {
2887
+ lineHeight: 0.7
2888
+ },
2889
+ Receiptheader1: {
2890
+ fontSize: 10,
2891
+ bold: true,
2892
+ alignment: 'center',
2893
+ margin: [0, 0, 0, 3]
2894
+ },
2895
+ Row1: {
2896
+ fontSize: this.TableHeaders,
2897
+ margin: [0, 5, 0, 5],
2898
+ },
2899
+ rowdata: {
2900
+ margin: [0, 10, 0, 0],
2901
+ fontSize: this.TableHeaders
2902
+ },
2903
+ forCompany: {
2904
+ margin: [0, 10, 30, 0],
2905
+ fontSize: 9
2906
+ },
2907
+ forCompany1: {
2908
+ margin: [0, 5, 15, 0],
2909
+ fontSize: 9
2910
+ },
2911
+ Rupees: {
2912
+ margin: [0, 40, 0, 0],
2913
+ fontSize: 10,
2914
+ },
2915
+ Signature: {
2916
+ margin: [0, 40, 50, 0],
2917
+ alignment: 'right',
2918
+ fontSize: 10
2919
+ },
2920
+ withApp: {
2921
+ alignment: 'center',
2922
+ lineHeight: 0.7
2923
+ },
2924
+ withOutApp: {
2925
+ alignment: 'center',
2926
+ lineHeight: 0.5
2927
+ },
2928
+ Sign: {
2929
+ fontSize: this.BodySize,
2930
+ margin: [0, 20, 0, 5]
2931
+ },
2932
+ Sign1: {
2933
+ fontSize: this.BodySize,
2934
+ margin: [0, 15, 0, 5]
2935
+ },
2936
+ // 'html-font': {
2937
+ // fontSize: this.TermsandCond,
2938
+ // },
2939
+ // 'html-ol': {
2940
+ // fontSize: this.TermsandCond,
2941
+ // },
2942
+ 'margin-all': {
2943
+ margin: [0, 5, 0, 5],
2944
+ },
2945
+ 'margin-top': {
2946
+ margin: [0, 5, 0, 0],
2947
+ },
2948
+ 'margin-bottom': {
2949
+ margin: [0, 0, 0, 5],
2950
+ },
2951
+ 'fontSize': {
2952
+ fontSize: this.TermsandCond,
2953
+ },
2954
+ // 'html-u': {
2955
+ // fontSize: 16,
2956
+ // },
2957
+ // 'html-b': {
2958
+
2959
+ // },
2960
+ // 'html-li': {
2961
+
2962
+ // },
2963
+ // 'html-span': {
2964
+ // fontSize: this.TermsandCond,
2965
+ // }
2966
+ };
2967
+ }
2968
+
2969
+ static convertNumberToWords(value: any) {
2970
+ var fraction = Math.round(this.frac(value) * 100);
2971
+ let f_text: any = '';
2972
+ if (fraction > 0) {
2973
+ let paisa: any = (this.convert_number(fraction) === 'ONE') ? 'Paisa' : ' Paise';
2974
+ f_text = 'And ' + this.convert_number(fraction) + paisa;
2975
+ }
2976
+
2977
+ return this.convert_number(value) + ' Rupee(s) ' + f_text + ' Only';
2978
+ }
2979
+
2980
+ static frac(f: any) {
2981
+ return f % 1;
2982
+ }
2983
+
2984
+ static convert_number(number: any) {
2985
+ if ((number < 0) || (number > 999999999)) {
2986
+ return 'NUMBER OUT OF RANGE!';
2987
+ }
2988
+ var Gn = Math.floor(number / 10000000); /* Crore */
2989
+ number -= Gn * 10000000;
2990
+ var kn = Math.floor(number / 100000); /* lakhs */
2991
+ number -= kn * 100000;
2992
+ var Hn = Math.floor(number / 1000); /* thousand */
2993
+ number -= Hn * 1000;
2994
+ var Dn = Math.floor(number / 100); /* Tens (deca) */
2995
+ number = number % 100; /* Ones */
2996
+ var tn = Math.floor(number / 10);
2997
+ var one = Math.floor(number % 10);
2998
+ var res = '';
2999
+
3000
+ if (Gn > 0) {
3001
+ res += (this.convert_number(Gn) + ' Crore');
3002
+ }
3003
+ if (kn > 0) {
3004
+ res += (((res === '') ? '' : ' ') +
3005
+ this.convert_number(kn) + ' Lakh');
3006
+ }
3007
+ if (Hn > 0) {
3008
+ res += (((res === '') ? '' : ' ') +
3009
+ this.convert_number(Hn) + ' Thousand');
3010
+ }
3011
+
3012
+ if (Dn) {
3013
+ res += (((res === '') ? '' : ' ') +
3014
+ this.convert_number(Dn) + ' Hundred');
3015
+ }
3016
+
3017
+ var ones = Array('', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Eleven',
3018
+ 'Twelve', 'Thirteen', 'Fourteen', 'Fifteen', 'Sixteen', 'Seventeen', 'Eighteen', 'Nineteen');
3019
+ var tens = Array('', '', 'Twenty', 'Thirty', 'Forty', 'Fifty', 'Sixty', 'Seventy', 'Eighty', 'Ninety');
3020
+
3021
+ if (tn > 0 || one > 0) {
3022
+ if (!(res === '')) {
3023
+ res += ' And ';
3024
+ }
3025
+ if (tn < 2) {
3026
+ res += ones[tn * 10 + one];
3027
+ } else {
3028
+ res += tens[tn];
3029
+ if (one > 0) {
3030
+ res += ('-' + ones[one]);
3031
+ }
3032
+ }
3033
+ }
3034
+
3035
+ if (res === '') {
3036
+ res = 'Zero';
3037
+ }
3038
+ return res;
3039
+ }
3040
+
3041
+ }
3042
+