shareneus 1.5.85 → 1.5.87

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.
@@ -270,7 +270,6 @@ class PosReceiptPrintService {
270
270
  }
271
271
  }
272
272
  static GetTotalDetails(InvoicePDFData, size) {
273
- console.log('InvoicePDFData', InvoicePDFData);
274
273
  let TotalData = [];
275
274
  if (!InvoicePDFData.Consolidate && !tr_utils_1.TrUtils.IsFixedZero(InvoicePDFData.STotal)) {
276
275
  // TotalData.push({ text: 'Sub Total : ' + InvoicePDFData.STotal, style: ['headerstyle'], alignment: 'right', marginRight: 5, })
@@ -593,7 +593,6 @@ class SalesReceiptpdfService {
593
593
  return headersNames;
594
594
  }
595
595
  static CommonTotalDetails(ROPrintData, index, numberofCopies, moreDiscDetails) {
596
- console.log('isConsolidate', ROPrintData.Consolidate);
597
596
  let CommonDetails = [
598
597
  shared_pdf_service_1.SharedPDFService.GetFinalTotalDetails(ROPrintData, ROPrintData.CustLaborTotalBeforeDisc, ROPrintData.CustLaborDiscTotal, ROPrintData.CustLaborCGST, ROPrintData.CustLaborSGST, ROPrintData.CustLaborIGST, ROPrintData.CustPartIGST, ROPrintData.ShowIGST, ROPrintData.ShowTaxColumn, ROPrintData.CustPartsTotalBeforeDisc, ROPrintData.CustPartsDiscTotal, ROPrintData.CustPartCGST, ROPrintData.CustPartSGST, ROPrintData.CustTaxGroupData, ROPrintData.ShowAccParts, ROPrintData.CustLaborAfterTax, ROPrintData.CustPartAfterTax, ROPrintData.FixedDisc, ROPrintData.For, ROPrintData.FixedTotal, ROPrintData.CustTotalRoundedBy, ROPrintData.CustRoundedTotal, ROPrintData.ShowTaxColumn, ROPrintData.ShowTaxColumn, tr_utils_1.TrUtils.isTaxable(ROPrintData.Settings.Tax), ROPrintData.CustLaborITax, ROPrintData.CustPartITax, ROPrintData.Consolidate, ROPrintData.From, ROPrintData.Adj, null, moreDiscDetails),
599
598
  shared_pdf_service_1.SharedPDFService.InvoiceDueStatus(ROPrintData.Type, ROPrintData.Paid, ROPrintData.Due, ROPrintData.Sts, false, ROPrintData.Entity.DecimalsNumber),
@@ -32,7 +32,6 @@ class SaleReceiptPrintService {
32
32
  argInvoiceData.Ops = [];
33
33
  }
34
34
  let finalTotalsData = invoice_total_service_1.InvoiceTotalsService.GetTotalsValue(argInvoiceData.Ops, argInvoiceData.Items, IsTaxable, true, argInvoiceData.LDisc, argInvoiceData.LPerc, argInvoiceData.PDisc, argInvoiceData.PPerc, argInvoiceData.Disc, argInvoiceData.Perc, TaxCodes, true, argInvoiceData.Settings, argInvoiceData.Adjust, InvoicePrintData.Entity.Round, InvoicePrintData.Entity);
35
- console.log('finalTotalsData', finalTotalsData);
36
35
  if (ConsolidateGST) {
37
36
  finalTotalsData.CustLaborTotalBeforeDisc = finalTotalsData.CustLaborAfterTax;
38
37
  finalTotalsData.CustPartsTotalBeforeDisc = finalTotalsData.CustPartAfterTax;
@@ -1,12 +1,17 @@
1
1
  export declare function CreateInvoicePDFService(PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
2
- footer?: ((_currentPage: number, pageCount: number) => {
2
+ footer?: (() => {
3
3
  margin: number[];
4
- columns: {
5
- text: string;
6
- alignment: string;
7
- fontSize: number;
8
- color: string;
9
- }[];
4
+ text: string;
5
+ alignment: "center" | "left" | "right";
6
+ fontSize: number;
7
+ color: string;
8
+ }) | undefined;
9
+ header?: ((currentPage: number, pageCount: number) => {
10
+ text: string;
11
+ alignment: string;
12
+ margin: number[];
13
+ fontSize: number;
14
+ color: string;
10
15
  }) | undefined;
11
16
  watermark?: {
12
17
  text: string;
@@ -21,7 +26,10 @@ export declare function CreateInvoicePDFService(PDFInvoiceData?: any, PrintConfi
21
26
  alignment: string;
22
27
  margin: number[];
23
28
  }) | undefined;
24
- pageSize: string;
29
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
30
+ width: number;
31
+ height: number;
32
+ };
25
33
  pageOrientation: "portrait" | "landscape";
26
34
  pageMargins: [number, number, number, number];
27
35
  content: any[];
@@ -31,14 +39,19 @@ export declare function CreateInvoicePDFService(PDFInvoiceData?: any, PrintConfi
31
39
  };
32
40
  };
33
41
  export declare function DownloadInvoicePDFService(filename?: string, PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
34
- footer?: ((_currentPage: number, pageCount: number) => {
42
+ footer?: (() => {
35
43
  margin: number[];
36
- columns: {
37
- text: string;
38
- alignment: string;
39
- fontSize: number;
40
- color: string;
41
- }[];
44
+ text: string;
45
+ alignment: "center" | "left" | "right";
46
+ fontSize: number;
47
+ color: string;
48
+ }) | undefined;
49
+ header?: ((currentPage: number, pageCount: number) => {
50
+ text: string;
51
+ alignment: string;
52
+ margin: number[];
53
+ fontSize: number;
54
+ color: string;
42
55
  }) | undefined;
43
56
  watermark?: {
44
57
  text: string;
@@ -53,7 +66,10 @@ export declare function DownloadInvoicePDFService(filename?: string, PDFInvoiceD
53
66
  alignment: string;
54
67
  margin: number[];
55
68
  }) | undefined;
56
- pageSize: string;
69
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
70
+ width: number;
71
+ height: number;
72
+ };
57
73
  pageOrientation: "portrait" | "landscape";
58
74
  pageMargins: [number, number, number, number];
59
75
  content: any[];
@@ -63,14 +79,19 @@ export declare function DownloadInvoicePDFService(filename?: string, PDFInvoiceD
63
79
  };
64
80
  };
65
81
  export declare function GetInvoicePdfDataUrl(PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
66
- footer?: ((_currentPage: number, pageCount: number) => {
82
+ footer?: (() => {
67
83
  margin: number[];
68
- columns: {
69
- text: string;
70
- alignment: string;
71
- fontSize: number;
72
- color: string;
73
- }[];
84
+ text: string;
85
+ alignment: "center" | "left" | "right";
86
+ fontSize: number;
87
+ color: string;
88
+ }) | undefined;
89
+ header?: ((currentPage: number, pageCount: number) => {
90
+ text: string;
91
+ alignment: string;
92
+ margin: number[];
93
+ fontSize: number;
94
+ color: string;
74
95
  }) | undefined;
75
96
  watermark?: {
76
97
  text: string;
@@ -85,7 +106,10 @@ export declare function GetInvoicePdfDataUrl(PDFInvoiceData?: any, PrintConfigDa
85
106
  alignment: string;
86
107
  margin: number[];
87
108
  }) | undefined;
88
- pageSize: string;
109
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
110
+ width: number;
111
+ height: number;
112
+ };
89
113
  pageOrientation: "portrait" | "landscape";
90
114
  pageMargins: [number, number, number, number];
91
115
  content: any[];
@@ -8,7 +8,6 @@ const pdf_table_section_1 = require("../../../shared/table-section/pdf-table.sec
8
8
  const pdf_totals_section_1 = require("../../../shared/totals-section/pdf-totals.section");
9
9
  const pdf_shared_utils_1 = require("../../../shared/header-footer-section/pdf-shared.utils");
10
10
  const pdf_header_footer_section_1 = require("../../../shared/header-footer-section/pdf-header-footer.section");
11
- const PAGE_SIZE = 'A4';
12
11
  const PAGE_MARGINS = [20, 20, 20, 20];
13
12
  const CELL_PADDING_LEFT = 4;
14
13
  const CELL_PADDING_RIGHT = 4;
@@ -65,11 +64,13 @@ function GetInvoicePdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCo
65
64
  function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
66
65
  const PrintConfig = normalizePrintConfig(PDFInvoiceData, PrintConfigData);
67
66
  const pageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation);
67
+ const pageSize = (0, pdf_header_footer_section_1.resolvePageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize, pageOrientation);
68
68
  const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
69
- const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(PAGE_SIZE, pageOrientation, pageMargins);
69
+ const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(pageSize, pageOrientation, pageMargins);
70
70
  const copyLabels = normalizeCopyLabels(printCopies);
71
71
  const watermark = (0, pdf_header_footer_section_1.buildWatermark)(PrintConfig);
72
72
  const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, PDFInvoiceData);
73
+ const header = (0, pdf_header_footer_section_1.buildPageNumberHeader)(PrintConfig);
73
74
  const footer = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
74
75
  const content = [];
75
76
  copyLabels.forEach((copyLabel, index) => {
@@ -108,10 +109,10 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
108
109
  }
109
110
  }, ...invoiceTotalsAndNotesContent, ...signatureContent);
110
111
  });
111
- const dd = Object.assign(Object.assign(Object.assign({ pageSize: PAGE_SIZE, pageOrientation: pageOrientation, pageMargins: pageMargins, content: content, info: {
112
+ const dd = Object.assign(Object.assign(Object.assign(Object.assign({ pageSize: pageSize, pageOrientation: pageOrientation, pageMargins: pageMargins, content: content, info: {
112
113
  title: 'invoice',
113
114
  subject: Array.isArray(printCopies) ? printCopies.join(', ') : ''
114
- } }, (background ? { background } : {})), (watermark ? { watermark } : {})), (footer ? { footer } : {}));
115
+ } }, (background ? { background } : {})), (watermark ? { watermark } : {})), (header ? { header } : {})), (footer ? { footer } : {}));
115
116
  return dd;
116
117
  }
117
118
  function normalizeCopyLabels(printCopies = []) {
@@ -1,12 +1,10 @@
1
1
  export declare function CreateReceiptPDFService(DocumentData?: any, PrintConfigData?: any): {
2
- footer?: ((_currentPage: number, pageCount: number) => {
2
+ footer?: (() => {
3
3
  margin: number[];
4
- columns: {
5
- text: string;
6
- alignment: string;
7
- fontSize: number;
8
- color: string;
9
- }[];
4
+ text: string;
5
+ alignment: "center" | "left" | "right";
6
+ fontSize: number;
7
+ color: string;
10
8
  }) | undefined;
11
9
  watermark?: {
12
10
  text: string;
@@ -249,14 +247,12 @@ export declare function CreateReceiptPDFService(DocumentData?: any, PrintConfigD
249
247
  };
250
248
  };
251
249
  export declare function DownloadReceiptPDFService(filename?: string, DocumentData?: any, PrintConfigData?: any): {
252
- footer?: ((_currentPage: number, pageCount: number) => {
250
+ footer?: (() => {
253
251
  margin: number[];
254
- columns: {
255
- text: string;
256
- alignment: string;
257
- fontSize: number;
258
- color: string;
259
- }[];
252
+ text: string;
253
+ alignment: "center" | "left" | "right";
254
+ fontSize: number;
255
+ color: string;
260
256
  }) | undefined;
261
257
  watermark?: {
262
258
  text: string;
@@ -499,14 +495,12 @@ export declare function DownloadReceiptPDFService(filename?: string, DocumentDat
499
495
  };
500
496
  };
501
497
  export declare function GetReceiptPdfDataUrl(DocumentData?: any, PrintConfigData?: any): {
502
- footer?: ((_currentPage: number, pageCount: number) => {
498
+ footer?: (() => {
503
499
  margin: number[];
504
- columns: {
505
- text: string;
506
- alignment: string;
507
- fontSize: number;
508
- color: string;
509
- }[];
500
+ text: string;
501
+ alignment: "center" | "left" | "right";
502
+ fontSize: number;
503
+ color: string;
510
504
  }) | undefined;
511
505
  watermark?: {
512
506
  text: string;
@@ -749,14 +743,12 @@ export declare function GetReceiptPdfDataUrl(DocumentData?: any, PrintConfigData
749
743
  };
750
744
  };
751
745
  export declare function buildPdfDocDefinition(DocumentData?: any, PrintConfigData?: any): {
752
- footer?: ((_currentPage: number, pageCount: number) => {
746
+ footer?: (() => {
753
747
  margin: number[];
754
- columns: {
755
- text: string;
756
- alignment: string;
757
- fontSize: number;
758
- color: string;
759
- }[];
748
+ text: string;
749
+ alignment: "center" | "left" | "right";
750
+ fontSize: number;
751
+ color: string;
760
752
  }) | undefined;
761
753
  watermark?: {
762
754
  text: string;
@@ -1,12 +1,17 @@
1
1
  export declare function CreateBillPDFService(PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
2
- footer?: ((_currentPage: number, pageCount: number) => {
2
+ footer?: (() => {
3
3
  margin: number[];
4
- columns: {
5
- text: string;
6
- alignment: string;
7
- fontSize: number;
8
- color: string;
9
- }[];
4
+ text: string;
5
+ alignment: "center" | "left" | "right";
6
+ fontSize: number;
7
+ color: string;
8
+ }) | undefined;
9
+ header?: ((currentPage: number, pageCount: number) => {
10
+ text: string;
11
+ alignment: string;
12
+ margin: number[];
13
+ fontSize: number;
14
+ color: string;
10
15
  }) | undefined;
11
16
  watermark?: {
12
17
  text: string;
@@ -21,7 +26,10 @@ export declare function CreateBillPDFService(PDFInvoiceData?: any, PrintConfigDa
21
26
  alignment: string;
22
27
  margin: number[];
23
28
  }) | undefined;
24
- pageSize: string;
29
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
30
+ width: number;
31
+ height: number;
32
+ };
25
33
  pageOrientation: "portrait" | "landscape";
26
34
  pageMargins: [number, number, number, number];
27
35
  content: any[];
@@ -31,14 +39,19 @@ export declare function CreateBillPDFService(PDFInvoiceData?: any, PrintConfigDa
31
39
  };
32
40
  };
33
41
  export declare function DownloadBillPDFService(filename?: string, PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
34
- footer?: ((_currentPage: number, pageCount: number) => {
42
+ footer?: (() => {
35
43
  margin: number[];
36
- columns: {
37
- text: string;
38
- alignment: string;
39
- fontSize: number;
40
- color: string;
41
- }[];
44
+ text: string;
45
+ alignment: "center" | "left" | "right";
46
+ fontSize: number;
47
+ color: string;
48
+ }) | undefined;
49
+ header?: ((currentPage: number, pageCount: number) => {
50
+ text: string;
51
+ alignment: string;
52
+ margin: number[];
53
+ fontSize: number;
54
+ color: string;
42
55
  }) | undefined;
43
56
  watermark?: {
44
57
  text: string;
@@ -53,7 +66,10 @@ export declare function DownloadBillPDFService(filename?: string, PDFInvoiceData
53
66
  alignment: string;
54
67
  margin: number[];
55
68
  }) | undefined;
56
- pageSize: string;
69
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
70
+ width: number;
71
+ height: number;
72
+ };
57
73
  pageOrientation: "portrait" | "landscape";
58
74
  pageMargins: [number, number, number, number];
59
75
  content: any[];
@@ -63,14 +79,19 @@ export declare function DownloadBillPDFService(filename?: string, PDFInvoiceData
63
79
  };
64
80
  };
65
81
  export declare function GetBillPdfDataUrl(PDFInvoiceData?: any, PrintConfigData?: any, printCopies?: string[]): {
66
- footer?: ((_currentPage: number, pageCount: number) => {
82
+ footer?: (() => {
67
83
  margin: number[];
68
- columns: {
69
- text: string;
70
- alignment: string;
71
- fontSize: number;
72
- color: string;
73
- }[];
84
+ text: string;
85
+ alignment: "center" | "left" | "right";
86
+ fontSize: number;
87
+ color: string;
88
+ }) | undefined;
89
+ header?: ((currentPage: number, pageCount: number) => {
90
+ text: string;
91
+ alignment: string;
92
+ margin: number[];
93
+ fontSize: number;
94
+ color: string;
74
95
  }) | undefined;
75
96
  watermark?: {
76
97
  text: string;
@@ -85,7 +106,10 @@ export declare function GetBillPdfDataUrl(PDFInvoiceData?: any, PrintConfigData?
85
106
  alignment: string;
86
107
  margin: number[];
87
108
  }) | undefined;
88
- pageSize: string;
109
+ pageSize: "A4" | "LETTER" | "LEGAL" | {
110
+ width: number;
111
+ height: number;
112
+ };
89
113
  pageOrientation: "portrait" | "landscape";
90
114
  pageMargins: [number, number, number, number];
91
115
  content: any[];
@@ -8,7 +8,6 @@ const pdf_table_section_1 = require("../../../shared/table-section/pdf-table.sec
8
8
  const pdf_totals_section_1 = require("../../../shared/totals-section/pdf-totals.section");
9
9
  const pdf_shared_utils_1 = require("../../../shared/header-footer-section/pdf-shared.utils");
10
10
  const pdf_header_footer_section_1 = require("../../../shared/header-footer-section/pdf-header-footer.section");
11
- const PAGE_SIZE = 'A4';
12
11
  const PAGE_MARGINS = [20, 20, 20, 20];
13
12
  const CELL_PADDING_LEFT = 4;
14
13
  const CELL_PADDING_RIGHT = 4;
@@ -65,11 +64,13 @@ function GetBillPdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCopie
65
64
  function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
66
65
  const PrintConfig = normalizePrintConfig(PDFInvoiceData, PrintConfigData);
67
66
  const pageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation);
67
+ const pageSize = (0, pdf_header_footer_section_1.resolvePageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize, pageOrientation);
68
68
  const pageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
69
- const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(PAGE_SIZE, pageOrientation, pageMargins);
69
+ const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(pageSize, pageOrientation, pageMargins);
70
70
  const copyLabels = normalizeCopyLabels(printCopies);
71
71
  const watermark = (0, pdf_header_footer_section_1.buildWatermark)(PrintConfig);
72
72
  const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, PDFInvoiceData);
73
+ const header = (0, pdf_header_footer_section_1.buildPageNumberHeader)(PrintConfig);
73
74
  const footer = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
74
75
  const content = [];
75
76
  copyLabels.forEach((copyLabel, index) => {
@@ -108,10 +109,10 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
108
109
  }
109
110
  }, ...invoiceTotalsAndNotesContent, ...signatureContent);
110
111
  });
111
- const dd = Object.assign(Object.assign(Object.assign({ pageSize: PAGE_SIZE, pageOrientation: pageOrientation, pageMargins: pageMargins, content: content, info: {
112
+ const dd = Object.assign(Object.assign(Object.assign(Object.assign({ pageSize: pageSize, pageOrientation: pageOrientation, pageMargins: pageMargins, content: content, info: {
112
113
  title: 'invoice',
113
114
  subject: Array.isArray(printCopies) ? printCopies.join(', ') : ''
114
- } }, (background ? { background } : {})), (watermark ? { watermark } : {})), (footer ? { footer } : {}));
115
+ } }, (background ? { background } : {})), (watermark ? { watermark } : {})), (header ? { header } : {})), (footer ? { footer } : {}));
115
116
  return dd;
116
117
  }
117
118
  function normalizeCopyLabels(printCopies = []) {
@@ -7,7 +7,6 @@ const tr_utils_1 = require("../../utils/tr-utils");
7
7
  const equipment_design_pdf_service_1 = require("./equipment-design-pdf.service");
8
8
  class SalesPdfService {
9
9
  static GetSalesPrint(ROPrintData, numberofCopies, isOtherIndustry, Entity, Sites, Items, Image, moreDiscDetails) {
10
- console.log('ROPrintData', ROPrintData);
11
10
  var contents = [];
12
11
  if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
13
12
  contents.push(this.CommonHeaderDetails(ROPrintData, null), this.PreparesparePartsTable(ROPrintData), this.CommonTotalDetails(ROPrintData, null, numberofCopies, moreDiscDetails));
@@ -1,4 +1,8 @@
1
1
  export declare function resolvePageOrientation(value: any): 'portrait' | 'landscape';
2
+ export declare function resolvePageSize(value: any, orientation?: 'portrait' | 'landscape'): 'A4' | 'LETTER' | 'LEGAL' | {
3
+ width: number;
4
+ height: number;
5
+ };
2
6
  export declare function deriveHeaderDataFromInvoice(PDFInvoiceData: any): {
3
7
  invoiceHeading: string;
4
8
  organization: {
@@ -107,12 +111,17 @@ export declare function buildLogoWatermarkBackground(PrintConfig: any, DocumentD
107
111
  alignment: string;
108
112
  margin: number[];
109
113
  }) | null;
110
- export declare function buildFooter(PrintConfig: any): ((_currentPage: number, pageCount: number) => {
114
+ export declare function buildFooter(PrintConfig: any): (() => {
111
115
  margin: number[];
112
- columns: {
113
- text: string;
114
- alignment: string;
115
- fontSize: number;
116
- color: string;
117
- }[];
116
+ text: string;
117
+ alignment: "center" | "left" | "right";
118
+ fontSize: number;
119
+ color: string;
120
+ }) | null;
121
+ export declare function buildPageNumberHeader(PrintConfig: any): ((currentPage: number, pageCount: number) => {
122
+ text: string;
123
+ alignment: string;
124
+ margin: number[];
125
+ fontSize: number;
126
+ color: string;
118
127
  }) | null;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolvePageOrientation = resolvePageOrientation;
4
+ exports.resolvePageSize = resolvePageSize;
4
5
  exports.deriveHeaderDataFromInvoice = deriveHeaderDataFromInvoice;
5
6
  exports.normalizeHeaderData = normalizeHeaderData;
6
7
  exports.normalizeHeaderStyle = normalizeHeaderStyle;
@@ -10,8 +11,12 @@ exports.buildDocumentHeadingSection = buildDocumentHeadingSection;
10
11
  exports.buildWatermark = buildWatermark;
11
12
  exports.buildLogoWatermarkBackground = buildLogoWatermarkBackground;
12
13
  exports.buildFooter = buildFooter;
14
+ exports.buildPageNumberHeader = buildPageNumberHeader;
13
15
  const pdf_shared_utils_1 = require("./pdf-shared.utils");
14
16
  const DEFAULT_PAGE_ORIENTATION = 'portrait';
17
+ const A4_WIDTH = 595.28;
18
+ const A4_HEIGHT = 841.89;
19
+ const HALF_A4_HEIGHT = A4_HEIGHT / 2;
15
20
  const DEFAULT_ORG_NAME_FONT_SIZE = 16;
16
21
  const DEFAULT_ORG_ADDRESS_FONT_SIZE = 9;
17
22
  const DEFAULT_ORG_NAME_FONT_COLOR = '#111827';
@@ -22,6 +27,19 @@ const DEFAULT_LOGO_POSITION = 'Left';
22
27
  function resolvePageOrientation(value) {
23
28
  return (value === null || value === void 0 ? void 0 : value.toLowerCase()) === 'landscape' ? 'landscape' : DEFAULT_PAGE_ORIENTATION;
24
29
  }
30
+ function resolvePageSize(value, orientation = DEFAULT_PAGE_ORIENTATION) {
31
+ const raw = String(value !== null && value !== void 0 ? value : '').trim().toLowerCase();
32
+ if (raw === 'halfa4') {
33
+ return { width: A4_WIDTH, height: HALF_A4_HEIGHT };
34
+ }
35
+ if (raw === 'letter') {
36
+ return 'LETTER';
37
+ }
38
+ if (raw === 'legal') {
39
+ return 'LEGAL';
40
+ }
41
+ return 'A4';
42
+ }
25
43
  function deriveHeaderDataFromInvoice(PDFInvoiceData) {
26
44
  const entity = (PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.Entity) || {};
27
45
  return {
@@ -207,13 +225,26 @@ function buildFooter(PrintConfig) {
207
225
  return null;
208
226
  }
209
227
  const textAlignment = normalizeFooterAlignment((_c = footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Position) !== null && _c !== void 0 ? _c : footerConfig === null || footerConfig === void 0 ? void 0 : footerConfig.Position);
210
- const pageAlignment = textAlignment === 'right' ? 'left' : 'right';
211
- return (_currentPage, pageCount) => ({
228
+ return () => ({
212
229
  margin: [20, 0, 20, 6],
213
- columns: [
214
- { text: value, alignment: textAlignment, fontSize: 8, color: '#4b5563' },
215
- { text: `Page ${_currentPage}/${pageCount}`, alignment: pageAlignment, fontSize: 8, color: '#4b5563' }
216
- ]
230
+ text: value,
231
+ alignment: textAlignment,
232
+ fontSize: 8,
233
+ color: '#4b5563'
234
+ });
235
+ }
236
+ function buildPageNumberHeader(PrintConfig) {
237
+ var _a;
238
+ const showPageNumber = ((_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Header) === null || _a === void 0 ? void 0 : _a.ShowPageNumber) !== false;
239
+ if (!showPageNumber) {
240
+ return null;
241
+ }
242
+ return (currentPage, pageCount) => ({
243
+ text: `Page ${currentPage}/${pageCount}`,
244
+ alignment: 'right',
245
+ margin: [20, 4, 20, 0],
246
+ fontSize: 8,
247
+ color: '#4b5563'
217
248
  });
218
249
  }
219
250
  function normalizeFooterAlignment(value) {
@@ -55,7 +55,6 @@ function buildPurchasePartyDetailsSection(PDFInvoiceData, customerLayout, printC
55
55
  }
56
56
  function buildPartyDetailsSectionLayout(config) {
57
57
  var _a, _b, _c, _d, _e, _f;
58
- console.log('Secondary Party:', config === null || config === void 0 ? void 0 : config.secondaryParty);
59
58
  const primaryStack = ((_a = config === null || config === void 0 ? void 0 : config.primaryParty) === null || _a === void 0 ? void 0 : _a.hasData)
60
59
  ? buildPartyStack(config.primaryTitle, config.primaryParty, config.customerLayout)
61
60
  : [{ text: '' }];
@@ -108,14 +107,12 @@ function resolveSalesBillToDetails(transactionData) {
108
107
  };
109
108
  }
110
109
  function resolveSalesShipToDetails(transactionData) {
111
- console.log('Resolving Ship To Details from Transaction Data:', transactionData);
112
110
  const shipTo = (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipTo) || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShippmentTo) || {};
113
111
  const address = normalizeAddress((shipTo === null || shipTo === void 0 ? void 0 : shipTo.Adrs)
114
112
  || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipAddress)
115
113
  || (transactionData === null || transactionData === void 0 ? void 0 : transactionData.ShipToAddress));
116
114
  const name = (0, pdf_shared_utils_1.firstValue)(shipTo === null || shipTo === void 0 ? void 0 : shipTo.Name, shipTo === null || shipTo === void 0 ? void 0 : shipTo.CName);
117
115
  const gstin = (0, pdf_shared_utils_1.firstValue)(shipTo === null || shipTo === void 0 ? void 0 : shipTo.GSTIN, shipTo === null || shipTo === void 0 ? void 0 : shipTo.GSTNo);
118
- console.log('Ship To Details:', { name, gstin, address });
119
116
  return {
120
117
  name,
121
118
  addressLines: buildAddressLines(address),
@@ -1665,7 +1665,6 @@ class SharedPDFService {
1665
1665
  };
1666
1666
  }
1667
1667
  static GetNotes(RecordData) {
1668
- console.log('RecordData.Notes shared', RecordData.Notes);
1669
1668
  if (!tr_utils_1.TrUtils.IsNull(RecordData.Notes)) {
1670
1669
  return {
1671
1670
  stack: [
@@ -2002,7 +2001,6 @@ class SharedPDFService {
2002
2001
  // { name: 'Labor Total', value: LaborAfterGST },
2003
2002
  // { name: 'Part Total', value: PartsAfterGST },
2004
2003
  ];
2005
- console.log('shared Consolidate', Consolidate);
2006
2004
  if (moreDiscDetails) {
2007
2005
  if (!tr_utils_1.TrUtils.IsZero(RecordData.PDisc)) {
2008
2006
  AccountFields.push({ name: 'Items Discount', value: tr_utils_1.TrUtils.FixPriceValue(RecordData.PDisc, DecimalsNumber) });
@@ -2025,7 +2023,6 @@ class SharedPDFService {
2025
2023
  AccountFields.unshift({ name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)), tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST))), DecimalsNumber) });
2026
2024
  }
2027
2025
  else {
2028
- console.log('Test', tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)), tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST)), tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(totalTax))), DecimalsNumber));
2029
2026
  AccountFields.unshift({ name: 'SubTotal', value: tr_utils_1.TrUtils.FixPriceValue((0, math_operations_1.Add)(tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(LaborAfterGST)), tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(PartsAfterGST)), tr_utils_1.TrUtils.SetValueToZeroIfNull(Number(totalTax))), DecimalsNumber) });
2030
2027
  }
2031
2028
  }
@@ -3,7 +3,10 @@ export declare function buildInvoiceTableData(PDFInvoiceData: any, PrintConfig:
3
3
  widths: number[];
4
4
  body: any[];
5
5
  };
6
- export declare function getAvailablePageWidth(pageSize: 'A4', orientation: 'portrait' | 'landscape', margins: [number, number, number, number]): number;
6
+ export declare function getAvailablePageWidth(pageSize: 'A4' | 'LETTER' | 'LEGAL' | {
7
+ width: number;
8
+ height: number;
9
+ }, orientation: 'portrait' | 'landscape', margins: [number, number, number, number]): number;
7
10
  export declare function calculateSectionTotals(rows: any[]): any;
8
11
  export declare function readNumericValue(row: any, fields: string[]): number;
9
12
  export declare function formatAmount(value: number, fixedTo?: number): string;
@@ -75,9 +75,13 @@ function buildInvoiceTableData(PDFInvoiceData, PrintConfig, availableWidth) {
75
75
  }
76
76
  function getAvailablePageWidth(pageSize, orientation, margins) {
77
77
  const pageWidths = {
78
- A4: { portrait: 595.28, landscape: 841.89 }
78
+ A4: { portrait: 595.28, landscape: 841.89 },
79
+ LETTER: { portrait: 612, landscape: 792 },
80
+ LEGAL: { portrait: 612, landscape: 1008 }
79
81
  };
80
- const fullWidth = pageWidths[pageSize][orientation];
82
+ const fullWidth = typeof pageSize === 'object'
83
+ ? (Number.isFinite(pageSize === null || pageSize === void 0 ? void 0 : pageSize.width) ? Number(pageSize.width) : pageWidths.A4[orientation])
84
+ : pageWidths[pageSize][orientation];
81
85
  return Math.max(1, fullWidth - margins[0] - margins[2]);
82
86
  }
83
87
  function calculateSectionTotals(rows) {
@@ -6,7 +6,9 @@ const pdf_header_footer_section_1 = require("../header-footer-section/pdf-header
6
6
  const pdf_shared_utils_1 = require("../header-footer-section/pdf-shared.utils");
7
7
  const pdf_table_section_1 = require("../table-section/pdf-table.section");
8
8
  function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintConfigData = {}) {
9
+ var _a;
9
10
  const normalizedInvoice = invoiceData || {};
11
+ const hideTopSection = isTruthy((_a = normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.Settings) === null || _a === void 0 ? void 0 : _a.NoPr);
10
12
  const taxSummary = resolveTaxSummary(normalizedInvoice);
11
13
  const showBankDetails = resolveShowBankDetails(normalizedInvoice, PrintConfigData);
12
14
  const showDueSection = shouldShowDueSection(PrintConfigData);
@@ -16,11 +18,9 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
16
18
  const notes = (0, pdf_shared_utils_1.firstValue)(normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.Notes, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.Note, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.Remarks, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.Remark);
17
19
  const terms = (0, pdf_shared_utils_1.firstValue)(normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.TermsAndConditions, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.TermsCondition, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.Terms, normalizedInvoice === null || normalizedInvoice === void 0 ? void 0 : normalizedInvoice.TC);
18
20
  const dueInfo = resolveDueInfo(normalizedInvoice, totals);
19
- console.log('Due Info:', dueInfo);
20
21
  const qrPayload = resolveQrPayload(normalizedInvoice);
21
- const hasTopSection = taxSummary.hasData || bankDetails.hasData || totals.hasData;
22
+ const hasTopSection = !hideTopSection && (taxSummary.hasData || bankDetails.hasData || totals.hasData);
22
23
  const hasBottomSection = !!(notes || terms || totalInWords || (showDueSection && dueInfo.hasData) || qrPayload);
23
- console.log('hasTopSection:', hasTopSection, 'hasBottomSection:', hasBottomSection);
24
24
  if (!hasTopSection && !hasBottomSection) {
25
25
  return [];
26
26
  }
@@ -35,7 +35,6 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
35
35
  columnGap: 20,
36
36
  margin: [0, 0, 0, 8]
37
37
  };
38
- console.log('Top Columns:', topColumns);
39
38
  const bottomColumns = buildPostTotalsInfoSection({
40
39
  totalInWords,
41
40
  notes,
@@ -45,7 +44,6 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
45
44
  qrPayload,
46
45
  showDueSection
47
46
  });
48
- console.log('Bottom Columns:', bottomColumns);
49
47
  if (hasTopSection && hasBottomSection) {
50
48
  return [dividerLine, topColumns, bottomColumns];
51
49
  }
@@ -73,7 +71,6 @@ function buildTopSectionColumns(taxSummary, showBankDetails, bankDetails, totals
73
71
  ];
74
72
  }
75
73
  function buildPostTotalsInfoSection(data) {
76
- console.log('Building Post Totals Info Section with data:', data);
77
74
  const hasQr = !!(0, pdf_shared_utils_1.firstValue)(data.qrPayload);
78
75
  const inWords = data.totalInWords || '-';
79
76
  const termsText = (0, pdf_shared_utils_1.firstValue)(data.terms);
@@ -87,7 +84,6 @@ function buildPostTotalsInfoSection(data) {
87
84
  margin: [0, 0, 0, 4]
88
85
  }
89
86
  ];
90
- console.log('showDueSection:', data.showDueSection, 'paidAmount:', data.paidAmount, 'dueAmount:', data.dueAmount);
91
87
  if (data.showDueSection) {
92
88
  const paidText = `Paid : Rs.${formatAmountFixed2(data.paidAmount)}`;
93
89
  const dueText = `Due : Rs.${formatAmountFixed2(data.dueAmount)}`;
@@ -108,8 +104,6 @@ function buildPostTotalsInfoSection(data) {
108
104
  margin: [0, 0, 0, 6]
109
105
  });
110
106
  }
111
- console.log('termsText:', termsText);
112
- console.log('hasQr:', hasQr);
113
107
  if (termsText) {
114
108
  leftStack.push({
115
109
  text: `\u2022 ${termsText}`,
@@ -118,7 +112,6 @@ function buildPostTotalsInfoSection(data) {
118
112
  lineHeight: 1.1
119
113
  });
120
114
  }
121
- console.log('leftStack:', leftStack);
122
115
  const leftColumn = {
123
116
  width: hasQr ? '74%' : '*',
124
117
  stack: leftStack
@@ -429,9 +422,7 @@ function resolveShowBankDetails(invoiceData, printConfigData = {}) {
429
422
  return isTruthy(value);
430
423
  }
431
424
  function shouldShowDueSection(printConfigData = {}) {
432
- console.log('printCOnfigData?.Type', printConfigData === null || printConfigData === void 0 ? void 0 : printConfigData.Type);
433
425
  const type = (0, pdf_shared_utils_1.firstValue)(printConfigData === null || printConfigData === void 0 ? void 0 : printConfigData.Type);
434
- console.log('Normalized Type:', type);
435
426
  if (!type) {
436
427
  return false;
437
428
  }
@@ -525,7 +516,6 @@ function resolveDueInfo(invoiceData, totals) {
525
516
  const dueFromInvoice = (0, pdf_table_section_1.readNumericValue)(invoiceData, ['Due', 'DueAmount', 'DueAmt', 'Balance', 'BalAmt']);
526
517
  const finalTotal = parseNumber((0, pdf_shared_utils_1.firstValue)(invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.FinalTotal, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Total, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.GrandTotal, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.NetTotal));
527
518
  const due = dueFromInvoice !== 0 ? dueFromInvoice : Math.max(0, finalTotal - paid);
528
- console.log('Due Info:', { paid, due, finalTotal });
529
519
  return {
530
520
  paid,
531
521
  due,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.85",
3
+ "version": "1.5.87",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",