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