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,681 @@
1
+ import { PrintSharedService } from '../../shared/shared-print.service';
2
+ import { TrUtils } from '../../utils/tr-utils';
3
+ import { SharedPDFService } from '../../shared/shared-pdf.service';
4
+
5
+ export class DebitNotePdfService {
6
+ FontSize: number = 8;
7
+
8
+ static GetInvoicePrint(ROPrintData: any, win: any, moreDiscDetails:boolean) {
9
+ var dd = {
10
+ info: {
11
+ title: this.GetFileName(ROPrintData),
12
+ },
13
+ background: function (currentPage: any, pageSize: any) {
14
+ return SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
15
+ },
16
+ header: function (currentPage: any, pageCount: any) {
17
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
18
+ },
19
+ pageMargins: [10, 15, 10, 15],
20
+ content: [
21
+ this.CommonHeaderDetails(ROPrintData),
22
+ this.PreparesparePartsTable(ROPrintData),
23
+ this.CommonTotalDetails(ROPrintData, moreDiscDetails)
24
+ ],
25
+ styles: SharedPDFService.GetStyles()
26
+ };
27
+ return dd;
28
+ }
29
+
30
+ static GetFileName(ROPrintData: any) {
31
+ let fileName: string = ROPrintData.HeaderName;
32
+ if (!TrUtils.IsNull(ROPrintData.Product) && !TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
33
+ fileName = fileName + '-' + ROPrintData.Product.RegNo;
34
+ }
35
+ return fileName;
36
+ }
37
+
38
+ static CommonHeaderDetails(ROPrintData: any) {
39
+ return [
40
+ this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor),
41
+ SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
42
+ ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For,
43
+ ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp,
44
+ ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, ROPrintData.Settings, null, false, null, null,null,null, ROPrintData.DoS),
45
+ SharedPDFService.CustomerAndVehicleDetailsAfterLine(),
46
+ SharedPDFService.GetDisplayTable(),
47
+ ];
48
+ }
49
+
50
+ static GetMainHeaderDetails(Entity: any, HeaderName: any, Image: any, HColor: any, AColor: any) {
51
+ return [
52
+ // SharedPDFService.MainHeading(Entity.CName, Entity.Header, Image, HColor, null),
53
+ SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, null),
54
+ SharedPDFService.GetPrintType(HeaderName),
55
+ SharedPDFService.HeaderAfterLine()
56
+ ];
57
+ }
58
+
59
+ static PreparesparePartsTable(ROPrintData: any) {
60
+ let List: any = [];
61
+ if (ROPrintData.Entity.Body === 1) {
62
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
63
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
64
+ ROPrintData.PrintInfo[i].Text = '';
65
+ };
66
+
67
+ }
68
+ } else {
69
+ if (ROPrintData.Entity.Body === 2) {
70
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
71
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
72
+ ROPrintData.PrintInfo[i].Text = '';
73
+ }
74
+ List.push(ROPrintData.PrintInfo[i].Text,
75
+ this.WithOutDiscountFieldTable(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn,
76
+ ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn)
77
+ );
78
+
79
+ }
80
+ } else {
81
+ if (ROPrintData.Summary) {
82
+ // List.push('',
83
+ // this.GetLaborPartsTableForView(ROPrintData.Items)
84
+ // );
85
+ } else {
86
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
87
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
88
+ ROPrintData.PrintInfo[i].Text = '';
89
+ }
90
+ List.push(ROPrintData.PrintInfo[i].Text,
91
+ this.GetWithOutDiscAndTaxFieldHeader(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items),
92
+ ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn)
93
+ );
94
+
95
+ }
96
+ }
97
+ }
98
+ }
99
+ return List;
100
+ }
101
+
102
+ static WithOutDiscountFieldTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
103
+ if (Parts.length !== 0) {
104
+ return {
105
+ style: 'tableExample',
106
+ marginLeft: 20,
107
+ table: {
108
+ widths: [15, 215, 25, 100, 60, 60, 60],
109
+ headerRows: 1,
110
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
111
+ },
112
+ layout: PrintSharedService.LayOutStyleanother()
113
+ };
114
+ // if (PrintPartNo) {
115
+ // return {
116
+ // style: 'tableExample',
117
+ // marginLeft: 20,
118
+ // table: {
119
+ // widths: [15, 67, 160, 25, 50, 60, 30, 53],
120
+ // headerRows: 1,
121
+ // body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
122
+ // },
123
+ // layout: this.LayOutStyleanother()
124
+ // };
125
+ // } else {
126
+ // return {
127
+ // style: 'tableExample',
128
+ // marginLeft: 20,
129
+ // table: {
130
+ // widths: [15, 215, 25, 50, 60, 45, 60],
131
+ // headerRows: 1,
132
+ // body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
133
+ // },
134
+ // layout: this.LayOutStyleanother()
135
+ // };
136
+ // }
137
+ } else {
138
+ let a: any = '';
139
+ return a;
140
+ }
141
+ }
142
+
143
+ static BuildTableBodyForLaborAndParts(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
144
+ var body: any = [];
145
+ let columns: any = this.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
146
+ // if (ShowTaxColumn) {
147
+ for (let i = 0; i < columns.length; i++) {
148
+ body.push(columns[i]);
149
+ }
150
+ columns = columns[1];
151
+ // } else {
152
+ // body.push(columns);
153
+ // }
154
+
155
+ if (Parts.length !== 0) {
156
+ let dummypartadding1: any = {};
157
+ dummypartadding1.SNo = '';
158
+ dummypartadding1.Desc = 'Spare Parts';
159
+ // dummypartadding1.Qty = '';
160
+ dummypartadding1.Pr = '';
161
+ dummypartadding1.LineTotal = '';
162
+ Parts.unshift(dummypartadding1);
163
+ }
164
+
165
+ let SNo: number = 1;
166
+ Parts.forEach((part: any) => {
167
+ var dataRow: any = [];
168
+ columns.forEach((column: any) => {
169
+ if (
170
+ (!TrUtils.IsFixedZero(part[column.Field]) && !TrUtils.IsNull(part[column.Field]))
171
+ || (column.text === 'Line Total')) {
172
+ if (part[column.Field] === 'Spare Parts') {
173
+ dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
174
+ } else {
175
+ if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
176
+ && TrUtils.CheckInvalidSelect(part.TCode))) {
177
+ part[column.Field] = '';
178
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
179
+ } else {
180
+ if (column.Field === 'Pr' || column.Field === 'QtyAndUoM'
181
+ || column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
182
+ || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc' || column.text === 'Line Total') {
183
+ if (column.Field === 'Disc') {
184
+ if (column.type === 'percentage') {
185
+ if (!TrUtils.IsEmpty(part[column.Field])) {
186
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
187
+ } else {
188
+ dataRow.push({ text: '', noWrap: true });
189
+ }
190
+ } else {
191
+ if (!TrUtils.IsZero(part[column.Field])) {
192
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
193
+ } else {
194
+ dataRow.push({ text: '', noWrap: true });
195
+ }
196
+ }
197
+ } else {
198
+ if (!TrUtils.IsZero(part[column.Field])) {
199
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
200
+ } else {
201
+ dataRow.push({ text: '', noWrap: true });
202
+ }
203
+ }
204
+ } else {
205
+ dataRow.push(part[column.Field].toString());
206
+ }
207
+ }
208
+ }
209
+ } else {
210
+ if (column.Field === 'SNo') {
211
+ part[column.Field] = SNo;
212
+ SNo = SNo + 1;
213
+ } else {
214
+ part[column.Field] = '';
215
+ }
216
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
217
+ }
218
+ });
219
+
220
+ body.push(dataRow);
221
+ });
222
+ return body;
223
+ }
224
+
225
+ static GetWithOutDiscountFieldHeader(permission: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
226
+ if (Body === 2) {
227
+ let headersNames: any = [{ text: 'Description', style: 'tableheader', Field: 'Desc' },
228
+ // { text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
229
+ { text: 'Price', style: 'tableheader', Field: 'Pr' },
230
+ { text: 'Labor Charges', style: 'tableheader', Field: 'Price' },
231
+ { text: 'Tax', style: 'tableheader', Field: 'TaxAmount' },
232
+ { text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }];
233
+ if (permission) {
234
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
235
+ let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
236
+ headersNames.unshift(sno, MPN);
237
+ } else {
238
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
239
+ headersNames.unshift(sno);
240
+ }
241
+ return headersNames;
242
+ } else {
243
+ if (ShowTaxColumn) {
244
+ return this.GetWithOutDiscountFieldHeader1(permission, Body, ShowIGST, ShowDiscountColumn);
245
+ } else {
246
+ return this.GetWithOutDiscountFieldHeader2(permission, Body, ShowDiscountColumn);
247
+ }
248
+ }
249
+ }
250
+
251
+ static GetWithOutDiscountFieldHeader1(permission: any, Body: any, ShowIGST: any, ShowDiscountColumn: any) {
252
+ let headersNames: any;
253
+ if (permission) {
254
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
255
+ { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
256
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
257
+ // { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
258
+ // { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
259
+ { text: 'Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'center', },
260
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
261
+ ],
262
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'MPN', lineHeight: 0.5 },
263
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
264
+ // { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
265
+ // { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 },
266
+ { text: '', Field: 'Pr', lineHeight: 0.5 },
267
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
268
+ ]];
269
+ let Count: number = 4;
270
+ if (ShowDiscountColumn) {
271
+ headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
272
+ headersNames[0].splice(Count + 1, 0, {});
273
+ headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
274
+ headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
275
+ Count = 6;
276
+ }
277
+ if (ShowIGST) {
278
+ headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
279
+ headersNames[0].splice(Count + 1, 0, {});
280
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
281
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
282
+ } else {
283
+ headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
284
+ headersNames[0].splice(Count + 1, 0, {});
285
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
286
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.5 });
287
+ headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
288
+ headersNames[0].splice(Count + 3, 0, {});
289
+ headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
290
+ headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
291
+ }
292
+ } else {
293
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 },
294
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.6 },
295
+ // { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
296
+ // { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.6 },
297
+ { text: 'Price', style: 'tableheader', rowSpan: 2, alignment: 'center', lineHeight: 0.6 },
298
+ { text: 'Line Total', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 }
299
+ ],
300
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 },
301
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
302
+ // { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
303
+ // { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 },
304
+ { text: '', Field: 'Pr', lineHeight: 0.5 },
305
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
306
+ ]];
307
+ let Count: number = 3;
308
+ if (ShowDiscountColumn) {
309
+ headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
310
+ headersNames[0].splice(Count + 1, 0, {});
311
+ headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
312
+ headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
313
+ Count = 5;
314
+ }
315
+ if (ShowIGST) {
316
+ headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
317
+ headersNames[0].splice(Count + 1, 0, {});
318
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
319
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
320
+ } else {
321
+ headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
322
+ headersNames[0].splice(Count + 1, 0, {});
323
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
324
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.5 });
325
+ headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
326
+ headersNames[0].splice(Count + 3, 0, {});
327
+ headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
328
+ headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
329
+ }
330
+ }
331
+ return headersNames;
332
+ }
333
+
334
+ static GetWithOutDiscountFieldHeader2(permission: any, Body: any, ShowDiscountColumn: any) {
335
+ let headersNames: any = [[
336
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
337
+ // { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
338
+ { text: 'Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'right', },
339
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
340
+ ],
341
+ [
342
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
343
+ // { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 },
344
+ { text: '', Field: 'Pr', lineHeight: 0.5 },
345
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
346
+ ]];
347
+ if (permission) {
348
+ let sno = { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 };
349
+ let MPN = { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 };
350
+ let sno1 = { text: '', Field: 'SNo', lineHeight: 0.5 };
351
+ let MPN1 = { text: '', Field: 'MPN', lineHeight: 0.5 };
352
+ headersNames[0].unshift(sno, MPN);
353
+ headersNames[1].unshift(sno1, MPN1);
354
+ if (ShowDiscountColumn) {
355
+ headersNames[0].splice(4, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
356
+ headersNames[0].splice(5, 0, {});
357
+ headersNames[1].splice(4, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
358
+ headersNames[1].splice(5, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
359
+ }
360
+ } else {
361
+ let sno = { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 };
362
+ let sno1 = { text: '', Field: 'SNo', lineHeight: 0.5 };
363
+ headersNames[0].unshift(sno);
364
+ headersNames[1].unshift(sno1);
365
+ if (ShowDiscountColumn) {
366
+ headersNames[0].splice(3, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
367
+ headersNames[0].splice(4, 0, {});
368
+ headersNames[1].splice(3, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
369
+ headersNames[1].splice(3, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
370
+ }
371
+ }
372
+ return headersNames;
373
+ }
374
+
375
+ static GetWithOutDiscAndTaxFieldHeader(Parts: any, ShowTaxColumn: any, PrintPartNo: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
376
+ if (Parts.length !== 0) {
377
+ if (ShowTaxColumn) {
378
+ return this.TaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
379
+ } else {
380
+ if (ConsolidateGST) {
381
+ return this.ConsolidateDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
382
+ } else {
383
+ return this.NoTaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
384
+ }
385
+ }
386
+ } else {
387
+ let a: any = '';
388
+ return a;
389
+ }
390
+ }
391
+
392
+ static TaxTableWidths(PrintPartNo: any, ShowIGST: any, ShowDiscountColumn: any) {
393
+ if (PrintPartNo) {
394
+ if (ShowIGST) {
395
+ if (ShowDiscountColumn) {
396
+ return [15, 50, 160, 37, 25, 40, 17, 35, 17, 35, 50];
397
+ } else {
398
+ return [15, 50, 222, 37, 25, 40, 17, 35, 55];
399
+ }
400
+ } else {
401
+ if (ShowDiscountColumn) {
402
+ return [15, 50, 175, 40, 17, 34, 17, 34, 17, 34, 48];
403
+ } else {
404
+ return [15, 50, 160, 35, 22, 40, 17, 34, 17, 34, 54];
405
+ }
406
+ }
407
+ } else {
408
+ if (ShowIGST) {
409
+ if (ShowDiscountColumn) {
410
+ return [20, "*", 60, 17, 35, 17, 35, 60];
411
+ } else {
412
+ return [20, '*', 40, 25, 40, 60];
413
+ }
414
+ } else {
415
+ if (ShowDiscountColumn) {
416
+ return [15, 155, 40, 50, 34, 35, 40, 40, 40, 40];
417
+ // return [15, 155, 40, 40, 40, 60, 60, 60];
418
+ } else {
419
+ return [15, 216, 35, 22, 40, 17, 34, 17, 34, 55];
420
+ }
421
+ }
422
+ }
423
+ }
424
+
425
+ static TaxDataTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
426
+ if (PrintPartNo) {
427
+ if (ShowIGST) {
428
+ return {
429
+ style: 'tableExample',
430
+ table: {
431
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
432
+ // headerRows: 2,
433
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
434
+ },
435
+ layout: PrintSharedService.LayOutStyle()
436
+ };
437
+ } else {
438
+ return {
439
+ style: 'tableExample',
440
+ table: {
441
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
442
+ // headerRows: 2,
443
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
444
+ },
445
+ layout: PrintSharedService.LayOutStyle()
446
+ };
447
+ }
448
+
449
+ } else {
450
+ if (ShowIGST) {
451
+ return {
452
+ style: 'tableExample',
453
+ table: {
454
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
455
+ // headerRows: 2,
456
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
457
+ },
458
+ layout: PrintSharedService.LayOutStyle()
459
+ };
460
+ } else {
461
+ return {
462
+ style: 'tableExample',
463
+ table: {
464
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
465
+ // headerRows: 2,
466
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
467
+ },
468
+ layout: PrintSharedService.LayOutStyle()
469
+ };
470
+ }
471
+
472
+ }
473
+ }
474
+
475
+ static ConsolidateDataTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
476
+ return {
477
+ style: 'tableExample',
478
+ table: {
479
+ widths: [25, 350, 80, 80,],
480
+ // headerRows: 1,
481
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
482
+ },
483
+ layout: PrintSharedService.LayOutStyle()
484
+ };
485
+ }
486
+
487
+ static WidthForInsuranceOrNot(ShowDiscountColumn: any, PrintPartNo: boolean) {
488
+ if (PrintPartNo) {
489
+ if (ShowDiscountColumn) {
490
+ return [15, 70, 240, 50, 40, 40, 60];
491
+ } else {
492
+ return [25, 70, 285, 60, 80];
493
+ }
494
+ } else {
495
+ if (ShowDiscountColumn) {
496
+ return [15, 230, 40, 70, 40, 40, 80];
497
+ } else {
498
+ return [25, 325, 40, 60, 80];
499
+ }
500
+ }
501
+
502
+ }
503
+
504
+ static NoTaxDataTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
505
+ if (PrintPartNo) {
506
+ return {
507
+ style: 'tableExample',
508
+ table: {
509
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
510
+ // headerRows: 1,
511
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
512
+ },
513
+ layout: PrintSharedService.LayOutStyle()
514
+ };
515
+ } else {
516
+ return {
517
+ style: 'tableExample',
518
+ table: {
519
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
520
+ // headerRows: 1,
521
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
522
+ },
523
+ layout: PrintSharedService.LayOutStyle()
524
+ };
525
+ }
526
+ }
527
+
528
+ static buildTableForCustomerLabor(Parts: any, PrintPartNo: any, customerorInsurance: any) {
529
+ var body: any = [];
530
+ let columns: any;
531
+ columns = this.getSummaryHeaders(PrintPartNo);
532
+ body.push(columns);
533
+
534
+ if (Parts.length !== 0) {
535
+ let dummypartadding1: any = {};
536
+ dummypartadding1.SNo = '';
537
+ dummypartadding1.Desc = 'Spare Parts';
538
+ // dummypartadding1.Qty = '';
539
+ dummypartadding1.Pr = '';
540
+ dummypartadding1.Price = '';
541
+ dummypartadding1.DiscountedPrice = '';
542
+ dummypartadding1.LineTotal = '';
543
+ // dummypartadding1.QtyAndUoM = '';
544
+ // dummypartadding1.HSN = '';
545
+ dummypartadding1.MPN = '';
546
+ Parts.unshift(dummypartadding1);
547
+ }
548
+
549
+ let SNo: number = 1;
550
+ Parts.forEach((part: any) => {
551
+ var dataRow: any = [];
552
+ columns.forEach((column: any) => {
553
+ if (!TrUtils.IsFixedZero(part[column.Field]) && !TrUtils.IsNull(part[column.Field])
554
+ || column.text === 'Line Total') {
555
+ if (part[column.Field] === 'Spare Parts') {
556
+ dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
557
+ } else {
558
+ // tslint:disable-next-line:max-line-length
559
+ if (column.Field === 'CustPrice' || column.Field === 'InsPrice' ||
560
+ column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount' || column.Field === 'Pr' || column.text === 'Line Total') {
561
+ if (column.Field === 'Disc Amt') {
562
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', noWrap: true });
563
+
564
+ } else {
565
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
566
+ }
567
+
568
+ } else {
569
+ dataRow.push({ text: part[column.Field].toString() });
570
+ }
571
+ }
572
+ } else {
573
+ if (column.Field === 'SNo') {
574
+ part[column.Field] = SNo;
575
+ SNo = SNo + 1;
576
+ } else {
577
+ part[column.Field] = '';
578
+ }
579
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
580
+ }
581
+ });
582
+
583
+ body.push(dataRow);
584
+ });
585
+
586
+ // if (Ops.length !== 0) {
587
+ // let dummypartadding1: any = {};
588
+ // dummypartadding1.SNo = '';
589
+ // dummypartadding1.Desc = 'Labor';
590
+ // dummypartadding1.Qty = '';
591
+ // dummypartadding1.Pr = '';
592
+ // dummypartadding1.Price = '';
593
+ // dummypartadding1.DiscountedPrice = '';
594
+ // dummypartadding1.LineTotal = '';
595
+ // dummypartadding1.QtyAndUoM = '';
596
+ // dummypartadding1.HSN = '';
597
+ // Ops.unshift(dummypartadding1);
598
+ // }
599
+
600
+ // Ops.forEach((labor: any) => {
601
+ // var dataRow: any = [];
602
+ // columns.forEach((column: any) => {
603
+ // if (!TrUtils.IsFixedZero(labor[column.Field]) && !TrUtils.IsNull(labor[column.Field])
604
+ // || column.text === 'Line Total') {
605
+ // if (labor[column.Field] === 'Labor') {
606
+ // dataRow.push({ text: labor[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
607
+ // } else {
608
+ // if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount'
609
+ // || column.Field === 'Pr' || column.Field === 'CustPrice' || column.Field === 'InsPrice') {
610
+ // if (column.Field === 'Disc Amt') {
611
+ // dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', noWrap: true });
612
+ // } else {
613
+ // dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', nowrap: true });
614
+ // }
615
+
616
+ // } else {
617
+ // dataRow.push({ text: labor[column.Field].toString() });
618
+ // }
619
+ // }
620
+ // } else {
621
+ // if (column.Field === 'SNo') {
622
+ // labor[column.Field] = SNo;
623
+ // SNo = SNo + 1;
624
+ // } else {
625
+ // labor[column.Field] = '';
626
+ // }
627
+ // dataRow.push({ text: labor[column.Field].toString(), alignment: 'center' });
628
+ // }
629
+ // });
630
+ // body.push(dataRow);
631
+ // });
632
+ return body;
633
+ }
634
+
635
+ static getSummaryHeaders(permission: boolean) {
636
+ let headersNames: any = [{ text: 'Description', style: 'tableheader', Field: 'Desc' },
637
+ // { text: 'HSN / SAC', style: 'tableheader', Field: 'SAC' },
638
+ // { text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
639
+ // { text: 'Rate / Unit', style: 'tableheader', Field: 'Pr' },
640
+ { text: 'Ins. Amt', style: 'tableheader', Field: 'AssPr' },
641
+ { text: 'Cust. Amt', style: 'tableheader', Field: 'Pr' },
642
+ { text: 'Disc.(Rs)', style: 'tableheader', Field: 'DiscountedPrice' },
643
+ { text: 'Tax %', style: 'tableheader', Field: 'TaxAmount' },
644
+ { text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }];
645
+ if (permission) {
646
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
647
+ let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
648
+ headersNames.unshift(sno, MPN);
649
+ } else {
650
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
651
+ headersNames.unshift(sno);
652
+ }
653
+
654
+
655
+ return headersNames;
656
+ }
657
+
658
+ static CommonTotalDetails(ROPrintData: any, moreDiscDetails:boolean) {
659
+ let CommonDetails = [
660
+ SharedPDFService.GetDebitTotalDetails(ROPrintData,ROPrintData.CustLaborTotalBeforeDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST,
661
+ ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
662
+ ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
663
+ ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts,
664
+ ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For,
665
+ ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal,
666
+ ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn,
667
+ TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.CustLaborITax,
668
+ ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From,moreDiscDetails),
669
+
670
+ SharedPDFService.DebitDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts),
671
+ SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
672
+ SharedPDFService.GetUnderLine(),
673
+ SharedPDFService.GetSignatures(ROPrintData.Entity.CName, ROPrintData.Type, ROPrintData.For),
674
+ ];
675
+ if (ROPrintData.Type !== 'Invoice') {
676
+ CommonDetails.splice(2, 0, SharedPDFService.GetUnderLine());
677
+ }
678
+ return CommonDetails;
679
+ }
680
+
681
+ }