shareneus 1.7.3 → 1.7.5

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 (213) 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/shared/totals-section/pdf-totals.section.js +1 -1
  44. package/dist/{accounting/invoice/invoice-pdf.service.js → shared/transactions-pdf.service.js} +14 -14
  45. package/package.json +1 -1
  46. package/src/accounting/counter-sales/auto-sales-receipt-pdf.service.ts +569 -0
  47. package/src/accounting/counter-sales/pos-receipt-pdf.ts +577 -0
  48. package/src/accounting/counter-sales/sales-receipt-pdf.service.ts +628 -0
  49. package/src/accounting/counter-sales/sales-receipt-print.service.ts +506 -0
  50. package/src/accounting/credit-note/cn-print.service.ts +264 -0
  51. package/src/accounting/credit-note/credit-note-pdf.service.ts +602 -0
  52. package/src/accounting/credit-note/credit-note-totals.service.ts +424 -0
  53. package/src/accounting/debit-note/debit-note-pdf.service.ts +681 -0
  54. package/src/accounting/debit-note/debit-note-print.service.ts +276 -0
  55. package/src/accounting/debit-note/debit-note-totals.service.ts +361 -0
  56. package/src/accounting/invoice/hc-inv-pdf.service.ts +880 -0
  57. package/src/accounting/invoice/inv-pdf.service.ts +812 -0
  58. package/src/accounting/invoice/inv-print.service.ts +532 -0
  59. package/src/accounting/invoice/invoice-landscape-pdf.service.ts +947 -0
  60. package/src/accounting/invoice/invoice-letterhead-pdf.service.ts +813 -0
  61. package/src/accounting/invoice/invoice-pdf/invoice-pdf.service.ts +359 -0
  62. package/src/accounting/invoice/invoice-portrait-pdf.ts +972 -0
  63. package/src/accounting/invoice/invoice-print.service.ts +2906 -0
  64. package/src/accounting/invoice/invoice-total.service.ts +834 -0
  65. package/src/accounting/invoice/reports/excel/analysis-excel.service.ts +291 -0
  66. package/src/accounting/invoice/reports/excel/category-wise-item-excel.service.ts +267 -0
  67. package/src/accounting/invoice/reports/excel/cust-wise-sales-details.ts +321 -0
  68. package/src/accounting/invoice/reports/excel/cust-wise-sales-summary-excel.service.ts +300 -0
  69. package/src/accounting/invoice/reports/excel/invoice-wise-excel.service.ts +859 -0
  70. package/src/accounting/invoice/reports/excel/item-wise-doctor-sale-excel.service.ts +255 -0
  71. package/src/accounting/invoice/reports/excel/items-wise-sales-excel.service.ts +312 -0
  72. package/src/accounting/invoice/reports/excel/manf-wise-sales-excel.service.ts +273 -0
  73. package/src/accounting/invoice/reports/excel/operator-wise-details.ts +258 -0
  74. package/src/accounting/invoice/reports/excel/operator-wise-summary.ts +259 -0
  75. package/src/accounting/invoice/reports/excel/sa-wise-labor-sales-excel.service.ts +230 -0
  76. package/src/accounting/invoice/reports/excel/sa-wise-part-sales-excel.service.ts +231 -0
  77. package/src/accounting/invoice/reports/excel/sale-summary-excel.service.ts +326 -0
  78. package/src/accounting/invoice/reports/excel/sales-by-service-details-excel.service.ts +0 -0
  79. package/src/accounting/invoice/reports/excel/sales-by-service-summary-excel.service.ts +432 -0
  80. package/src/accounting/invoice/reports/excel/scheduled-drug-summary-excel.service.ts +373 -0
  81. package/src/accounting/invoice/reports/excel/scheduled-drugs-excel.service.ts +372 -0
  82. package/src/accounting/invoice/reports/pdf/analysis-pdf.service.ts +113 -0
  83. package/src/accounting/invoice/reports/pdf/category-wise-item-pdf.service.ts +107 -0
  84. package/src/accounting/invoice/reports/pdf/cust-wise-sales-details-pdf.service.ts +125 -0
  85. package/src/accounting/invoice/reports/pdf/cust-wise-sales-summary-pdf.service.ts +119 -0
  86. package/src/accounting/invoice/reports/pdf/item-wise-doctor-sale-pdf.service.ts +180 -0
  87. package/src/accounting/invoice/reports/pdf/item-wise-sales-pdf.service.ts +193 -0
  88. package/src/accounting/invoice/reports/pdf/manf-wise-sales-pdf.service.ts +188 -0
  89. package/src/accounting/invoice/reports/pdf/operator-wise-details-pdf.service.ts +118 -0
  90. package/src/accounting/invoice/reports/pdf/operator-wise-summary-pdf.ts +116 -0
  91. package/src/accounting/invoice/reports/pdf/sales-by-service-pdf.service.ts +132 -0
  92. package/src/accounting/invoice/reports/pdf/scheduled-drug-pdf.service.ts +191 -0
  93. package/src/accounting/invoice/reports/pdf/scheduled-drug-summary-pdf.service.ts +202 -0
  94. package/src/accounting/invoice/shared-inv-pdf.service.ts +787 -0
  95. package/src/accounting/invoice/unified-invoice-pdf.service.ts +937 -0
  96. package/src/accounting/payment-receive/payment-pdf.service.ts +410 -0
  97. package/src/accounting/payment-receive/payment-receipt-pdf/receipt-pdf.service.ts +470 -0
  98. package/src/accounting/payment-receive/receipt-print.service.ts +71 -0
  99. package/src/accounting/payment-receive/reports/excel/cust-balance-excel.service.ts +298 -0
  100. package/src/accounting/payment-receive/reports/excel/payment-receive-excel.service.ts +221 -0
  101. package/src/accounting/payment-receive/reports/pdf/customer-balances-pdf.service.ts +182 -0
  102. package/src/accounting/payment-receive/reports/pdf/payment-report-pdf.service.ts +116 -0
  103. package/src/aggregation/aggregation.ts +58 -0
  104. package/src/appointments/appointments/appointment-total.service.ts +298 -0
  105. package/src/appointments/consultations/consultation-fee-receipt.service.ts +407 -0
  106. package/src/appointments/consultations/consultation-full-pdf.service.ts +238 -0
  107. package/src/appointments/consultations/consultation-letterhead-pdf.service.ts +430 -0
  108. package/src/appointments/consultations/consultation-pdf.service.ts +417 -0
  109. package/src/common/reports/excel/product-without-owner-excel.service.ts +308 -0
  110. package/src/common/reports/pdf/product-without-owner-pdf.service.ts +146 -0
  111. package/src/enums/cache-enums.ts +33 -0
  112. package/src/enums/code-enums.ts +291 -0
  113. package/src/enums/country-enums.ts +9 -0
  114. package/src/enums/enums.ts +364 -0
  115. package/src/enums/industry-enums.ts +26 -0
  116. package/src/enums/treatment-enums.ts +9 -0
  117. package/src/gst/excel/GSTR-RO-excel.service.ts +926 -0
  118. package/src/gst/excel/GSTR1-excel.service.ts +313 -0
  119. package/src/gst/excel/GSTR2-excel.service.ts +314 -0
  120. package/src/gst/excel/hsn-summary.ts +314 -0
  121. package/src/gst/excel/tally-sales-import.service.ts +767 -0
  122. package/src/gst/pdf/hsn-summary-pdf.ts +176 -0
  123. package/src/index.ts +194 -0
  124. package/src/inventory/items/adjustment-pdf.service.ts +177 -0
  125. package/src/inventory/items/issue-parts-pdf.service.ts +795 -0
  126. package/src/inventory/items/item-bar-code-label-pdf.ts +194 -0
  127. package/src/inventory/items/item-detais-pdf.ts +141 -0
  128. package/src/inventory/items/item-price-for-pricelist.ts +368 -0
  129. package/src/inventory/items/reports/excel/expiring-drugs-excel.service.ts +290 -0
  130. package/src/inventory/items/reports/excel/item-wise-mout-details.ts +284 -0
  131. package/src/inventory/items/reports/excel/item-wise-mout-summary.ts +279 -0
  132. package/src/inventory/items/reports/excel/spares-issue-excel.service.ts +494 -0
  133. package/src/inventory/items/reports/excel/stock-excel.service.ts +319 -0
  134. package/src/inventory/items/reports/pdf/expiring-drugs-pdf.service.ts +172 -0
  135. package/src/inventory/items/reports/pdf/item-wise-mout-details-pdf.ts +122 -0
  136. package/src/inventory/items/reports/pdf/item-wise-mout-summary-pdf.ts +115 -0
  137. package/src/inventory/items/reports/pdf/reorder-point-pdf.service.ts +163 -0
  138. package/src/inventory/material-out/mout-pdf.service.ts +545 -0
  139. package/src/inventory/transfer-order/transfer-order-pdf.service.ts +154 -0
  140. package/src/purchases/bills/bill-pdf/bill-pdf.service.ts +211 -0
  141. package/src/purchases/bills/bill-pdf.service.ts +21 -0
  142. package/src/purchases/payment-made/reports/excel/payments-made-excel.service.ts +313 -0
  143. package/src/purchases/payment-made/reports/excel/ven-balance-excel.service.ts +307 -0
  144. package/src/purchases/payment-made/reports/pdf/vendor-balances-pdf.service.ts +114 -0
  145. package/src/purchases/purchase-order/po-totals.service.ts +343 -0
  146. package/src/purchases/purchase-order/purchase-order-pdf.service.ts +1016 -0
  147. package/src/purchases/purchase-order/purchase-order-print.service.ts +279 -0
  148. package/src/purchases/purchase-order/purchase-order-totals.service.ts +637 -0
  149. package/src/purchases/vendor-credit-note/vendor-credit-note-pdf.service.ts +1055 -0
  150. package/src/purchases/vendor-credit-note/vendor-credit-note-print.service.ts +145 -0
  151. package/src/purchases/vendor-credit-note/vendor-credit-note-totals.service.ts +399 -0
  152. package/src/purchases/vendor-debit-note/vendor-debit-note-pdf.service.ts +582 -0
  153. package/src/purchases/vendor-debit-note/vendor-debit-note-print.service.ts +295 -0
  154. package/src/purchases/vendor-debit-note/vendor-debit-note-totals.service.ts +377 -0
  155. package/src/sales/delivery-challan/dc-landscape-pdf.service.ts +922 -0
  156. package/src/sales/delivery-challan/dc-landscape-without-price-pdf.service.ts +869 -0
  157. package/src/sales/delivery-challan/dc-without-price-pdf.service.ts +505 -0
  158. package/src/sales/delivery-challan/delivery-challan-pdf.service.ts +461 -0
  159. package/src/sales/delivery-challan/delivery-challan-print.service.ts +229 -0
  160. package/src/sales/delivery-challan/delivery-challan-totals.ts +466 -0
  161. package/src/sales/sales/equipment-design-pdf.service.ts +153 -0
  162. package/src/sales/sales/pack-ship-pdf.service.ts +128 -0
  163. package/src/sales/sales/pack-ship-print.service.ts +198 -0
  164. package/src/sales/sales/sales-pdf.service.ts +658 -0
  165. package/src/sales/sales/sales-print.service.ts +376 -0
  166. package/src/sales/sales/sales-totals.service.ts +500 -0
  167. package/src/sales-receive/sales-receive-pdf.service.ts +602 -0
  168. package/src/sales-receive/sales-receive-print.service.ts +242 -0
  169. package/src/sales-receive/sales-receive-totals.service.ts +651 -0
  170. package/src/services/checklist-pdf.ts +151 -0
  171. package/src/services/checklists-pdf.ts +133 -0
  172. package/src/services/est.print-service.ts +1155 -0
  173. package/src/services/reports/excel/insurance-expire-excel.service.ts +292 -0
  174. package/src/services/reports/excel/next-service-date-excel.service.ts +317 -0
  175. package/src/services/reports/excel/repair-orders-excel.service.ts +249 -0
  176. package/src/services/reports/pdf/insurance-expire-pdf.service.ts +115 -0
  177. package/src/services/reports/pdf/next-service-date-pdf.service.ts +198 -0
  178. package/src/services/reports/pdf/repair-orders-pdf.service.ts +184 -0
  179. package/src/services/ro-pdf.service.ts +1917 -0
  180. package/src/services/ro-print-service.ts +881 -0
  181. package/src/services/ro-totals.service.ts +1314 -0
  182. package/src/services/separate-wo-print.service.ts +396 -0
  183. package/src/services/service-history-pdf.service.ts +145 -0
  184. package/src/services/service-price-for-pricelist.ts +649 -0
  185. package/src/services/technician-pdf.service.ts +234 -0
  186. package/src/services/technician-print.service.ts +95 -0
  187. package/src/shared/header-footer-section/pdf-header-footer.section.ts +519 -0
  188. package/src/shared/header-footer-section/pdf-shared.utils.ts +46 -0
  189. package/src/shared/math-operations.ts +208 -0
  190. package/src/shared/party-details-section/pdf-party-details.section.ts +602 -0
  191. package/src/shared/shared-pdf.service.ts +3042 -0
  192. package/src/shared/shared-print.service.ts +879 -0
  193. package/src/shared/table-section/pdf-table.config.ts +8 -0
  194. package/src/shared/table-section/pdf-table.header.ts +396 -0
  195. package/src/shared/table-section/pdf-table.row.ts +248 -0
  196. package/src/shared/table-section/pdf-table.section.ts +447 -0
  197. package/src/shared/totals-section/pdf-totals.section.ts +921 -0
  198. package/src/shared/transactions-pdf.service.ts +191 -0
  199. package/src/shared/util.ts +101 -0
  200. package/src/tasks/meetings/meeting-pdf.ts +410 -0
  201. package/src/tasks/tasks/task-pdf.service.ts +238 -0
  202. package/src/tasks/tasks/task-reports-pdf.service.ts +313 -0
  203. package/src/tax/index.ts +86 -0
  204. package/src/tax/tax-calculator.ts +1025 -0
  205. package/src/tax/tax.types.ts +535 -0
  206. package/src/transaction-calculations/discounts-distribution.ts +343 -0
  207. package/src/transaction-calculations/index.ts +3 -0
  208. package/src/transaction-calculations/total-calculation.ts +443 -0
  209. package/src/transaction-calculations/transaction-calculation-engine.ts +903 -0
  210. package/src/utils/my-date.ts +111 -0
  211. package/src/utils/tr-utils.ts +104 -0
  212. package/tsconfig.json +2 -2
  213. /package/dist/{accounting/invoice/invoice-pdf.service.d.ts → shared/transactions-pdf.service.d.ts} +0 -0
@@ -0,0 +1,869 @@
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 DCLandscapeWithoutPricePdfService {
7
+ FontSize: number = 8;
8
+
9
+ static GetDeliveryChallanPrint(ROPrintData: any, numberofCopies: any) {
10
+ var contents = [];
11
+ if (TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
12
+ contents.push(
13
+ this.CommonHeaderDetails(ROPrintData, null),
14
+ this.PreparesparePartsTable(ROPrintData),
15
+ this.CommonTotalDetails(ROPrintData, null, numberofCopies)
16
+ );
17
+ } else {
18
+ numberofCopies.forEach((text: any, index: any) => {
19
+ contents.push(
20
+ this.CommonHeaderDetails(ROPrintData, text),
21
+ this.PreparesparePartsTable(ROPrintData),
22
+ this.CommonTotalDetails(ROPrintData, index, numberofCopies)
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
+ pageMargins: [10, 15, 10, 15],
37
+ // pageOrientation: 'landscape',
38
+ content: contents,
39
+ // footer:footers,
40
+ // footer: {
41
+ // columns: this.CommonTotalDetails(ROPrintData, null, numberofCopies)
42
+ // },
43
+ styles: SharedPDFService.GetStyles()
44
+ };
45
+ return dd;
46
+ }
47
+
48
+ static GetFileName(ROPrintData: any) {
49
+ let fileName: string = ROPrintData.HeaderName;
50
+ if (!TrUtils.IsNull(ROPrintData.Product) && !TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
51
+ fileName = fileName + '-' + ROPrintData.Product.RegNo;
52
+ }
53
+ return fileName;
54
+ }
55
+
56
+ static GetAddress(Entity: any) {
57
+ return Entity.Adrs1 + ', ' + Entity.Adrs2 + ', ' + Entity.City + '-' + Entity.PIN + ', Cell : ' + Entity.Phone;
58
+ }
59
+
60
+ static GetHeaderInfo(InvoicePDFData: any) {
61
+ let TaxInfo: any = [];
62
+ if (!TrUtils.IsEmpty(InvoicePDFData.Entity.GSTIN)) {
63
+ TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 7, width: 'auto' },
64
+ );
65
+ }
66
+ // if (!TrUtils.IsEmpty(InvoicePDFData.Entity.PAN)) {
67
+ // TaxInfo.push({ text: 'PAN : ' + InvoicePDFData.Entity.PAN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: 'auto' },
68
+ // );
69
+ // }
70
+ if (!TrUtils.IsEmpty(InvoicePDFData.Entity.DLNo)) {
71
+ TaxInfo.push({ text: 'D.L.NO : ' + InvoicePDFData.Entity.DLNo, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 7, width: '*' },
72
+ );
73
+ }
74
+
75
+ TaxInfo.push(this.GetBillofSupplyName(InvoicePDFData.Settings));
76
+
77
+
78
+ return TaxInfo;
79
+ }
80
+
81
+ static GetBillofSupplyName(Settings: any) {
82
+ return { text: Settings.Tax === 'BS' ? 'Bill of Supply' : null, alignment: 'right', marginRight: 5, marginTop: 2, marginBottom: 3, fontSize: 9, width: 'auto' };
83
+ }
84
+
85
+ static CommonHeaderDetails(ROPrintData: any, text: any) {
86
+ return [
87
+ { text: 'DELIVERY CHALLAN', alignment: 'center', bold: true, fontSize: 10 },
88
+ { text: text, color: 'grey', alignment: 'right', width: 100, marginTop: (text !==null)?-11:0, fontSize: 10 },
89
+
90
+ {
91
+ style: 'tableExample',
92
+ table: {
93
+ widths: ['*', '*', '*'],
94
+ body: [
95
+ [
96
+ {
97
+ stack: [
98
+ { text: ROPrintData.Entity.CName, alignment: 'center', bold: true, fontSize: 10 },
99
+ // this.GetAddresDetailsAndLogo(ROPrintData.Entity, ROPrintData.Image, ROPrintData.AColor, ROPrintData.HColor, text)
100
+ { text: this.GetAddress(ROPrintData.Entity), alignment: 'center', style: ['headerstyle'] },
101
+ {
102
+ stack: this.GetHeaderInfo(ROPrintData)
103
+ },
104
+ ]
105
+ },
106
+ SharedPDFService.GetCustomer(ROPrintData.Customer, ROPrintData.Type, ROPrintData.For,
107
+ ROPrintData.Product, ROPrintData.Settings, 'Customer Name & Address', false)
108
+ , SharedPDFService.GetVehicleDetails(ROPrintData.Type, ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
109
+ ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.IsProforma, ROPrintData.Settings, false, ROPrintData.BL, null,null,null, ROPrintData.DoS)],
110
+ ]
111
+ },
112
+ layout: PrintSharedService.LayOutStyle()
113
+
114
+ },
115
+ // this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text),
116
+ // SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
117
+ // ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For,
118
+ // ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp,
119
+ // ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, ROPrintData.Settings, null, false, ROPrintData.BL),
120
+ // SharedPDFService.GetOwnerDetails(ROPrintData.Cust, ROPrintData.Type, ROPrintData.For),
121
+ // SharedPDFService.CustomerAndVehicleDetailsAfterLine(),
122
+ // SharedPDFService.GetDisplayTable(),
123
+ ];
124
+ }
125
+
126
+ static MainHeading(CName: any, Entity: any, Image: any, HColor: any, CopyName: any) {
127
+ let headerstyle: string;
128
+ let MainHeaderStyle: any = SharedPDFService.GetMainHeaderStyleForLeftAlignHeader(CName);
129
+ // if (Header === 1) {
130
+ headerstyle = 'header2';
131
+ // } else {
132
+ // headerstyle = 'temp2header';
133
+ // }
134
+ return SharedPDFService.HeaderAlignmentBasedOnCondition(CName, Image, HColor, headerstyle, MainHeaderStyle, Entity, CopyName);
135
+ }
136
+
137
+ static GetAddresDetailsAndLogo(Entity: any, Image: any, AColor: any, HColor: any, text: any) {
138
+ let Details: any = [
139
+ {
140
+ stack: [
141
+ { columns: [this.MainHeading(Entity.CName, Entity, Image, HColor, text)] },
142
+ {
143
+ columns: [{
144
+ width: 150,
145
+ margin: [0, 0, 0, 5],
146
+ stack: SharedPDFService.GetHeader(Entity, HColor),
147
+ color: AColor,
148
+ style: 'header'
149
+ },
150
+ SharedPDFService.GetEntityDetails(Entity)]
151
+ }
152
+ ]
153
+ }
154
+ ]
155
+ if (!TrUtils.IsNull(Image)) {
156
+ // Details.unshift({ text: '', width: 120 });
157
+ if (Entity.CName.length < 28) {
158
+ Details[0].stack[0].columns.push({ text: '', width: 140 });
159
+ }
160
+ if (!TrUtils.IsNull(text)) {
161
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
162
+ }
163
+ Details.unshift({ image: Image, width: 120, height: 80 });
164
+ } else {
165
+ Details[0].stack[1].columns.unshift({ text: '', width: 130 });
166
+ if (!TrUtils.IsNull(text)) {
167
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
168
+ }
169
+ }
170
+
171
+ return Details;
172
+ }
173
+
174
+ static GetMainHeaderDetails(Entity: any, HeaderName: any, Image: any, HColor: any, AColor: any, text: any) {
175
+ return [
176
+ // SharedPDFService.MainHeading(Entity.CName, Entity.Header, Image, HColor, text),
177
+ SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text),
178
+ SharedPDFService.GetPrintType(HeaderName),
179
+ SharedPDFService.HeaderAfterLine()
180
+ ];
181
+ }
182
+
183
+ static PreparesparePartsTable(ROPrintData: any) {
184
+ let List: any = [];
185
+ if (ROPrintData.Entity.Body === 1) {
186
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
187
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
188
+ ROPrintData.PrintInfo[i].Text = '';
189
+ }
190
+ // List.push(ROPrintData.PrintInfo[i].Text,
191
+ // this.GetLaborPartsTableForView(ROPrintData.PrintInfo[i].Items)
192
+ // );
193
+
194
+ }
195
+ } else {
196
+ if (ROPrintData.Entity.Body === 2) {
197
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
198
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
199
+ ROPrintData.PrintInfo[i].Text = '';
200
+ }
201
+ List.push(ROPrintData.PrintInfo[i].Text,
202
+ this.WithOutDiscountFieldTable(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn,
203
+ ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn)
204
+ );
205
+
206
+ }
207
+ } else {
208
+ if (ROPrintData.Summary) {
209
+ // List.push('',
210
+ // this.GetLaborPartsTableForView(ROPrintData.Items)
211
+ // );
212
+ } else {
213
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
214
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
215
+ ROPrintData.PrintInfo[i].Text = '';
216
+ }
217
+ List.push(ROPrintData.PrintInfo[i].Text,
218
+ this.GetWithOutDiscAndTaxFieldHeader(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items),
219
+ ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn)
220
+ );
221
+
222
+ }
223
+ }
224
+ }
225
+ }
226
+ return List;
227
+ }
228
+
229
+ static WithOutDiscountFieldTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
230
+ if (Parts.length !== 0) {
231
+ if (PrintPartNo) {
232
+ return {
233
+ style: 'tableExample',
234
+ marginLeft: 20,
235
+ table: {
236
+ widths: [15, 67, 160, 25, 50, 60, 30, 53],
237
+ headerRows: 1,
238
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
239
+ },
240
+ layout: PrintSharedService.LayOutStyleanother()
241
+ };
242
+ } else {
243
+ return {
244
+ style: 'tableExample',
245
+ marginLeft: 20,
246
+ table: {
247
+ widths: [15, 215, 25, 50, 60, 45, 60],
248
+ headerRows: 1,
249
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
250
+ },
251
+ layout: PrintSharedService.LayOutStyleanother()
252
+ };
253
+ }
254
+ } else {
255
+ let a: any = '';
256
+ return a;
257
+ }
258
+ }
259
+
260
+ static GetWithOutDiscountFieldHeader1(permission: any, Body: any, ShowIGST: any, ShowDiscountColumn: any) {
261
+ let headersNames: any;
262
+ if (permission) {
263
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
264
+ { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
265
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
266
+ { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
267
+ { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
268
+ { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
269
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
270
+ { text: 'Offer Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
271
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'center', },
272
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tabFleheader' }
273
+ ],
274
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'MPN', lineHeight: 0.5 },
275
+ { text: '', Field: 'Desc', lineHeight: 0.5 }, { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
276
+ { text: '', Field: 'Batch', lineHeight: 0.5 }, { text: 'Expiry', Field: 'ExDate', lineHeight: 0.5 },
277
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: '', Field: 'OfQty', lineHeight: 0.5 }, { text: '', Field: 'UnPr', lineHeight: 0.5 },
278
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
279
+ ]
280
+ ];
281
+ let Count: number = 9;
282
+ if (ShowDiscountColumn) {
283
+ headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
284
+ headersNames[0].splice(Count + 1, 0, {});
285
+ headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
286
+ headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
287
+ Count = 11;
288
+ }
289
+ if (ShowIGST) {
290
+ headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
291
+ headersNames[0].splice(Count + 1, 0, {});
292
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
293
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
294
+ } else {
295
+ headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
296
+ headersNames[0].splice(Count + 1, 0, {});
297
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
298
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.7 });
299
+ headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
300
+ headersNames[0].splice(Count + 3, 0, {});
301
+ headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
302
+ headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
303
+ }
304
+ } else {
305
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 },
306
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.6 },
307
+ { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
308
+ { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
309
+ { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
310
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.6 },
311
+ { text: 'Offer Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
312
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, alignment: 'center', lineHeight: 0.6 },
313
+ { text: 'Line Total', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 }
314
+ ],
315
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 },
316
+ { text: '', Field: 'Desc', lineHeight: 0.5 }, { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
317
+ { text: '', Field: 'Batch', lineHeight: 0.5 }, { text: 'Expiry', Field: 'ExDate', lineHeight: 0.5 },
318
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: '', Field: 'OfQty', lineHeight: 0.5 }, { text: '', Field: 'UnPr', lineHeight: 0.5 },
319
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
320
+ ]];
321
+ let Count: number = 8;
322
+ if (ShowDiscountColumn) {
323
+ headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
324
+ headersNames[0].splice(Count + 1, 0, {});
325
+ headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
326
+ headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
327
+ Count = 10;
328
+ }
329
+ if (ShowIGST) {
330
+ headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
331
+ headersNames[0].splice(Count + 1, 0, {});
332
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
333
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
334
+ } else {
335
+ headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
336
+ headersNames[0].splice(Count + 1, 0, {});
337
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
338
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.5 });
339
+ headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
340
+ headersNames[0].splice(Count + 3, 0, {});
341
+ headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
342
+ headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
343
+ }
344
+ }
345
+ return headersNames;
346
+ }
347
+
348
+ static GetWithOutDiscountFieldHeader2(permission: any, Body: any, ShowDiscountColumn: any) {
349
+
350
+ let headersNames: any = [[
351
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 1 },
352
+ { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
353
+ { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
354
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
355
+
356
+ // { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'right', },
357
+ // { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
358
+ ],
359
+ [
360
+ { text: '', Field: 'Desc', lineHeight: 1 },
361
+ { text: '', Field: 'Batch', lineHeight: 1 },
362
+ { text: '', Field: 'ExDate', lineHeight: 1 },
363
+ { text: '', Field: 'QtyAndUoM', lineHeight: 1 },
364
+ // { text: '', Field: 'UnPr', lineHeight: 0.5 },
365
+ // { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
366
+ ]];
367
+ if (permission) {
368
+ let sno = { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 1 };
369
+ let MPN = { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 1 };
370
+ let sno1 = { text: '', Field: 'SNo', lineHeight:1 };
371
+ let MPN1 = { text: '', Field: 'MPN', lineHeight: 1 };
372
+ headersNames[0].unshift(sno, MPN);
373
+ headersNames[1].unshift(sno1, MPN1);
374
+ // if (ShowDiscountColumn) {
375
+ // headersNames[0].splice(5, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
376
+ // headersNames[0].splice(6, 0, {});
377
+ // headersNames[1].splice(5, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
378
+ // headersNames[1].splice(6, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
379
+ // }
380
+ } else {
381
+ let sno = { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 };
382
+ let sno1 = { text: '', Field: 'SNo', lineHeight: 0.5 };
383
+ headersNames[0].unshift(sno);
384
+ headersNames[1].unshift(sno1);
385
+ // if (ShowDiscountColumn) {
386
+ // headersNames[0].splice(4, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
387
+ // headersNames[0].splice(5, 0, {});
388
+ // headersNames[1].splice(4, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
389
+ // headersNames[1].splice(5, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
390
+ // }
391
+ }
392
+ return headersNames;
393
+ }
394
+
395
+ static GetWithOutDiscountFieldHeader(permission: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ShowDiscountColumn: any) {
396
+ if (Body === 2) {
397
+ let headersNames: any = [{ text: 'Description', style: 'tableheader', Field: 'Desc' },
398
+ { text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
399
+ // { text: 'Unit Price', style: 'tableheader', Field: 'UnPr' },
400
+ // { text: 'Labor Charges', style: 'tableheader', Field: 'Price' },
401
+ // { text: 'Tax', style: 'tableheader', Field: 'TaxAmount' },
402
+ // { text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }
403
+ ];
404
+ if (permission) {
405
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
406
+ let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
407
+ headersNames.unshift(sno, MPN);
408
+ } else {
409
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
410
+ headersNames.unshift(sno);
411
+ }
412
+ return headersNames;
413
+ } else {
414
+ if (ShowTaxColumn) {
415
+ return this.GetWithOutDiscountFieldHeader1(permission, Body, ShowIGST, ShowDiscountColumn);
416
+ } else {
417
+ return this.GetWithOutDiscountFieldHeader2(permission, Body, ShowDiscountColumn);
418
+ }
419
+ }
420
+ }
421
+
422
+ static BuildTableBodyForLaborAndParts(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
423
+ var body: any = [];
424
+ let columns: any = this.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
425
+ // if (ShowTaxColumn) {
426
+ for (let i = 0; i < columns.length; i++) {
427
+ body.push(columns[i]);
428
+ }
429
+ columns = columns[1];
430
+ // } else {
431
+ // body.push(columns);
432
+ // }
433
+
434
+
435
+ let DummyOps: any = [];
436
+
437
+ if (Parts.length !== 0) {
438
+ // let dummypartadding1: any = {};
439
+ // dummypartadding1.SNo = '';
440
+ // dummypartadding1.Desc = 'Spare Parts';
441
+ // dummypartadding1.Qty = '';
442
+ // dummypartadding1.UnPr = '';
443
+ // dummypartadding1.LineTotal = '';
444
+ // Parts.unshift(dummypartadding1);
445
+
446
+ // if (Parts.length <= 15) {
447
+ // let Count: number = 18 - Parts.length;
448
+ // for (let i = 0; i < Count; i++) {
449
+ // Parts.push({});
450
+ // }
451
+ // } else {
452
+ // let Count: number = 58 - Parts.length;
453
+ // for (let i = 0; i < Count; i++) {
454
+ // Parts.push({});
455
+ // }
456
+ // }
457
+ }
458
+
459
+ let SNo: number = 1;
460
+ Parts.forEach((part: any) => {
461
+ var dataRow: any = [];
462
+ columns.forEach((column: any) => {
463
+ if (
464
+ (!TrUtils.IsFixedZero(part[column.Field]) && !TrUtils.IsNull(part[column.Field]))
465
+ || (column.text === 'Line Total' || column.text === 'Expiry')) {
466
+ if (part[column.Field] === 'Spare Parts') {
467
+ dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
468
+ } else {
469
+ if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
470
+ && TrUtils.CheckInvalidSelect(part.TCode))) {
471
+ part[column.Field] = '';
472
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
473
+ } else {
474
+ if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'Batch' || column.Field === 'ExDate' || column.Field === 'QtyAndUoM'
475
+ || column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
476
+ || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
477
+ if (column.Field === 'Disc') {
478
+ if (column.type === 'percentage') {
479
+ if (!TrUtils.IsEmpty(part[column.Field])) {
480
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
481
+ } else {
482
+ dataRow.push({ text: '', noWrap: true });
483
+ }
484
+ } else {
485
+ if (!TrUtils.IsZero(part[column.Field])) {
486
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
487
+ } else {
488
+ dataRow.push({ text: '', noWrap: true });
489
+ }
490
+ }
491
+ } else {
492
+ if (column.Field === 'Batch') {
493
+ if (!TrUtils.IsNull(part[column.Field])) {
494
+ dataRow.push({ text: part[column.Field].BN, nowrap: true });
495
+ } else {
496
+ dataRow.push({ text: '', noWrap: true });
497
+ }
498
+ } else if (column.Field === 'ExDate') {
499
+ if (!TrUtils.IsNull(part['Batch'])) {
500
+ dataRow.push({ text: MyDate.ConvertUTCDateToReadableExDate(part['Batch'].ExDt), nowrap: true });
501
+ } else {
502
+ dataRow.push({ text: '', noWrap: true });
503
+ }
504
+ } else {
505
+ if (!TrUtils.IsZero(part[column.Field])) {
506
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
507
+ } else {
508
+ dataRow.push({ text: '', noWrap: true });
509
+ }
510
+ }
511
+
512
+ }
513
+ } else {
514
+ // dataRow.push(part[column.Field].toString());
515
+ if (column.Field === 'Desc') {
516
+ let DescData: any = [];
517
+ DescData.push(part[column.Field].toString());
518
+ if (!TrUtils.IsEmpty(part['EDesc'])) {
519
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
520
+ }
521
+ dataRow.push({ stack: DescData });
522
+ } else {
523
+ dataRow.push({ text: part[column.Field].toString() });
524
+ }
525
+ }
526
+ }
527
+ }
528
+ } else {
529
+ if (column.Field === 'SNo' && !TrUtils.IsNull(part.Desc)) {
530
+ part[column.Field] = SNo;
531
+ SNo = SNo + 1;
532
+ } else {
533
+ part[column.Field] = '';
534
+ }
535
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
536
+ }
537
+ });
538
+
539
+ body.push(dataRow);
540
+ });
541
+
542
+ // if (Labor.length !== 0) {
543
+ // let dummypartadding1: any = {};
544
+ // dummypartadding1.SNo = '';
545
+ // dummypartadding1.Desc = 'Labor';
546
+ // dummypartadding1.Qty = '';
547
+ // dummypartadding1.UnPr = '';
548
+ // dummypartadding1.LineTotal = '';
549
+ // Labor.unshift(dummypartadding1);
550
+ // // DummyOps.unshift(dummypartadding1);
551
+ // }
552
+ // if (Body === 2) {
553
+ // for (let i = 0; i < Labor.length; i++) {
554
+ // Labor[i].UnPr = '';
555
+ // }
556
+ // }
557
+
558
+ // Labor.forEach((Ops: any) => {
559
+ // var dataRow: any = [];
560
+ // columns.forEach((column: any) => {
561
+ // if ((!TrUtils.IsFixedZero(Ops[column.Field]) && !TrUtils.IsNull(Ops[column.Field]))
562
+ // || (column.text === 'Line Total')) {
563
+ // if (Ops[column.Field] === 'Labor') {
564
+ // dataRow.push({ text: Ops[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
565
+ // } else {
566
+ // if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
567
+ // && TrUtils.CheckInvalidSelect(Ops.TCode))) {
568
+ // Ops[column.Field] = '';
569
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
570
+ // } else {
571
+ // if (column.text === 'Line Total' || column.Field === 'Price' || column.text === 'Tax' || column.Field === 'UnPr'
572
+ // || column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
573
+ // || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
574
+ // if (column.Field === 'Disc') {
575
+ // if (column.type === 'percentage') {
576
+ // if (Ops.Perc && !TrUtils.IsZero(Ops[column.Field])) {
577
+ // dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
578
+ // } else {
579
+ // dataRow.push({ text: '', noWrap: true });
580
+ // }
581
+ // } else {
582
+ // if (!Ops.Perc && !TrUtils.IsZero(Ops[column.Field])) {
583
+ // dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
584
+ // } else {
585
+ // dataRow.push({ text: '', noWrap: true });
586
+ // }
587
+ // }
588
+ // } else {
589
+ // if (!TrUtils.IsZero(Ops[column.Field])) {
590
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', nowrap: true });
591
+ // } else {
592
+ // dataRow.push({ text: '', noWrap: true });
593
+ // }
594
+ // }
595
+
596
+ // } else {
597
+ // dataRow.push(Ops[column.Field].toString());
598
+ // }
599
+ // }
600
+ // }
601
+ // } else {
602
+ // if (column.Field === 'SNo') {
603
+ // Ops[column.Field] = SNo;
604
+ // SNo = SNo + 1;
605
+ // } else {
606
+ // Ops[column.Field] = '';
607
+ // }
608
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
609
+ // }
610
+ // });
611
+ // body.push(dataRow);
612
+ // });
613
+ return body;
614
+ }
615
+
616
+ static GetWithOutDiscAndTaxFieldHeader(Parts: any, ShowTaxColumn: any, PrintPartNo: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
617
+ if (Parts.length !== 0) {
618
+ if (ShowTaxColumn) {
619
+ return this.TaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
620
+ } else {
621
+ if (ConsolidateGST) {
622
+ return this.ConsolidateDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
623
+ } else {
624
+ return this.NoTaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
625
+ }
626
+ }
627
+ } else {
628
+ let a: any = '';
629
+ return a;
630
+ }
631
+ }
632
+
633
+ static TaxTableWidths(PrintPartNo: any, ShowIGST: any, ShowDiscountColumn: any) {
634
+ if (PrintPartNo) {
635
+ if (ShowIGST) {
636
+ if (ShowDiscountColumn) {
637
+ return [24, 50, '*', 35, 35, 35, 30, 25, 40, 20, 35, 20, 35, 45];
638
+ } else {
639
+ return [24, 50, '*', 35, 35, 35, 30, 25, 40, 20, 35, 51];
640
+ }
641
+ } else {
642
+ if (ShowDiscountColumn) {
643
+ return [24, 45, '*', 35, 35, 35, 30, 22, 40, 20, 34, 20, 32, 20, 32, 48];
644
+ } else {
645
+ return [24, 45, '*', 35, 35, 35, 30, 22, 40, 20, 32, 20, 32, 54];
646
+ }
647
+ }
648
+ } else {
649
+ if (ShowIGST) {
650
+ if (ShowDiscountColumn) {
651
+ return [24, '*', 35, 41, 35, 30, 25, 40, 20, 35, 20, 35, 41];
652
+ } else {
653
+ return [24, '*', 35, 50, 35, 30, 25, 40, 20, 40, 50];
654
+ }
655
+ } else {
656
+ if (ShowDiscountColumn) {
657
+ return [24, '*', 35, 45, 35, 30, 22, 40, 20, 34, 20, 35, 20, 35, 45];
658
+ } else {
659
+ return [24, '*', 35, 50, 35, 30, 22, 40, 20, 35, 20, 35, 50];
660
+ }
661
+ }
662
+ }
663
+ }
664
+
665
+ static TaxDataTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
666
+ if (PrintPartNo) {
667
+ if (ShowIGST) {
668
+ return {
669
+ style: 'tableExample',
670
+ marginTop: -6,
671
+ table: {
672
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
673
+ // headerRows: 2,
674
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
675
+ },
676
+ layout: PrintSharedService.LayOutStyle()
677
+ };
678
+ } else {
679
+ return {
680
+ style: 'tableExample',
681
+ marginTop: -6,
682
+ table: {
683
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
684
+ // headerRows: 2,
685
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
686
+ },
687
+ layout: PrintSharedService.LayOutStyle()
688
+ };
689
+ }
690
+
691
+ } else {
692
+ if (ShowIGST) {
693
+ return {
694
+ style: 'tableExample',
695
+ marginTop: -6,
696
+ table: {
697
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
698
+ // headerRows: 2,
699
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
700
+ },
701
+ layout: PrintSharedService.LayOutStyle()
702
+ };
703
+ } else {
704
+ return {
705
+ style: 'tableExample',
706
+ marginTop: -6,
707
+ table: {
708
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
709
+ // headerRows: 2,
710
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
711
+ },
712
+ layout: PrintSharedService.LayOutStyle()
713
+ };
714
+ }
715
+
716
+ }
717
+ }
718
+
719
+ static LayOutStyle() {
720
+ return {
721
+ hLineWidth: function (i: any, node: any) {
722
+ return (i === 0 || i === 1 || i === 2) ? 0.7 : 0;
723
+ },
724
+ vLineWidth: function (i: any, node: any) {
725
+ return (i === 0 || i === 1 || i === 2) ? 0.7 : 0.7;
726
+ },
727
+ hLineColor: function (i: any, node: any) {
728
+ let color;
729
+ if (i === 0 || i === node.table.body.length) {
730
+ color = 'black';
731
+ } else {
732
+ if (i === 1) {
733
+ color = 'gray';
734
+ } else {
735
+ color = 'lightgray';
736
+ }
737
+ }
738
+
739
+ return color;
740
+ },
741
+ vLineColor: function (i: any, node: any) {
742
+ let color;
743
+ if (i === 0 || i === node.table.widths.length) {
744
+ color = 'black';
745
+ } else {
746
+ color = 'lightgray';
747
+ }
748
+ return color;
749
+ },
750
+ };
751
+ }
752
+
753
+ static ConsolidateDataTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
754
+ if (PrintPartNo) {
755
+ return {
756
+ style: 'tableExample',
757
+ marginTop: -6,
758
+ table: {
759
+ widths: [15, 70, 273, 25, 60, 80, 10, 40],
760
+ // headerRows: 1,
761
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
762
+ },
763
+ layout: PrintSharedService.LayOutStyle()
764
+ };
765
+ } else {
766
+ return {
767
+ style: 'tableExample',
768
+ marginTop: -6,
769
+ table: {
770
+ widths: [20, 300, 50, 80, 80, 10, 40],
771
+ // headerRows: 1,
772
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
773
+ },
774
+ layout: PrintSharedService.LayOutStyle()
775
+ };
776
+ }
777
+ }
778
+
779
+ static WidthForInsuranceOrNot(ShowDiscountColumn: any, PrintPartNo: boolean) {
780
+ if (PrintPartNo) {
781
+ if (ShowDiscountColumn) {
782
+ return [24, 70, '*', 25, 60, 45, 45, 50];
783
+ } else {
784
+ return [25, 70, '*', 80, 80, 80];
785
+ }
786
+ } else {
787
+ if (ShowDiscountColumn) {
788
+ return [25, '*', 70, 70, 70, 70, 70];
789
+ } else {
790
+ return [25, '*', 80, 80, 80];
791
+ }
792
+ }
793
+
794
+ }
795
+
796
+ static NoTaxDataTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
797
+ if (PrintPartNo) {
798
+ return {
799
+ style: 'tableExample',
800
+ marginTop: -6,
801
+ table: {
802
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
803
+ // headerRows: 1,
804
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
805
+ },
806
+ layout: PrintSharedService.LayOutStyle()
807
+ };
808
+ } else {
809
+ return {
810
+ style: 'tableExample',
811
+ marginTop: -6,
812
+ table: {
813
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
814
+ // headerRows: 1,
815
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
816
+ },
817
+ layout: PrintSharedService.LayOutStyle()
818
+ };
819
+ }
820
+ }
821
+
822
+ static CommonTotalDetails(ROPrintData: any, index: any, numberofCopies: any) {
823
+ let CommonDetails = [
824
+ SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
825
+ // SharedPDFService.GetUnderLine(),
826
+ this.GetSignatures(ROPrintData.Entity.CName, ROPrintData.Type, ROPrintData.For),
827
+ ];
828
+ // if (ROPrintData.Type !== 'Invoice') {
829
+ // CommonDetails.splice(2, 0, SharedPDFService.GetUnderLine());
830
+ // }
831
+ if (!TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
832
+ CommonDetails.push({ text: '', pageBreak: 'after' })
833
+ }
834
+ return CommonDetails;
835
+ }
836
+
837
+ static GetSignatures(CName: any, For: any, Type: any) {
838
+ return {
839
+ columns: [{
840
+ stack: [
841
+ this.CompanyName(CName),
842
+ { columns: [this.Authorizedsignature(), SharedPDFService.SurveyorSignature(For, Type), this.CustomerSignature()] }
843
+ ]
844
+ }],
845
+ };
846
+ }
847
+
848
+ static CompanyName(CName: any) {
849
+ return {
850
+ style: 'forCompany1',
851
+ text: ['For ', { text: CName, bold: 'true' }],
852
+ };
853
+ }
854
+
855
+ static Authorizedsignature() {
856
+ return {
857
+ style: 'Sign1',
858
+ text: ['Authorized Signatory'],
859
+ };
860
+ }
861
+
862
+ static CustomerSignature() {
863
+ return {
864
+ style: 'Sign1',
865
+ text: ['Customer Signature'], marginLeft: 90
866
+ };
867
+ }
868
+
869
+ }