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,577 @@
1
+ import { TrUtils } from "../../utils/tr-utils";
2
+ import { SharedPDFService } from "../../shared/shared-pdf.service";
3
+ import JsBarcode from "jsbarcode";
4
+ import { Add } from "../../shared/math-operations";
5
+
6
+
7
+
8
+
9
+ export class PosReceiptPrintService {
10
+
11
+
12
+ static GetPrint(InvoicePDFData: any, size: string) {
13
+ // console.log('InvoicePDFData', InvoicePDFData);
14
+ if (TrUtils.IsNull(InvoicePDFData.Name)) {
15
+ InvoicePDFData.Name = '';
16
+ }
17
+ let dd: any = {
18
+ // info: {
19
+ // title: this.GetFileName(ROPrintData),
20
+ // },
21
+ info: {
22
+ title: 'CounterSale',
23
+ },
24
+ background: function (currentPage: any, pageSize: any) {
25
+ // if (size !== 'full') {
26
+ // pageSize.height = pageSize.height - 435.945;
27
+ // }
28
+ return SharedPDFService.GetWatermarkImage(InvoicePDFData.Image, pageSize, InvoicePDFData.Entity.Wmark);
29
+ },
30
+ header: function (currentPage: any, pageCount: any, pageSize: any) {
31
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 25, fontSize: 8, marginTop: 2 };
32
+ },
33
+ pageMargins: this.GetMarginsBasedOnPaperSize(size),
34
+ pageSize: 'A4',
35
+ // pageSize: {
36
+ // width: 595.28,
37
+ // height: 420.945
38
+ // },
39
+ // pageOrientation: 'portrait',
40
+ content: [
41
+ this.GetMainHeaderInfo(InvoicePDFData),
42
+ // { text: InvoicePDFData.Entity.CName, style: ['headerstyle'], alignment: 'center', fontSize: 20 },
43
+ // { text: this.GetAddress(InvoicePDFData.Entity), alignment: 'center', style: ['headerstyle'] },
44
+ // {
45
+ // columns: this.GetHeaderInfo(InvoicePDFData)
46
+ // },
47
+ // this.CustomerAndVehicleDetailsAfterLine(size),
48
+ // {
49
+ // columns: [{
50
+ // width: '*',
51
+ // // marginTop: 4,
52
+ // marginLeft: 5,
53
+ // stack: [{ text: 'Name : ' + InvoicePDFData.Customer.Name, style: ['headerstyle'] },
54
+ // { text: 'Doctor : ' + InvoicePDFData.Name, style: ['headerstyle'] }]
55
+ // }, {
56
+ // width: 'auto',
57
+ // // marginTop: 4,
58
+ // marginRight: 5,
59
+ // stack: [{ text: 'Bill No : ' + InvoicePDFData._id, style: ['headerstyle'] },
60
+ // { text: 'Date : ' + InvoicePDFData.CrDate, style: ['headerstyle'] }]
61
+ // }],
62
+ // columnGap: 10,
63
+ // marginTop: 5
64
+ // },
65
+
66
+ {
67
+ style: 'tableExample',
68
+ table: {
69
+ widths: ['*', 'auto', '*'],
70
+ body: [
71
+ [{
72
+ // marginTop: 4,
73
+ marginLeft: 5,
74
+ // stack: [{ text: 'UHID : ' + InvoicePDFData.Customer.Code, style: ['headerstyle'] },
75
+ // { text: 'Name : ' + InvoicePDFData.Customer.Name, style: ['headerstyle'] },
76
+ // { text: 'Doctor : ' + InvoicePDFData.Name, style: ['headerstyle'] }],
77
+ table: {
78
+ lineHeight: 0.5,
79
+ body: this.CustomerInfo(InvoicePDFData)
80
+ }, layout: 'noBorders'
81
+ }, this.GetBarCode(InvoicePDFData.Customer?.Code, InvoicePDFData.Entity.PrCustBar),
82
+ {
83
+ // marginTop: 4,
84
+ marginRight: 5,
85
+ marginLeft: 70,
86
+ // alignment: 'right',
87
+ // stack: [{ text: 'Bill No : ' + InvoicePDFData._id, style: ['headerstyle'] },
88
+ // { text: 'Date : ' + InvoicePDFData.CrDate, style: ['headerstyle'] }]
89
+ table: {
90
+ lineHeight: 0.5,
91
+ body: [
92
+ [{ text: 'Bill No', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData._id, style: ['headerstyle'] }],
93
+ [{ text: 'Date', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData.CrDate, style: ['headerstyle'] }],
94
+ // [{text:'Doctor', style: ['headerstyle']}, {text:':', style: ['headerstyle']}, {text: InvoicePDFData.Name, style: ['headerstyle']}]
95
+ ]
96
+ }, layout: 'noBorders'
97
+ }]
98
+ ]
99
+ },
100
+ layout: this.HeaderLayOut()
101
+ },
102
+
103
+ this.GetItemsTable(InvoicePDFData.Items, InvoicePDFData.ShowTaxColumn, size),
104
+ // { text: 'SubTotal : ' + InvoicePDFData.FixedSubTotal, style: ['headerstyle'], alignment: 'right' },
105
+ // { text: 'Discount : -' + InvoicePDFData.FixedDisc, style: ['headerstyle'], alignment: 'right' },
106
+ // { text: 'Adjust : ' + this.GetAdjustValue(InvoicePDFData.Adj), style: ['headerstyle'], alignment: 'right' },
107
+ {
108
+ columns: [{ text: '', width: '*' }, { text: this.finalReturnTotal(InvoicePDFData), width: '*', bold: true, fontSize: 10, alignment: 'center' },
109
+ this.GetTotalDetails(InvoicePDFData, size)]
110
+ },
111
+ // { text: '' , fontSize: 8, alignment: 'left' },
112
+ {
113
+ stack: ['* Goods once sold will not be taken back or exchanged',
114
+ '* PLEASE GET YOUR MEDICINES CHECKED BY YOUR DOCTOR BEFORE USE *'],
115
+ fontSize: 7,
116
+ marginLeft: 5
117
+ },
118
+ this.GetSignatures(InvoicePDFData.Entity.CName, InvoicePDFData.Type, InvoicePDFData.For),
119
+ ],
120
+ styles: {
121
+ headerstyle: {
122
+ fontFamily: 'Calibri',
123
+ fontSize: 9
124
+ },
125
+ Sign: {
126
+ fontSize: 8,
127
+ margin: [0, 30, 0, 5]
128
+ },
129
+ forCompany: {
130
+ // margin: [0, 10, 30, 0],
131
+ marginRight: 5,
132
+ marginTop: 10,
133
+ fontSize: 9,
134
+ alignment: 'right'
135
+ },
136
+ tableheader: {
137
+ bold: true,
138
+ fontFamily: 'Calibri',
139
+ margin: [0, 1, 0, 5],
140
+ alignment: 'center'
141
+ },
142
+ tableheader1: {
143
+ bold: true,
144
+ fontFamily: 'Calibri',
145
+ margin: [0, 2, 0, 2],
146
+ alignment: 'center'
147
+ },
148
+ tableExample: {
149
+ fontSize: 9
150
+ }
151
+ }
152
+
153
+ };
154
+ return dd;
155
+ }
156
+
157
+ static CustomerInfo(InvoicePDFData: any) {
158
+ let CustomerTable: any = [
159
+ [{ text: 'Name', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData.Customer.Name, style: ['headerstyle'] }],
160
+ [{ text: 'Doctor', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData.Name, style: ['headerstyle'] }]
161
+ ];
162
+ if (InvoicePDFData.Customer.Code) {
163
+ CustomerTable.unshift([{ text: 'UHID', style: ['headerstyle'] }, { text: ':', style: ['headerstyle'] }, { text: InvoicePDFData.Customer.Code, style: ['headerstyle'] }]);
164
+ }
165
+
166
+ return CustomerTable;
167
+
168
+ }
169
+
170
+ static GetBarCode(code: string, PrCustBar: boolean) {
171
+ if (!TrUtils.IsNull(code) && PrCustBar) {
172
+ return { svg: this.textToSvgBarcode(code).svg }
173
+ } else {
174
+ return {};
175
+ }
176
+ }
177
+
178
+ static textToSvgBarcode(text: string): any {
179
+ const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
180
+ JsBarcode(svgElement, text, {
181
+ format: "CODE128", width: 1.25, height: 25, margin: 0, marginTop: 8,
182
+ displayValue: true, fontSize: 7, textMargin: 0, fontOptions: 'bold'
183
+ });
184
+ return { svg: svgElement.outerHTML };
185
+ }
186
+
187
+
188
+ static HeaderLayOut() {
189
+ return {
190
+ hLineWidth: function (i: any, node: any) {
191
+
192
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0;
193
+ },
194
+ vLineWidth: function (i: any, node: any) {
195
+ return (i === 0 || i === node.table.widths.length) ? 1 : 0;
196
+ },
197
+ // hLineStyle: function (i, node) {
198
+ // return (i === 0 || i === 1) ? { dash: { length: 5, space: 5 } } : null;
199
+ // },
200
+ hLineColor: function (i: any, node: any) {
201
+ return 'gray';
202
+ },
203
+ vLineColor: function (i: any, node: any) {
204
+ return 'gray';
205
+ },
206
+ };
207
+ }
208
+
209
+ static GetMainHeaderInfo(InvoicePDFData: any) {
210
+ if (!TrUtils.IsNull(InvoicePDFData.Image)) {
211
+ return {
212
+ columns: [{ image: InvoicePDFData.Image, width: 60, height: 60, marginBottom: 5 },
213
+ {
214
+ stack: [
215
+ { text: InvoicePDFData.Entity.CName, style: ['headerstyle'], alignment: 'left', fontSize: 15 },
216
+ { text: this.GetAddress(InvoicePDFData.Entity), alignment: 'left', style: ['headerstyle'] },
217
+ {
218
+ columns: this.GetHeaderInfo(InvoicePDFData, 0)
219
+ },
220
+ { text: InvoicePDFData.HeaderName, alignment: 'center', style: ['Receiptheader1'], marginTop: 5 }
221
+ ]
222
+ }
223
+ ], columnGap: 10
224
+ }
225
+ } else {
226
+ return {
227
+ stack: [
228
+ { text: InvoicePDFData.Entity.CName, style: ['headerstyle'], alignment: 'center', fontSize: 15 },
229
+ { text: this.GetAddress(InvoicePDFData.Entity), alignment: 'center', style: ['headerstyle'] },
230
+ {
231
+ columns: this.GetHeaderInfo(InvoicePDFData, 5)
232
+ },
233
+ { text: InvoicePDFData.HeaderName, alignment: 'center', style: ['Receiptheader1'] }
234
+ ]
235
+ }
236
+ }
237
+
238
+ }
239
+
240
+ static GetHeaderInfo(InvoicePDFData: any, marginleft: number) {
241
+ let TaxInfo: any = [];
242
+ if (!TrUtils.IsEmpty(InvoicePDFData.Entity.GSTIN)) {
243
+ TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft: marginleft, alignment: 'left', fontSize: 9, width: 'auto' },
244
+ );
245
+ }
246
+ if (!TrUtils.IsEmpty(InvoicePDFData.Entity.DLNo)) {
247
+ TaxInfo.push({ text: 'D.L.NO : ' + InvoicePDFData.Entity.DLNo, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: '*' },
248
+ );
249
+ }
250
+
251
+ TaxInfo.push(this.GetBillofSupplyName(InvoicePDFData.Settings));
252
+
253
+
254
+ return TaxInfo;
255
+ }
256
+
257
+ // static GetHeaderInfo(InvoicePDFData: any) {
258
+ // let TaxInfo: any = [];
259
+ // if (!TrUtils.IsEmpty(InvoicePDFData.Entity.GSTIN)) {
260
+ // TaxInfo.push({ text: 'GSTIN : ' + InvoicePDFData.Entity.GSTIN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: 'auto' },
261
+ // );
262
+ // }
263
+ // // if (!TrUtils.IsEmpty(InvoicePDFData.Entity.PAN)) {
264
+ // // TaxInfo.push({ text: 'PAN : ' + InvoicePDFData.Entity.PAN, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: 'auto' },
265
+ // // );
266
+ // // }
267
+ // if (!TrUtils.IsEmpty(InvoicePDFData.Entity.DLNo)) {
268
+ // TaxInfo.push({ text: 'D.L.NO : ' + InvoicePDFData.Entity.DLNo, marginTop: 2, marginLeft: 5, alignment: 'left', fontSize: 9, width: '*' },
269
+ // );
270
+ // }
271
+
272
+ // TaxInfo.push(this.GetBillofSupplyName(InvoicePDFData.Settings));
273
+
274
+
275
+ // return TaxInfo;
276
+ // }
277
+
278
+ static finalReturnTotal(InvoicePDFData: any) {
279
+ // if (!TrUtils.IsFixedZero(InvoicePDFData.CustRetRoundedTotal)) {
280
+ // return 'Returns Total : ' + InvoicePDFData.CustRetRoundedTotal
281
+ // } else {
282
+ return '';
283
+ // }
284
+ }
285
+
286
+ static GetMarginsBasedOnPaperSize(size: any) {
287
+ if (size === 'full') {
288
+ return [25, 15, 25, 15];
289
+ } else {
290
+ return [25, 15, 25, 435.945];
291
+ }
292
+ }
293
+
294
+ static GetTotalDetails(InvoicePDFData: any, size: any) {
295
+ let TotalData: any = [];
296
+
297
+ if (!InvoicePDFData.Consolidate && !TrUtils.IsFixedZero(InvoicePDFData.STotal)) {
298
+ // TotalData.push({ text: 'Sub Total : ' + InvoicePDFData.STotal, style: ['headerstyle'], alignment: 'right', marginRight: 5, })
299
+ TotalData.push({ name: 'Sub Total', value: InvoicePDFData.STotal });
300
+ } else {
301
+ TotalData.push({ name: 'Sub Total', value: TrUtils.FixPriceValue(Add(InvoicePDFData.CustNonRetRoundedTotal, InvoicePDFData.CustPartsDiscTotal)) });
302
+
303
+ }
304
+ if (!TrUtils.IsFixedZero(this.GetDiscountOverall(InvoicePDFData))) {
305
+ // TotalData.push({ text: 'Discount : -' + this.GetDiscountOverall(InvoicePDFData), style: ['headerstyle'], alignment: 'right', marginRight: 5, });
306
+ TotalData.push({ name: 'Discount', value: this.GetDiscountOverall(InvoicePDFData) });
307
+ }
308
+ if (!InvoicePDFData.Consolidate && !TrUtils.IsFixedZero(InvoicePDFData.CustPartITax) && TrUtils.IsFixedZero(InvoicePDFData.CustRetRoundedTotal)) {
309
+ TotalData.push({ name: 'Tax Amount', value: TrUtils.FixPriceValue(InvoicePDFData.CustPartITax) });
310
+ }
311
+ if (!TrUtils.IsFixedZero(InvoicePDFData.Round) && TrUtils.IsFixedZero(InvoicePDFData.CustRetRoundedTotal)) {
312
+ TotalData.push({ name: 'Round off', value: TrUtils.FixPriceValue(InvoicePDFData.Round) });
313
+ }
314
+ if (!TrUtils.IsFixedZero(InvoicePDFData.CustRetRoundedTotal)) {
315
+ // TotalData.push({ text: 'Total : ' + InvoicePDFData.CustRoundedTotal, style: ['headerstyle'], alignment: 'right', marginRight: 5, });
316
+ TotalData.push({ name: 'Total', value: InvoicePDFData.CustNonRetRoundedTotal });
317
+ TotalData.push({ name: 'Returns Total', value: InvoicePDFData.CustRetRoundedTotal });
318
+ }
319
+
320
+ if (!TrUtils.IsFixedZero(InvoicePDFData.CustRoundedTotal)) {
321
+ // TotalData.push({ text: 'Total : ' + InvoicePDFData.CustRoundedTotal, style: ['headerstyle'], alignment: 'right', marginRight: 5, });
322
+ TotalData.push({ name: 'Final Total', value: InvoicePDFData.CustRoundedTotal });
323
+ }
324
+
325
+ if (!TrUtils.IsFixedZero(InvoicePDFData.Due)) {
326
+ // TotalData.push({ text: 'Total : ' + InvoicePDFData.CustRoundedTotal, style: ['headerstyle'], alignment: 'right', marginRight: 5, });
327
+ TotalData.push({ name: 'Due', value: InvoicePDFData.Due });
328
+ }
329
+
330
+ return {
331
+ style: ['columnheader', 'TotalsStyles'],
332
+ lineHeight: 0.7,
333
+ marginBottom: 5,
334
+ width: 'auto',
335
+ table: {
336
+ body: this.GrandTotalTable(TotalData)
337
+ },
338
+ layout: 'noBorders'
339
+ // layout: {
340
+ // hLineWidth: function (i: any, node: any) {
341
+ // return (i === 0) ? 1 : 0;
342
+ // },
343
+ // vLineWidth: function (i: any, node: any) {
344
+ // return (i === 0 || i === node.table.body.length) ? 0 : 0;
345
+ // }
346
+ // },
347
+ };
348
+
349
+ // return TotalData;
350
+ }
351
+
352
+ static GrandTotalTable(data: any) {
353
+ var body: any = [];
354
+ data.forEach((row: any) => {
355
+ if (!TrUtils.IsFixedZero(row.value) || row.name === 'Total') {
356
+ var dataRow: any = [];
357
+ dataRow.push({ text: (row.name).toString(), noWrap: true, bold: true, style: ['headerstyle'], fontSize: 10 });
358
+ dataRow.push({ text: ':', style: ['headerstyle'], bold: true, fontSize: 10 });
359
+ if (!TrUtils.IsNull(row.value)) {
360
+ dataRow.push({ text: (row.value).toString(), noWrap: true, alignment: 'right', bold: true, style: ['headerstyle'], fontSize: 10, marginRight: 5 });
361
+ } else {
362
+ dataRow.push({ text: '', noWrap: true, alignment: 'right', style: ['headerstyle'] });
363
+ }
364
+ body.push(dataRow);
365
+ }
366
+ });
367
+ return body;
368
+ }
369
+
370
+ static GetBillofSupplyName(Settings: any) {
371
+ return { text: Settings.Tax === 'BS' ? ' Bill of Supply' : null, alignment: 'center', marginLeft: 15, marginTop: 2, marginBottom: 3, fontSize: 9, width: 'auto' };
372
+ }
373
+
374
+ static GetDiscountOverall(InvoicePDFData: any) {
375
+ // let OveralDisc: number = TrUtils.SetValueToZeroIfNull(Number(InvoicePDFData.Disc)) +
376
+ // TrUtils.SetValueToZeroIfNull(Number(InvoicePDFData.CustPartsDiscTotal));
377
+ // console.log(InvoicePDFData.Disc,InvoicePDFData.CustPartsDiscTotal);
378
+ return TrUtils.FixPriceValue(Number(InvoicePDFData.CustPartsDiscTotal));
379
+ }
380
+
381
+ static CustomerAndVehicleDetailsAfterLine(size: any) {
382
+ let length: any = 575;
383
+ if (size === 'A3') {
384
+ length = 820;
385
+ } else if (size === 'Custom') {
386
+ length = 575;
387
+ }
388
+ return {
389
+ canvas: [
390
+ {
391
+ type: 'line',
392
+ lineColor: 'gray',
393
+ x1: 0,
394
+ y1: 0,
395
+ x2: 540,
396
+ y2: 0,
397
+ lineWidth: 1
398
+ }
399
+ ]
400
+ };
401
+ }
402
+
403
+ static GetSignatures(CName: any, For: any, Type: any) {
404
+ return {
405
+ columns: [{
406
+ stack: [
407
+ this.CompanyName(CName),
408
+ // { columns: [this.Authorizedsignature(), this.SurveyorSignature(For, Type), this.CustomerSignature()] }
409
+ ]
410
+ }],
411
+ };
412
+ }
413
+
414
+ static CompanyName(CName: any) {
415
+ return {
416
+ style: 'forCompany',
417
+ text: ['For ', { text: CName, }],
418
+ };
419
+ }
420
+
421
+ static Authorizedsignature() {
422
+ return {
423
+ style: 'Sign',
424
+ text: ['Authorized Signatory'],
425
+ };
426
+ }
427
+
428
+ static CustomerSignature() {
429
+ return {
430
+ style: 'Sign',
431
+ text: ['Customer Signature'], marginLeft: 90
432
+ };
433
+ }
434
+
435
+ static GetItemsTable(Items: any, ShowTaxColumn: boolean, size: any) {
436
+ return {
437
+ style: 'tableExample',
438
+ marginTop: 3,
439
+ marginBottom: 5,
440
+ table: {
441
+ widths: this.GetWidths(ShowTaxColumn),
442
+ headerRows: 1,
443
+ body: this.BuildTableBodyForLaborAndParts(Items, ShowTaxColumn, size)
444
+ },
445
+ layout: {
446
+ hLineWidth: function (i: any, node: any) {
447
+ // || (i === 20 && size !== 'full')
448
+ return (i === 0 || i === 1 || i === node.table.body.length) ? 1 : 0;
449
+ },
450
+ vLineWidth: function (i: any, node: any) {
451
+ return (i === 0 || i === node.table.widths.length) ? 1 : 0.5;
452
+ },
453
+ // hLineStyle: function (i, node) {
454
+ // return (i === 0 || i === 1) ? { dash: { length: 5, space: 5 } } : null;
455
+ // },
456
+ hLineColor: function (i: any, node: any) {
457
+ return 'gray';
458
+ },
459
+ vLineColor: function (i: any, node: any) {
460
+ return 'gray';
461
+ },
462
+ }
463
+ };
464
+ }
465
+
466
+ static GetWidths(ShowTaxColumn: any) {
467
+ if (ShowTaxColumn) {
468
+ return [18, '*', 40, 50, 25, 25, 18, 20, 45, 45, 50];
469
+ } else {
470
+ return [22, '*', 60, 30, 25, 18, 20, 50, 50];
471
+ }
472
+ }
473
+
474
+ static GetAddress(Entity: any) {
475
+ return Entity.Adrs1 + ', ' + Entity.Adrs2 + ', ' + Entity.City + '-' + Entity.PIN + ', Cell : ' + Entity.Phone;
476
+ }
477
+
478
+ static BuildTableBodyForLaborAndParts(Items: any, ShowTaxColumn: any, size: any) {
479
+ let body: any = this.GetHeaderNames(ShowTaxColumn);
480
+ let j = 1;
481
+ Items.forEach((item: any, index: any) => {
482
+ let dataRow: any = [];
483
+ dataRow.push({ text: index + 1, });
484
+ dataRow.push({ text: item.Desc, });
485
+ if (ShowTaxColumn) {
486
+ dataRow.push({ text: item.HSN, alignment: 'center', style: ['headerstyle'], });
487
+ }
488
+ dataRow.push({ text: item.BN, alignment: 'center', style: ['headerstyle'], });
489
+ dataRow.push({ text: item.ExDt, alignment: 'center', style: ['headerstyle'], });
490
+ dataRow.push({ text: item.Make, alignment: 'center', style: ['headerstyle'], });
491
+ dataRow.push({ text: item.Sch, alignment: 'center', style: ['headerstyle'], });
492
+ dataRow.push({ text: item.Ret ? -item.Qty : item.Qty, alignment: 'right', style: ['headerstyle'], });
493
+ dataRow.push({ text: TrUtils.FixPriceValue(item.UnPr), alignment: 'right', style: ['headerstyle'], });
494
+ if (ShowTaxColumn) {
495
+ dataRow.push({ text: item.TaxName, alignment: 'center', style: ['headerstyle'], });
496
+ }
497
+ dataRow.push({ text: item.Ret ? '-' + TrUtils.FixPriceValue(item.LineTotal) : TrUtils.FixPriceValue(item.LineTotal), alignment: 'right', style: ['headerstyle'], });
498
+
499
+
500
+ body.push(dataRow);
501
+ if (index + 1 === j * 9) {
502
+ j++;
503
+ if (size === 'diff') {
504
+ // let dataRow1: any = [{ text: '' }, '', '', '', '', ''];
505
+ // if (ShowTaxColumn) {
506
+ // dataRow1.push('');
507
+ // dataRow1.push('');
508
+ // }
509
+ // body.push(dataRow1);
510
+ // let dataRow2: any = [{ text: '' }, '', '', '', '', ''];
511
+ // if (ShowTaxColumn) {
512
+ // dataRow2.push('');
513
+ // dataRow2.push('');
514
+ // }
515
+ // body.push(dataRow2);
516
+ // let dataRow3: any = [{ text: '' }, '', '', '', '', ''];
517
+ // if (ShowTaxColumn) {
518
+ // dataRow3.push('');
519
+ // dataRow3.push('');
520
+ // }
521
+ // body.push(dataRow3);
522
+ // let dataRow4: any = [{ text: '' }, '', '', '', '', ''];
523
+ // if (ShowTaxColumn) {
524
+ // dataRow4.push('');
525
+ // dataRow4.push('');
526
+ // }
527
+ // body.push(dataRow4);
528
+ // let dataRow5: any = [{ text: '' }, '', '', '', '', ''];
529
+ // if (ShowTaxColumn) {
530
+ // dataRow5.push('');
531
+ // dataRow5.push('');
532
+ // }
533
+ // body.push(dataRow5);
534
+ // body.push(this.GetHeaderNames(ShowTaxColumn)[0]);
535
+ // } else {
536
+ let dataRow1: any = [{ text: '', pageBreak: 'after' }, '', '', '', '', ''];
537
+ if (ShowTaxColumn) {
538
+ dataRow1.push('');
539
+ dataRow1.push('');
540
+ }
541
+ body.push(dataRow1);
542
+ }
543
+
544
+ }
545
+ });
546
+ return body;
547
+ }
548
+
549
+ static GetHeaderNames(ShowTaxColumn: any) {
550
+ let HeadingNames: any;
551
+ if (ShowTaxColumn) {
552
+ HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left', fontSize: 8 },
553
+ { text: 'Item Name', style: 'tableheader1', Field: 'Desc', alignment: 'left', line: true },
554
+ { text: 'HSN', style: 'tableheader1', Field: 'HSN' },
555
+ { text: 'Batch No.', style: 'tableheader1', Field: 'Batches' },
556
+ { text: 'Ex.Dt', style: 'tableheader1', Field: 'ExDate' },
557
+ { text: 'Manf', style: 'tableheader1', Field: 'Manf' },
558
+ { text: 'Sch', style: 'tableheader1', Field: 'Sch' },
559
+ { text: 'Qty', style: 'tableheader1', Field: 'Qty', alignment: 'right' },
560
+ { text: 'Price', style: 'tableheader1', Field: 'UnPr', alignment: 'right' },
561
+ { text: 'Tax', style: 'tableheader1', Field: 'TaxAmount' },
562
+ { text: 'Line Total', style: 'tableheader1', Field: 'LineTotal', alignment: 'right' }]];
563
+ } else {
564
+ HeadingNames = [[{ text: 'S.No', style: 'tableheader1', Field: 'SNo', alignment: 'left' },
565
+ { text: 'Item Name', style: 'tableheader1', Field: 'Desc', alignment: 'left', line: true },
566
+ { text: 'Batch No.', style: 'tableheader1', Field: 'Batches', alignment: 'left' },
567
+ { text: 'Ex.Dt', style: 'tableheader1', Field: 'ExDate', alignment: 'left' },
568
+ { text: 'Manf', style: 'tableheader1', Field: 'Manf', alignment: 'right' },
569
+ { text: 'Sch', style: 'tableheader1', Field: 'Sch', alignment: 'right' },
570
+ { text: 'Qty', style: 'tableheader1', Field: 'Qty', alignment: 'right' },
571
+ { text: 'Price', style: 'tableheader1', Field: 'UnPr', alignment: 'right' },
572
+ { text: 'Line Total', style: 'tableheader1', Field: 'LineTotal', alignment: 'right' }]];
573
+ }
574
+ return HeadingNames;
575
+ }
576
+
577
+ }