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,813 @@
1
+ import { Add } from "../../shared/math-operations";
2
+ import { SharedPDFService } from "../../shared/shared-pdf.service";
3
+ import { PrintSharedService } from "../../shared/shared-print.service";
4
+ import { MyDate } from "../../utils/my-date";
5
+ import { TrUtils } from "../../utils/tr-utils";
6
+
7
+
8
+ export class InvoiceLetterheadPdfService {
9
+ FontSize: number = 8;
10
+
11
+ static GetInvoiceLetterheadPrint(ROPrintData: any, numberofCopies: any, isotherIndustry: boolean, withPass: boolean, isAuto: boolean, LetterHead:any, moreDiscDetails:boolean) {
12
+ var contents = [];
13
+ if (TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
14
+ contents.push(
15
+ this.CommonHeaderDetails(ROPrintData, null, isotherIndustry),
16
+ this.PreparesparePartsTable(ROPrintData, isAuto),
17
+ this.CommonTotalDetails(ROPrintData, null, numberofCopies, withPass, isAuto, moreDiscDetails)
18
+ );
19
+ } else {
20
+ numberofCopies.forEach((text: any, index: any) => {
21
+ contents.push(
22
+ this.CommonHeaderDetails(ROPrintData, text, isotherIndustry),
23
+ this.PreparesparePartsTable(ROPrintData, isAuto),
24
+ this.CommonTotalDetails(ROPrintData, index, numberofCopies, withPass, isAuto, moreDiscDetails)
25
+ );
26
+ });
27
+ }
28
+ var dd = {
29
+ info: {
30
+ title: this.GetFileName(ROPrintData),
31
+ },
32
+ watermark: this.GetWatermark(ROPrintData, isAuto),
33
+ background: function (currentPage: any, pageSize: any) {
34
+ return SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
35
+ },
36
+ header: function (currentPage: any, pageCount: any) {
37
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
38
+ },
39
+ pageBreakBefore: function (currentNode:any, followingNodesOnPage:any, nodesOnNextPage:any, previousNodesOnPage:any) {
40
+ return currentNode.startPosition.top >= 700 && !TrUtils.IsNull(currentNode?.id) && currentNode?.id === '567';
41
+ },
42
+ pageMargins: [10, LetterHead.Top, 10, LetterHead.Bottom],
43
+ content: contents,
44
+ styles: SharedPDFService.GetStyles()
45
+ };
46
+ return dd;
47
+ }
48
+
49
+ static GetWatermark(ROPrintData: any, isAuto:any) {
50
+ if (isAuto && ROPrintData.IsProforma && ROPrintData.Entity.Wmark) {
51
+ return { text: 'Not a final invoice', opacity: 0.2 };
52
+ } else {
53
+ return '';
54
+ }
55
+ }
56
+
57
+ static GetFileName(ROPrintData: any) {
58
+ let fileName: string = ROPrintData.HeaderName;
59
+ if (!TrUtils.IsNull(ROPrintData.Product) && !TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
60
+ fileName = fileName + '-' + ROPrintData.Product.RegNo;
61
+ }
62
+ return fileName;
63
+ }
64
+
65
+ static CommonHeaderDetails(ROPrintData: any, text: any, isotherIndustry: boolean) {
66
+ return [
67
+ this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text),
68
+ SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
69
+ ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For,
70
+ ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp,
71
+ ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, ROPrintData.Settings, ROPrintData.Location, isotherIndustry, ROPrintData.BL, ROPrintData.ROCode, ROPrintData.TypeName, ROPrintData.AdmNo, ROPrintData.DoS),
72
+ SharedPDFService.GetOwnerDetails(ROPrintData.Cust, ROPrintData.Type, ROPrintData.For),
73
+ SharedPDFService.CustomerAndVehicleDetailsAfterLine(),
74
+ SharedPDFService.GetDisplayTable(),
75
+ ];
76
+ }
77
+
78
+ static GetMainHeaderDetails(Entity: any, HeaderName: any, Image: any, HColor: any, AColor: any, text: any) {
79
+ return [
80
+ // SharedPDFService.MainHeading(Entity.CName, Entity.Header, Image, HColor, text),
81
+ // SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text),
82
+ SharedPDFService.GetPrintType(HeaderName),
83
+ SharedPDFService.HeaderAfterLine()
84
+ ];
85
+ }
86
+
87
+ static PreparesparePartsTable(ROPrintData: any, isAuto: boolean) {
88
+ let List: any = [];
89
+ if (ROPrintData.Entity.Body === 1) {
90
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
91
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
92
+ ROPrintData.PrintInfo[i].Text = '';
93
+ }
94
+ List.push(ROPrintData.PrintInfo[i].Text,
95
+ this.GetLaborPartsTableForView(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.Entity.MPN)
96
+ );
97
+
98
+ }
99
+ } else {
100
+ if (ROPrintData.Entity.Body === 2) {
101
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
102
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
103
+ ROPrintData.PrintInfo[i].Text = '';
104
+ }
105
+ List.push(ROPrintData.PrintInfo[i].Text,
106
+ this.WithOutDiscountFieldTable(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops), ROPrintData.ShowTaxColumn,
107
+ ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn, isAuto, ROPrintData.Entity.DecimalsNumber)
108
+ );
109
+
110
+ }
111
+ } else {
112
+ if (ROPrintData.Summary) {
113
+ List.push('',
114
+ this.GetLaborPartsTableForView(ROPrintData.Items, ROPrintData.Ops, ROPrintData.Entity.MPN)
115
+ );
116
+ } else {
117
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
118
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
119
+ ROPrintData.PrintInfo[i].Text = '';
120
+ }
121
+ List.push(ROPrintData.PrintInfo[i].Text,
122
+ this.GetWithOutDiscAndTaxFieldHeader(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), TrUtils.Stringify(ROPrintData.PrintInfo[i].Ops),
123
+ ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn, isAuto, ROPrintData.Entity.DecimalsNumber)
124
+ );
125
+
126
+ }
127
+ }
128
+ }
129
+ }
130
+ return List;
131
+ }
132
+
133
+ static GetLaborPartsTableForView(Parts: any, Ops: any, PrintPartNo: any) {
134
+ if (Parts.length !== 0 || Ops.length !== 0) {
135
+ if (PrintPartNo) {
136
+ return {
137
+ style: 'tableExample',
138
+ // marginLeft: 20,
139
+ table: {
140
+ widths: [25, 30, 170, 85, 15, 20, 50, 30, 30, 50],
141
+ // headerRows: 2,
142
+ body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false)
143
+ },
144
+ layout: PrintSharedService.LayOutStyleanother()
145
+ };
146
+ } else {
147
+ return {
148
+ style: 'tableExample',
149
+ // marginLeft: 20,
150
+ table: {
151
+ widths: [25, 200, 55, 25, 55, 55, 40, 15, 50],
152
+ // headerRows: 2,
153
+ body: this.buildTableForCustomerLabor(Parts, Ops, PrintPartNo, false)
154
+ },
155
+ layout: PrintSharedService.LayOutStyleanother()
156
+ };
157
+ }
158
+ } else {
159
+ let a: any = '';
160
+ return a;
161
+ }
162
+ }
163
+
164
+ static WithOutDiscountFieldTable(Parts: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
165
+ if (Parts.length !== 0 || Ops.length !== 0) {
166
+ if (PrintPartNo) {
167
+ return {
168
+ style: 'tableExample',
169
+ marginLeft: 20,
170
+ table: {
171
+ widths: [25, 60, 155, 30, 50, 60, 30, 50],
172
+ headerRows: 1,
173
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
174
+ },
175
+ layout: PrintSharedService.LayOutStyleanother()
176
+ };
177
+ } else {
178
+ return {
179
+ style: 'tableExample',
180
+ marginLeft: 20,
181
+ table: {
182
+ widths: [25, 215, 25, 50, 60, 45, 50],
183
+ headerRows: 1,
184
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
185
+ },
186
+ layout: PrintSharedService.LayOutStyleanother()
187
+ };
188
+ }
189
+ } else {
190
+ let a: any = '';
191
+ return a;
192
+ }
193
+ }
194
+
195
+ static BuildTableBodyForLaborAndParts(Parts: any, Labor: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
196
+ var body: any = [];
197
+ let columns: any = PrintSharedService.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
198
+ // if (ShowTaxColumn) {
199
+ for (let i = 0; i < columns.length; i++) {
200
+ body.push(columns[i]);
201
+ }
202
+ columns = columns[1];
203
+ // } else {
204
+ // body.push(columns);
205
+ // }
206
+
207
+
208
+ let DummyOps: any = [];
209
+
210
+ if (Parts.length !== 0) {
211
+ // console.log('Parts', Parts);
212
+ if (isAuto) {
213
+ let Qty: number = 0;
214
+ let CGSTAMT: number = 0;
215
+ let SGSTAMT: number = 0;
216
+ let IGSTAMT: number = 0;
217
+ let Taxable: number = 0;
218
+ let FinalTotal: number = 0;
219
+ Parts.forEach((part: any) => {
220
+ // console.log('part', part);
221
+ Qty = Add(Qty, TrUtils.FixedTo(part.Qty, DecimalsNumber));
222
+ CGSTAMT = Add(CGSTAMT, TrUtils.FixedTo(part.CGSTAmt, DecimalsNumber));
223
+ SGSTAMT = Add(SGSTAMT, TrUtils.FixedTo(part.SGSTAmt, DecimalsNumber));
224
+ IGSTAMT = Add(IGSTAMT, TrUtils.FixedTo(part.IGSTAmt, DecimalsNumber));
225
+ Taxable = Add(Taxable, TrUtils.FixedTo(part.AfterPartDisc, DecimalsNumber));
226
+ FinalTotal = Add(FinalTotal, TrUtils.FixedTo(part.AfterPartTax, DecimalsNumber));
227
+ });
228
+ let dpartadding1: any = {};
229
+ dpartadding1.SNo = '';
230
+ dpartadding1.Desc = 'Spare Total';
231
+ dpartadding1.QtyAndUoM = TrUtils.FixedTo(Qty, DecimalsNumber);
232
+ dpartadding1.bold = true;
233
+ dpartadding1.UnPr = TrUtils.FixedTo(Taxable, DecimalsNumber);
234
+ dpartadding1.SGSTAmt = TrUtils.FixedTo(SGSTAMT, DecimalsNumber);
235
+ dpartadding1.IGSTAmt = TrUtils.FixedTo(IGSTAMT, DecimalsNumber);
236
+ dpartadding1.CGSTAmt = TrUtils.FixedTo(CGSTAMT, DecimalsNumber);
237
+ dpartadding1.TCode = ShowTaxColumn ? 114 : undefined;
238
+ dpartadding1.LineTotal = TrUtils.FixPriceValue(FinalTotal, DecimalsNumber);
239
+ Parts.push({ SNo: '' });
240
+ Parts.push(dpartadding1);
241
+ }
242
+
243
+
244
+ let dummypartadding1: any = {};
245
+ dummypartadding1.SNo = '';
246
+ dummypartadding1.Desc = 'Spare Parts';
247
+ dummypartadding1.Qty = '';
248
+ dummypartadding1.UnPr = '';
249
+ dummypartadding1.LineTotal = '';
250
+ Parts.unshift(dummypartadding1);
251
+ }
252
+
253
+ let SNo: number = 1;
254
+ Parts.forEach((part: any) => {
255
+ var dataRow: any = [];
256
+ columns.forEach((column: any) => {
257
+ if (
258
+ (!TrUtils.IsFixedZero(part[column.Field]) && !TrUtils.IsNull(part[column.Field]))
259
+ || (column.text === 'Line Total')) {
260
+ if (part[column.Field] === 'Spare Parts') {
261
+ dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
262
+ } else {
263
+ if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
264
+ && TrUtils.CheckInvalidSelect(part.TCode))) {
265
+ part[column.Field] = '';
266
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
267
+ } else {
268
+ if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'QtyAndUoM'
269
+ || column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
270
+ || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
271
+ if (column.Field === 'Disc') {
272
+ if (column.type === 'percentage') {
273
+ if (!TrUtils.IsEmpty(part[column.Field])) {
274
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
275
+ } else {
276
+ dataRow.push({ text: '', noWrap: true });
277
+ }
278
+ } else {
279
+ if (!TrUtils.IsNull(part[column.Field])) {
280
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
281
+ } else {
282
+ dataRow.push({ text: '', noWrap: true });
283
+ }
284
+ }
285
+ } else {
286
+ if (!TrUtils.IsNull(part[column.Field])) {
287
+ dataRow.push({ text: part[column.Field].toString(), bold: part.bold, alignment: 'right', nowrap: true });
288
+ } else {
289
+ dataRow.push({ text: '', noWrap: true });
290
+ }
291
+ }
292
+ } else {
293
+ // dataRow.push(part[column.Field].toString());
294
+ if (column.Field === 'Desc') {
295
+ let DescData: any = [];
296
+ DescData.push({ text: part[column.Field].toString(), bold: part.bold });
297
+ if (!TrUtils.IsEmpty(part['EDesc'])) {
298
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
299
+ }
300
+ dataRow.push({ stack: DescData });
301
+ } else {
302
+ dataRow.push({ text: part[column.Field].toString() });
303
+ }
304
+ }
305
+ }
306
+ }
307
+ } else {
308
+ if (column.Field === 'SNo') {
309
+ part[column.Field] = SNo;
310
+ SNo = SNo + 1;
311
+ } else {
312
+ if (TrUtils.IsNull(part[column.Field])) {
313
+ part[column.Field] = '';
314
+ }
315
+ }
316
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
317
+ }
318
+ });
319
+
320
+ body.push(dataRow);
321
+ });
322
+ SNo = 1;
323
+ if (Labor.length !== 0) {
324
+ // let Qty: number = 0;
325
+ if (isAuto) {
326
+ let CGSTAMT: number = 0;
327
+ let SGSTAMT: number = 0;
328
+ let IGSTAMT: number = 0;
329
+ let Taxable: number = 0;
330
+ let FinalTotal: number = 0;
331
+ Labor.forEach((operation: any) => {
332
+ // console.log('operation', operation);
333
+ // Qty = Qty + operation.Qty;
334
+ CGSTAMT = Add(CGSTAMT, TrUtils.FixedTo(operation.CGSTAmt, DecimalsNumber));
335
+ SGSTAMT = Add(SGSTAMT, TrUtils.FixedTo(operation.SGSTAmt, DecimalsNumber));
336
+ IGSTAMT = Add(IGSTAMT, TrUtils.FixedTo(operation.IGSTAmt, DecimalsNumber));
337
+ Taxable = Add(Taxable, TrUtils.FixedTo(operation.AfterLaborDisc, DecimalsNumber));
338
+ FinalTotal = Add(FinalTotal, TrUtils.FixedTo(operation.AfterLaborTax, DecimalsNumber));
339
+ });
340
+ let dpartadding1: any = {};
341
+ dpartadding1.SNo = '';
342
+ dpartadding1.Desc = 'Labor Total';
343
+ // dpartadding1.QtyAndUoM = Qty;
344
+ dpartadding1.UnPr = TrUtils.FixedTo(Taxable, DecimalsNumber);
345
+ dpartadding1.SGSTAmt = TrUtils.FixedTo(SGSTAMT, DecimalsNumber);
346
+ dpartadding1.IGSTAmt = TrUtils.FixedTo(IGSTAMT, DecimalsNumber);
347
+ dpartadding1.CGSTAmt = TrUtils.FixedTo(CGSTAMT, DecimalsNumber);
348
+ dpartadding1.TCode = ShowTaxColumn ? 114 : undefined;
349
+ dpartadding1.bold = true;
350
+ dpartadding1.LineTotal = TrUtils.FixPriceValue(FinalTotal, DecimalsNumber);
351
+ Labor.push({ SNo: '' });
352
+ Labor.push(dpartadding1);
353
+ }
354
+ let dummypartadding1: any = {};
355
+ dummypartadding1.SNo = '';
356
+ dummypartadding1.Desc = 'Labor';
357
+ dummypartadding1.Qty = '';
358
+ dummypartadding1.UnPr = '';
359
+ dummypartadding1.LineTotal = '';
360
+ Labor.unshift(dummypartadding1);
361
+ // DummyOps.unshift(dummypartadding1);
362
+ }
363
+ if (Body === 2) {
364
+ for (let i = 0; i < Labor.length; i++) {
365
+ Labor[i].UnPr = '';
366
+ }
367
+ }
368
+
369
+ Labor.forEach((Ops: any) => {
370
+ var dataRow: any = [];
371
+ columns.forEach((column: any) => {
372
+ if ((!TrUtils.IsFixedZero(Ops[column.Field]) && !TrUtils.IsNull(Ops[column.Field]))
373
+ || (column.text === 'Line Total')) {
374
+ if (Ops[column.Field] === 'Labor') {
375
+ dataRow.push({ text: Ops[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
376
+ } else {
377
+ if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
378
+ && TrUtils.CheckInvalidSelect(Ops.TCode))) {
379
+ Ops[column.Field] = '';
380
+ dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
381
+ } else {
382
+ if (column.text === 'Line Total' || column.Field === 'Price' || column.text === 'Tax' || column.Field === 'UnPr'
383
+ || column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'Perc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
384
+ || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
385
+ if (column.Field === 'Disc') {
386
+ if (column.type === 'percentage') {
387
+ if (!TrUtils.IsEmpty(Ops[column.Field])) {
388
+ dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
389
+ } else {
390
+ dataRow.push({ text: '', noWrap: true });
391
+ }
392
+ } else {
393
+ if (!TrUtils.IsNull(Ops[column.Field])) {
394
+ dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
395
+ } else {
396
+ dataRow.push({ text: '', noWrap: true });
397
+ }
398
+ }
399
+ } else {
400
+ if (!TrUtils.IsNull(Ops[column.Field])) {
401
+ dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', nowrap: true, bold: Ops.bold });
402
+ } else {
403
+ dataRow.push({ text: '', noWrap: true });
404
+ }
405
+ }
406
+
407
+ } else {
408
+ dataRow.push({ text: Ops[column.Field].toString(), bold: Ops.bold });
409
+ }
410
+ }
411
+ }
412
+ } else {
413
+ if (column.Field === 'SNo') {
414
+ Ops[column.Field] = SNo;
415
+ SNo = SNo + 1;
416
+ } else {
417
+ if (TrUtils.IsNull(Ops[column.Field])) {
418
+ Ops[column.Field] = '';
419
+ }
420
+
421
+ }
422
+ dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
423
+ }
424
+ });
425
+ body.push(dataRow);
426
+ });
427
+ return body;
428
+ }
429
+
430
+ static GetWithOutDiscAndTaxFieldHeader(Parts: any, Ops: any, ShowTaxColumn: any, PrintPartNo: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
431
+ if (Parts.length !== 0 || Ops.length !== 0) {
432
+ if (ShowTaxColumn) {
433
+ return this.TaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber);
434
+ } else {
435
+ if (ConsolidateGST) {
436
+ return this.ConsolidateDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber);
437
+ } else {
438
+ return this.NoTaxDataTable(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber);
439
+ }
440
+ }
441
+ } else {
442
+ let a: any = '';
443
+ return a;
444
+ }
445
+ }
446
+
447
+ static TaxDataTable(Parts: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
448
+ if (PrintPartNo) {
449
+ if (ShowIGST) {
450
+ return {
451
+ style: 'tableExample',
452
+ table: {
453
+ widths: PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
454
+ // headerRows: 2,
455
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
456
+ },
457
+ layout: PrintSharedService.LayOutStyle()
458
+ };
459
+ } else {
460
+ return {
461
+ style: 'tableExample',
462
+ table: {
463
+ widths: PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
464
+ // headerRows: 2,
465
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
466
+ },
467
+ layout: PrintSharedService.LayOutStyle()
468
+ };
469
+ }
470
+
471
+ } else {
472
+ if (ShowIGST) {
473
+ return {
474
+ style: 'tableExample',
475
+ table: {
476
+ widths: PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
477
+ // headerRows: 2,
478
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
479
+ },
480
+ layout: PrintSharedService.LayOutStyle()
481
+ };
482
+ } else {
483
+ return {
484
+ style: 'tableExample',
485
+ table: {
486
+ widths: PrintSharedService.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
487
+ // headerRows: 2,
488
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
489
+ },
490
+ layout: PrintSharedService.LayOutStyle()
491
+ };
492
+ }
493
+
494
+ }
495
+ }
496
+
497
+ static ConsolidateDataTable(Parts: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
498
+ if (PrintPartNo) {
499
+ return {
500
+ style: 'tableExample',
501
+ table: {
502
+ widths: [25, 70, 263, 25, 60, 80, 10, 40],
503
+ // headerRows: 1,
504
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
505
+ },
506
+ layout: PrintSharedService.LayOutStyle()
507
+ };
508
+ } else {
509
+ return {
510
+ style: 'tableExample',
511
+ table: {
512
+ widths: [25, 295, 50, 80, 80, 10, 40],
513
+ // headerRows: 1,
514
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
515
+ },
516
+ layout: PrintSharedService.LayOutStyle()
517
+ };
518
+ }
519
+ }
520
+
521
+ static NoTaxDataTable(Parts: any, Ops: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any, isAuto: boolean, DecimalsNumber: number) {
522
+ if (PrintPartNo) {
523
+ return {
524
+ style: 'tableExample',
525
+ table: {
526
+ widths: PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
527
+ // headerRows: 1,
528
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
529
+ },
530
+ layout: PrintSharedService.LayOutStyle()
531
+ };
532
+ } else {
533
+ return {
534
+ style: 'tableExample',
535
+ table: {
536
+ widths: PrintSharedService.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
537
+ // headerRows: 1,
538
+ body: this.BuildTableBodyForLaborAndParts(Parts, Ops, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn, isAuto, DecimalsNumber)
539
+ },
540
+ layout: PrintSharedService.LayOutStyle()
541
+ };
542
+ }
543
+ }
544
+
545
+ static buildTableForCustomerLabor(Parts: any, Ops: any, PrintPartNo: any, customerorInsurance: any) {
546
+ var body: any = [];
547
+ let columns: any;
548
+ columns = this.getSummaryHeaders(PrintPartNo);
549
+ body.push(columns);
550
+ if (Parts.length !== 0) {
551
+ let dummypartadding1: any = {};
552
+ dummypartadding1.SNo = '';
553
+ dummypartadding1.Desc = 'Spare Parts';
554
+ dummypartadding1.Qty = '';
555
+ dummypartadding1.UnPr = '';
556
+ dummypartadding1.Price = '';
557
+ dummypartadding1.DiscountedPrice = '';
558
+ dummypartadding1.LineTotal = '';
559
+ dummypartadding1.QtyAndUoM = '';
560
+ dummypartadding1.HSN = '';
561
+ dummypartadding1.MPN = '';
562
+ Parts.unshift(dummypartadding1);
563
+ }
564
+
565
+ let SNo: number = 1;
566
+ Parts.forEach((part: any) => {
567
+ var dataRow: any = [];
568
+ columns.forEach((column: any) => {
569
+ if (!TrUtils.IsFixedZero(part[column.Field]) && !TrUtils.IsNull(part[column.Field])
570
+ || column.text === 'Line Total') {
571
+ if (part[column.Field] === 'Spare Parts') {
572
+ dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
573
+ } else {
574
+ // tslint:disable-next-line:max-line-length
575
+ if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'CustPrice' || column.Field === 'InsPrice' ||
576
+ column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount' || column.Field === 'UnPr') {
577
+ if (column.Field === 'Disc Amt') {
578
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', noWrap: true });
579
+
580
+ } else {
581
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
582
+ }
583
+
584
+ } else {
585
+ if (column.Field === 'Desc') {
586
+ let DescData: any = [];
587
+ DescData.push(part[column.Field].toString());
588
+ if (!TrUtils.IsEmpty(part['EDesc'])) {
589
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
590
+ }
591
+ dataRow.push({ stack: DescData });
592
+ } else {
593
+ dataRow.push({ text: part[column.Field].toString() });
594
+ }
595
+ }
596
+ }
597
+ } else {
598
+ if (column.Field === 'SNo') {
599
+ part[column.Field] = SNo;
600
+ SNo = SNo + 1;
601
+ } else {
602
+ if (TrUtils.IsNull(part[column.Field])) {
603
+ part[column.Field] = '';
604
+ }
605
+ }
606
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
607
+ }
608
+ });
609
+
610
+ body.push(dataRow);
611
+ });
612
+ SNo = 1;
613
+ if (Ops.length !== 0) {
614
+ let dummypartadding1: any = {};
615
+ dummypartadding1.SNo = '';
616
+ dummypartadding1.Desc = 'Labor';
617
+ dummypartadding1.Qty = '';
618
+ dummypartadding1.UnPr = '';
619
+ dummypartadding1.Price = '';
620
+ dummypartadding1.DiscountedPrice = '';
621
+ dummypartadding1.LineTotal = '';
622
+ dummypartadding1.QtyAndUoM = '';
623
+ dummypartadding1.HSN = '';
624
+ Ops.unshift(dummypartadding1);
625
+ }
626
+
627
+ Ops.forEach((labor: any) => {
628
+ var dataRow: any = [];
629
+ columns.forEach((column: any) => {
630
+ if (!TrUtils.IsFixedZero(labor[column.Field]) && !TrUtils.IsNull(labor[column.Field])
631
+ || column.text === 'Line Total') {
632
+ if (labor[column.Field] === 'Labor') {
633
+ dataRow.push({ text: labor[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
634
+ } else {
635
+ if (column.text === 'Line Total' || column.Field === 'QtyAndUoM' || column.Field === 'DiscountedPrice' || column.Field === 'TaxAmount'
636
+ || column.Field === 'UnPr' || column.Field === 'CustPrice' || column.Field === 'InsPrice') {
637
+ if (column.Field === 'Disc Amt') {
638
+ dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', noWrap: true });
639
+ } else {
640
+ dataRow.push({ text: labor[column.Field].toString(), alignment: 'right', nowrap: true });
641
+ }
642
+
643
+ } else {
644
+ dataRow.push({ text: labor[column.Field].toString() });
645
+ }
646
+ }
647
+ } else {
648
+ if (column.Field === 'SNo') {
649
+ labor[column.Field] = SNo;
650
+ SNo = SNo + 1;
651
+ } else {
652
+ if (TrUtils.IsNull(labor[column.Field])) {
653
+ labor[column.Field] = '';
654
+ }
655
+ }
656
+ dataRow.push({ text: labor[column.Field].toString(), alignment: 'center' });
657
+ }
658
+ });
659
+ body.push(dataRow);
660
+ });
661
+ return body;
662
+ }
663
+
664
+ static getSummaryHeaders(permission: boolean) {
665
+ let headersNames: any = [{ text: 'Description', style: 'tableheader', Field: 'Desc' },
666
+ { text: 'HSN / SAC', style: 'tableheader', Field: 'SAC' },
667
+ { text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
668
+ // { text: 'Rate / Unit', style: 'tableheader', Field: 'UnPr' },
669
+ { text: 'Ins. Amt', style: 'tableheader', Field: 'AssPr' },
670
+ { text: 'Cust. Amt', style: 'tableheader', Field: 'Pr' },
671
+ { text: 'Disc.(Rs)', style: 'tableheader', Field: 'DiscountedPrice' },
672
+ { text: 'Tax %', style: 'tableheader', Field: 'TaxAmount' },
673
+ { text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }];
674
+ if (permission) {
675
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
676
+ let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
677
+ headersNames.unshift(sno, MPN);
678
+ } else {
679
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
680
+ headersNames.unshift(sno);
681
+ }
682
+
683
+
684
+ return headersNames;
685
+ }
686
+
687
+ static CommonTotalDetails(ROPrintData: any, index: any, numberofCopies: any, withPass: boolean, isAuto:boolean, moreDiscDetails:boolean) {
688
+ // console.log('ROPrintData', ROPrintData);
689
+ let CommonDetails = [
690
+ // SharedPDFService.GetFinalTotalDetails(ROPrintData.CustLaborTotalAfterDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST,
691
+ // ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
692
+ // ROPrintData.CustPartsTotalAfterDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
693
+ // ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts,
694
+ // ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For,
695
+ // ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal,
696
+ // ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn,
697
+ // TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.CustLaborITax,
698
+ // ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, ROPrintData.Adj,ROPrintData.STotal),
699
+ SharedPDFService.GetFinalTotalDetails1(ROPrintData,ROPrintData.CustLaborTotalAfterDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST,
700
+ ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
701
+ ROPrintData.CustPartsTotalAfterDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
702
+ ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupDataByPerc, ROPrintData.ShowAccParts,
703
+ ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For,
704
+ ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal,
705
+ ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn,
706
+ TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.CustLaborITax,
707
+ ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, ROPrintData.Adj, ROPrintData.CustLaborTaxGroupDataByPerc, ROPrintData.STotal, isAuto, moreDiscDetails),
708
+
709
+ this.GetNumberInWords(ROPrintData.CustRoundedTotal),
710
+ SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, ROPrintData.isCountersale, ROPrintData.Entity.DecimalsNumber),
711
+ SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
712
+ this.GetBanckdetailswithQRCode(ROPrintData),
713
+ SharedPDFService.GetUnderLine(),
714
+ SharedPDFService.GetInvSignatures(ROPrintData.Entity.CName, ROPrintData.isCountersale),
715
+ // this.PageBrake(ROPrintData, withPass),
716
+ SharedPDFService.GetUnderLine1(withPass),
717
+ this.GetGatePass(withPass, ROPrintData)
718
+ ];
719
+ if (ROPrintData.Type !== 'Invoice') {
720
+ CommonDetails.splice(2, 0, SharedPDFService.GetUnderLine());
721
+ }
722
+ if (!TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
723
+ CommonDetails.push({ text: '', pageBreak: 'after' })
724
+ }
725
+ return CommonDetails;
726
+ }
727
+
728
+ static GetBanckdetailswithQRCode(ROPrintData:any){
729
+ return { columns: [ SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
730
+ SharedPDFService.GetEntityDetails(ROPrintData.Entity)] }
731
+
732
+ }
733
+
734
+ static GetNumberInWords(TotalAmount:any) {
735
+ var rupee = SharedPDFService.convertNumberToWords(TotalAmount);
736
+ // console.log('rupee', rupee);
737
+ return { columns: [{ text: 'In Words :', fontSize: 9, width: 45 }, { text: rupee, bold: true, fontSize: 9, width: '*' }] }
738
+ }
739
+
740
+ static GetGatePass(isGatepass: boolean, ROPrintData: any) {
741
+ // console.log('ROPrintData', ROPrintData);
742
+ if (isGatepass) {
743
+ return {
744
+ columns: [{
745
+ id: '567',
746
+ text: [{ text: '', id: '1234' }],
747
+ stack: [
748
+ {
749
+ columns: [{ text: '' }, { text: 'Gate Pass', bold: true, fontSize: 9, alignment: 'center', marginTop: 5 },
750
+ { text: 'Date: ' + MyDate.ConvertUTCDateToReadable(MyDate.GetDateTimeNowInUTC(ROPrintData.Entity.User.TZ)), marginTop: 5, fontSize: 9, alignment: 'right' }]
751
+ },
752
+ { text: ROPrintData.Entity.CName, alignment: 'center', bold: true, fontSize: 12, marginTop: 5, marginBottom: 5 },
753
+ {
754
+ marginTop: 5,
755
+ columns: [
756
+ // {
757
+ // stack: [{ text: 'Customer Name :' + ROPrintData.Customer.Name, fontSize: 9 }, { text: 'Service Advisor :', fontSize: 9, marginBottom: 10 },
758
+ // { text: 'Vehicle has been received from workshop and work done as per my satisfaction.', fontSize: 6 }]
759
+ // }
760
+ { text: '', width: 60 },
761
+ this.GetCustomerDetails(ROPrintData, false)
762
+ ,
763
+ this.GetVehicleDetails(ROPrintData.Product, false)
764
+ // {
765
+ // stack: [{ text: 'Chassis No :' + ROPrintData.Product.VIN, fontSize: 9 },
766
+ // { text: 'Vehicle No :' + ROPrintData.Product.RegNo, fontSize: 9 }, { text: 'Vehicle Model :' + ROPrintData.Product.Model, fontSize: 9 }, { text: 'Repair Order No :', fontSize: 9 }]
767
+ // }
768
+ ]
769
+ },
770
+ { text: 'Vehicle has been received from workshop and work done as per my satisfaction.', fontSize: 7, marginTop: 10, marginLeft: 60 },
771
+ { columns: [SharedPDFService.CustomerSignature(), { text: '' }, SharedPDFService.Accountantsignature()] }
772
+ ]
773
+ }],
774
+ };
775
+
776
+
777
+ } else {
778
+ return SharedPDFService.emptyObject();
779
+ }
780
+ }
781
+
782
+ static GetCustomerDetails(ROPrintData: any, isOtherIndustry: boolean) {
783
+ let CustomerData = [
784
+ { name: 'Customer Name', value: ROPrintData.Customer.Name },
785
+ { name: 'Service Advisor', value: ROPrintData.Name },
786
+ ];
787
+ return SharedPDFService.GetVehicleDataTable(CustomerData);
788
+ }
789
+
790
+ static GetVehicleDetails(Vehicle: any, isOtherIndustry: boolean) {
791
+ let vehicleData: any;
792
+ vehicleData = [
793
+ ];
794
+ if (isOtherIndustry) {
795
+ vehicleData.push({ name: 'Serial No', value: SharedPDFService.CheckAndSetString(Vehicle.SNo) });
796
+ }
797
+ let a: any = [
798
+ { name: 'Vehicle Model', value: SharedPDFService.CheckAndSetString(Vehicle.Model) },
799
+ ];
800
+ if (!isOtherIndustry) {
801
+ a.unshift({ name: 'Regn. No', value: SharedPDFService.CheckAndSetString(Vehicle.RegNo) });
802
+ if (!TrUtils.IsEmpty(Vehicle.VIN)) {
803
+ a.unshift({ name: 'Chassis No', value: SharedPDFService.CheckAndSetString(Vehicle.VIN) });
804
+ }
805
+ }
806
+ for (let i = 0; i < a.length; i++) {
807
+ vehicleData.push(a[i]);
808
+ }
809
+
810
+ return SharedPDFService.GetVehicleDataTable(vehicleData);
811
+ }
812
+
813
+ }