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,922 @@
1
+ import { Add } from '../../shared/math-operations';
2
+ import { SharedPDFService } from '../../shared/shared-pdf.service';
3
+ import { PrintSharedService } from '../../shared/shared-print.service';
4
+ import { MyDate } from '../../utils/my-date';
5
+ import { TrUtils } from '../../utils/tr-utils';
6
+
7
+ export class DCLandscapePdfService {
8
+ FontSize: number = 8;
9
+
10
+ static GetDeliveryChallanPrint(ROPrintData: any, numberofCopies: any, moreDiscDetails:boolean) {
11
+ var contents = [];
12
+ if (TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
13
+ contents.push(
14
+ this.CommonHeaderDetails(ROPrintData, null),
15
+ this.PreparesparePartsTable(ROPrintData),
16
+ this.CommonTotalDetails(ROPrintData, null, numberofCopies,moreDiscDetails)
17
+ );
18
+ } else {
19
+ numberofCopies.forEach((text: any, index: any) => {
20
+ contents.push(
21
+ this.CommonHeaderDetails(ROPrintData, text),
22
+ this.PreparesparePartsTable(ROPrintData),
23
+ this.CommonTotalDetails(ROPrintData, index, numberofCopies, moreDiscDetails)
24
+ );
25
+ });
26
+ }
27
+ var dd = {
28
+ info: {
29
+ title: this.GetFileName(ROPrintData),
30
+ },
31
+ background: function (currentPage: any, pageSize: any) {
32
+ return SharedPDFService.GetWatermarkImage(ROPrintData.Image, pageSize, ROPrintData.Entity.Wmark);
33
+ },
34
+ header: function (currentPage: any, pageCount: any) {
35
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
36
+ },
37
+ pageMargins: [10, 15, 10, 15],
38
+ pageOrientation: 'landscape',
39
+ content: contents,
40
+ // footer:footers,
41
+ // footer: {
42
+ // columns: this.CommonTotalDetails(ROPrintData, null, numberofCopies)
43
+ // },
44
+ styles: SharedPDFService.GetStyles()
45
+ };
46
+ return dd;
47
+ }
48
+
49
+ static GetFileName(ROPrintData: any) {
50
+ let fileName: string = ROPrintData.HeaderName;
51
+ if (!TrUtils.IsNull(ROPrintData.Product) && !TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
52
+ fileName = fileName + '-' + ROPrintData.Product.RegNo;
53
+ }
54
+ return fileName;
55
+ }
56
+
57
+ static GetAddress(Entity: any) {
58
+ return Entity.Adrs1 + ', ' + Entity.Adrs2 + ', ' + Entity.City + '-' + Entity.PIN + ', Cell : ' + Entity.Phone;
59
+ }
60
+
61
+ static GetHeaderInfo(InvoicePDFData: any) {
62
+ let TaxInfo: any = [];
63
+ if (!TrUtils.IsEmpty(InvoicePDFData.Entity.GSTIN)) {
64
+ TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: 'auto' },
65
+ );
66
+ }
67
+ if (!TrUtils.IsEmpty(InvoicePDFData.Entity.DLNo)) {
68
+ TaxInfo.push({ text: 'D.L.NO : ' + InvoicePDFData.Entity.DLNo, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: '*' },
69
+ );
70
+ }
71
+
72
+ TaxInfo.push(this.GetBillofSupplyName(InvoicePDFData.Settings));
73
+
74
+
75
+ return TaxInfo;
76
+ }
77
+
78
+ static GetBillofSupplyName(Settings: any) {
79
+ return { text: Settings.Tax === 'BS' ? 'Bill of Supply' : null, alignment: 'right', marginRight: 5, marginTop: 2, marginBottom: 3, fontSize: 9, width: 'auto' };
80
+ }
81
+
82
+ static CommonHeaderDetails(ROPrintData: any, text: any) {
83
+ return [
84
+ { text: 'DELIVERY CHALLAN', alignment: 'center', bold: true, fontSize: 10 },
85
+ { text: text, color: 'grey', alignment: 'right', width: 100, marginTop: (text !==null)?-11:0, fontSize: 10 },
86
+
87
+ {
88
+ style: 'tableExample',
89
+ table: {
90
+ widths: ['*', '*', '*'],
91
+ body: [
92
+ [
93
+ {
94
+ stack: [
95
+ { text: ROPrintData.Entity.CName, alignment: 'center', bold: true, fontSize: 13 },
96
+ // this.GetAddresDetailsAndLogo(ROPrintData.Entity, ROPrintData.Image, ROPrintData.AColor, ROPrintData.HColor, text)
97
+ { text: this.GetAddress(ROPrintData.Entity), alignment: 'center', style: ['headerstyle'] },
98
+ {
99
+ stack: this.GetHeaderInfo(ROPrintData)
100
+ },
101
+ ]
102
+ },
103
+ SharedPDFService.GetCustomer(ROPrintData.Customer, ROPrintData.Type, ROPrintData.For,
104
+ ROPrintData.Product, ROPrintData.Settings, 'Customer Name & Address', false)
105
+ , SharedPDFService.GetVehicleDetails(ROPrintData.Type, ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
106
+ ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.IsProforma, ROPrintData.Settings, false, ROPrintData.BL, null,null,null, ROPrintData.DoS)],
107
+ ]
108
+ },
109
+ layout: PrintSharedService.LayOutStyle()
110
+
111
+ },
112
+ // this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text),
113
+ // SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
114
+ // ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For,
115
+ // ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp,
116
+ // ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, ROPrintData.Settings, null, false, ROPrintData.BL),
117
+ // SharedPDFService.GetOwnerDetails(ROPrintData.Cust, ROPrintData.Type, ROPrintData.For),
118
+ // SharedPDFService.CustomerAndVehicleDetailsAfterLine(),
119
+ // SharedPDFService.GetDisplayTable(),
120
+ ];
121
+ }
122
+
123
+ static MainHeading(CName: any, Entity: any, Image: any, HColor: any, CopyName: any) {
124
+ let headerstyle: string;
125
+ let MainHeaderStyle: any = SharedPDFService.GetMainHeaderStyleForLeftAlignHeader(CName);
126
+ // if (Header === 1) {
127
+ headerstyle = 'header2';
128
+ // } else {
129
+ // headerstyle = 'temp2header';
130
+ // }
131
+ return SharedPDFService.HeaderAlignmentBasedOnCondition(CName, Image, HColor, headerstyle, MainHeaderStyle, Entity, CopyName);
132
+ }
133
+
134
+ static GetAddresDetailsAndLogo(Entity: any, Image: any, AColor: any, HColor: any, text: any) {
135
+ let Details: any = [
136
+ {
137
+ stack: [
138
+ { columns: [this.MainHeading(Entity.CName, Entity, Image, HColor, text)] },
139
+ {
140
+ columns: [{
141
+ width: 150,
142
+ margin: [0, 0, 0, 5],
143
+ stack: SharedPDFService.GetHeader(Entity, HColor),
144
+ color: AColor,
145
+ style: 'header'
146
+ },
147
+ SharedPDFService.GetEntityDetails(Entity)]
148
+ }
149
+ ]
150
+ }
151
+ ]
152
+ if (!TrUtils.IsNull(Image)) {
153
+ // Details.unshift({ text: '', width: 120 });
154
+ if (Entity.CName.length < 28) {
155
+ Details[0].stack[0].columns.push({ text: '', width: 140 });
156
+ }
157
+ if (!TrUtils.IsNull(text)) {
158
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
159
+ }
160
+ Details.unshift({ image: Image, width: 120, height: 80 });
161
+ } else {
162
+ Details[0].stack[1].columns.unshift({ text: '', width: 130 });
163
+ if (!TrUtils.IsNull(text)) {
164
+ Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 10 });
165
+ }
166
+ }
167
+
168
+ return Details;
169
+ }
170
+
171
+ static GetMainHeaderDetails(Entity: any, HeaderName: any, Image: any, HColor: any, AColor: any, text: any) {
172
+ return [
173
+ // SharedPDFService.MainHeading(Entity.CName, Entity.Header, Image, HColor, text),
174
+ SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text),
175
+ SharedPDFService.GetPrintType(HeaderName),
176
+ SharedPDFService.HeaderAfterLine()
177
+ ];
178
+ }
179
+
180
+ static PreparesparePartsTable(ROPrintData: any) {
181
+ let List: any = [];
182
+ if (ROPrintData.Entity.Body === 1) {
183
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
184
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
185
+ ROPrintData.PrintInfo[i].Text = '';
186
+ }
187
+ // List.push(ROPrintData.PrintInfo[i].Text,
188
+ // this.GetLaborPartsTableForView(ROPrintData.PrintInfo[i].Items)
189
+ // );
190
+
191
+ }
192
+ } else {
193
+ if (ROPrintData.Entity.Body === 2) {
194
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
195
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
196
+ ROPrintData.PrintInfo[i].Text = '';
197
+ }
198
+ List.push(ROPrintData.PrintInfo[i].Text,
199
+ this.WithOutDiscountFieldTable(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items), ROPrintData.ShowTaxColumn,
200
+ ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn)
201
+ );
202
+
203
+ }
204
+ } else {
205
+ if (ROPrintData.Summary) {
206
+ // List.push('',
207
+ // this.GetLaborPartsTableForView(ROPrintData.Items)
208
+ // );
209
+ } else {
210
+ for (let i = 0; i < ROPrintData.PrintInfo.length; i++) {
211
+ if (TrUtils.IsNull(ROPrintData.PrintInfo[i].Text)) {
212
+ ROPrintData.PrintInfo[i].Text = '';
213
+ }
214
+ List.push(ROPrintData.PrintInfo[i].Text,
215
+ this.GetWithOutDiscAndTaxFieldHeader(TrUtils.Stringify(ROPrintData.PrintInfo[i].Items),
216
+ ROPrintData.ShowTaxColumn, ROPrintData.Entity.MPN, ROPrintData.Entity.Body, ROPrintData.ShowIGST, ROPrintData.ConsolidateGST, ROPrintData.ShowDiscountColumn)
217
+ );
218
+
219
+ }
220
+ }
221
+ }
222
+ }
223
+ return List;
224
+ }
225
+
226
+ static WithOutDiscountFieldTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
227
+ if (Parts.length !== 0) {
228
+ if (PrintPartNo) {
229
+ return {
230
+ style: 'tableExample',
231
+ marginLeft: 20,
232
+ table: {
233
+ widths: [15, 67, 160, 25, 50, 60, 30, 53],
234
+ headerRows: 1,
235
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
236
+ },
237
+ layout: PrintSharedService.LayOutStyleanother()
238
+ };
239
+ } else {
240
+ return {
241
+ style: 'tableExample',
242
+ marginLeft: 20,
243
+ table: {
244
+ widths: [15, 215, 25, 50, 60, 45, 60],
245
+ headerRows: 1,
246
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
247
+ },
248
+ layout: PrintSharedService.LayOutStyleanother()
249
+ };
250
+ }
251
+ } else {
252
+ let a: any = '';
253
+ return a;
254
+ }
255
+ }
256
+
257
+ static GetWithOutDiscountFieldHeader1(permission: any, Body: any, ShowIGST: any, ShowDiscountColumn: any) {
258
+ let headersNames: any;
259
+ if (permission) {
260
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
261
+ { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 },
262
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
263
+ { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
264
+ { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
265
+ { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
266
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
267
+ { text: 'Offer Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
268
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'center', },
269
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tabFleheader' }
270
+ ],
271
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 }, { text: '', Field: 'MPN', lineHeight: 0.5 },
272
+ { text: '', Field: 'Desc', lineHeight: 0.5 }, { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
273
+ { text: '', Field: 'Batch', lineHeight: 0.5 }, { text: 'Expiry', Field: 'ExDate', lineHeight: 0.5 },
274
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: '', Field: 'OfQty', lineHeight: 0.5 }, { text: '', Field: 'UnPr', lineHeight: 0.5 },
275
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
276
+ ]
277
+ ];
278
+ let Count: number = 9;
279
+ if (ShowDiscountColumn) {
280
+ headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
281
+ headersNames[0].splice(Count + 1, 0, {});
282
+ headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
283
+ headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
284
+ Count = 11;
285
+ }
286
+ if (ShowIGST) {
287
+ headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
288
+ headersNames[0].splice(Count + 1, 0, {});
289
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
290
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
291
+ } else {
292
+ headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
293
+ headersNames[0].splice(Count + 1, 0, {});
294
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
295
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.7 });
296
+ headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
297
+ headersNames[0].splice(Count + 3, 0, {});
298
+ headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
299
+ headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
300
+ }
301
+ } else {
302
+ headersNames = [[{ text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 },
303
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.6 },
304
+ { text: 'HSN/SAC', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
305
+ { text: 'Batch No', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
306
+ { text: 'Expiry', rowSpan: 2, style: 'tableheader', lineHeight: 1 },
307
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.6 },
308
+ { text: 'Offer Qty', style: 'tableheader', rowSpan: 2, lineHeight: 1 },
309
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, alignment: 'center', lineHeight: 0.6 },
310
+ { text: 'Line Total', rowSpan: 2, style: 'tableheader', lineHeight: 0.6 }
311
+ ],
312
+ [{ text: '', Field: 'SNo', lineHeight: 0.5 },
313
+ { text: '', Field: 'Desc', lineHeight: 0.5 }, { text: 'HSN/SAC', Field: 'HSN', lineHeight: 0.5 },
314
+ { text: '', Field: 'Batch', lineHeight: 0.5 }, { text: 'Expiry', Field: 'ExDate', lineHeight: 0.5 },
315
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: '', Field: 'OfQty', lineHeight: 0.5 }, { text: '', Field: 'UnPr', lineHeight: 0.5 },
316
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
317
+ ]];
318
+ let Count: number = 8;
319
+ if (ShowDiscountColumn) {
320
+ headersNames[0].splice(Count, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
321
+ headersNames[0].splice(Count + 1, 0, {});
322
+ headersNames[1].splice(Count, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
323
+ headersNames[1].splice(Count + 1, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
324
+ Count = 10;
325
+ }
326
+ if (ShowIGST) {
327
+ headersNames[0].splice(Count, 0, { text: 'IGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
328
+ headersNames[0].splice(Count + 1, 0, {});
329
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'IGSTPerc', type: 'percentage', lineHeight: 0.8 });
330
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'IGSTAmt', type: 'amount', lineHeight: 0.5 });
331
+ } else {
332
+ headersNames[0].splice(Count, 0, { text: 'CGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
333
+ headersNames[0].splice(Count + 1, 0, {});
334
+ headersNames[1].splice(Count, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'CGSTPerc', type: 'percentage', lineHeight: 0.8 });
335
+ headersNames[1].splice(Count + 1, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'CGSTAmt', type: 'amount', lineHeight: 0.5 });
336
+ headersNames[0].splice(Count + 2, 0, { text: 'SGST/UTGST', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.8 });
337
+ headersNames[0].splice(Count + 3, 0, {});
338
+ headersNames[1].splice(Count + 2, 0, { text: 'Rate %', alignment: 'center', style: 'tableheader', Field: 'SGSTPerc', type: 'percentage', lineHeight: 0.8 });
339
+ headersNames[1].splice(Count + 3, 0, { text: 'Amount', alignment: 'center', style: 'tableheader', Field: 'SGSTAmt', type: 'amount', lineHeight: 0.5 });
340
+ }
341
+ }
342
+ return headersNames;
343
+ }
344
+
345
+ static GetWithOutDiscountFieldHeader2(permission: any, Body: any, ShowDiscountColumn: any) {
346
+
347
+ let headersNames: any = [[
348
+ { text: 'Description', rowSpan: 2, style: 'tableheader', alignment: 'center', lineHeight: 0.5 },
349
+ { text: 'Qty', style: 'tableheader', rowSpan: 2, lineHeight: 0.5 },
350
+ { text: 'Unit Price', style: 'tableheader', rowSpan: 2, lineHeight: 0.5, alignment: 'right', },
351
+ { text: 'Line Total', rowSpan: 2, lineHeight: 0.5, style: 'tableheader' }
352
+ ],
353
+ [
354
+ { text: '', Field: 'Desc', lineHeight: 0.5 },
355
+ { text: '', Field: 'QtyAndUoM', lineHeight: 0.5 }, { text: '', Field: 'UnPr', lineHeight: 0.5 },
356
+ { text: 'Line Total', Field: 'LineTotal', lineHeight: 0.5 }
357
+ ]];
358
+ if (permission) {
359
+ let sno = { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 };
360
+ let MPN = { text: 'Part No', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 };
361
+ let sno1 = { text: '', Field: 'SNo', lineHeight: 0.5 };
362
+ let MPN1 = { text: '', Field: 'MPN', lineHeight: 0.5 };
363
+ headersNames[0].unshift(sno, MPN);
364
+ headersNames[1].unshift(sno1, MPN1);
365
+ if (ShowDiscountColumn) {
366
+ headersNames[0].splice(5, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
367
+ headersNames[0].splice(6, 0, {});
368
+ headersNames[1].splice(5, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
369
+ headersNames[1].splice(6, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
370
+ }
371
+ } else {
372
+ let sno = { text: 'S.No.', rowSpan: 2, style: 'tableheader', lineHeight: 0.5 };
373
+ let sno1 = { text: '', Field: 'SNo', lineHeight: 0.5 };
374
+ headersNames[0].unshift(sno);
375
+ headersNames[1].unshift(sno1);
376
+ if (ShowDiscountColumn) {
377
+ headersNames[0].splice(4, 0, { text: 'Discount', style: 'tableheader', colSpan: 2, alignment: 'center', lineHeight: 0.5 });
378
+ headersNames[0].splice(5, 0, {});
379
+ headersNames[1].splice(4, 0, { text: '%', alignment: 'center', style: 'tableheader', Field: 'Perc', type: 'percentage', lineHeight: 0.5 });
380
+ headersNames[1].splice(5, 0, { text: 'Rs', alignment: 'center', style: 'tableheader', Field: 'Disc', type: 'amount', lineHeight: 0.5 });
381
+ }
382
+ }
383
+ return headersNames;
384
+ }
385
+
386
+ static GetWithOutDiscountFieldHeader(permission: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ShowDiscountColumn: any) {
387
+ if (Body === 2) {
388
+ let headersNames: any = [{ text: 'Description', style: 'tableheader', Field: 'Desc' },
389
+ { text: 'Qty', style: 'tableheader', Field: 'QtyAndUoM' },
390
+ { text: 'Unit Price', style: 'tableheader', Field: 'UnPr' },
391
+ { text: 'Labor Charges', style: 'tableheader', Field: 'Price' },
392
+ { text: 'Tax', style: 'tableheader', Field: 'TaxAmount' },
393
+ { text: 'Line Total', style: 'tableheader', Field: 'LineTotal' }];
394
+ if (permission) {
395
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
396
+ let MPN = { text: 'Part No', style: 'tableheader', Field: 'MPN' };
397
+ headersNames.unshift(sno, MPN);
398
+ } else {
399
+ let sno = { text: 'S.No.', style: 'tableheader', Field: 'SNo' };
400
+ headersNames.unshift(sno);
401
+ }
402
+ return headersNames;
403
+ } else {
404
+ if (ShowTaxColumn) {
405
+ return this.GetWithOutDiscountFieldHeader1(permission, Body, ShowIGST, ShowDiscountColumn);
406
+ } else {
407
+ return this.GetWithOutDiscountFieldHeader2(permission, Body, ShowDiscountColumn);
408
+ }
409
+ }
410
+ }
411
+
412
+ static BuildTableBodyForLaborAndParts(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
413
+ var body: any = [];
414
+ let columns: any = this.GetWithOutDiscountFieldHeader(PrintPartNo, ShowTaxColumn, Body, ShowIGST, ShowDiscountColumn);
415
+ // if (ShowTaxColumn) {
416
+ for (let i = 0; i < columns.length; i++) {
417
+ body.push(columns[i]);
418
+ }
419
+ columns = columns[1];
420
+ // } else {
421
+ // body.push(columns);
422
+ // }
423
+
424
+
425
+ let DummyOps: any = [];
426
+
427
+ if (Parts.length !== 0) {
428
+ // let dummypartadding1: any = {};
429
+ // dummypartadding1.SNo = '';
430
+ // dummypartadding1.Desc = 'Spare Parts';
431
+ // dummypartadding1.Qty = '';
432
+ // dummypartadding1.UnPr = '';
433
+ // dummypartadding1.LineTotal = '';
434
+ // Parts.unshift(dummypartadding1);
435
+ if (Parts.length <= 15) {
436
+ let Count: number = 18 - Parts.length;
437
+ for (let i = 0; i < Count; i++) {
438
+ Parts.push({});
439
+ }
440
+ } else {
441
+ let Count: number = 58 - Parts.length;
442
+ for (let i = 0; i < Count; i++) {
443
+ Parts.push({});
444
+ }
445
+ }
446
+ }
447
+
448
+ let SNo: number = 1;
449
+ Parts.forEach((part: any) => {
450
+ var dataRow: any = [];
451
+ columns.forEach((column: any) => {
452
+ if (
453
+ (!TrUtils.IsFixedZero(part[column.Field]) && !TrUtils.IsNull(part[column.Field]))
454
+ || (column.text === 'Line Total' || column.text === 'Expiry')) {
455
+ if (part[column.Field] === 'Spare Parts') {
456
+ dataRow.push({ text: part[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
457
+ } else {
458
+ if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
459
+ && TrUtils.CheckInvalidSelect(part.TCode))) {
460
+ part[column.Field] = '';
461
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
462
+ } else {
463
+ if (column.text === 'Line Total' || column.Field === 'UnPr' || column.Field === 'Batch' || column.Field === 'ExDate' || column.Field === 'QtyAndUoM'
464
+ || column.text === 'Tax' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
465
+ || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
466
+ if (column.Field === 'Disc') {
467
+ if (column.type === 'percentage') {
468
+ if (!TrUtils.IsEmpty(part[column.Field])) {
469
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
470
+ } else {
471
+ dataRow.push({ text: '', noWrap: true });
472
+ }
473
+ } else {
474
+ if (!TrUtils.IsZero(part[column.Field])) {
475
+ dataRow.push({ text: part[column.Field].toString(), noWrap: true });
476
+ } else {
477
+ dataRow.push({ text: '', noWrap: true });
478
+ }
479
+ }
480
+ } else {
481
+ if (column.Field === 'Batch') {
482
+ if (!TrUtils.IsNull(part[column.Field])) {
483
+ dataRow.push({ text: part[column.Field].BN, nowrap: true });
484
+ } else {
485
+ dataRow.push({ text: '', noWrap: true });
486
+ }
487
+ } else if (column.Field === 'ExDate') {
488
+ if (!TrUtils.IsNull(part['Batch'])) {
489
+ dataRow.push({ text: MyDate.ConvertUTCDateToReadableExDate(part['Batch'].ExDt), nowrap: true });
490
+ } else {
491
+ dataRow.push({ text: '', noWrap: true });
492
+ }
493
+ } else {
494
+ if (!TrUtils.IsZero(part[column.Field])) {
495
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
496
+ } else {
497
+ dataRow.push({ text: '', noWrap: true });
498
+ }
499
+ }
500
+
501
+ }
502
+ } else {
503
+ // dataRow.push(part[column.Field].toString());
504
+ if (column.Field === 'Desc') {
505
+ let DescData: any = [];
506
+ DescData.push(part[column.Field].toString());
507
+ if (!TrUtils.IsEmpty(part['EDesc'])) {
508
+ DescData.push({ text: part['EDesc'].toString(), color: 'grey' });
509
+ }
510
+ dataRow.push({ stack: DescData });
511
+ } else {
512
+ dataRow.push({ text: part[column.Field].toString() });
513
+ }
514
+ }
515
+ }
516
+ }
517
+ } else {
518
+ if (column.Field === 'SNo' && !TrUtils.IsNull(part.Desc)) {
519
+ part[column.Field] = SNo;
520
+ SNo = SNo + 1;
521
+ } else {
522
+ part[column.Field] = '';
523
+ }
524
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'center' });
525
+ }
526
+ });
527
+
528
+ body.push(dataRow);
529
+ });
530
+
531
+ // if (Labor.length !== 0) {
532
+ // let dummypartadding1: any = {};
533
+ // dummypartadding1.SNo = '';
534
+ // dummypartadding1.Desc = 'Labor';
535
+ // dummypartadding1.Qty = '';
536
+ // dummypartadding1.UnPr = '';
537
+ // dummypartadding1.LineTotal = '';
538
+ // Labor.unshift(dummypartadding1);
539
+ // // DummyOps.unshift(dummypartadding1);
540
+ // }
541
+ // if (Body === 2) {
542
+ // for (let i = 0; i < Labor.length; i++) {
543
+ // Labor[i].UnPr = '';
544
+ // }
545
+ // }
546
+
547
+ // Labor.forEach((Ops: any) => {
548
+ // var dataRow: any = [];
549
+ // columns.forEach((column: any) => {
550
+ // if ((!TrUtils.IsFixedZero(Ops[column.Field]) && !TrUtils.IsNull(Ops[column.Field]))
551
+ // || (column.text === 'Line Total')) {
552
+ // if (Ops[column.Field] === 'Labor') {
553
+ // dataRow.push({ text: Ops[column.Field].toString(), marginLeft: 50, style: 'InlineHeader' });
554
+ // } else {
555
+ // if (((column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt' || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc')
556
+ // && TrUtils.CheckInvalidSelect(Ops.TCode))) {
557
+ // Ops[column.Field] = '';
558
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
559
+ // } else {
560
+ // if (column.text === 'Line Total' || column.Field === 'Price' || column.text === 'Tax' || column.Field === 'UnPr'
561
+ // || column.Field === 'QtyAndUoM' || column.Field === 'Disc' || column.Field === 'CGSTAmt' || column.Field === 'SGSTAmt'
562
+ // || column.Field === 'CGSTPerc' || column.Field === 'SGSTPerc' || column.Field === 'IGSTAmt' || column.Field === 'IGSTPerc') {
563
+ // if (column.Field === 'Disc') {
564
+ // if (column.type === 'percentage') {
565
+ // if (Ops.Perc && !TrUtils.IsZero(Ops[column.Field])) {
566
+ // dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
567
+ // } else {
568
+ // dataRow.push({ text: '', noWrap: true });
569
+ // }
570
+ // } else {
571
+ // if (!Ops.Perc && !TrUtils.IsZero(Ops[column.Field])) {
572
+ // dataRow.push({ text: Ops[column.Field].toString(), noWrap: true });
573
+ // } else {
574
+ // dataRow.push({ text: '', noWrap: true });
575
+ // }
576
+ // }
577
+ // } else {
578
+ // if (!TrUtils.IsZero(Ops[column.Field])) {
579
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'right', nowrap: true });
580
+ // } else {
581
+ // dataRow.push({ text: '', noWrap: true });
582
+ // }
583
+ // }
584
+
585
+ // } else {
586
+ // dataRow.push(Ops[column.Field].toString());
587
+ // }
588
+ // }
589
+ // }
590
+ // } else {
591
+ // if (column.Field === 'SNo') {
592
+ // Ops[column.Field] = SNo;
593
+ // SNo = SNo + 1;
594
+ // } else {
595
+ // Ops[column.Field] = '';
596
+ // }
597
+ // dataRow.push({ text: Ops[column.Field].toString(), alignment: 'center' });
598
+ // }
599
+ // });
600
+ // body.push(dataRow);
601
+ // });
602
+ return body;
603
+ }
604
+
605
+ static GetWithOutDiscAndTaxFieldHeader(Parts: any, ShowTaxColumn: any, PrintPartNo: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
606
+ if (Parts.length !== 0) {
607
+ if (ShowTaxColumn) {
608
+ return this.TaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
609
+ } else {
610
+ if (ConsolidateGST) {
611
+ return this.ConsolidateDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
612
+ } else {
613
+ return this.NoTaxDataTable(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn);
614
+ }
615
+ }
616
+ } else {
617
+ let a: any = '';
618
+ return a;
619
+ }
620
+ }
621
+
622
+ static TaxTableWidths(PrintPartNo: any, ShowIGST: any, ShowDiscountColumn: any) {
623
+ if (PrintPartNo) {
624
+ if (ShowIGST) {
625
+ if (ShowDiscountColumn) {
626
+ return [24, 50, '*', 35, 35, 35, 30, 25, 40, 20, 35, 20, 35, 45];
627
+ } else {
628
+ return [24, 50, '*', 35, 35, 35, 30, 25, 40, 20, 35, 51];
629
+ }
630
+ } else {
631
+ if (ShowDiscountColumn) {
632
+ return [24, 45, '*', 35, 35, 35, 30, 22, 40, 20, 34, 20, 32, 20, 32, 48];
633
+ } else {
634
+ return [24, 45, '*', 35, 35, 35, 30, 22, 40, 20, 32, 20, 32, 54];
635
+ }
636
+ }
637
+ } else {
638
+ if (ShowIGST) {
639
+ if (ShowDiscountColumn) {
640
+ return [24, '*', 35, 41, 35, 30, 25, 40, 20, 35, 20, 35, 41];
641
+ } else {
642
+ return [24, '*', 35, 50, 35, 30, 25, 40, 20, 40, 50];
643
+ }
644
+ } else {
645
+ if (ShowDiscountColumn) {
646
+ return [24, '*', 35, 45, 35, 30, 22, 40, 20, 34, 20, 35, 20, 35, 45];
647
+ } else {
648
+ return [24, '*', 35, 50, 35, 30, 22, 40, 20, 35, 20, 35, 50];
649
+ }
650
+ }
651
+ }
652
+ }
653
+
654
+ static TaxDataTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
655
+ if (PrintPartNo) {
656
+ if (ShowIGST) {
657
+ return {
658
+ style: 'tableExample',
659
+ marginTop: -6,
660
+ table: {
661
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
662
+ // headerRows: 2,
663
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
664
+ },
665
+ layout: PrintSharedService.LayOutStyle()
666
+ };
667
+ } else {
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
+ }
679
+
680
+ } else {
681
+ if (ShowIGST) {
682
+ return {
683
+ style: 'tableExample',
684
+ marginTop: -6,
685
+ table: {
686
+ widths: this.TaxTableWidths(PrintPartNo, ShowIGST, ShowDiscountColumn),
687
+ // headerRows: 2,
688
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
689
+ },
690
+ layout: PrintSharedService.LayOutStyle()
691
+ };
692
+ } else {
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
+ }
704
+
705
+ }
706
+ }
707
+
708
+ static LayOutStyle() {
709
+ return {
710
+ hLineWidth: function (i: any, node: any) {
711
+ return (i === 0 || i === 1 || i === 2) ? 0.7 : 0;
712
+ },
713
+ vLineWidth: function (i: any, node: any) {
714
+ return (i === 0 || i === 1 || i === 2) ? 0.7 : 0.7;
715
+ },
716
+ hLineColor: function (i: any, node: any) {
717
+ let color;
718
+ if (i === 0 || i === node.table.body.length) {
719
+ color = 'black';
720
+ } else {
721
+ if (i === 1) {
722
+ color = 'gray';
723
+ } else {
724
+ color = 'lightgray';
725
+ }
726
+ }
727
+
728
+ return color;
729
+ },
730
+ vLineColor: function (i: any, node: any) {
731
+ let color;
732
+ if (i === 0 || i === node.table.widths.length) {
733
+ color = 'black';
734
+ } else {
735
+ color = 'lightgray';
736
+ }
737
+ return color;
738
+ },
739
+ };
740
+ }
741
+
742
+ static ConsolidateDataTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
743
+ if (PrintPartNo) {
744
+ return {
745
+ style: 'tableExample',
746
+ marginTop: -6,
747
+ table: {
748
+ widths: [15, 70, 273, 25, 60, 80, 10, 40],
749
+ // headerRows: 1,
750
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
751
+ },
752
+ layout: PrintSharedService.LayOutStyle()
753
+ };
754
+ } else {
755
+ return {
756
+ style: 'tableExample',
757
+ marginTop: -6,
758
+ table: {
759
+ widths: [20, 300, 50, 80, 80, 10, 40],
760
+ // headerRows: 1,
761
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
762
+ },
763
+ layout: PrintSharedService.LayOutStyle()
764
+ };
765
+ }
766
+ }
767
+
768
+ static WidthForInsuranceOrNot(ShowDiscountColumn: any, PrintPartNo: boolean) {
769
+ if (PrintPartNo) {
770
+ if (ShowDiscountColumn) {
771
+ return [24, 70, '*', 25, 60, 45, 45, 50];
772
+ } else {
773
+ return [25, 70, '*', 35, 60, 80];
774
+ }
775
+ } else {
776
+ if (ShowDiscountColumn) {
777
+ return [25, '*', 70, 70, 70, 70, 70];
778
+ } else {
779
+ return [25, '*', 40, 60, 80];
780
+ }
781
+ }
782
+
783
+ }
784
+
785
+ static NoTaxDataTable(Parts: any, PrintPartNo: any, ShowTaxColumn: any, Body: any, ShowIGST: any, ConsolidateGST: any, ShowDiscountColumn: any) {
786
+ if (PrintPartNo) {
787
+ return {
788
+ style: 'tableExample',
789
+ marginTop: -6,
790
+ table: {
791
+ widths: this.WidthForInsuranceOrNot(ShowDiscountColumn, PrintPartNo),
792
+ // headerRows: 1,
793
+ body: this.BuildTableBodyForLaborAndParts(Parts, PrintPartNo, ShowTaxColumn, Body, ShowIGST, ConsolidateGST, ShowDiscountColumn)
794
+ },
795
+ layout: PrintSharedService.LayOutStyle()
796
+ };
797
+ } else {
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
+ }
809
+ }
810
+
811
+ static CommonTotalDetails(ROPrintData: any, index: any, numberofCopies: any, moreDiscDetails:boolean) {
812
+ let CommonDetails = [
813
+ // SharedPDFService.GetFinalTotalDetails('0.00', '0.00', '0.00',
814
+ // '0.00', '0.00', '0.00', ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
815
+ // ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
816
+ // ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts,
817
+ // '0.00', ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For,
818
+ // ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal,
819
+ // ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn,
820
+ // TrUtils.isTaxable(ROPrintData.Settings.Tax), '0.00',
821
+ // ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, null),
822
+ this.TotalDetails(ROPrintData, moreDiscDetails, ROPrintData.Entity.DecimalsNumber),
823
+
824
+ // SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts),
825
+ SharedPDFService.GetTemsAndConditions(ROPrintData.Entity.Terms),
826
+ // SharedPDFService.GetUnderLine(),
827
+ this.GetSignatures(ROPrintData.Entity.CName, ROPrintData.Type, ROPrintData.For),
828
+ ];
829
+ // if (ROPrintData.Type !== 'Invoice') {
830
+ // CommonDetails.splice(2, 0, SharedPDFService.GetUnderLine());
831
+ // }
832
+ if (!TrUtils.IsNull(numberofCopies) && numberofCopies.length !== 0 && (index !== (numberofCopies.length - 1))) {
833
+ CommonDetails.push({ text: '', pageBreak: 'after' })
834
+ }
835
+ return CommonDetails;
836
+ }
837
+
838
+ static GetSignatures(CName: any, For: any, Type: any) {
839
+ return {
840
+ columns: [{
841
+ stack: [
842
+ this.CompanyName(CName),
843
+ { columns: [this.Authorizedsignature(), SharedPDFService.SurveyorSignature(For, Type), this.CustomerSignature()] }
844
+ ]
845
+ }],
846
+ };
847
+ }
848
+
849
+ static CompanyName(CName: any) {
850
+ return {
851
+ style: 'forCompany1',
852
+ text: ['For ', { text: CName, bold: 'true' }],
853
+ };
854
+ }
855
+
856
+ static Authorizedsignature() {
857
+ return {
858
+ style: 'Sign1',
859
+ text: ['Authorized Signatory'],
860
+ };
861
+ }
862
+
863
+ static CustomerSignature() {
864
+ return {
865
+ style: 'Sign1',
866
+ text: ['Customer Signature'], marginLeft: 90
867
+ };
868
+ }
869
+
870
+ static TotalDetails(ROPrintData: any, moreDiscDetails:boolean, DecimalsNumber: number) {
871
+ let totalDisc: any;
872
+ let totalTax: any;
873
+ if (!ROPrintData.Consolidate) {
874
+ totalTax = TrUtils.FixPriceValue(Add(Number(0), Number(ROPrintData.CustPartITax)), DecimalsNumber);
875
+ if (TrUtils.isTaxable(ROPrintData.Settings.Tax)) {
876
+ totalDisc = TrUtils.FixPriceValue(Add(Number(0), Number(ROPrintData.CustPartsDiscTotal)), DecimalsNumber);
877
+ } else {
878
+ totalDisc = TrUtils.FixPriceValue(Add(Number(0), Number(ROPrintData.CustPartsDiscTotal), Number(ROPrintData.FixedDisc)), DecimalsNumber);
879
+ }
880
+ }
881
+ return [
882
+ {
883
+ style: 'tableExample',
884
+ marginTop: -6,
885
+ table: {
886
+ widths: ['*', '*', '*'],
887
+ heights: [105, 105, 105],
888
+ body: [
889
+ [
890
+ SharedPDFService.PartsTaxAmounts1(ROPrintData.CustTaxGroupData, true, ROPrintData.ShowIGST,
891
+ ROPrintData.ShowTaxColumn),
892
+ // SharedPDFService.GetTaxOnParts(ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST,
893
+ // ROPrintData.CustPartSGST, ROPrintData.ShowAccParts, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn,
894
+ // ROPrintData.ShowTaxColumn, ROPrintData.From),
895
+ SharedPDFService.GetBankDetials(ROPrintData.Entity.Bank, ROPrintData.Entity.PrBank, ROPrintData.Entity.UPIPhone),
896
+
897
+ {
898
+ columns: [{ text: '', width: moreDiscDetails?140:175 }, SharedPDFService.GrandTotal(ROPrintData,'0.00', ROPrintData.CustPartsTotalBeforeDisc, totalDisc, totalTax, ROPrintData.For,
899
+ ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, null,ROPrintData.Consolidate,null,moreDiscDetails, ROPrintData.Entity.DecimalsNumber)],
900
+ }
901
+
902
+
903
+ // SharedPDFService.GetCustomer(ROPrintData.Customer, ROPrintData.Type, ROPrintData.For,
904
+ // ROPrintData.Product, ROPrintData.Settings, 'Customer Name & Address', false)
905
+ // , SharedPDFService.GetVehicleDetails(ROPrintData.Type, ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
906
+ // ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.IsProforma, ROPrintData.Settings, false, ROPrintData.BL)
907
+ ],
908
+ ]
909
+ },
910
+ layout: PrintSharedService.LayOutStyle()
911
+ },
912
+ // this.GetMainHeaderDetails(ROPrintData.Entity, ROPrintData.HeaderName, ROPrintData.Image, ROPrintData.HColor, ROPrintData.AColor, text),
913
+ // SharedPDFService.GetCustomerAndVehicleDetails(ROPrintData._id, ROPrintData.CrDate, ROPrintData.PrDate,
914
+ // ROPrintData.MOut, ROPrintData.MIn, ROPrintData.Product, ROPrintData.PrintType, ROPrintData.For,
915
+ // ROPrintData.SurName, ROPrintData.SurPhone, ROPrintData.Type, ROPrintData.SurEmail, ROPrintData.InsComp,
916
+ // ROPrintData.PolNo, ROPrintData.PolType, ROPrintData.Customer, ROPrintData.IsProforma, ROPrintData.Settings, null, false, ROPrintData.BL),
917
+ // SharedPDFService.GetOwnerDetails(ROPrintData.Cust, ROPrintData.Type, ROPrintData.For),
918
+ // SharedPDFService.CustomerAndVehicleDetailsAfterLine(),
919
+ // SharedPDFService.GetDisplayTable(),
920
+ ];
921
+ }
922
+ }