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,211 @@
1
+
2
+ import { buildInvoicePartyDetailsSection, buildPurchasePartyDetailsSection } from '../../../shared/party-details-section/pdf-party-details.section';
3
+ import { buildInvoiceTableData, getAvailablePageWidth } from '../../../shared/table-section/pdf-table.section';
4
+ import { buildInvoiceTotalsAndNotesSection, buildSignatureSection } from '../../../shared/totals-section/pdf-totals.section';
5
+ import { toStr } from '../../../shared/header-footer-section/pdf-shared.utils';
6
+ import {
7
+ buildFooter,
8
+ buildDocumentHeaderSection,
9
+ buildPageNumberHeader,
10
+ buildDocumentHeadingSection,
11
+ buildLogoWatermarkBackground,
12
+ buildWatermark,
13
+ deriveHeaderDataFromInvoice,
14
+ normalizeHeaderStyle,
15
+ resolvePageMargins,
16
+ resolvePageOrientation,
17
+ resolvePageSize
18
+ } from '../../../shared/header-footer-section/pdf-header-footer.section';
19
+
20
+
21
+ const PAGE_MARGINS: [number, number, number, number] = [20, 20, 20, 20];
22
+ const CELL_PADDING_LEFT = 4;
23
+ const CELL_PADDING_RIGHT = 4;
24
+ const BORDER_WIDTH = 0.5;
25
+ const TABLE_BORDER_COLOR = '#d3d3d3';
26
+
27
+ export function CreateBillPDFService(PDFInvoiceData: any = {}, PrintConfigData: any = {}, printCopies: string[] = []) {
28
+ const dd = buildPdfDocDefinition(PDFInvoiceData, PrintConfigData, printCopies);
29
+ // pdfMake.createPdf(dd).open();
30
+ return dd;
31
+ }
32
+
33
+ export function DownloadBillPDFService(filename: string = 'bill.pdf', PDFInvoiceData: any = {}, PrintConfigData: any = {}, printCopies: string[] = []) {
34
+ const dd = buildPdfDocDefinition(PDFInvoiceData, PrintConfigData, printCopies);
35
+ // pdfMake.createPdf(dd).download(filename);
36
+ return dd;
37
+ }
38
+
39
+ export function GetBillPdfDataUrl(PDFInvoiceData: any = {}, PrintConfigData: any = {}, printCopies: string[] = []) {
40
+ const dd = buildPdfDocDefinition(PDFInvoiceData, PrintConfigData, printCopies);
41
+ return dd;
42
+
43
+ // return new Promise((resolve, reject) => {
44
+ // let settled = false;
45
+ // const done = (value: string) => {
46
+ // if (!settled) {
47
+ // settled = true;
48
+ // resolve(value);
49
+ // }
50
+ // };
51
+ // const fail = (error: any) => {
52
+ // if (!settled) {
53
+ // settled = true;
54
+ // reject(error);
55
+ // }
56
+ // };
57
+
58
+ // try {
59
+ // if (typeof pdfDoc.getDataUrl === 'function') {
60
+ // const result = pdfDoc.getDataUrl((dataUrl: string) => done(dataUrl));
61
+ // if (result && typeof result.then === 'function') {
62
+ // result.then((dataUrl: string) => done(dataUrl)).catch(fail);
63
+ // }
64
+ // return;
65
+ // }
66
+
67
+ // if (typeof pdfDoc.getBlob === 'function') {
68
+ // const result = pdfDoc.getBlob((blob: Blob) => done(URL.createObjectURL(blob)));
69
+ // if (result && typeof result.then === 'function') {
70
+ // result.then((blob: Blob) => done(URL.createObjectURL(blob))).catch(fail);
71
+ // }
72
+ // return;
73
+ // }
74
+
75
+ // fail(new Error('No supported preview API found on pdf document instance.'));
76
+ // } catch (error) {
77
+ // fail(error);
78
+ // }
79
+ // });
80
+ }
81
+
82
+ function buildPdfDocDefinition(PDFInvoiceData: any = {}, PrintConfigData: any = {}, printCopies: string[] = []) {
83
+ const PrintConfig = normalizePrintConfig(PDFInvoiceData, PrintConfigData);
84
+ const requestedPageOrientation = resolvePageOrientation(PrintConfig?.PageOrientation);
85
+ const pageSize = resolvePageSize(PrintConfig?.PSize, requestedPageOrientation);
86
+ const basePageMargins = resolvePageMargins(PrintConfig?.pageMargins);
87
+ const copyLabels = normalizeCopyLabels(printCopies);
88
+ const watermark = buildWatermark(PrintConfig);
89
+ const background = buildLogoWatermarkBackground(PrintConfig, PDFInvoiceData);
90
+ const pageHeader = buildPageNumberHeader(PrintConfig);
91
+ const pageFooter = buildFooter(PrintConfig);
92
+ const pageMargins: [number, number, number, number] = pageHeader !== null
93
+ ? [basePageMargins[0], Math.max(basePageMargins[1], 18), basePageMargins[2], basePageMargins[3]]
94
+ : basePageMargins;
95
+ const availableWidth = getAvailablePageWidth(pageSize, requestedPageOrientation, pageMargins);
96
+ const content: any[] = [];
97
+ copyLabels.forEach((copyLabel: string, index: number) => {
98
+ const invoiceHeaderContent = buildDocumentHeaderSection(PrintConfig, PDFInvoiceData);
99
+ const invoiceHeadingContent = buildDocumentHeadingSection(PDFInvoiceData, PrintConfig, availableWidth);
100
+ const invoicePartyDetailsContent = buildPurchasePartyDetailsSection(PDFInvoiceData, PrintConfig?.Customer, PrintConfig);
101
+ const invoiceTotalsAndNotesContent = buildInvoiceTotalsAndNotesSection(PDFInvoiceData, availableWidth, PrintConfigData);
102
+ const signatureContent = buildSignatureSection(PrintConfig, PDFInvoiceData, availableWidth);
103
+ const tableData = buildInvoiceTableData(PDFInvoiceData, PrintConfig, availableWidth);
104
+
105
+ if (index > 0) {
106
+ content.push({ text: '', pageBreak: 'before' });
107
+ }
108
+
109
+ if (copyLabel) {
110
+ content.push({
111
+ text: copyLabel,
112
+ alignment: 'right',
113
+ bold: true,
114
+ fontSize: 8,
115
+ margin: [0, 0, 0, 2]
116
+ });
117
+ }
118
+
119
+ content.push(
120
+ ...invoiceHeaderContent,
121
+ ...invoiceHeadingContent,
122
+ ...invoicePartyDetailsContent,
123
+ {
124
+ table: {
125
+ lineHeight: 2,
126
+ headerRows: tableData.headerRows.length,
127
+ widths: tableData.widths,
128
+ body: tableData.body
129
+ },
130
+ layout: {
131
+ paddingLeft: () => CELL_PADDING_LEFT,
132
+ paddingRight: () => CELL_PADDING_RIGHT,
133
+ vLineWidth: () => BORDER_WIDTH,
134
+ hLineWidth: () => BORDER_WIDTH,
135
+ vLineColor: () => TABLE_BORDER_COLOR,
136
+ hLineColor: () => TABLE_BORDER_COLOR
137
+ }
138
+ },
139
+ ...invoiceTotalsAndNotesContent,
140
+ ...signatureContent
141
+ );
142
+ });
143
+
144
+ const dd = {
145
+ pageSize: pageSize,
146
+ ...(typeof pageSize === 'string' ? { pageOrientation: requestedPageOrientation } : {}),
147
+ pageMargins: pageMargins,
148
+ content: content,
149
+ info: {
150
+ title: 'invoice',
151
+ subject: Array.isArray(printCopies) ? printCopies.join(', ') : ''
152
+ },
153
+ ...(background ? { background } : {}),
154
+ ...(watermark ? { watermark } : {}),
155
+ ...(pageHeader !== null ? { header: pageHeader } : {}),
156
+ ...(pageFooter !== null ? { footer: pageFooter } : {})
157
+ };
158
+
159
+ return dd;
160
+ }
161
+
162
+ function normalizeCopyLabels(printCopies: string[] = []) {
163
+ const labels = Array.isArray(printCopies)
164
+ ? printCopies
165
+ .map((entry: any) => toStr(entry).trim())
166
+ .filter((entry: string) => !!entry)
167
+ : [];
168
+ return labels.length > 0 ? labels : [''];
169
+ }
170
+
171
+ function normalizePrintConfig(PDFInvoiceData: any, PrintConfigData: any) {
172
+ const config = PrintConfigData || {};
173
+ const itemsHeader = Array.isArray(config?.TableConfig) ? config.TableConfig : [];
174
+ const headerData = config?.headerData ? config.headerData : deriveHeaderDataFromInvoice(PDFInvoiceData);
175
+ const pageMargins = resolvePageMargins(config?.Margin ?? PAGE_MARGINS);
176
+ const watermarkText = toStr(config?.WatermarkText);
177
+ const watermark = !!config?.Watermark;
178
+ const watermarkEnabled = !!config?.WatermarkEnabled;
179
+ const footerText = toStr(config?.Footer?.Text);
180
+ const headerStyles = normalizeHeaderStyle(config?.headerStyles ?? {
181
+ OrgNameFsize: config?.OrgNameFsize,
182
+ OrgNameClr: config?.OrgNameClr,
183
+ AdrsFsize: config?.AdrsFsize,
184
+ AdrsClr: config?.AdrsClr
185
+ });
186
+ const fixedTo = normalizeFixedTo(config?.fixedTo);
187
+
188
+ return {
189
+ ...config,
190
+ itemsHeader,
191
+ headerData,
192
+ pageMargins,
193
+ watermarkText,
194
+ watermark,
195
+ watermarkEnabled,
196
+ footerText,
197
+ headerStyles,
198
+ fixedTo
199
+ };
200
+ }
201
+
202
+ function normalizeFixedTo(value: any) {
203
+ const parsed = Number(value);
204
+ if (!Number.isFinite(parsed) || parsed < 0) {
205
+ return 2;
206
+ }
207
+ return Math.floor(parsed);
208
+ }
209
+
210
+
211
+
@@ -0,0 +1,21 @@
1
+
2
+ import { TrUtils } from "../../utils/tr-utils";
3
+ import { PurchaseOrderPrintService } from "../purchase-order/purchase-order-print.service";
4
+ import { CreateBillPDFService } from "./bill-pdf/bill-pdf.service";
5
+
6
+ export function GetBillPDF(billData: any, entityData: any, headerConfig:any, printConfig:any, taxCodes: any, image: any = null) {
7
+
8
+ const printConfigData: any = TrUtils.ConcatObjects(
9
+ TrUtils.Stringify(headerConfig),
10
+ TrUtils.Stringify(printConfig)
11
+ );
12
+ const invoicePrintData: any = PurchaseOrderPrintService.GetDataForPurchaseOrderPrint(billData, entityData, image,
13
+ billData.BFrom, taxCodes, false);
14
+ let invPrint: any;
15
+ // if (options.ConsolidateGST || !options.ShowGST) {
16
+ // invPrint = GetInvoicePrint(invoicePrintData, numberofCopies, withPass, options.Size, options.MoreDiscDetails, options.Orientation);
17
+ // } else {
18
+ invPrint = CreateBillPDFService(invoicePrintData, printConfigData);
19
+ // }
20
+ return invPrint;
21
+ }
@@ -0,0 +1,313 @@
1
+ import * as XLSX from 'xlsx';
2
+ import { MyDate } from '../../../../utils/my-date';
3
+ import { TrUtils } from '../../../../utils/tr-utils';
4
+
5
+ export class PaymentsMadeXlsxFileService {
6
+ static wb: any = {};
7
+ static Row: any = 2;
8
+ static MergeArray: any[] = [];
9
+ static range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
10
+ static ws: any = {};
11
+
12
+ static GetPaymentsMadeDetailsExcelData(MainData: any, isPur: boolean, isSale: boolean, searchValue: any, HeaderName: string, ExtraFields: boolean, EntitySettings: any) {
13
+ this.wb = {};
14
+ this.ws = {};
15
+ this.Row = 0;
16
+ this.range = { s: { c: 0, r: 0 }, e: { c: 0, r: 0 } };
17
+ this.MergeArray = [];
18
+ let ws_name = HeaderName;
19
+ this.wb.Sheets = {};
20
+ this.wb.Props = {};
21
+ this.wb.SSF = {};
22
+ this.wb.SheetNames = [];
23
+
24
+ // MainData = this.GetTotals(MainData);
25
+ let showSearch: any = [];
26
+ for (const key in searchValue) {
27
+ if (!TrUtils.IsNull(searchValue[key]) && !TrUtils.CheckInvalidSelect(searchValue[key]) && key !== 'Date' && key !== 'CustCntrlId') {
28
+ showSearch.push([{
29
+ text: (key === 'StDate') ? 'Start Date' : (key === 'EnDate') ? 'End Date' : (key === 'CustCntrl') ? isSale ? 'Customer' : 'Vendor' : key,
30
+ ColRange: 1,
31
+ bold: true,
32
+ ChildHeadings: [
33
+ // { text: 'Central Tax', ColRange: 1 },
34
+ // { text: 'State Tax', ColRange: 1 },
35
+ // { text: 'IGST Tax', ColRange: 1 },
36
+ ],
37
+ }, {
38
+ text: (key === 'StDate') ? MyDate.ConvertUTCDateToReadable(searchValue[key]) : (key === 'EnDate') ? MyDate.ConvertUTCDateToReadable(searchValue[key]) : searchValue[key],
39
+ ColRange: 7,
40
+ bold: true,
41
+ ChildHeadings: [
42
+ // { text: 'Central Tax', ColRange: 1 },
43
+ // { text: 'State Tax', ColRange: 1 },
44
+ // { text: 'IGST Tax', ColRange: 1 },
45
+ ],
46
+ }]);
47
+ }
48
+
49
+ // console.log(`${key}: ${searchValue[key]}`);
50
+ }
51
+ this.setHeadingInCell(isPur, showSearch, HeaderName, ExtraFields);
52
+
53
+ this.setInvoiceDetailsInCell(MainData, isSale,isPur, ExtraFields, EntitySettings.DecimalsNumber);
54
+
55
+ this.ws['!ref'] = XLSX.utils.encode_range(this.range);
56
+
57
+ this.ws['!merges'] = this.MergeArray;
58
+ this.ws["!cols"] = [{ wch: 10 }, { wch: 15 }, { wch: 50 }, { wch: 10 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 15 }, { wch: 20 }];
59
+
60
+ this.wb.SheetNames.push(ws_name);
61
+
62
+ this.wb.Sheets[ws_name] = this.ws;
63
+
64
+ return this.wb;
65
+ }
66
+
67
+ static GetTotals(MainData: any) {
68
+ MainData.forEach((InvoiceInfo: any) => {
69
+
70
+ // InvoiceInfo.Tax =
71
+ // InvoiceInfo.ItemsCGST + InvoiceInfo.ItemsSGST + InvoiceInfo.ItemsIGST;
72
+ InvoiceInfo.TotalAmount = InvoiceInfo.Tax + InvoiceInfo.NetAmt;
73
+ });
74
+ return MainData;
75
+ }
76
+
77
+ static setHeadingInCell(isPur: boolean, showSearch: any, HeaderName: any, ExtraFields: boolean) {
78
+
79
+ let MainHeadings: any[] = [
80
+ {
81
+ text: 'SNo',
82
+ ColRange: 1,
83
+ bold: true,
84
+ },
85
+
86
+ {
87
+ text: 'Transaction #',
88
+ ColRange: 1,
89
+ bold: true,
90
+ },
91
+ // {
92
+ // text: isSale?'Invoice No':'Bill No',
93
+ // ColRange: 1,
94
+ // bold: true,
95
+
96
+ // },
97
+ // {
98
+ // text: isSale?'RO No':'PO No',
99
+ // ColRange: 1,
100
+ // bold: true,
101
+ // },
102
+ // {
103
+ // text: 'Vehicle No',
104
+ // ColRange: 1,
105
+ // bold: true,
106
+ // },
107
+
108
+ {
109
+ text: isPur ? 'Vendor Name' : 'Customer Name',
110
+ ColRange: 1,
111
+ bold: true,
112
+ },
113
+ {
114
+ text: 'Payment Date',
115
+ ColRange: 1,
116
+ bold: true,
117
+ },
118
+ {
119
+ text: 'Payment Type',
120
+ ColRange: 1,
121
+ bold: true,
122
+
123
+ },
124
+ // {
125
+ // text: 'Reg. No',
126
+ // ColRange: 1,
127
+ // bold: true,
128
+
129
+ // },
130
+
131
+
132
+ {
133
+ text: 'Amount Paid',
134
+ ColRange: 1,
135
+ bold: true,
136
+
137
+ },
138
+ ];
139
+
140
+ if (ExtraFields) {
141
+ MainHeadings.splice(2, 0, {
142
+ text: isPur ? 'Bill No' : 'Invoice No',
143
+ ColRange: 1,
144
+ bold: true,
145
+
146
+ },
147
+ {
148
+ text: isPur ? 'PO No' : 'RO No',
149
+ ColRange: 1,
150
+ bold: true,
151
+ },
152
+ {
153
+ text: 'Vehicle No',
154
+ ColRange: 1,
155
+ bold: true,
156
+ }
157
+ )
158
+ }
159
+
160
+ this.SetDataInCell(HeaderName, 0, this.Row);
161
+ this.MergeArray.push({
162
+ s: { r: this.Row, c: 0 },
163
+ e: { r: this.Row, c: 0 + 5 - 1 },
164
+ });
165
+ this.Row += 2;
166
+ // console.log('showSearch', showSearch);
167
+ showSearch.forEach((search: any) => {
168
+ let ColStart: any = 0;
169
+ // console.log('search', search, ColStart);
170
+ search.forEach((item: any) => {
171
+ // console.log('text', oyo.text, ColStart);
172
+ this.SetDataInCell(item.text, ColStart, this.Row);
173
+ this.MergeArray.push({
174
+ s: { r: this.Row, c: ColStart },
175
+ e: { r: this.Row, c: ColStart + item.ColRange - 1 },
176
+ });
177
+ ColStart += item.ColRange;
178
+ });
179
+ this.Row += 1;
180
+ });
181
+ this.Row += 1;
182
+ let MainColStart: any = 0;
183
+ MainHeadings.forEach((MainHeader: any) => {
184
+ this.SetDataInCell(MainHeader.text, MainColStart, this.Row);
185
+ this.MergeArray.push({
186
+ s: { r: this.Row, c: MainColStart },
187
+ e: { r: this.Row, c: MainColStart + MainHeader.ColRange - 1 },
188
+ });
189
+ MainColStart += MainHeader.ColRange;
190
+ });
191
+
192
+ this.Row += 2;
193
+ }
194
+
195
+ static setInvoiceDetailsInCell(MainData: any, isSale: boolean,isPur:boolean, ExtraFields:boolean, DecimalsNumber: number) {
196
+ MainData.forEach((InvoiceList: any, index: any) => {
197
+ this.SetInvoiceDataInExcel(InvoiceList, index, isSale,isPur, ExtraFields, DecimalsNumber);
198
+ });
199
+ }
200
+
201
+ static SetInvoiceDataInExcel(InvoiceInfo: any, index: any, isSale: boolean,isPur:any, ExtraFields:boolean, DecimalsNumber: number) {
202
+ if (isSale) {
203
+ InvoiceInfo.Date = this.ConvertDateToReadableFormat(InvoiceInfo.Pay.Dt);
204
+ } else {
205
+ InvoiceInfo.Date = this.ConvertDateToReadableFormat(InvoiceInfo.Date);
206
+
207
+ }
208
+
209
+ let InvoiceData: any = [
210
+ { text: index + 1, ColRange: 1, IsString: true },
211
+ { text: InvoiceInfo.Code, ColRange: 1, IsString: true },
212
+ // { text: isSale?InvoiceInfo.InvCode:InvoiceInfo.BNo, ColRange: 1, IsString: false },
213
+ // { text: isSale?InvoiceInfo.OrdCode:InvoiceInfo.POCode, ColRange: 1, IsString: false },
214
+ // { text: InvoiceInfo.RegNo, ColRange: 1, IsString: true },
215
+ { text: isSale ? InvoiceInfo.CustName : InvoiceInfo.Name, ColRange: 1, IsString: true },
216
+ { text: InvoiceInfo.Date, ColRange: 1, IsString: true },
217
+ { text: isSale ? InvoiceInfo.Pay.Type : InvoiceInfo.PType, ColRange: 1, IsString: true },
218
+ { text: isSale ? TrUtils.FixPriceValue(InvoiceInfo.Pay?.Amt, DecimalsNumber) : TrUtils.FixPriceValue(InvoiceInfo.Amt, DecimalsNumber), ColRange: 1, IsString: false }
219
+ ];
220
+ if (ExtraFields) {
221
+ InvoiceData.splice(2, 0,
222
+ { text: isPur ? InvoiceInfo.BNo : InvoiceInfo.InvCode, ColRange: 1, IsString: false },
223
+ { text: isPur ? InvoiceInfo.POCode : InvoiceInfo.OrdCode, ColRange: 1, IsString: false },
224
+ { text: InvoiceInfo.RegNo, ColRange: 1, IsString: true },
225
+ )
226
+ }
227
+ let ColStart: any = 0;
228
+ InvoiceData.forEach((InvData: any) => {
229
+ InvData.text = this.ConvertToString(InvData.text, InvData.IsString, DecimalsNumber);
230
+ this.SetDataInCell(InvData.text, ColStart, this.Row);
231
+ this.MergeArray.push({
232
+ s: { r: this.Row, c: ColStart },
233
+ e: { r: this.Row, c: ColStart + InvData.ColRange - 1 },
234
+ });
235
+ ColStart += InvData.ColRange;
236
+ });
237
+
238
+ this.Row += 1;
239
+ }
240
+
241
+ static ConvertToString(Text: any, IsString: any, DecimalsNumber: number) {
242
+ if (IsString) {
243
+ if (Text == null) {
244
+ Text = '';
245
+ }
246
+ } else {
247
+ if (Text == null) {
248
+ Text = 0;
249
+ }
250
+ }
251
+ if (typeof Text === 'number') {
252
+ return Number(TrUtils.FixedTo(Text, DecimalsNumber));
253
+ } else {
254
+ return Text;
255
+ }
256
+ }
257
+
258
+ static SetDataInCell(Data: any, ColRange: number, RowNum: any) {
259
+ var cell = { v: Data };
260
+ var cell_ref = XLSX.utils.encode_cell({ c: ColRange, r: RowNum });
261
+ if (this.range.e.c < ColRange) {
262
+ this.range.e.c = ColRange;
263
+ }
264
+ if (this.range.e.r < RowNum) {
265
+ this.range.e.r = RowNum;
266
+ }
267
+ cell = this.getcelltype(cell);
268
+ this.ws[cell_ref] = cell;
269
+ }
270
+
271
+ static getcelltype(cell: any) {
272
+ if (typeof cell.v === 'number') cell.t = 'n';
273
+ else if (typeof cell.v === 'boolean') cell.t = 'b';
274
+ else cell.t = 's';
275
+ return cell;
276
+ }
277
+
278
+ static ConvertDateToReadableFormat(DateObject: any) {
279
+ if (!TrUtils.IsEmpty(DateObject)) {
280
+ let date: any = new Date(DateObject);
281
+ let Month: any;
282
+ let Day: any;
283
+
284
+ let MonthName = new Array();
285
+ MonthName[0] = 'Jan';
286
+ MonthName[1] = 'Feb';
287
+ MonthName[2] = 'Mar';
288
+ MonthName[3] = 'Apr';
289
+ MonthName[4] = 'May';
290
+ MonthName[5] = 'Jun';
291
+ MonthName[6] = 'Jul';
292
+ MonthName[7] = 'Aug';
293
+ MonthName[8] = 'Sept';
294
+ MonthName[9] = 'Oct';
295
+ MonthName[10] = 'Nov';
296
+ MonthName[11] = 'Dec';
297
+
298
+ Month = MonthName[date.getMonth()];
299
+
300
+ if (date.getDate() < 10) {
301
+ Day = '0' + date.getDate();
302
+ } else {
303
+ Day = date.getDate();
304
+ }
305
+
306
+ date = Day + '-' + Month + '-' + date.getFullYear();
307
+ return date;
308
+ } else {
309
+ return null;
310
+ }
311
+ }
312
+
313
+ }