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,238 @@
1
+ import { SharedPDFService } from '../../shared/shared-pdf.service';
2
+ import { PrintSharedService } from '../../shared/shared-print.service';
3
+ import { MyDate } from '../../utils/my-date';
4
+ import { TrUtils } from '../../utils/tr-utils';
5
+
6
+ declare var pdfMake: any;
7
+
8
+ export class TaskPDfService {
9
+
10
+ static BodySize: number = 8;
11
+
12
+ static GetPdfForUnAssignedTasks(TaskData: any, Image: any, EntityData: any) {
13
+ let Images: any;
14
+ // let IsThere: boolean = false;
15
+ // Images = this.imageExists(meetingData.image);
16
+ // console.log(Images);
17
+ // TaskData.image = 'assets/images/1013/logo.jpg';
18
+ SharedPDFService.convertImgToBase64URL(Image, function (base64Img: any) {
19
+ Images = base64Img.toString();
20
+ }, function (ntg: any) {
21
+ Images = null;
22
+ });
23
+
24
+ SharedPDFService.convertImgToBase64URL(Image, function (base64Img: any) {
25
+ }, function (ntg: any) {
26
+ });
27
+ setTimeout(() => {
28
+ var dd: any = {
29
+ info: {
30
+ title: 'Tasks',
31
+ },
32
+ header: function (currentPage: any, pageCount: any) {
33
+ return { text: currentPage.toString() + ' of ' + pageCount, alignment: 'right', marginRight: 7, fontSize: 8, marginTop: 2 };
34
+ },
35
+ pageMargins: [20, 20, 20, 15],
36
+ content: [
37
+ this.HeaderContent(Images, TaskData),
38
+ this.HeaderAfterLine(),
39
+ this.GetTaskSubHeadre(TaskData),
40
+ // this.HeaderAfterLine(),
41
+ this.GetTaskDetails(TaskData, EntityData.User.TZ),
42
+ ],
43
+ styles: SharedPDFService.GetStyles(),
44
+ };
45
+ pdfMake.createPdf(dd).open();
46
+ }, 400)
47
+ }
48
+
49
+ static GetHeader(task: any) {
50
+ return {
51
+ stack: [{ text: '[' + task.Code + ']' + ' ' + task.Name, alignment: 'center', bold: true, fontSize: 13, marginBottom: 5 },
52
+ // { text: task.Name, alignment: 'left', fontSize: 13, bold: true },
53
+ // { text: this.GetDescription(task), alignment: 'left', fontSize: 10, marginTop: 10 },
54
+ // { text: 'Details', alignment: 'left', fontSize: 10, bold: true, marginTop: 7 },
55
+ ]
56
+ };
57
+ }
58
+
59
+ static GetTaskSubHeadre(task: any) {
60
+ return {
61
+ stack: [
62
+ { text: this.GetDescription(task), alignment: 'left', fontSize: 10, marginTop: 10 },
63
+ { text: 'Details', alignment: 'left', fontSize: 10, bold: true, marginTop: 7 },
64
+ ]
65
+ };
66
+ }
67
+
68
+ static HeaderContent(Images: any, TaskData: any) {
69
+ if (TrUtils.IsNull(Images)) {
70
+ return { columns: [this.GetHeader(TaskData)], width: '*', marginBottom: 5 };
71
+ } else {
72
+ return {
73
+ columns: [{ image: Images, width: 40 * 1 },
74
+ // { text: 'Task Details', alignment: 'center', bold: true, fontSize: 16, marginRight: 15 }
75
+ this.GetHeader(TaskData),
76
+
77
+ ], marginBottom: 3
78
+ }
79
+ }
80
+ }
81
+
82
+ static GetDescription(task: any) {
83
+ if (!TrUtils.IsNull(task.Desc)) {
84
+ // var plainText = HtmlUtilities.ConvertToPlainText(task.Desc);
85
+ let plainText = this.stripHtml(task.Desc);
86
+ return plainText;
87
+ } else {
88
+ return 'No Description'
89
+ }
90
+ }
91
+
92
+ static stripHtml(html: any) {
93
+ // Create a new div element
94
+ var temporalDivElement = document.createElement("div");
95
+ // Set the HTML content with the providen
96
+ temporalDivElement.innerHTML = html;
97
+ // Retrieve the text property of the element (cross-browser support)
98
+ return temporalDivElement.textContent || temporalDivElement.innerText || "";
99
+ }
100
+
101
+ static GetTaskDetails(TaskData: any, UserTimeZone: any) {
102
+ return {
103
+ stack: [
104
+ this.GetTableHeadersForApproval(TaskData, UserTimeZone),
105
+ ]
106
+ };
107
+ }
108
+
109
+ static GetTableHeadersForApproval(TaskData: any, UserTimeZone: any) {
110
+ let headersNames: any =
111
+ [
112
+ { name: 'Status', value: this.GetValue(TaskData.Sts) },
113
+ { name: 'Start date', value: this.GetValue(MyDate.ConvertUTCDateToReadable(TaskData.EstStDt)) },
114
+ { name: 'Due date', value: this.GetValue(MyDate.ConvertUTCDateToReadable(TaskData.EstEnDt)) },
115
+ { name: 'Estimated Time', value: this.GetTime(TaskData.EstEnDt,UserTimeZone) },
116
+ { name: 'Priority', value: this.GetPriority(TaskData.Prty) },
117
+ { name: 'Progress', value: this.GetProgress(TaskData.CoPerc) },
118
+ { name: 'Assingned To', value: this.GetValue(this.GetAssinessList(TaskData.Members)) },
119
+ { name: 'Assingned by', value: this.GetValue(this.GetOwner(TaskData.Members)) },
120
+ ];
121
+
122
+ return this.GetDetails(headersNames);
123
+ }
124
+
125
+ static GetValue(value: any) {
126
+ if (!TrUtils.IsEmpty(value)) {
127
+ return value;
128
+ } else {
129
+ return 'Not specified';
130
+ }
131
+ }
132
+
133
+ static GetProgress(value: any) {
134
+ if (!TrUtils.IsEmpty(value)) {
135
+ return value + '%';
136
+ } else {
137
+ return '0' + '%';
138
+ }
139
+ }
140
+
141
+ static GetPriority(value: any) {
142
+ if (!TrUtils.IsEmpty(value)) {
143
+ return value;
144
+ } else {
145
+ return 'None';
146
+ }
147
+ }
148
+
149
+ static GetTime(date: any, UserTimeZone: any) {
150
+ if (!TrUtils.IsNull(date)) {
151
+ let time = MyDate.ConvertUTCDateTimeToReadable(date, UserTimeZone);
152
+ return time;
153
+ } else {
154
+ return 'Not specified';
155
+ }
156
+
157
+ }
158
+
159
+ static GetAssinessList(Members: any) {
160
+ let Assignees: any = '';
161
+ let membersData: any = Members.filter((member: any) => {
162
+ return !TrUtils.IsNull(member.Ass) && TrUtils.IsNull(member.EnDt);
163
+ });
164
+ membersData.forEach((member: any, index: any) => {
165
+ if (member.Role === 'Assignee') {
166
+ let comma: string = ' , ';
167
+ if (membersData.length === index + 1) {
168
+ comma = ' ';
169
+ }
170
+ let date = MyDate.ConvertUTCDateToReadable(member.Ass);
171
+ Assignees = Assignees + member.Name + ' (' + date + ')' + comma;
172
+ }
173
+ });
174
+ return Assignees;
175
+ }
176
+
177
+ static GetOwner(Members: any) {
178
+ let Owner: any = '';
179
+ Members.forEach((member: any) => {
180
+ if (member.Role === 'Owner') {
181
+ Owner = member.Name
182
+ }
183
+ });
184
+ return Owner;
185
+ }
186
+
187
+ static GetDetails(data: any) {
188
+ return {
189
+ style: 'tableExample',
190
+ fontSize: this.BodySize,
191
+ lineHeight: 1,
192
+ marginTop: 5,
193
+ table: {
194
+ widths: [150, '*'],
195
+ body: this.GetDetailsTable(data)
196
+ },
197
+ layout: PrintSharedService.LayOutStyle()
198
+ };
199
+ }
200
+
201
+ static GetDetailsTable(data: any) {
202
+ var body: any = [];
203
+ data.forEach((row: any) => {
204
+ if (!TrUtils.IsEmpty(row.value)) {
205
+ var dataRow: any = [];
206
+ dataRow.push({ text: (row.name).toString(), noWrap: true, bold: true, fontSize: 10, margin: 5, fillColor: '#FAF9F8' });
207
+ dataRow.push({ text: (row.value).toString(), lineHeight: 1, fontSize: 10, margin: 5 });
208
+ body.push(dataRow);
209
+ }
210
+ });
211
+ return body;
212
+ }
213
+
214
+ static HeaderAfterLine() {
215
+ return {
216
+ canvas: [
217
+ {
218
+ type: 'line',
219
+ lineColor: 'black',
220
+ x1: 0,
221
+ y1: 0,
222
+ x2: 555,
223
+ y2: 0,
224
+ lineWidth: 1.5
225
+ }
226
+ ]
227
+ };
228
+ }
229
+
230
+ static uniqueBy(a: any, key: any) {
231
+ var seen: any = {};
232
+ return a.filter(function (item: any) {
233
+ var k = key(item);
234
+ return seen.hasOwnProperty(k) ? false : (seen[k] = true);
235
+ });
236
+ }
237
+
238
+ }
@@ -0,0 +1,313 @@
1
+ import { SharedPDFService } from '../../shared/shared-pdf.service';
2
+ import { PrintSharedService } from '../../shared/shared-print.service';
3
+ import { MyDate } from '../../utils/my-date';
4
+ import { TrUtils } from '../../utils/tr-utils';
5
+
6
+ class Group {
7
+ level: number = 0;
8
+ parent: any;
9
+ expanded: boolean = true;
10
+ Assignee: string = '';
11
+ get visible(): boolean {
12
+ return !this.parent || (this.parent.visible && this.parent.expanded);
13
+ }
14
+ }
15
+
16
+ declare var pdfMake: any;
17
+
18
+ export class TaskReportsPDfService {
19
+
20
+ static overdueTasks: any[] = [];
21
+
22
+ static groupByColumns: string[] = ['UserId'];
23
+
24
+ static GetPdfForUnAssignedTasks(TaskData: any, IsLandScape: any, ReportType: any, Image: any, EntityData: any) {
25
+ let Images: any;
26
+ SharedPDFService.convertImgToBase64URL(Image, function (base64Img: any) {
27
+ Images = base64Img.toString();
28
+ }, function (ntg: any) {
29
+ Images = null;
30
+ });
31
+ setTimeout(() => {
32
+ var dd: any = {
33
+ // header: function () {
34
+ // return { text: ReportType.toString(), alignment: 'center', margin: 10, fontSize: 14 };
35
+ // },
36
+ info: {
37
+ title: 'TaskReport',
38
+ },
39
+ pageMargins: [10, 15, 10, 15],
40
+ pageOrientation: IsLandScape ? 'landscape' : 'portrait',
41
+ content: [
42
+ this.GetHeader(Images, ReportType),
43
+ // { text: ReportType.toString(), alignment: 'center', margin: 10, fontSize: 14 },
44
+ this.GetTableForApproval(TaskData, ReportType, EntityData.User.TZ),
45
+ ],
46
+ styles: SharedPDFService.GetStyles(),
47
+ };
48
+ pdfMake.createPdf(dd).open();
49
+ }, 400)
50
+
51
+ // return dd;
52
+ }
53
+
54
+ static GetHeader(Images: any, ReportType: any) {
55
+ if (TrUtils.IsNull(Images)) {
56
+ return {
57
+ stack: [{ text: 'REPORT', alignment: 'center', bold: true, fontSize: 16, marginBottom: 5 },
58
+ { text: ReportType.toString(), alignment: 'center', fontSize: 14 }]
59
+ }
60
+ } else {
61
+ return {
62
+ columns: [{ image: Images, width: 40 * 1 }, {
63
+ stack: [{ text: 'REPORT', alignment: 'center', bold: true, fontSize: 16, marginBottom: 5 },
64
+ { text: ReportType.toString(), alignment: 'center', fontSize: 14 }]
65
+ }]
66
+ }
67
+ }
68
+ }
69
+
70
+ static GetTableForApproval(TaskData: any, ReportType: any, TZ: any) {
71
+ return {
72
+ style: 'tableExample',
73
+ marginTop: 7,
74
+ lineHeight: 1,
75
+ dontBreakRows: true,
76
+ table: {
77
+ // widths: [30, 50, 200, 60, 100, 60],
78
+ widths: [30, 50, '*', 200, 50, 50],
79
+ body: this.GetApprovalTableHeaderBody(TaskData, ReportType, TZ)
80
+ },
81
+ layout: PrintSharedService.LayOutStyle()
82
+ };
83
+ }
84
+
85
+ static GetApprovalTableHeaderBody(TaskData: any, ReportType: any, TZ: any) {
86
+
87
+ var body: any = [];
88
+ let SNo: number = 1;
89
+ let columns: any = this.GetTableHeadersForApproval();
90
+ body.push(columns);
91
+ TaskData.forEach((task: any) => {
92
+ var dataRow: any = [];
93
+ columns.forEach((column: any) => {
94
+ if (!TrUtils.IsFixedZero(task[column.Field]) && !TrUtils.IsNull(task[column.Field])) {
95
+ if (column.Field === 'SNo') {
96
+ dataRow.push(task[column.Field].toString());
97
+ } else {
98
+ if (!TrUtils.IsNull(task['EstEnDt']) && column.Field === 'EstEnDt') {
99
+ dataRow.push({ text: this.GetDueDate(task, TZ), alignment: 'left', nowrap: true });
100
+ } else {
101
+ dataRow.push({ text: task[column.Field].toString(), alignment: 'left', nowrap: true });
102
+ }
103
+ }
104
+ } else {
105
+ if (column.Field === 'SNo') {
106
+ task[column.Field] = SNo;
107
+ SNo = SNo + 1;
108
+ } else {
109
+ task[column.Field] = '';
110
+ }
111
+ dataRow.push({ text: task[column.Field].toString(), alignment: 'left' });
112
+ }
113
+ });
114
+ body.push(dataRow);
115
+ });
116
+ return body;
117
+ }
118
+
119
+ static GetTableHeadersForApproval() {
120
+ let headersNames: any =
121
+ [
122
+ { text: 'S.No.', style: 'tableheader', Field: 'SNo' },
123
+ { text: 'Task #', style: 'tableheader', Field: 'Code' },
124
+ { text: 'Task Name', style: 'tableheader', Field: 'Name' },
125
+ { text: 'Due Date', style: 'tableheader', Field: 'EstEnDt' },
126
+ { text: 'Priority', style: 'tableheader', Field: 'Prty' },
127
+ { text: 'Status', style: 'tableheader', Field: 'Sts' },
128
+ ];
129
+
130
+ return headersNames;
131
+ }
132
+
133
+ static GetOverDuePrint(TaskData: any, IsLandScape: any, ReportType: any, Image: any, EntityData: any) {
134
+ TaskData = this.PrepareDataForTable(TaskData, EntityData);
135
+ let Images: any;
136
+ SharedPDFService.convertImgToBase64URL(Image, function (base64Img: any) {
137
+ Images = base64Img.toString();
138
+ }, function (ntg: any) {
139
+ Images = null;
140
+ });
141
+ setTimeout(() => {
142
+ var dd: any = {
143
+ // header: function () {
144
+ // return { text: ReportType.toString(), alignment: 'center', margin: 10, fontSize: 14 };
145
+ // },
146
+ pageMargins: [10, 15, 10, 15],
147
+ pageOrientation: IsLandScape ? 'landscape' : 'portrait',
148
+ content: [
149
+ this.GetHeader(Images, ReportType),
150
+ // { text: ReportType.toString(), alignment: 'center', margin: 10, fontSize: 14 },
151
+ this.GetTableForApprovalUnAssignedTasks(TaskData, ReportType),
152
+ ],
153
+ styles: SharedPDFService.GetStyles()
154
+ };
155
+ pdfMake.createPdf(dd).open();
156
+ }, 400)
157
+
158
+ // return dd;
159
+ }
160
+
161
+ static GetTableForApprovalUnAssignedTasks(TaskData: any, ReportType: any) {
162
+ return {
163
+ style: 'tableExample',
164
+ marginTop: 7,
165
+ lineHeight: 1,
166
+ dontBreakRows: true,
167
+ table: {
168
+ widths: [30, 50, '*', 100, 180],
169
+ body: this.GetApprovalTableHeaderUnAssignedTasksBody(TaskData, ReportType)
170
+ },
171
+ layout: PrintSharedService.LayOutStyle()
172
+ };
173
+ }
174
+
175
+ static GetApprovalTableHeaderUnAssignedTasksBody(TaskData: any, ReportType: any) {
176
+ var body: any = [];
177
+ let SNo: number = 1;
178
+ let columns: any = this.GetOverDueTableHeadersForApproval();
179
+ body.push(columns);
180
+ TaskData.forEach((task: any) => {
181
+ var dataRow: any = [];
182
+ columns.forEach((column: any) => {
183
+ if (!TrUtils.IsNull(task.level) && column.Field === 'SNo') {
184
+ dataRow.push({ text: task.Assignee.toString(), alignment: 'left', bold: true, colSpan: 5, nowrap: true, fillColor: 'lightgrey' });
185
+ } else if (TrUtils.IsNull(task.level)) {
186
+ if (!TrUtils.IsFixedZero(task[column.Field]) && !TrUtils.IsNull(task[column.Field])) {
187
+ if (column.Field === 'SNo') {
188
+ dataRow.push(task[column.Field].toString());
189
+ } else {
190
+ dataRow.push({ text: task[column.Field].toString(), alignment: 'left', nowrap: true });
191
+ }
192
+
193
+ } else {
194
+ if (column.Field === 'SNo') {
195
+ task[column.Field] = SNo;
196
+ SNo = SNo + 1;
197
+ } else {
198
+ task[column.Field] = '';
199
+ }
200
+ dataRow.push({ text: task[column.Field].toString(), alignment: 'left' });
201
+ }
202
+ } else {
203
+ dataRow.push({});
204
+ }
205
+ });
206
+ body.push(dataRow);
207
+ });
208
+ return body;
209
+ }
210
+
211
+ static GetOverDueTableHeadersForApproval() {
212
+ let headersNames: any =
213
+ [
214
+ { text: 'S.No.', style: 'tableheader', Field: 'SNo' },
215
+ { text: 'Task #', style: 'tableheader', Field: 'TId' },
216
+ { text: 'Task Name', style: 'tableheader', Field: 'Name' },
217
+ { text: 'Assign Date', style: 'tableheader', Field: 'AssDate' },
218
+ { text: 'Due Date', style: 'tableheader', Field: 'DueDt' }
219
+ ];
220
+
221
+ return headersNames;
222
+ }
223
+
224
+ static GetDueDate(params: any, TZ:any) {
225
+ if (!TrUtils.IsEmpty(params.EstEnDt)) {
226
+ let DueDays: string;
227
+ let TodayDate: any = MyDate.GetDateTimeNowInUTC(TZ);
228
+ let Days = MyDate.GetDaysDiffBetween(TodayDate, params.EstEnDt);
229
+ if (Days > 1) {
230
+ DueDays = 'Due in' + ' ' + Days + ' ' + 'days';
231
+ } else if (Days === 1) {
232
+ DueDays = 'Due tomorrow';
233
+ } else if (Days === 0) {
234
+ DueDays = 'Due today';
235
+ } else {
236
+ let days: any = Math.abs(Days);
237
+ if (days === 1) {
238
+ DueDays = '1 day overdue';
239
+ } else {
240
+ DueDays = Math.abs(Days) + ' ' + 'days overdue';
241
+ }
242
+ }
243
+ return MyDate.GetWeekAndDate(params.EstEnDt, TZ) + ' , ' + DueDays;
244
+ }
245
+ return '';
246
+ }
247
+
248
+ static PrepareDataForTable(overdueEmpTasks: any[], EntityData: any) {
249
+ this.overdueTasks = [];
250
+ overdueEmpTasks.forEach((overdueEmpTask: any) => {
251
+ overdueEmpTask.Tasks.forEach((Task: any) => {
252
+ let TaskInfo: any = {
253
+ UserId: overdueEmpTask._id,
254
+ TId: Task.Code,
255
+ DueDt: this.GetDueDate(Task, EntityData.User.TZ),
256
+ Name: Task.Name,
257
+ Assignee: Task.Assignee.Name,
258
+ AssDate: (Task.Assignee.Ass === true || Task.Assignee.Ass === false) ? '' : MyDate.GetWeekAndDate(Task.Assignee.Ass, EntityData.User.TZ)
259
+ };
260
+ this.overdueTasks.push(TaskInfo);
261
+ });
262
+ });
263
+ let TableData = this.addGroups(this.overdueTasks, this.groupByColumns);
264
+ return TableData;
265
+ }
266
+
267
+ static addGroups(data: any[], groupByColumns: string[]): any[] {
268
+ var rootGroup = new Group();
269
+ return this.getSublevel(data, 0, groupByColumns, rootGroup);
270
+ }
271
+
272
+ static getSublevel(data: any[], level: number, groupByColumns: string[], parent: Group): any[] {
273
+ // Recursive function, stop when there are no more levels.
274
+ if (level >= groupByColumns.length)
275
+ return data;
276
+
277
+ var groups = this.uniqueBy(
278
+ data.map(
279
+ row => {
280
+ var result: any = new Group();
281
+ result.level = level + 1;
282
+ result.parent = parent;
283
+ for (var i = 0; i <= level; i++)
284
+ result[groupByColumns[i]] = row[groupByColumns[i]];
285
+ return result;
286
+ }
287
+ ),
288
+ JSON.stringify);
289
+
290
+ const currentColumn = groupByColumns[level];
291
+
292
+ var subGroups: any[] = [];
293
+ groups.forEach((group: any) => {
294
+ let rowsInGroup = data.filter(row => group[currentColumn] === row[currentColumn]);
295
+ if (rowsInGroup.length !== 0) {
296
+ group.Assignee = rowsInGroup[0].Assignee;
297
+ }
298
+ let subGroup = this.getSublevel(rowsInGroup, level + 1, groupByColumns, group);
299
+ subGroup.unshift(group);
300
+ subGroups = subGroups.concat(subGroup);
301
+ });
302
+ return subGroups;
303
+ }
304
+
305
+ static uniqueBy(a: any, key: any) {
306
+ var seen: any = {};
307
+ return a.filter(function (item: any) {
308
+ var k = key(item);
309
+ return seen.hasOwnProperty(k) ? false : (seen[k] = true);
310
+ });
311
+ }
312
+
313
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Tax System — Public API
3
+ *
4
+ * This is the entry point for all tax-related functionality.
5
+ * Import from "shareneus/tax" in both UI and API code.
6
+ */
7
+
8
+ // Types
9
+ export type {
10
+ // Enums / Union types
11
+ TaxComponentType,
12
+ CalcMethod,
13
+ AppliedOn,
14
+ RoundingMethod,
15
+ TaxCategory,
16
+ SupplyType,
17
+ ResolvedSupplyType,
18
+ WithholdingType,
19
+ ResolverType,
20
+
21
+ // Regime types
22
+ IRegimeComponent,
23
+ IRegimeFeatures,
24
+ IRounding,
25
+ ITreatment,
26
+ ITaxRegime,
27
+
28
+ // TaxCode types
29
+ ITaxCodeComponent,
30
+ ITaxCode,
31
+
32
+ // Line-item types
33
+ ITaxComponent,
34
+
35
+ // Summary types (optional, v2)
36
+ ITaxSummaryLine,
37
+ ITaxSummary,
38
+
39
+ // Withholding types (TDS/TCS generic)
40
+ IWithholding,
41
+ IWithholdingCalcInput,
42
+
43
+ // Input/Output types
44
+ ILineAmountFields,
45
+ IComponentOverride,
46
+ ITaxCalcLineInput,
47
+ ITaxSummaryInput,
48
+ IRoundingConfig,
49
+ IDocumentTotalsInput,
50
+ IDocumentTotals,
51
+
52
+ // TaxId types
53
+ ITaxIdLabel,
54
+ ITaxIdEntry,
55
+
56
+ // Exemption types (v2 master)
57
+ ITaxExemption,
58
+
59
+ // Authority types (v2, US)
60
+ ITaxAuthority,
61
+
62
+ // External provider types (v2)
63
+ IExternalProvider,
64
+ } from "./tax.types";
65
+
66
+ // Calculator functions and result types
67
+ export type { IInclusiveResult } from "./tax-calculator";
68
+
69
+ export {
70
+ CalculateGrossAmt,
71
+ CalculateNetAmt,
72
+ CalculateLineTax,
73
+ ExtractNetFromInclusive,
74
+ SumTaxComponents,
75
+ ComputeTaxSummary,
76
+ ComputeDocumentTotals,
77
+ DetermineSupplyType,
78
+ FindTaxCodeByRateAndSupplyType,
79
+ CalculateWithholding,
80
+ RoundAmount,
81
+ ValidateTaxId,
82
+ ValidateHSNSACLength,
83
+ ConvertFlatToTaxes,
84
+ GetDefaultTaxIdLabels,
85
+ GetPrintableTaxIds,
86
+ } from "./tax-calculator";