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,1016 @@
1
+ import { SharedPDFService } from '../../shared/shared-pdf.service';
2
+ import { PrintSharedService } from '../../shared/shared-print.service';
3
+ import { TrUtils } from '../../utils/tr-utils';
4
+
5
+ export class PurchaseOrderPDFService {
6
+ static SmallFont: number = 6;
7
+ static MediumFont: number = 8;
8
+ static LargeFont: number = 9;
9
+ dd: any;
10
+ static PurchaseOrder(ROPrintData: any, moreDiscDetails:boolean) {
11
+ let dd = {
12
+ info: {
13
+ title: this.GetFileName(ROPrintData),
14
+ },
15
+ background: function (currentPage: any, pageSize: any) {
16
+ return SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
17
+ },
18
+ header: function (currentPage: any, pageCount: any) {
19
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
20
+ },
21
+ pageMargins: [10, 15, 10, 15],
22
+ content: [
23
+ // SharedPDFService.MainHeading(ROPrintData.Entity.CName, ROPrintData.Entity.Header, ROPrintData.Image, ROPrintData.HColor, null),
24
+ SharedPDFService.GetMainHeader(ROPrintData.Entity, ROPrintData.Image, ROPrintData.AColor, ROPrintData.HColor, null),
25
+ SharedPDFService.GetPrintType(ROPrintData.HeaderName),
26
+ SharedPDFService.HeaderAfterLine(),
27
+ this.GetVendorDetails(ROPrintData),
28
+ this.VendorDetailsAfterLine(),
29
+ this.GetDisplayTable(),
30
+ this.getPartsData(ROPrintData),
31
+ SharedPDFService.GetUnderLine(),
32
+ this.GetPOTotalDetails(ROPrintData, moreDiscDetails),
33
+ SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
34
+ SharedPDFService.GetUnderLine(),
35
+ this.GetSignatures(ROPrintData.Entity.CName),
36
+ ],
37
+ styles: this.GetStyles()
38
+ };
39
+ return dd;
40
+
41
+ }
42
+
43
+ static GetFileName(ROPrintData: any) {
44
+ let fileName: string = ROPrintData.HeaderName;
45
+ return fileName;
46
+ }
47
+
48
+ static GetDisplayTable() {
49
+ return { text: '', fontSize: 10, bold: true, margin: [0, 0, 0, 5] };
50
+ }
51
+
52
+ static GetStyles() {
53
+ return {
54
+ temp2header: {
55
+ fontSize: 23,
56
+ bold: true,
57
+ alignment: 'left',
58
+ // margin: [0, 10, 0, 0],
59
+ },
60
+ header: {
61
+ fontSize: 26,
62
+ bold: true,
63
+ alignment: 'center',
64
+ // margin: [0, 10, 0, 0],
65
+ },
66
+ Cust_Adrs: {
67
+ fontSize: this.MediumFont,
68
+ lineHeight: 1.2,
69
+ },
70
+
71
+ WSHeader_Left: {
72
+ fontSize: 23,
73
+ bold: true,
74
+ alignment: 'left',
75
+ // margin: [0, 10, 0, 0],
76
+ },
77
+ WSHeader_Center: {
78
+ fontSize: 26,
79
+ bold: true,
80
+ alignment: 'center',
81
+ // margin: [0, 10, 0, 0],
82
+ },
83
+ ws_adrs_center: {
84
+ fontSize: this.MediumFont,
85
+ alignment: 'center',
86
+ },
87
+ ws_adrs_left: {
88
+ fontSize: this.MediumFont,
89
+ alignment: 'left',
90
+ },
91
+ table_data: {
92
+ margin: [0, 0.5, 0, 5],
93
+ fontSize: this.MediumFont
94
+ },
95
+ table_header: {
96
+ bold: true,
97
+ fontSize: this.LargeFont,
98
+ margin: [0, 1, 0, 5],
99
+ alignment: 'center'
100
+ },
101
+ vendor_font: {
102
+ fontSize: this.MediumFont,
103
+ margin: [0, 5, 0, 5],
104
+ },
105
+ PO_Status: {
106
+ fontSize: this.MediumFont,
107
+ lineHeight: 1.4,
108
+ margin: [10, 0, 0, 0],
109
+ },
110
+ po_status_font: {
111
+ fontSize: this.LargeFont,
112
+ // bold: true
113
+ },
114
+ totals_Styles: {
115
+ marginTop: 15,
116
+ lineHeight: 1.4,
117
+ fontSize: this.MediumFont,
118
+ margin: [15, 0, 0, 0],
119
+ },
120
+ total_margin: {
121
+ margin: [0, 5, 0, 0],
122
+ },
123
+ hed: {
124
+ fontSize: this.LargeFont,
125
+ bold: true
126
+ },
127
+ Receiptheader1: {
128
+ fontSize: 12,
129
+ bold: true,
130
+ alignment: 'center',
131
+ margin: [0, 0, 0, 3]
132
+ },
133
+ }
134
+ }
135
+
136
+ static MainHeading(CName: any, Header: any, Image: any, HColor: any, AColor: any) {
137
+ let headerstyle: string;
138
+ let MainHeaderStyle: any = this.GetMainHeaderStyleForLeftAlignHeader(CName);
139
+ if (Header === 1) {
140
+ headerstyle = 'WSHeader_Center';
141
+ } else {
142
+ headerstyle = 'WSHeader_Left';
143
+ }
144
+ return [{ text: '' + CName + '', style: [headerstyle, MainHeaderStyle] }];
145
+ }
146
+
147
+ static GetMainHeaderStyleForLeftAlignHeader(WorkShopName: string) {
148
+ var wsname_fontSize: any;
149
+
150
+ if (TrUtils.IsNull(WorkShopName)) {
151
+ WorkShopName = '';
152
+ }
153
+
154
+ switch (true) {
155
+ case (WorkShopName.length < 30):
156
+ wsname_fontSize = 23;
157
+ break;
158
+ case (WorkShopName.length < 35):
159
+ wsname_fontSize = 20;
160
+ break;
161
+ case (WorkShopName.length < 50):
162
+ wsname_fontSize = 17;
163
+ break;
164
+ default:
165
+ wsname_fontSize = 14;
166
+ }
167
+
168
+ var WSHeaderFontSize: any = {
169
+ fontSize: wsname_fontSize,
170
+ bold: true,
171
+ };
172
+
173
+ return WSHeaderFontSize;
174
+
175
+ }
176
+
177
+ static GetHeader(Entity: any) {
178
+ let headerstyle: string;
179
+ if (Entity.Header === 1) {
180
+ headerstyle = 'ws_adrs_center';
181
+ } else {
182
+ headerstyle = 'ws_adrs_left';
183
+ }
184
+ let SubHeader: any = [
185
+ { text: '' + Entity.Adrs1 + '', style: [headerstyle] },
186
+ { text: '' + Entity.City + this.GetPinCode(Entity.PIN) + ', ' + 'Ph: ' + Entity.Phone, style: headerstyle },
187
+ { text: '' + this.GetEmailName(Entity.Email) + '', style: headerstyle }
188
+ ];
189
+ if (!TrUtils.IsEmpty(Entity.Adrs2)) {
190
+ SubHeader.splice(1, 0, { text: '' + Entity.Adrs2 + '', style: [headerstyle] });
191
+ }
192
+ if (!TrUtils.IsEmpty(Entity.TLine)) {
193
+ SubHeader.unshift({ text: this.GetTagLine(Entity.TLine), fontSize: 10, bold: true, margin: [0, 0, 0, 2] });
194
+ }
195
+ return SubHeader;
196
+ }
197
+
198
+ static GetEntityDetails(Entity: any) {
199
+ return {
200
+ lineHeight: 0.7,
201
+ columns: [this.GetEntityTaxDetails(Entity)
202
+ ]
203
+ };
204
+
205
+ }
206
+
207
+ static GetTagLine(TLine: any) {
208
+ if (TrUtils.IsEmpty(TLine)) {
209
+ TLine = '';
210
+ }
211
+ return TLine;
212
+ }
213
+
214
+ static GetEmailName(email: any) {
215
+ let Email: any = '';
216
+ if (!TrUtils.IsNull(email)) {
217
+ Email = 'Email: ' + email;
218
+ }
219
+ return Email;
220
+ }
221
+
222
+ static GetPinCode(pin: any) {
223
+ let code: any = '';
224
+ if (!TrUtils.IsNull(pin)) {
225
+ code = ' - ' + pin;
226
+ }
227
+ return code;
228
+ }
229
+
230
+ static GetEntityTaxDetails(Entity: any) {
231
+ let EntityData: any = [];
232
+ if (!TrUtils.IsEmpty(Entity.GSTIN)) {
233
+ EntityData.push({ name: 'GSTIN', value: Entity.GSTIN })
234
+ }
235
+ if (!TrUtils.IsEmpty(Entity.PAN)) {
236
+ EntityData.push({ name: 'PAN No', value: Entity.PAN })
237
+ }
238
+ if (EntityData.length !== 0) {
239
+ return this.GetEntityeDataTable(EntityData);
240
+ } else {
241
+ return SharedPDFService.emptyObject();
242
+ }
243
+ }
244
+
245
+ static GetEntityeDataTable(EntityFields: any) {
246
+ return {
247
+ lineHeight: 0.7,
248
+ marginLeft: 25,
249
+ fontSize: this.SmallFont,
250
+ table: {
251
+ body: [
252
+ [{
253
+ table: {
254
+ fontSize: this.SmallFont,
255
+ widths: [37, 'auto', '*'],
256
+
257
+ body: this.DataCreateForTable(EntityFields)
258
+ },
259
+ layout: 'noBorders',
260
+ }]
261
+ ]
262
+ },
263
+ layout: 'noBorders',
264
+ };
265
+ }
266
+
267
+ static DataCreateForTable(EntityFields: any) {
268
+ var body: any = [];
269
+ EntityFields.forEach((row: any) => {
270
+ if (!TrUtils.IsFixedZero(row.value) && !TrUtils.IsEmpty(row.value)) {
271
+ var dataRow: any = [];
272
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
273
+ dataRow.push(':');
274
+ dataRow.push({ text: (row.value).toString(), noWrap: true });
275
+ body.push(dataRow);
276
+ }
277
+ });
278
+ return body;
279
+ }
280
+
281
+ static GetVendorDetails(PurchaseOrder: any) {
282
+ return {
283
+ style: 'vendor_font',
284
+ columns: [
285
+ { stack: [this.GetVendorData(PurchaseOrder.Vendor, PurchaseOrder.Type)], width: 120 }, { text: '', width: 250 },
286
+ this.GetVehicle(PurchaseOrder)
287
+ ],
288
+ // columnGap: 150
289
+ };
290
+ }
291
+
292
+ static GetVehicle(PurchaseOrder: any) {
293
+ return {
294
+ style: 'PO_Status',
295
+ lineHeight: 0.7,
296
+ columns: [
297
+ {
298
+ table: {
299
+ fontSize: 6,
300
+ widths: [37, 'auto', '*'],
301
+ body: [[{ text: 'ID', alignment: 'right', style: 'po_status_font' }, { text: ':', style: 'po_status_font' }, PurchaseOrder.Id],
302
+ [{ text: 'Date', alignment: 'right', style: 'po_status_font' }, { text: ':', style: 'po_status_font' }, PurchaseOrder.CrDate],
303
+ // [{ text: 'Status', alignment: 'right', style: 'po_status_font' }, { text: ':', style: 'po_status_font' }, PurchaseOrder.Status]
304
+
305
+ ]
306
+ },
307
+ layout: 'noBorders',
308
+ },
309
+
310
+ ]
311
+
312
+ };
313
+ }
314
+
315
+ static GetVendorData(Vendor: any, Type: any) {
316
+ if (TrUtils.IsNull(Vendor)) {
317
+ return SharedPDFService.emptyObject();
318
+ }
319
+ return {
320
+ style: 'Cust_Adrs',
321
+ stack: [{ text: 'Vendor Name & Address:', style: 'hed' },
322
+ { text: Vendor.Name, marginTop: 2 },
323
+ { text: this.GetAddress(Vendor), marginTop: 3 },
324
+ this.GetVendorPhoneNumber(Vendor, Type), this.GetVendorGSTIN(Vendor)
325
+ ]
326
+ };
327
+ }
328
+
329
+ static GetAddress(Vendor: any) {
330
+ var Address = this.GetFormatAddress(Vendor);
331
+ if (Address.length !== 5) {
332
+ return Address;
333
+ } else {
334
+ let a: any = '';
335
+ return a;
336
+ }
337
+ }
338
+
339
+ static GetFormatContact(CustomerObj: any) {
340
+ var contactnew = '';
341
+ CustomerObj.Contact.forEach((Contact: any) => {
342
+ contactnew = contactnew + '(' + Contact.Type + '):' + Contact.No + '\n';
343
+ });
344
+ return contactnew;
345
+ }
346
+
347
+ static GetFormatAddress(CustomerObj: any) {
348
+ var Addressnew = '';
349
+ if (!TrUtils.IsNull(CustomerObj) && !TrUtils.IsNull(CustomerObj.Address)) {
350
+ CustomerObj.Address.forEach((Adrs: any) => {
351
+ Addressnew = Addressnew + Adrs + '\n';
352
+ });
353
+ }
354
+
355
+ return Addressnew;
356
+ }
357
+
358
+ static GetVendorGSTIN(Vendor: any) {
359
+ let GSTIN: any = {};
360
+ if (!TrUtils.IsEmpty(Vendor.GSTIN)) {
361
+ let columns: any = [];
362
+ columns.push({ text: 'GSTIN :', width: 33, style: 'hed' });
363
+ columns.push({ text: Vendor.GSTIN, marginTop: 1.5 });
364
+ GSTIN.columns = columns;
365
+ return GSTIN;
366
+ } else {
367
+ return GSTIN;
368
+ }
369
+ }
370
+
371
+ static GetVendorPhoneNumber(Vendor: any, Type: any) {
372
+ let PhoneNumber: any = {};
373
+ if (Type !== 'Technician Copy') {
374
+ var contact = this.GetFormatContact(Vendor);
375
+ if (contact.length !== 0) {
376
+ let columns: any = [];
377
+ columns.push({ text: 'Phone', width: 27, style: 'hed' });
378
+ columns.push(contact);
379
+ PhoneNumber.columns = columns;
380
+ return PhoneNumber;
381
+ } else {
382
+ return PhoneNumber;
383
+ }
384
+ } else {
385
+ return PhoneNumber;
386
+ }
387
+ }
388
+
389
+ static VendorDetailsAfterLine() {
390
+ return {
391
+ canvas: [
392
+ {
393
+ type: 'line',
394
+ lineColor: 'black',
395
+ x1: 0,
396
+ y1: 0,
397
+ x2: 575,
398
+ y2: 0,
399
+ lineWidth: 1
400
+ }
401
+ ]
402
+ };
403
+ }
404
+
405
+ static getPartsData(ROPrintData: any) {
406
+ if (ROPrintData.Entity.Body === 1) {
407
+ return this.GetPartsTableForView(TrUtils.Stringify(ROPrintData.Items), TrUtils.Stringify(ROPrintData.Ops), ROPrintData.Entity.MPN);
408
+ } else {
409
+ if (ROPrintData.Entity.Body === 2) {
410
+ return this.WithOutDiscountFieldTable(TrUtils.Stringify(ROPrintData.Items), TrUtils.Stringify(ROPrintData.Ops), ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ShowDiscountColumn);
411
+ } else {
412
+ return this.GetWithOutDiscAndTaxFieldHeader(
413
+ TrUtils.Stringify(ROPrintData.Items), TrUtils.Stringify(ROPrintData.Ops), ROPrintData.Entity.MPN, ROPrintData.ShowTaxColumn, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ShowDiscountColumn);
414
+ }
415
+ }
416
+ }
417
+
418
+ static GetWithOutDiscAndTaxFieldHeader(Items: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ShowDiscountColumn: any) {
419
+ if (Items.length !== 0) {
420
+ if (ShowTaxColumn) {
421
+ return this.TaxDataTable(PrintPartNo, ShowIGST, Items, Ops, Body, ShowTaxColumn, ShowDiscountColumn);
422
+ } else {
423
+ return this.WithOutTaxDataTable(PrintPartNo, ShowIGST, Items, Ops, Body, ShowTaxColumn, ShowDiscountColumn)
424
+ }
425
+ } else {
426
+ let a: any = '';
427
+ return a;
428
+ }
429
+ }
430
+
431
+ static TaxDataTable(PrintPartNo: any, ShowIGST: any, Items: any, Ops: any, Body: any, ShowTaxColumn: any, ShowDiscountColumn: any) {
432
+ if (PrintPartNo) {
433
+ return this.TaxDataTableWithPartNumber(PrintPartNo, ShowIGST, Items, Ops, Body, ShowTaxColumn, ShowDiscountColumn);
434
+ } else {
435
+ return this.TaxDataTableWithOutPartNumber(PrintPartNo, ShowIGST, Items, Ops, Body, ShowTaxColumn, ShowDiscountColumn);
436
+ }
437
+ }
438
+
439
+ static TaxDataTableWithPartNumber(PrintPartNo: any, ShowIGST: any, Items: any, Ops: any, Body: any, ShowTaxColumn: any, ShowDiscountColumn: any) {
440
+ if (ShowIGST) {
441
+ return this.IGSTTaxDataTableWithPartNumber(PrintPartNo, ShowIGST, Items, Ops, Body, ShowTaxColumn, ShowDiscountColumn);
442
+ } else {
443
+ return this.CGSTAndSGSTTaxDataTableWithPartNUmber(PrintPartNo, ShowIGST, Items, Ops, Body, ShowTaxColumn, ShowDiscountColumn);
444
+
445
+ }
446
+ }
447
+
448
+ static IGSTTaxDataTableWithPartNumber(PrintPartNo: any, ShowIGST: any, Items: any, Ops: any, Body: any, ShowTaxColumn: any, ShowDiscountColumn: any) {
449
+ return {
450
+ style: 'table_data',
451
+ table: {
452
+ widths: PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
453
+ body: this.BuildTableBodyForLaborAndParts(Items, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
454
+ },
455
+ layout: PrintSharedService.LayOutStyle()
456
+ };
457
+ }
458
+
459
+ static CGSTAndSGSTTaxDataTableWithPartNUmber(PrintPartNo: any, ShowIGST: any, Items: any, Ops: any, Body: any, ShowTaxColumn: any, ShowDiscountColumn: any) {
460
+ return {
461
+ style: 'table_data',
462
+ table: {
463
+ widths: PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
464
+ body: this.BuildTableBodyForLaborAndParts(Items, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
465
+ },
466
+ layout: PrintSharedService.LayOutStyle()
467
+ };
468
+ }
469
+
470
+ static TaxDataTableWithOutPartNumber(PrintPartNo: any, ShowIGST: any, Items: any, Ops: any, Body: any, ShowTaxColumn: any, ShowDiscountColumn: any) {
471
+ if (ShowIGST) {
472
+ return this.IGSTTaxDataTableWithOutPartNumber(PrintPartNo, ShowIGST, Items, Ops, Body, ShowTaxColumn, ShowDiscountColumn);
473
+ } else {
474
+ return this.CGSTAndSGSTTaxDataTableWithOutPartNUmber(PrintPartNo, ShowIGST, Items, Ops, Body, ShowTaxColumn, ShowDiscountColumn);
475
+ }
476
+ }
477
+
478
+ static IGSTTaxDataTableWithOutPartNumber(PrintPartNo: any, ShowIGST: any, Items: any, Ops: any, Body: any, ShowTaxColumn: any, ShowDiscountColumn: any) {
479
+ return {
480
+ style: 'table_data',
481
+ table: {
482
+ widths: PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
483
+ body: this.BuildTableBodyForLaborAndParts(Items, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
484
+ },
485
+ layout: PrintSharedService.LayOutStyle()
486
+ };
487
+ }
488
+
489
+ static CGSTAndSGSTTaxDataTableWithOutPartNUmber(PrintPartNo: any, ShowIGST: any, Items: any, Ops: any, Body: any, ShowTaxColumn: any, ShowDiscountColumn: any) {
490
+ return {
491
+ style: 'table_data',
492
+ table: {
493
+ widths: PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
494
+ body: this.BuildTableBodyForLaborAndParts(Items, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
495
+ },
496
+ layout: PrintSharedService.LayOutStyle()
497
+ };
498
+ }
499
+
500
+ static WithOutTaxDataTable(PrintPartNo: any, ShowIGST: any, Items: any, Ops: any, Body: any, ShowTaxColumn: any, ShowDiscountColumn: any) {
501
+ if (PrintPartNo) {
502
+ return this.WithOutTaxDataTableWithPartNumber(Items, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
503
+ } else {
504
+ return this.WithOutTaxDataTableWithOutPartNumber(Items, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
505
+ }
506
+ }
507
+
508
+ static WithOutTaxDataTableWithPartNumber(Items: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ShowDiscountColumn: any) {
509
+ return {
510
+ style: 'table_data',
511
+ marginLeft: 20,
512
+ table: {
513
+ widths: [15, 70, 200, 25, 60, 40, 40, 55],
514
+ body: this.BuildTableBodyForLaborAndParts(Items, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
515
+ },
516
+ layout: PrintSharedService.LayOutStyle()
517
+ };
518
+ }
519
+
520
+ static WithOutTaxDataTableWithOutPartNumber(Items: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ShowDiscountColumn: any) {
521
+ return {
522
+ style: 'table_data',
523
+ marginLeft: 20,
524
+ table: {
525
+ widths: [15, 274, 50, 72, 80],
526
+ body: this.BuildTableBodyForLaborAndParts(Items, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
527
+ },
528
+ layout: PrintSharedService.LayOutStyle()
529
+ };
530
+ }
531
+
532
+ static GetPartsTableForView(Items: any, Ops: any, PrintPartNo: any) {
533
+ if (Items.length !== 0) {
534
+ if (PrintPartNo) {
535
+ return {
536
+ style: 'table_data',
537
+ marginLeft: 20,
538
+ table: {
539
+ widths: [15, 85, 170, 20, 50, 30, 30, 60],
540
+ // headerRows: 2,
541
+ body: this.PartsTableBody(Items, Ops, PrintPartNo)
542
+ },
543
+ layout: PrintSharedService.LayOutStyleanother()
544
+ };
545
+ } else {
546
+ return {
547
+ style: 'table_data',
548
+ marginLeft: 20,
549
+ table: {
550
+ widths: [15, 250, 25, 50, 35, 35, 60],
551
+ // headerRows: 2,
552
+ body: this.PartsTableBody(Items, Ops, PrintPartNo)
553
+ },
554
+ layout: PrintSharedService.LayOutStyleanother()
555
+ };
556
+ }
557
+ } else {
558
+ let a: any = '';
559
+ return a;
560
+ }
561
+ }
562
+
563
+ static WithOutDiscountFieldTable(Items: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ShowDiscountColumn: any) {
564
+ if (Items.length !== 0) {
565
+ if (PrintPartNo) {
566
+ return {
567
+ style: 'table_data',
568
+ marginLeft: 20,
569
+ table: {
570
+ widths: [15, 67, 160, 25, 50, 60, 30, 53],
571
+ headerRows: 1,
572
+ body: this.BuildTableBodyForLaborAndParts(Items, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
573
+ },
574
+ layout: PrintSharedService.LayOutStyleanother()
575
+ };
576
+ } else {
577
+ return {
578
+ style: 'table_data',
579
+ marginLeft: 20,
580
+ table: {
581
+ widths: [15, 215, 25, 50, 60, 45, 60],
582
+ headerRows: 1,
583
+ body: this.BuildTableBodyForLaborAndParts(Items, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn)
584
+ },
585
+ layout: PrintSharedService.LayOutStyleanother()
586
+ };
587
+ }
588
+ } else {
589
+ let a: any = '';
590
+ return a;
591
+ }
592
+ }
593
+
594
+ static BuildTableBodyForLaborAndParts(Items: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ShowDiscountColumn: any) {
595
+ var body: any = [];
596
+ let columns: any = PrintSharedService.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
597
+ // if (ShowTaxColumn) {
598
+ for (let i = 0; i < columns.length; i++) {
599
+ body.push(columns[i]);
600
+ }
601
+ columns = columns[1];
602
+ // } else {
603
+ // body.push(columns);
604
+ // }
605
+ let PartsTable = this.GetPartsDataTable(Items, Ops, columns, body);
606
+ return PartsTable;
607
+ }
608
+
609
+ static GetPartsDataTable(Items: any, Ops: any, columns: any, body: any) {
610
+ let SNo: number = 1;
611
+ Items.forEach((part: any) => {
612
+ var dataRow: any = [];
613
+ columns.forEach((column: any) => {
614
+ if (!TrUtils.IsFixedZero(part[column.Field]) && !TrUtils.IsNull(part[column.Field])
615
+ || column.text === 'Line Total' || column.text === 'Unit Price') {
616
+ if (part[column.Field] === 'Spare Items') {
617
+ dataRow.push({ text: part[column.Field]?.toString(), marginLeft: 50, style: 'InlineHeader' });
618
+ } else {
619
+ if (column.text === 'Line Total' || column.Field === 'QtyAndUoM'
620
+ || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt') {
621
+ dataRow.push({ text: part[column.Field]?.toString(), alignment: 'right', nowrap: true });
622
+ } else if (column.Field1 === 'UnCo') {
623
+ dataRow.push({ text: part[column.Field1]?.toString(), alignment: 'right', nowrap: true });
624
+ } else {
625
+ // dataRow.push(part[column.Field].toString());
626
+ if (column.Field === 'Desc') {
627
+ let DescData: any = [];
628
+ DescData.push(part[column.Field]?.toString());
629
+ if (!TrUtils.IsEmpty(part['EDesc'])) {
630
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
631
+ }
632
+ dataRow.push({ stack: DescData });
633
+ } else {
634
+ dataRow.push({ text: part[column.Field].toString() });
635
+ }
636
+ }
637
+ }
638
+ } else {
639
+ if (column.Field === 'SNo') {
640
+ part[column.Field] = SNo;
641
+ SNo = SNo + 1;
642
+ } else {
643
+ part[column.Field] = '';
644
+ }
645
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
646
+ }
647
+ });
648
+
649
+ body.push(dataRow);
650
+ });
651
+
652
+ if (!TrUtils.IsNull(Ops)) {
653
+ Ops?.forEach((part: any) => {
654
+ var dataRow: any = [];
655
+ columns.forEach((column: any) => {
656
+ if (!TrUtils.IsFixedZero(part[column.Field]) && !TrUtils.IsNull(part[column.Field])
657
+ || column.text === 'Line Total' || column.text === 'Unit Price') {
658
+ if (part[column.Field] === 'Spare Items') {
659
+ dataRow.push({ text: part[column.Field]?.toString(), marginLeft: 50, style: 'InlineHeader' });
660
+ } else {
661
+ if (column.text === 'Line Total' || column.Field === 'QtyAndUoM'
662
+ || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt') {
663
+ dataRow.push({ text: part[column.Field]?.toString(), alignment: 'right', nowrap: true });
664
+ } else if (column.Field1 === 'UnCo') {
665
+ dataRow.push({ text: part[column.Field1]?.toString(), alignment: 'right', nowrap: true });
666
+ } else {
667
+ // dataRow.push(part[column.Field].toString());
668
+ if (column.Field === 'Desc') {
669
+ let DescData: any = [];
670
+ DescData.push(part[column.Field]?.toString());
671
+ if (!TrUtils.IsEmpty(part['EDesc'])) {
672
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
673
+ }
674
+ dataRow.push({ stack: DescData });
675
+ } else {
676
+ dataRow.push({ text: part[column.Field].toString() });
677
+ }
678
+ }
679
+ }
680
+ } else {
681
+ if (column.Field === 'SNo') {
682
+ part[column.Field] = SNo;
683
+ SNo = SNo + 1;
684
+ } else {
685
+ part[column.Field] = '';
686
+ }
687
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
688
+ }
689
+ });
690
+
691
+ body.push(dataRow);
692
+ });
693
+ }
694
+
695
+
696
+
697
+ return body;
698
+ }
699
+
700
+ static PartsTableBody(Items: any, Ops: any, PrintPartNo: any) {
701
+ var body: any = [];
702
+ let columns: any = SharedPDFService.GetHeaders(PrintPartNo);
703
+ for (let i = 0; i < columns.length; i++) {
704
+ body.push(columns[i]);
705
+ }
706
+
707
+ let PartsTable = this.GetPartsDataTable(Items, Ops, columns[1], body);
708
+ return PartsTable;
709
+ }
710
+
711
+ static GetPOTotalDetails(ROPrintData: any, moreDiscDetails:boolean) {
712
+ if (TrUtils.IsNull(ROPrintData.SubTotal)) {
713
+ ROPrintData.SubTotal = 0;
714
+ }
715
+ return {
716
+ columns: [
717
+ {
718
+ stack: [
719
+ this.GetTaxOnParts(ROPrintData.PartsTotalAfterDisc, ROPrintData.PartsTotalBeforeDisc,
720
+ ROPrintData.PartCGST, ROPrintData.PartSGST, ROPrintData.PartIGST, ROPrintData.ShowIGST, ROPrintData.ShowAccParts, ROPrintData.ShowTaxColumn, ROPrintData.ShowDetailedPartTaxInfo),
721
+ this.PartsAmountGroupByTax(ROPrintData.PartsTaxInfo, ROPrintData.ShowAccParts,
722
+ ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn)
723
+ ]
724
+ }, { text: '', width: moreDiscDetails?170:200 }, this.GrandTotal(ROPrintData,ROPrintData.LaborAfterGST, ROPrintData.PartAfterTax,
725
+ ROPrintData.Total, ROPrintData.TotalRoundedBy, ROPrintData.RoundedTotal, ROPrintData.SubTotal, ROPrintData.TaxTotal,
726
+ ROPrintData.PartsDiscTotal, ROPrintData.Adjust, moreDiscDetails)]
727
+ , marginLeft: 10
728
+ };
729
+ }
730
+
731
+ static GetTaxOnParts(BasicPartsTotal: any, PartsTotalBeforeDisc: any, PCGST: any, PSGST: any, ShowAccParts: any, PIGST: any, ShowIGST: any, ShowTaxColumn: any, ShowDetailedPartTaxInfo: any) {
732
+ let istheretax = false;
733
+ let PartsTotal = [];
734
+ if (!TrUtils.IsFixedZero(BasicPartsTotal)) {
735
+ PartsTotal.push({ name: 'Total Taxable', value: BasicPartsTotal });
736
+ }
737
+ if (ShowTaxColumn) {
738
+ if (!TrUtils.IsFixedZero(PartsTotalBeforeDisc)) {
739
+ PartsTotal.unshift({ name: 'Items', value: PartsTotalBeforeDisc });
740
+ }
741
+ }
742
+ if (ShowTaxColumn && ShowDetailedPartTaxInfo) {
743
+ if (ShowIGST) {
744
+ PartsTotal.push({ name: 'IGST On Items', value: PIGST });
745
+ } else {
746
+ PartsTotal.push({ name: 'CGST On Items', value: PCGST });
747
+ PartsTotal.push({ name: 'SGST On Items', value: PSGST });
748
+ }
749
+ }
750
+ if (PartsTotal.length !== 0) {
751
+ return {
752
+ style: ['total_margin', 'totals_Styles'],
753
+ lineHeight: 0.7,
754
+ fontSize: 7,
755
+ marginBottom: 5,
756
+ table: {
757
+ body: this.CreatePartsTotalsTable(PartsTotal, true)
758
+ },
759
+ layout: 'noBorders',
760
+ };
761
+ } else {
762
+ return SharedPDFService.emptyObject();
763
+ }
764
+ }
765
+
766
+ static GrandTotal(RecordData:any, LaborAfterGST: any, PartsAfterGST: any, OverAllRecordTotal: any, Rounded: any, GrandTotal: any, SubTotal: any, TaxTotal: any, PartsDiscTotal: any, Adj: any, moreDiscDetails:boolean) {
767
+ let AccountFields = [
768
+ // { name: 'Part Total', value: PartsAfterGST }
769
+ ];
770
+ let total = {
771
+ name: 'Total',
772
+ value: TrUtils.FixPriceValue(OverAllRecordTotal, RecordData.Entity.DecimalsNumber)
773
+ };
774
+ let Rounding = { name: 'Rounding', value: Rounded };
775
+ let FinalTotal = { name: 'Total', value: GrandTotal };
776
+ if (Rounding.value > 0) {
777
+ Rounding.value = '+' + Rounding.value;
778
+ }
779
+
780
+ if (!TrUtils.IsFixedZero(SubTotal)) {
781
+ AccountFields.push({ name: 'SubTotal', value: TrUtils.FixPriceValue(SubTotal, RecordData.Entity.DecimalsNumber) })
782
+ }
783
+
784
+ if (!TrUtils.IsEmpty(PartsDiscTotal) && !moreDiscDetails) {
785
+ AccountFields.push({ name: 'Discount', value: '-' + PartsDiscTotal });
786
+ }else{
787
+ AccountFields.push({ name: 'Overall Discount', value: '-' + TrUtils.FixPriceValue(RecordData.Disc, RecordData.Entity.DecimalsNumber) });
788
+
789
+ }
790
+
791
+ if (!TrUtils.IsEmpty(TaxTotal)) {
792
+ AccountFields.push({ name: 'Total Tax', value: TaxTotal });
793
+ }
794
+
795
+ if (!TrUtils.IsEmpty(Adj)) {
796
+ if (Adj > 0) {
797
+ Adj = '+' + TrUtils.FixPriceValue(Adj, RecordData.Entity.DecimalsNumber);
798
+ }
799
+ AccountFields.push({ name: 'Adjust', value: TrUtils.FixPriceValue(Adj, RecordData.Entity.DecimalsNumber) });
800
+ }
801
+ AccountFields.push(total);
802
+ AccountFields.push(Rounding);
803
+ if (!TrUtils.IsFixedZero(Rounded)) {
804
+ AccountFields.push(FinalTotal);
805
+ }
806
+ return {
807
+ style: ['total_margin', 'totals_Styles'],
808
+ lineHeight: 0.7,
809
+ marginBottom: 5,
810
+ table: {
811
+ body: this.CreateGrandTotalTable(AccountFields)
812
+ },
813
+ layout: 'noBorders'
814
+ };
815
+ }
816
+
817
+ static PartsAmountGroupByTax(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
818
+ if (ShowTaxColumn) {
819
+ return {
820
+ stack: [this.PartsGroupByHSN(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
821
+ };
822
+ } else {
823
+ return '';
824
+ }
825
+ }
826
+
827
+ static PartsGroupByHSN(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
828
+
829
+ if (ShowIGST) {
830
+ return {
831
+ style: 'table_data',
832
+ table: {
833
+ widths: [40, 30, 45, 45],
834
+ headerRows: 1,
835
+ body: this.CreateTableForGroupByHSN(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
836
+ },
837
+ layout: this.HeaderLineStyle(),
838
+ };
839
+ } else {
840
+ return {
841
+ style: 'table_data',
842
+ table: {
843
+ widths: [40, 15, 15, 45, 45],
844
+ headerRows: 1,
845
+ body: this.CreateTableForGroupByHSN(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
846
+ },
847
+ layout: this.HeaderLineStyle(),
848
+ };
849
+ }
850
+ }
851
+
852
+ static PartsGroupByPercentage(PartsTaxInfo: any, ShowAccParts: any, ShowTaxColumn: any) {
853
+ return {
854
+ style: 'table_data',
855
+ table: {
856
+ widths: [20, 20, 40, 40],
857
+ body: this.CreateTableForGroupByPercentage(PartsTaxInfo, ShowAccParts, ShowTaxColumn)
858
+ },
859
+ layout: this.HeaderLineStyle(),
860
+ };
861
+ }
862
+
863
+ static GetSignatures(CName: any) {
864
+ return {
865
+ fontSize: this.MediumFont,
866
+ columns: [{
867
+ stack: [
868
+ this.CompanyName(CName),
869
+ { columns: [this.Authorizedsignature()] }
870
+ ]
871
+ }],
872
+ };
873
+ }
874
+
875
+ static CompanyName(CName: any) {
876
+ return {
877
+ style: 'forCompany',
878
+ text: ['For ', { text: CName, bold: 'true' }],
879
+ };
880
+ }
881
+
882
+ static Authorizedsignature() {
883
+ return {
884
+ style: 'Sign',
885
+ text: ['Authorized Signatory'],
886
+ };
887
+ }
888
+
889
+ static HeaderLineStyle() {
890
+ return {
891
+ hLineWidth: function (i: any, node: any) {
892
+ return (i === 1) ? 0.5 : 0;
893
+ },
894
+ vLineWidth: function (i: any, node: any) {
895
+ return (i === 0 || i === node.table.widths.length) ? 0 : 0;
896
+ },
897
+ };
898
+ }
899
+
900
+ static CreateHeaderForGroupByPercentage() {
901
+ let HeaderNames = [{ text: 'GST(%)', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'CombinedTaxPercentage' },
902
+ { text: 'Count', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'PartsCount' },
903
+ { text: 'Taxble Value', style: 'table_header', alignment: 'right', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount' },
904
+ { text: 'Amount', style: 'table_header', alignment: 'right', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
905
+ ];
906
+ return HeaderNames;
907
+ }
908
+
909
+ static CreateHeaderForGroupByHSN(ShowIGST: any) {
910
+ let HeaderNames = [{ text: 'HSN', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'HSN' },
911
+ { text: 'Taxable Value', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount' },
912
+ { text: 'Amount', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
913
+ ];
914
+ if (ShowIGST) {
915
+ HeaderNames.splice(1, 0, { text: 'IGST', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'IGST' })
916
+ } else {
917
+ HeaderNames.splice(1, 0, { text: 'CGST', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'CGST' })
918
+ HeaderNames.splice(2, 0, { text: 'SGST', style: 'table_header', fontSize: 6, lineHeight: 0.3, Field: 'SGST' })
919
+ }
920
+ return HeaderNames;
921
+ }
922
+
923
+ static CreateTableForGroupByHSN(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
924
+ if (!TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
925
+ var body: any = [];
926
+ let columns: any = this.CreateHeaderForGroupByHSN(ShowIGST);
927
+ body.push(columns);
928
+ PartsTaxInfo.forEach((part: any) => {
929
+ var dataRow: any = [];
930
+ columns.forEach((column: any) => {
931
+ if (!TrUtils.IsFixedZero(part[column.Field]) &&
932
+ !TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST'
933
+ || column.Field === 'TotalTaxAmount') {
934
+ if (column.Field === 'SGSTLaborAmt') {
935
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
936
+ } else {
937
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center', nowrap: true });
938
+ }
939
+ } else {
940
+ part[column.Field] = '';
941
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
942
+ }
943
+ });
944
+
945
+ body.push(dataRow);
946
+ });
947
+ return body;
948
+ } else {
949
+ return [{}];
950
+ }
951
+ }
952
+
953
+ static CreateTableForGroupByPercentage(PartsTaxInfo: any, ShowAccParts: any, ShowTaxColumn: any) {
954
+ if (!TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
955
+ var body: any = [];
956
+ let columns: any = this.CreateHeaderForGroupByPercentage();
957
+ body.push(columns);
958
+ PartsTaxInfo.forEach((part: any) => {
959
+
960
+ var dataRow: any = [];
961
+ columns.forEach((column: any) => {
962
+ if (!TrUtils.IsNull(part[column.Field]) && !TrUtils.IsNull(part[column.Field])) {
963
+ if (column.Field === 'TotalTaxAmount' || column.Field === 'TotalTaxableAmount') {
964
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
965
+ } else {
966
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center', nowrap: true });
967
+ }
968
+ } else {
969
+ part[column.Field] = '';
970
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
971
+ }
972
+ });
973
+
974
+ body.push(dataRow);
975
+ });
976
+ return body;
977
+ } else {
978
+ return [{}];
979
+ }
980
+ }
981
+
982
+ static CreateGrandTotalTable(data: any) {
983
+ var body: any = [];
984
+ data.forEach((row: any) => {
985
+ if (!TrUtils.IsFixedZero(row.value) || row.name === 'Total') {
986
+ var dataRow: any = [];
987
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
988
+ dataRow.push(':');
989
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right' });
990
+ body.push(dataRow);
991
+ }
992
+ });
993
+ return body;
994
+ }
995
+
996
+ static CreatePartsTotalsTable(data: any, istotal: boolean) {
997
+ var body: any = [];
998
+ data.forEach((row: any) => {
999
+ var dataRow: any = [];
1000
+ if (row.name === 'Items') {
1001
+ dataRow.push({ text: [{ text: row.name, bold: 'true' }, ' Total'] });
1002
+ } else {
1003
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
1004
+ }
1005
+ dataRow.push(':');
1006
+ if (istotal) {
1007
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right' });
1008
+ } else {
1009
+ dataRow.push({ text: (row.value).toString(), noWrap: true, });
1010
+ }
1011
+ body.push(dataRow);
1012
+ });
1013
+ return body;
1014
+ }
1015
+
1016
+ }