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