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