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,972 @@
1
+ import { PayTypeEnum } from "../../enums/enums";
2
+ import { Add } from "../../shared/math-operations";
3
+ import { SharedPDFService } from "../../shared/shared-pdf.service";
4
+ import { MyDate } from "../../utils/my-date";
5
+ import { TrUtils } from "../../utils/tr-utils";
6
+
7
+
8
+
9
+ export class InvoicePortraitPrintService {
10
+
11
+ static TableHeaders: number = 9;
12
+ static GetPrint(InvoicePDFData: any, size: string, printOptions: any, moreDiscDetails: boolean) {
13
+ // console.log('InvoicePDFData', InvoicePDFData);
14
+ if (TrUtils.IsNull(InvoicePDFData.Name)) {
15
+ InvoicePDFData.Name = '';
16
+ }
17
+ let dd: any = {
18
+ info: {
19
+ title: 'TAX INVOICE',
20
+ },
21
+ background: function (currentPage: any, pageSize: any) {
22
+ if (size !== 'full') {
23
+ pageSize.height = pageSize.height - 435.945;
24
+ }
25
+ return SharedPDFService.GetWatermarkImage(InvoicePDFData.Image, pageSize, InvoicePDFData.Entity.Wmark);
26
+ },
27
+ header: function (currentPage: any, pageCount: any, pageSize: any) {
28
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 25, fontSize: 8, marginTop: 2 };
29
+ },
30
+ pageMargins: this.GetMarginsBasedOnPaperSize(size),
31
+ pageSize: 'A4',
32
+ content: [
33
+ this.GetMainHeaderInfo(InvoicePDFData),
34
+ {
35
+ style: 'tableExample',
36
+ table: {
37
+ widths: [200, '*', 'auto'],
38
+ body: this.GetCustomerAndBankDetails(InvoicePDFData)
39
+ },
40
+ layout: this.HeaderLayOut()
41
+ },
42
+
43
+ this.GetItemsTable(InvoicePDFData.Ops, InvoicePDFData.Items, InvoicePDFData.ShowTaxColumn, InvoicePDFData.SType, printOptions, size, InvoicePDFData.Entity.DecimalsNumber),
44
+
45
+ [this.TotalDetails(InvoicePDFData, moreDiscDetails, InvoicePDFData.Entity.DecimalsNumber)],
46
+ [this.GetNumberInWords(InvoicePDFData.CustRoundedTotal)],
47
+ [this.InvoiceDueStatus(InvoicePDFData.Type, InvoicePDFData.Paid, InvoicePDFData.Due, InvoicePDFData.Sts, InvoicePDFData.isCountersale, InvoicePDFData.Entity.DecimalsNumber)
48
+ ],
49
+ {
50
+ style: 'tableExample',
51
+ table: {
52
+ widths: ['*', 'auto'],
53
+ body: this.GetSignatures(InvoicePDFData.Entity.CName, InvoicePDFData.CustRoundedTotal)
54
+ },
55
+ layout: 'noBorders'
56
+ },
57
+
58
+ // this.GetSignatures(InvoicePDFData.Entity.CName, InvoicePDFData.CustRoundedTotal),
59
+ ],
60
+ styles: {
61
+ headerstyle: {
62
+ fontFamily: 'Calibri',
63
+ fontSize: 9
64
+ },
65
+ Sign: {
66
+ fontSize: 8,
67
+ margin: [0, 15, 0, 5]
68
+ },
69
+ forCompany: {
70
+ // margin: [0, 10, 30, 0],
71
+ marginRight: 5,
72
+ marginTop: 10,
73
+ fontSize: 9,
74
+ alignment: 'right'
75
+ },
76
+ forCompany1: {
77
+ margin: [0, 5, 15, 0],
78
+ fontSize: 8
79
+ },
80
+ tableheader: {
81
+ bold: true,
82
+ fontFamily: 'Calibri',
83
+ margin: [0, 1, 0, 5],
84
+ alignment: 'center'
85
+ },
86
+ tableheader1: {
87
+ bold: true,
88
+ fontFamily: 'Calibri',
89
+ margin: [0, 2, 0, 2],
90
+ alignment: 'center'
91
+ },
92
+ tableExample: {
93
+ fontSize: 9
94
+ },
95
+ tableExample1: {
96
+ fontSize: 8
97
+ }
98
+ }
99
+
100
+ };
101
+ return dd;
102
+ }
103
+
104
+ static LayOutStyle() {
105
+ return {
106
+ hLineColor: function (i: any, node: any) {
107
+ return (i === 0 || i === 1 || i === 2 || i === node.table.body.length) ? 'gray' : 'white';
108
+ },
109
+ vLineColor: function (i: any, node: any) {
110
+ return (i === 0 || i === node.table.widths.length) ? 'gray' : 'white';
111
+ }
112
+ };
113
+ }
114
+
115
+ static InvoiceDueStatus(Type: any, Paid: any, Due: any, Status: any, isCounter: boolean, DecimalsNumber: number) {
116
+ if (Type === 'Invoice' && !isCounter) {
117
+ return {
118
+ // lineHeight: 0.7,
119
+ fontSize: this.TableHeaders,
120
+ marginTop: 3,
121
+ marginBottom: 5,
122
+ table: {
123
+ widths: ['*', 'auto'],
124
+ body: [[{ text: 'Paid : ' + TrUtils.FixPriceValue(Paid, DecimalsNumber), marginLeft: 20 },
125
+ { text: 'Due : ' + TrUtils.FixPriceValue(Due, DecimalsNumber), marginRight: 20 }]]
126
+ },
127
+ layout: SharedPDFService.LayOutLineStyle(),
128
+ };
129
+ } else {
130
+ return this.emptyObject();
131
+ }
132
+ }
133
+
134
+ static GetMainHeaderInfo(InvoicePDFData: any) {
135
+ if (!TrUtils.IsNull(InvoicePDFData.Image)) {
136
+ return {
137
+ columns: [{ image: InvoicePDFData.Image, width: 60, height: 60, marginBottom: 5 },
138
+ {
139
+ stack: [
140
+ { text: InvoicePDFData.Entity.CName, style: ['headerstyle'], alignment: 'left', fontSize: 15 },
141
+ { text: this.GetAddress(InvoicePDFData.Entity), alignment: 'left', style: ['headerstyle'] },
142
+ {
143
+ columns: this.GetHeaderInfo(InvoicePDFData, 0)
144
+ },
145
+ { text: InvoicePDFData.HeaderName, alignment: 'left', style: ['Receiptheader1'], marginTop: 5 }
146
+ ]
147
+ }
148
+ ], columnGap: 10
149
+ }
150
+ } else {
151
+ return {
152
+ stack: [
153
+ { text: InvoicePDFData.Entity.CName, style: ['headerstyle'], alignment: 'center', fontSize: 15 },
154
+ { text: this.GetAddress(InvoicePDFData.Entity), alignment: 'center', style: ['headerstyle'] },
155
+ {
156
+ columns: this.GetHeaderInfo(InvoicePDFData, 5)
157
+ },
158
+ { text: InvoicePDFData.HeaderName, alignment: 'center', style: ['Receiptheader1'] }
159
+ ]
160
+ }
161
+ }
162
+
163
+ }
164
+
165
+ static GetCustomerAndBankDetails(InvoicePDFData: any) {
166
+ let CustDetails: any = [];
167
+ CustDetails.push([{
168
+ marginLeft: 3,
169
+ stack: [
170
+ this.GetCustomerDetails(InvoicePDFData.Customer, InvoicePDFData.Type, null, null, 'Customer Name & Address')
171
+ ]
172
+ },
173
+ {
174
+ marginLeft: 5,
175
+ marginRight: 5,
176
+ stack: [this.GetCustomerGSTIN(InvoicePDFData.Customer), this.GetCustomerDLNo(InvoicePDFData.Customer)]
177
+
178
+ },
179
+
180
+ {
181
+ marginRight: 5,
182
+ stack: [{ text: 'Invoice No : ' + InvoicePDFData._id, style: ['headerstyle'] },
183
+ { text: 'Date : ' + InvoicePDFData.CrDate, style: ['headerstyle'] }]
184
+ }]);
185
+ if (InvoicePDFData.Entity.PrBank) {
186
+ CustDetails.push([{ text: 'Note: OUR BANK A/C: ' + InvoicePDFData.Entity.Bank.ACNo + ', IFSC CODE: ' + InvoicePDFData.Entity.Bank.IFSC + ', Account Holder Name: ' + InvoicePDFData.Entity.Bank.ACName + ', BANK NAME: ' + InvoicePDFData.Entity.Bank.Name, colSpan: 3, fontSize: 8 }]);
187
+ }
188
+
189
+ return CustDetails;
190
+ }
191
+
192
+
193
+ static GetAddress1(Customer: any) {
194
+ var Address = this.GetFormatAddress(Customer);
195
+ if (Address.length !== 5) {
196
+ return Address;
197
+ } else {
198
+ let a: any = '';
199
+ return a;
200
+ }
201
+ }
202
+
203
+ static GetFormatAddress(CustomerObj: any) {
204
+ var Addressnew = '';
205
+ if (!TrUtils.IsNull(CustomerObj.Adrs)) {
206
+ CustomerObj.Adrs.forEach((Adrs: any, index: any) => {
207
+ Addressnew = Addressnew + Adrs;
208
+ if (CustomerObj.Adrs.length > (index + 1)) {
209
+ Addressnew = Addressnew + ', '
210
+ }
211
+ });
212
+ }
213
+
214
+ return Addressnew;
215
+ }
216
+
217
+ static GetCustomerDetails(Customer: any, Type: any, Vehicle: any, Settings: any, CustHeader: string) {
218
+ if (TrUtils.IsNull(Customer)) {
219
+ return this.emptyObject();
220
+ }
221
+
222
+ let Data: any = [{ text: CustHeader + ':', style: 'hed', bold: true },
223
+ { text: Customer.Name, marginTop: 2 },
224
+ { text: this.GetAddress1(Customer), marginTop: 3, fontSize: 7 },
225
+ this.GetCustPhoneNumber(Customer, Type),
226
+ this.GetCustomerName(Customer.CustName)]
227
+
228
+ return {
229
+ style: 'colum1',
230
+ stack: Data
231
+ };
232
+ }
233
+
234
+ static GetFormatContact(CustomerObj: any) {
235
+ var contactnew = '';
236
+ if (!TrUtils.IsNull(CustomerObj.Cons)) {
237
+ CustomerObj.Cons.forEach((Contact: any) => {
238
+ contactnew = contactnew + '(' + Contact.Type + '):' + Contact.No + '\n';
239
+ });
240
+ }
241
+
242
+ return contactnew;
243
+ }
244
+
245
+ static GetCustPhoneNumber(Customer: any, Type: any) {
246
+ if (Type !== 'Technician Copy') {
247
+ var contact = this.GetFormatContact(Customer);
248
+ if (contact.length !== 0) {
249
+ return { columns: [{ text: 'Phone', width: 27, style: 'hed' }, contact] };
250
+ } else {
251
+ return this.emptyObject();
252
+ }
253
+
254
+ } else {
255
+ return this.emptyObject();
256
+ }
257
+ }
258
+
259
+ static emptyObject() {
260
+ let a: any = {};
261
+ return a;
262
+ }
263
+
264
+ static GetCustomerName(Customer: any) {
265
+ if (!TrUtils.IsEmpty(Customer)) {
266
+ let GSTIN = { columns: [{ text: 'Customer Name :', width: 65, bold: true }, { text: Customer }] };
267
+ return GSTIN;
268
+ } else {
269
+ return this.emptyObject();
270
+ }
271
+
272
+ }
273
+
274
+ static GetCustomerGSTIN(Customer: any) {
275
+ if (!TrUtils.IsEmpty(Customer.GSTIN)) {
276
+ let GSTIN = { columns: [{ text: 'GSTIN :', width: 33, style: 'hed' }, { text: Customer.GSTIN, marginTop: 1.5 }] };
277
+ return GSTIN;
278
+ } else {
279
+ return this.emptyObject();
280
+ }
281
+
282
+ }
283
+
284
+ static GetCustomerDLNo(Customer: any) {
285
+ if (!TrUtils.IsEmpty(Customer.DLNo)) {
286
+ let GSTIN = { columns: [{ text: 'DL No :', width: 33, style: 'hed' }, { text: Customer.DLNo, marginTop: 1.5 }] };
287
+ return GSTIN;
288
+ } else {
289
+ return this.emptyObject();
290
+ }
291
+
292
+ }
293
+
294
+ static HeaderLayOut() {
295
+ return {
296
+ hLineWidth: function (i: any, node: any) {
297
+
298
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0;
299
+ },
300
+ vLineWidth: function (i: any, node: any) {
301
+ return (i === 0 || i === node.table.widths.length) ? 1 : 0;
302
+ },
303
+ hLineColor: function (i: any, node: any) {
304
+ return 'gray';
305
+ },
306
+ vLineColor: function (i: any, node: any) {
307
+ return 'gray';
308
+ },
309
+ };
310
+ }
311
+
312
+ static GetHeaderInfo(InvoicePDFData: any, marginleft: number) {
313
+ let TaxInfo: any = [];
314
+ if (!TrUtils.IsEmpty(InvoicePDFData.Entity.GSTIN)) {
315
+ TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft: marginleft, alignment: 'left', fontSize: 9, width: 'auto' },
316
+ );
317
+ }
318
+ if (!TrUtils.IsEmpty(InvoicePDFData.Entity.DLNo)) {
319
+ TaxInfo.push({ text: 'D.L.NO : ' + InvoicePDFData.Entity.DLNo, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: '*' },
320
+ );
321
+ }
322
+
323
+ TaxInfo.push(this.GetBillofSupplyName(InvoicePDFData.Settings));
324
+
325
+
326
+ return TaxInfo;
327
+ }
328
+
329
+ static GetMarginsBasedOnPaperSize(size: any) {
330
+ if (size === 'full') {
331
+ return [20, 15, 20, 15];
332
+ } else {
333
+ return [20, 15, 20, 435.945];
334
+ }
335
+ }
336
+
337
+ static GrandTotalTable(data: any) {
338
+ var body: any = [];
339
+ data.forEach((row: any) => {
340
+ if (!TrUtils.IsFixedZero(row.value) || row.name === 'Total') {
341
+ var dataRow: any = [];
342
+ dataRow.push({ text: (row.name).toString(), noWrap: true });
343
+ dataRow.push(':');
344
+ if (row.name === 'Final Total') {
345
+ dataRow.push({ text: (row.value).toString(), noWrap: true, bold: true, fontSize: 12, alignment: 'right' });
346
+ } else if (!TrUtils.IsNull(row.value)) {
347
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right' });
348
+ } else {
349
+ dataRow.push({ text: '', noWrap: true, alignment: 'right' });
350
+ }
351
+ body.push(dataRow);
352
+ }
353
+ });
354
+ return body;
355
+ }
356
+
357
+ static GetBillofSupplyName(Settings: any) {
358
+ return { text: Settings.Tax === 'BS' ? ' Bill of Supply' : null, alignment: 'center', marginLeft: 15, marginTop: 2, marginBottom: 3, fontSize: 9, width: 'auto' };
359
+ }
360
+
361
+ static GetDiscountOverall(InvoicePDFData: any) {
362
+ return TrUtils.FixPriceValue(Number(InvoicePDFData.FixedDisc));
363
+ }
364
+
365
+ static CustomerAndVehicleDetailsAfterLine(size: any) {
366
+ let length: any = 575;
367
+ if (size === 'A3') {
368
+ length = 820;
369
+ } else if (size === 'Custom') {
370
+ length = 575;
371
+ }
372
+ return {
373
+ canvas: [
374
+ {
375
+ type: 'line',
376
+ lineColor: 'gray',
377
+ x1: 0,
378
+ y1: 0,
379
+ x2: 540,
380
+ y2: 0,
381
+ lineWidth: 1
382
+ }
383
+ ]
384
+ };
385
+ }
386
+
387
+ // static GetSignatures(CName: any, Total:any) {
388
+ // return {
389
+ // columns: [{
390
+ // stack: [
391
+ // { columns: [this.GetNumberInWords(Total), this.CompanyName(CName)] }
392
+ // ]
393
+ // }],
394
+ // };
395
+ // }
396
+
397
+ static GetSignatures(CName: any, Total: any) {
398
+ return [['', this.CompanyName(CName)]];
399
+
400
+ }
401
+
402
+ static CompanyName(CName: any) {
403
+ return {
404
+ style: 'forCompany1',
405
+ text: ['For ', { text: CName, bold: 'true' }],
406
+ };
407
+ }
408
+
409
+ static Authorizedsignature() {
410
+ return {
411
+ style: 'Sign',
412
+ text: ['Authorized Signatory'],
413
+ };
414
+ }
415
+
416
+ static CustomerSignature() {
417
+ return {
418
+ style: 'Sign',
419
+ text: ['Customer Signature'], marginLeft: 90
420
+ };
421
+ }
422
+
423
+ static GetItemsTable(Services: any, Items: any, ShowTaxColumn: boolean, SType: any, printOptions: any, size: any, DecimalsNumber: number) {
424
+ return {
425
+ style: 'tableExample',
426
+ marginTop: 3,
427
+ marginBottom: 5,
428
+ table: {
429
+ widths: this.GetWidths(ShowTaxColumn, printOptions),
430
+ headerRows: 1,
431
+ body: this.BuildTableBodyForLaborAndParts(Services, Items, ShowTaxColumn, SType, printOptions, size, DecimalsNumber)
432
+ },
433
+ layout: {
434
+ hLineWidth: function (i: any, node: any) {
435
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0;
436
+ },
437
+ vLineWidth: function (i: any, node: any) {
438
+ return (i === 0 || i === node.table.widths.length) ? 1 : 0.5;
439
+ },
440
+ hLineColor: function (i: any, node: any) {
441
+ return 'gray';
442
+ },
443
+ vLineColor: function (i: any, node: any) {
444
+ return 'gray';
445
+ },
446
+ }
447
+ };
448
+ }
449
+
450
+ static GetWidths(ShowTaxColumn: any, printOptions: any) {
451
+ if (ShowTaxColumn && printOptions.ShowTax !== 'NO') {
452
+ if (printOptions.Disc === 'NO') {
453
+ return [16, '*', 40, 45, 25, 20, 20, 45, 45, 30, 50];
454
+ } else {
455
+ return [16, '*', 40, 45, 25, 20, 20, 45, 45, 35, 35, 45];
456
+ }
457
+ } else {
458
+ if (printOptions.Disc === 'NO') {
459
+ return [22, '*', 40, 45, 25, 20, 20, 50, 50, 50];
460
+ } else {
461
+ return [22, '*', 40, 45, 25, 20, 20, 50, 50, 50, 50];
462
+ }
463
+ }
464
+ }
465
+
466
+ static GetAddress(Entity: any) {
467
+ return Entity.Adrs1 + ', ' + Entity.Adrs2 + ', ' + Entity.City + '-' + Entity.PIN + ', Cell : ' + Entity.Phone;
468
+ }
469
+
470
+ static BuildTableBodyForLaborAndParts(Services: any, Items: any, ShowTaxColumn: any, SType: any, printOptions: any, size: any, DecimalsNumber: number) {
471
+ let body: any = this.GetHeaderNames(ShowTaxColumn, SType, printOptions);
472
+ let j = 1;
473
+ if (!TrUtils.IsNull(Services) && Services.length !== 0) {
474
+ Services.forEach((item: any, index: any) => {
475
+ let dataRow: any = [];
476
+ dataRow.push({ text: index + 1, });
477
+ if (!TrUtils.IsEmpty(item.EDesc)) {
478
+ let DescData: any = [];
479
+ DescData.push({ text: item.Desc, });
480
+ if (!TrUtils.IsEmpty(item['EDesc'])) {
481
+ DescData.push({ text: item.EDesc, color: 'grey' });
482
+ }
483
+ dataRow.push({ stack: DescData });
484
+ } else {
485
+ dataRow.push({ text: item.Desc, });
486
+ }
487
+ if (ShowTaxColumn) {
488
+ dataRow.push({ text: item.SAC, alignment: 'center', style: ['headerstyle'], });
489
+ }
490
+ dataRow.push({ text: '', alignment: 'center', style: ['headerstyle'], });
491
+ dataRow.push({ text: '', alignment: 'center', style: ['headerstyle'], });
492
+ dataRow.push({ text: item.Qty, alignment: 'right', style: ['headerstyle'], });
493
+ dataRow.push({ text: '', alignment: 'right', style: ['headerstyle'], });
494
+ dataRow.push({ text: '', alignment: 'right', style: ['headerstyle'], });
495
+ dataRow.push({ text: TrUtils.FixPriceValue(item.Pr, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
496
+ if (printOptions.Disc !== 'NO') {
497
+ if (printOptions.Disc === 'PERC') {
498
+ dataRow.push({ text: TrUtils.FixPriceValue(item.DiscPerc, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
499
+ } else {
500
+ dataRow.push({ text: TrUtils.FixPriceValue(item.Disc, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
501
+ }
502
+ }
503
+
504
+ if (ShowTaxColumn && printOptions.ShowTax !== 'NO') {
505
+ let Tax: any = item.TaxName?.split('%');
506
+ dataRow.push({ text: TrUtils.IsNull(Tax) ? '' : Tax[0], alignment: 'right', style: ['headerstyle'], });
507
+ }
508
+ dataRow.push({ text: item.Ret ? '-' + TrUtils.FixPriceValue(item.LineTotal, DecimalsNumber) : TrUtils.FixPriceValue(item.LineTotal, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
509
+
510
+
511
+ body.push(dataRow);
512
+ if (index + 1 === j * 9) {
513
+ j++;
514
+ if (size === 'diff') {
515
+
516
+ let dataRow1: any = [{ text: '', pageBreak: 'after' }, '', '', '', '', ''];
517
+ if (ShowTaxColumn) {
518
+ dataRow1.push('');
519
+ dataRow1.push('');
520
+ }
521
+ body.push(dataRow1);
522
+ }
523
+
524
+ }
525
+ });
526
+ }
527
+ if (!TrUtils.IsNull(Items) && Items.length !== 0) {
528
+ if (!TrUtils.IsNull(Services) && Services.length !== 0) {
529
+ let dataRow: any = [];
530
+ dataRow.push({ text: '', });
531
+ dataRow.push({ text: '', });
532
+ if (ShowTaxColumn) {
533
+ dataRow.push({ text: '', alignment: 'center', style: ['headerstyle'], });
534
+ }
535
+ dataRow.push({ text: '', alignment: 'center', style: ['headerstyle'], });
536
+ dataRow.push({ text: '', alignment: 'center', style: ['headerstyle'], });
537
+ dataRow.push({ text: '', alignment: 'right', style: ['headerstyle'], });
538
+ dataRow.push({ text: '', alignment: 'right', style: ['headerstyle'], });
539
+ dataRow.push({ text: '', alignment: 'right', style: ['headerstyle'], });
540
+ dataRow.push({ text: '', alignment: 'right', style: ['headerstyle'], });
541
+ if (printOptions.Disc !== 'NO') {
542
+ if (printOptions.Disc === 'PERC') {
543
+ dataRow.push({ text: '', alignment: 'right', style: ['headerstyle'], });
544
+ } else {
545
+ dataRow.push({ text: '', alignment: 'right', style: ['headerstyle'], });
546
+ }
547
+ }
548
+
549
+ if (ShowTaxColumn && printOptions.ShowTax !== 'NO') {
550
+ dataRow.push({ text: '', alignment: 'right', style: ['headerstyle'], });
551
+ }
552
+ dataRow.push({ text: '', alignment: 'right', style: ['headerstyle'], });
553
+
554
+
555
+ body.push(dataRow);
556
+ }
557
+ Items.forEach((item: any, index: any) => {
558
+ let dataRow: any = [];
559
+ dataRow.push({ text: index + 1, });
560
+ // dataRow.push({ text: item.Desc, });
561
+ if (!TrUtils.IsEmpty(item.EDesc)) {
562
+ let DescData: any = [];
563
+ DescData.push({ text: item.Desc, });
564
+ if (!TrUtils.IsEmpty(item['EDesc'])) {
565
+ DescData.push({ text: item.EDesc, color: 'grey' });
566
+ }
567
+ dataRow.push({ stack: DescData });
568
+ } else {
569
+ dataRow.push({ text: item.Desc, });
570
+ }
571
+ if (ShowTaxColumn) {
572
+ dataRow.push({ text: item.HSN, alignment: 'center', style: ['headerstyle'], });
573
+ }
574
+ dataRow.push({ text: item.Batch?.BN, alignment: 'center', style: ['headerstyle'], });
575
+ dataRow.push({ text: MyDate.ConvertUTCDateToReadableExDate(item['Batch']?.ExDt), alignment: 'center', style: ['headerstyle'], });
576
+ dataRow.push({ text: item.QtyAndUoM, alignment: 'right', style: ['headerstyle'], });
577
+ dataRow.push({ text: item.OfQty, alignment: 'right', style: ['headerstyle'], });
578
+ dataRow.push({ text: TrUtils.FixPriceValue(item.MRP, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
579
+ dataRow.push({ text: TrUtils.FixPriceValue(item.UnPr, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
580
+ if (printOptions.Disc !== 'NO') {
581
+ if (printOptions.Disc === 'PERC') {
582
+ dataRow.push({ text: TrUtils.FixPriceValue(item.DiscPerc, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
583
+ } else {
584
+ dataRow.push({ text: TrUtils.FixPriceValue(item.Disc, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
585
+ }
586
+ }
587
+
588
+ if (ShowTaxColumn && printOptions.ShowTax !== 'NO') {
589
+ let Tax: any = item.TaxName?.split('%');
590
+ dataRow.push({ text: TrUtils.IsNull(Tax) ? '' : Number(Tax[0]), alignment: 'right', style: ['headerstyle'], });
591
+ }
592
+ dataRow.push({ text: item.Ret ? '-' + TrUtils.FixPriceValue(item.LineTotal, DecimalsNumber) : TrUtils.FixPriceValue(item.LineTotal, DecimalsNumber), alignment: 'right', style: ['headerstyle'], });
593
+
594
+
595
+ body.push(dataRow);
596
+ if (index + 1 === j * 9) {
597
+ j++;
598
+ if (size === 'diff') {
599
+
600
+ let dataRow1: any = [{ text: '', pageBreak: 'after' }, '', '', '', '', ''];
601
+ if (ShowTaxColumn) {
602
+ dataRow1.push('');
603
+ dataRow1.push('');
604
+ }
605
+ body.push(dataRow1);
606
+ }
607
+
608
+ }
609
+ });
610
+ }
611
+
612
+
613
+
614
+
615
+ return body;
616
+ }
617
+
618
+ static GetHeaderNames(ShowTaxColumn: any, SType: any, printOptions: any) {
619
+ let HeadingNames: any;
620
+ if (ShowTaxColumn) {
621
+ HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left', fontSize: 7 },
622
+ { text: 'Item Name', style: 'tableheader1', Field: 'Desc', alignment: 'left', line: true },
623
+ { text: 'HSN/SAC', style: 'tableheader1', Field: 'HSN' },
624
+ { text: 'Batch No.', style: 'tableheader1', Field: 'Batches' },
625
+ { text: 'Ex.Dt', style: 'tableheader1', Field: 'ExDate' },
626
+ { text: 'Qty', style: 'tableheader1', Field: 'Qty', alignment: 'right' },
627
+ { text: 'Free', style: 'tableheader1', Field: 'OfQty', alignment: 'right' },
628
+ { text: 'MRP', style: 'tableheader1', Field: 'MRP', alignment: 'right' },
629
+ { text: 'Price', style: 'tableheader1', Field: 'UnPr', alignment: 'right' },
630
+ { text: 'Line Total', style: 'tableheader1', Field: 'LineTotal', alignment: 'right' }]];
631
+
632
+ if (printOptions.Disc !== 'NO') {
633
+ HeadingNames[0].splice(9, 0, { text: (printOptions.Disc === 'PERC') ? 'Disc(%)' : 'Disc(Rs)', style: 'tableheader1', Field: 'Disc' },
634
+ )
635
+ }
636
+ if (printOptions.ShowTax !== 'NO') {
637
+ HeadingNames[0].splice(10, 0, { text: (SType === 'Intra') ? 'GST(%)' : 'IGST(%)', style: 'tableheader1', Field: 'TaxAmount', alignment: 'right' }
638
+ )
639
+ }
640
+ } else {
641
+ HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left' },
642
+ { text: 'Item Name', style: 'tableheader1', Field: 'Desc', alignment: 'left', line: true },
643
+ { text: 'Batch No.', style: 'tableheader1', Field: 'Batches', alignment: 'left' },
644
+ { text: 'Ex.Dt', style: 'tableheader1', Field: 'ExDate', alignment: 'left' },
645
+ { text: 'Qty', style: 'tableheader1', Field: 'Qty', alignment: 'right' },
646
+ { text: 'Free', style: 'tableheader1', Field: 'OfQty', alignment: 'right' },
647
+ { text: 'MRP', style: 'tableheader1', Field: 'MRP', alignment: 'right' },
648
+ { text: 'Price', style: 'tableheader1', Field: 'UnPr', alignment: 'right' },
649
+ // { text: 'Disc(%)', style: 'tableheader1', Field: 'Disc' },
650
+ { text: 'Line Total', style: 'tableheader1', Field: 'LineTotal', alignment: 'right' }]];
651
+ if (printOptions.Disc !== 'NO') {
652
+ HeadingNames[0].splice(8, 0, { text: (printOptions.Disc === 'PERC') ? 'Disc(%)' : 'Disc(Rs)', style: 'tableheader1', Field: 'Disc' },
653
+ )
654
+ }
655
+ }
656
+ return HeadingNames;
657
+ }
658
+
659
+ static TotalDetails(ROPrintData: any, moreDiscDetails: boolean, DecimalsNumber: number) {
660
+ let totalDisc: any;
661
+ let totalTax: any;
662
+ if (!ROPrintData.Consolidate) {
663
+ totalTax = TrUtils.FixPriceValue(Add(Number(ROPrintData.CustLaborITax), Number(ROPrintData.CustPartITax)), DecimalsNumber);
664
+ if (TrUtils.isTaxable(ROPrintData.Settings.Tax)) {
665
+ totalDisc = TrUtils.FixPriceValue(Add(Number(ROPrintData.CustLaborDiscTotal), Number(ROPrintData.CustPartsDiscTotal)), DecimalsNumber);
666
+ } else {
667
+ totalDisc = TrUtils.FixPriceValue(Add(Number(ROPrintData.CustLaborDiscTotal), Number(ROPrintData.CustPartsDiscTotal)), DecimalsNumber);
668
+ }
669
+ }
670
+ return [
671
+ {
672
+ style: 'tableExample',
673
+ marginTop: -3,
674
+ table: {
675
+ widths: ['*', '*'],
676
+ body: [
677
+ [
678
+ {
679
+ stack: [this.PartsTaxAmounts1(ROPrintData.TaxSummary, true, ROPrintData.ShowIGST,
680
+ ROPrintData.ShowTaxColumn)]
681
+ },
682
+ {
683
+ columns: [{ text: '', width: moreDiscDetails ? 120 : 150 }, this.GrandTotal(ROPrintData, '0.00', ROPrintData.CustPartsTotalBeforeDisc, totalDisc, totalTax, ROPrintData.For,
684
+ ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, null, ROPrintData.Consolidate, ROPrintData.STotal, moreDiscDetails, ROPrintData.Entity.DecimalsNumber)],
685
+ }
686
+ ],
687
+ ]
688
+ },
689
+ layout: 'noBorders'
690
+ },
691
+ ];
692
+ }
693
+
694
+ static PartsTaxAmounts(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
695
+ if (ShowTaxColumn) {
696
+ return {
697
+ stack: [this.AllHSNPartCGSTTaxListTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
698
+ };
699
+ } else {
700
+ return '';
701
+ }
702
+ }
703
+
704
+ static GrandTotal(InvoiceData: any, LaborAfterGST: any, PartsAfterGST: any, OverAllRecordDiscount: any, totalTax: any, For: any, OverAllRecordTotal: any,
705
+ Rounded: any, GrandTotal: any, Adj: any, Consolidate: any, subTotal: any, moreDiscDetails: boolean, DecimalsNumber: number) {
706
+ let AccountFields = [
707
+ ];
708
+ if (moreDiscDetails) {
709
+ if (!TrUtils.IsZero(InvoiceData.PDisc)) {
710
+ AccountFields.push({ name: 'Items Discount', value: TrUtils.FixPriceValue(InvoiceData.PDisc, DecimalsNumber) });
711
+ }
712
+
713
+ if (!TrUtils.IsZero(InvoiceData.LDisc)) {
714
+ AccountFields.push({ name: 'Services Discount', value: TrUtils.FixPriceValue(InvoiceData.LDisc, DecimalsNumber) });
715
+ }
716
+
717
+ if (!TrUtils.IsZero(InvoiceData.Disc)) {
718
+ AccountFields.push({ name: 'Overall Discount', value: TrUtils.FixPriceValue(InvoiceData.Disc, DecimalsNumber) });
719
+ }
720
+ } else {
721
+ AccountFields.push({ name: 'Discount', value: OverAllRecordDiscount });
722
+ }
723
+ if (!Consolidate && !TrUtils.IsNull(subTotal)) {
724
+ AccountFields.unshift({ name: 'SubTotal', value: TrUtils.FixPriceValue(TrUtils.SetValueToZeroIfNull(Number(subTotal)), DecimalsNumber) });
725
+ } else {
726
+ if (!Consolidate) {
727
+ AccountFields.unshift({ name: 'SubTotal', value: TrUtils.FixPriceValue(Add(TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)), TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST))), DecimalsNumber) });
728
+ }
729
+ }
730
+
731
+ if (!TrUtils.IsEmpty(totalTax)) {
732
+ AccountFields.push({ name: 'Total Tax', value: totalTax });
733
+ }
734
+ if (!TrUtils.IsEmpty(Adj)) {
735
+ if (Adj > 0) {
736
+ Adj = '+' + TrUtils.FixPriceValue(Adj, DecimalsNumber);
737
+ }
738
+ AccountFields.push({ name: 'Adjust', value: Adj });
739
+ }
740
+ if (For === PayTypeEnum.Insurance) {
741
+ let total = {
742
+ name: 'Total',
743
+ value: OverAllRecordTotal
744
+ };
745
+ let Rounding = { name: 'Rounding', value: Rounded };
746
+ if (Rounding.value > 0) {
747
+ Rounding.value = '+' + Rounding.value;
748
+ }
749
+ let FinalTotal = { name: 'Final Total', value: GrandTotal, bold: true, fontSize: 12 };
750
+ AccountFields.push(total);
751
+ AccountFields.push(Rounding);
752
+ if (!TrUtils.IsFixedZero(Rounded)) {
753
+ AccountFields.push(FinalTotal);
754
+ }
755
+
756
+ } else {
757
+ let total = {
758
+ name: 'Total',
759
+ value: OverAllRecordTotal
760
+ };
761
+ let Rounding = { name: 'Rounding', value: Rounded };
762
+ let FinalTotal = { name: 'Final Total', value: GrandTotal };
763
+ if (Rounding.value > 0) {
764
+ Rounding.value = '+' + Rounding.value;
765
+ }
766
+ // AccountFields.push(total);
767
+ AccountFields.push(Rounding);
768
+ if (!TrUtils.IsFixedZero(Rounded)) {
769
+ AccountFields.push(FinalTotal);
770
+ }
771
+ }
772
+ return {
773
+ style: ['columnheader', 'TotalsStyles'],
774
+ lineHeight: 0.7,
775
+ marginBottom: 5,
776
+ width: 'auto',
777
+ table: {
778
+ widths: ['auto', 'auto', 60],
779
+ body: this.GrandTotalTable(AccountFields)
780
+ },
781
+ layout: 'noBorders'
782
+ };
783
+ }
784
+
785
+ static AllHSNPartCGSTTaxListTable(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
786
+
787
+ if (ShowIGST) {
788
+ return {
789
+ style: 'tableExample1',
790
+ table: {
791
+ widths: [50, 30, 45, 45],
792
+ headerRows: 1,
793
+ body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
794
+ },
795
+ layout: this.HeaderLineStyle(),
796
+ };
797
+ } else {
798
+ return {
799
+ style: 'tableExample1',
800
+ table: {
801
+ widths: [50, 30, 30, 60, 60],
802
+ headerRows: 1,
803
+ body: this.CreateHSNTaxTable(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
804
+ },
805
+ layout: this.HeaderLineStyle(),
806
+ };
807
+ }
808
+ }
809
+
810
+ static PartsTaxAmounts1(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
811
+ if (ShowTaxColumn && !TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length > 0) {
812
+ return {
813
+ stack: [this.AllHSNPartCGSTTaxListTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)]
814
+ };
815
+ } else {
816
+ return '';
817
+ }
818
+ }
819
+
820
+ static AllHSNPartCGSTTaxListTable1(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
821
+
822
+ if (ShowIGST) {
823
+ return {
824
+ style: 'tableExample',
825
+ table: {
826
+ widths: [25, 60, 50],
827
+ headerRows: 1,
828
+ body: this.CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
829
+ },
830
+ layout: this.HeaderLineStyle(),
831
+ };
832
+ } else {
833
+ return {
834
+ style: 'tableExample',
835
+ table: {
836
+ widths: [25, 60, 40, 40],
837
+ headerRows: 1,
838
+ body: SharedPDFService.CreateHSNTaxTable1(PartsTaxInfo, ShowAccParts, ShowIGST, ShowTaxColumn)
839
+ },
840
+ layout: this.HeaderLineStyle(),
841
+ };
842
+ }
843
+ }
844
+
845
+ static CreateHSNTaxTable1(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
846
+ if (!TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
847
+ var body: any = [];
848
+ let columns: any = this.CreateHeadingAllTaxList(ShowIGST);
849
+ body.push(columns);
850
+ PartsTaxInfo.forEach((part: any) => {
851
+ var dataRow: any = [];
852
+ columns.forEach((column: any) => {
853
+ if (!TrUtils.IsFixedZero(part[column.Field]) &&
854
+ !TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt'
855
+ || column.Field === 'TotalTaxableAmount') {
856
+ if (column.Field === 'TotalTaxableAmount' || column.Field === 'SGSTAmt' || column.Field === 'CGSTAmt' || column.Field === 'IGSTAmt') {
857
+ dataRow.push({ text: TrUtils.FixPriceValue(part[column.Field]), alignment: 'right', opacity: 0.7, nowrap: true, fontSize: 6 });
858
+ } else if (column.Field === 'CombinedTaxPercentage') {
859
+ dataRow.push({ text: part[column.Field].toString() + '%', alignment: 'left', opacity: 0.7, nowrap: true, fontSize: 6 });
860
+ } else {
861
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'left', opacity: 0.7, nowrap: true, fontSize: 6 });
862
+ }
863
+ } else {
864
+ part[column.Field] = '';
865
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'left', opacity: 0.7, fontSize: 6 });
866
+ }
867
+ });
868
+
869
+ body.push(dataRow);
870
+ });
871
+ return body;
872
+ } else {
873
+ return [{}];
874
+ }
875
+ }
876
+
877
+ static CreateHeadingAllHSNTaxList(ShowIGST: any) {
878
+ let HeaderNames = [{ text: 'HSN', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'HSN', alignment: 'right' },
879
+ { text: 'Taxable Value', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxableAmount', alignment: 'right' },
880
+ { text: 'Amount', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount', alignment: 'right' },
881
+ ];
882
+ if (ShowIGST) {
883
+ HeaderNames.splice(1, 0, { text: 'IGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'IGST', alignment: 'right' })
884
+ } else {
885
+ HeaderNames.splice(1, 0, { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST', alignment: 'right' })
886
+ HeaderNames.splice(2, 0, { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST', alignment: 'right' })
887
+ }
888
+ return HeaderNames;
889
+ }
890
+
891
+ static CreateHeadingAllTaxList(ShowIGST: any) {
892
+ let HeaderNames = [
893
+ // { text: 'CGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'CGST' },
894
+ // { text: 'SGST', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'SGST' },
895
+ // { text: 'Count', style: 'tableheader', fontSize: 6, lineHeight: 0.3, Field: 'PartsCount' },
896
+ { text: 'Tax Rate', style: 'tableheader2', fontSize: 6, lineHeight: 0.8, Field: 'CombinedTaxPercentage', alignment: 'left' },
897
+ { text: 'Taxable Amount', style: 'tableheader2', fontSize: 6, lineHeight: 0.8, Field: 'TotalTaxableAmount', alignment: 'right' },
898
+ // { text: 'Tax Amount', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'TotalTaxAmount' },
899
+ ];
900
+ if (ShowIGST) {
901
+ // HeaderNames.splice(1, 0, { text: 'IGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'IGST' });
902
+ HeaderNames.splice(2, 0, { text: 'IGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.8, Field: 'IGSTAmt', alignment: 'right' });
903
+ } else {
904
+ // HeaderNames.splice(1, 0, { text: 'CGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
905
+ HeaderNames.splice(2, 0, { text: 'CGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.8, Field: 'CGSTAmt', alignment: 'right' });
906
+ // HeaderNames.splice(3, 0, { text: 'SGST(%)', style: 'tableheader2', fontSize: 6, lineHeight: 0.3, Field: 'CGST' });
907
+ HeaderNames.splice(3, 0, { text: 'SGST(Rs.)', style: 'tableheader2', fontSize: 6, lineHeight: 0.8, Field: 'SGSTAmt', alignment: 'right' });
908
+ }
909
+ return HeaderNames;
910
+ }
911
+
912
+ static CreateHSNTaxTable(PartsTaxInfo: any, ShowAccParts: any, ShowIGST: any, ShowTaxColumn: any) {
913
+ if (!TrUtils.IsNull(PartsTaxInfo) && PartsTaxInfo.length !== 0 && ShowAccParts && ShowTaxColumn) {
914
+ var body: any = [];
915
+ let columns: any = this.CreateHeadingAllHSNTaxList(ShowIGST);
916
+ // body.push(columns);
917
+ PartsTaxInfo.forEach((part: any) => {
918
+ var dataRow: any = [];
919
+ columns.forEach((column: any) => {
920
+ if (!TrUtils.IsFixedZero(part[column.Field]) &&
921
+ !TrUtils.IsNull(part[column.Field]) || column.Field === 'SGST' || column.Field === 'CGST'
922
+ || column.Field === 'TotalTaxAmount') {
923
+ if (column.Field === 'HSN') {
924
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
925
+ } else {
926
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right', nowrap: true });
927
+ }
928
+ } else {
929
+ part[column.Field] = '';
930
+ dataRow.push({ text: part[column.Field].toString(), alignment: 'right' });
931
+ }
932
+ });
933
+
934
+ body.push(dataRow);
935
+ });
936
+ return body;
937
+ } else {
938
+ return [{}];
939
+ }
940
+ }
941
+
942
+ static GetNumberInWords(TotalAmount: any) {
943
+ var rupee = SharedPDFService.convertNumberToWords(TotalAmount);
944
+ // console.log('rupee', rupee);
945
+ return { columns: [{ text: 'In Words :', fontSize: 8, width: 45 }, { text: rupee, bold: true, fontSize: 8, width: '*' }] }
946
+ }
947
+
948
+ static HeaderLineStyle() {
949
+ return {
950
+ hLineWidth: function (i: any, node: any) {
951
+ return (i === 1) ? 0.1 : 0;
952
+ },
953
+ vLineWidth: function (i: any, node: any) {
954
+ return (i === 0 || i === node.table.widths.length) ? 0 : 0;
955
+ },
956
+ hLineColor: function (i: any, node: any) {
957
+ let color;
958
+ if (i === 0 || i === node.table.body.length) {
959
+ color = 'black';
960
+ } else {
961
+ if (i === 1) {
962
+ color = 'lightgray';
963
+ } else {
964
+ color = 'lightgray';
965
+ }
966
+ }
967
+
968
+ return color;
969
+ },
970
+ };
971
+ }
972
+ }