shareneus 1.6.73 → 1.6.75

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.
@@ -8,6 +8,7 @@ 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 shared_pdf_service_1 = require("../../../shared/shared-pdf.service");
11
12
  const PAGE_MARGINS = [20, 20, 20, 20];
12
13
  const CELL_PADDING_LEFT = 4;
13
14
  const CELL_PADDING_RIGHT = 4;
@@ -61,40 +62,43 @@ function GetInvoicePdfDataUrl(PDFInvoiceData = {}, PrintConfigData = {}, printCo
61
62
  // }
62
63
  // });
63
64
  }
65
+ function SalesReceiptHeaderData(Entity, Image, AColor, HColor, text) {
66
+ return [
67
+ shared_pdf_service_1.SharedPDFService.GetMainHeader(Entity, Image, AColor, HColor, text),
68
+ shared_pdf_service_1.SharedPDFService.GetPrintType('Sales Receipt'),
69
+ shared_pdf_service_1.SharedPDFService.HeaderAfterLine()
70
+ ];
71
+ }
64
72
  function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printCopies = []) {
73
+ var _a;
65
74
  const PrintConfig = normalizePrintConfig(PDFInvoiceData, PrintConfigData);
66
- const compactLayout = (0, pdf_header_footer_section_1.isHalfA4PageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize);
67
75
  const requestedPageOrientation = (0, pdf_header_footer_section_1.resolvePageOrientation)((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Orientation) || (PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PageOrientation));
68
76
  const pageSize = (0, pdf_header_footer_section_1.resolvePageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize, requestedPageOrientation);
69
77
  const basePageMargins = (0, pdf_header_footer_section_1.resolvePageMargins)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.pageMargins);
70
- const resolvedPrintConfig = compactLayout ? Object.assign(Object.assign({}, PrintConfig), { compactLayout: true }) : PrintConfig;
71
78
  const copyLabels = normalizeCopyLabels(printCopies);
72
- const watermark = (0, pdf_header_footer_section_1.buildWatermark)(resolvedPrintConfig, PDFInvoiceData);
73
- const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(resolvedPrintConfig, PDFInvoiceData);
74
- const pageHeader = (0, pdf_header_footer_section_1.buildPageNumberHeader)(resolvedPrintConfig);
75
- const pageFooter = (0, pdf_header_footer_section_1.buildFooter)(resolvedPrintConfig);
76
- const pageMargins = pageHeader !== null
77
- ? [
78
- compactLayout ? Math.min(basePageMargins[0], 12) : basePageMargins[0],
79
- compactLayout ? Math.max(Math.min(basePageMargins[1], 12), 12) : Math.max(basePageMargins[1], 18),
80
- compactLayout ? Math.min(basePageMargins[2], 12) : basePageMargins[2],
81
- compactLayout ? Math.min(basePageMargins[3], 12) : basePageMargins[3]
82
- ]
83
- : [
84
- compactLayout ? Math.min(basePageMargins[0], 12) : basePageMargins[0],
85
- compactLayout ? Math.min(basePageMargins[1], 12) : basePageMargins[1],
86
- compactLayout ? Math.min(basePageMargins[2], 12) : basePageMargins[2],
87
- compactLayout ? Math.min(basePageMargins[3], 12) : basePageMargins[3]
88
- ];
79
+ const watermark = (0, pdf_header_footer_section_1.buildWatermark)(PrintConfig, PDFInvoiceData);
80
+ const background = (0, pdf_header_footer_section_1.buildLogoWatermarkBackground)(PrintConfig, PDFInvoiceData);
81
+ const pageHeader = (0, pdf_header_footer_section_1.buildPageNumberHeader)(PrintConfig);
82
+ const pageFooter = (0, pdf_header_footer_section_1.buildFooter)(PrintConfig);
83
+ let pageMargins = pageHeader !== null
84
+ ? [basePageMargins[0], Math.max(basePageMargins[1], 18), basePageMargins[2], basePageMargins[3]]
85
+ : basePageMargins;
86
+ const raw = String((_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize) !== null && _a !== void 0 ? _a : '').trim().toLowerCase();
87
+ const normalized = raw.replace(/[\s_-]/g, '');
88
+ if (normalized === 'halfa4') {
89
+ pageMargins = [25, 15, 25, 435.945];
90
+ }
89
91
  const availableWidth = (0, pdf_table_section_1.getAvailablePageWidth)(pageSize, requestedPageOrientation, pageMargins);
90
92
  const content = [];
91
93
  copyLabels.forEach((copyLabel, index) => {
92
- const invoiceHeaderContent = (0, pdf_header_footer_section_1.buildDocumentHeaderSection)(resolvedPrintConfig, PDFInvoiceData);
93
- const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, resolvedPrintConfig, availableWidth);
94
- const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData, resolvedPrintConfig === null || resolvedPrintConfig === void 0 ? void 0 : resolvedPrintConfig.Customer, resolvedPrintConfig);
95
- const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth, resolvedPrintConfig);
96
- const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(resolvedPrintConfig, PDFInvoiceData, availableWidth);
97
- const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, resolvedPrintConfig, availableWidth);
94
+ var _a, _b, _c;
95
+ // const invoiceHeaderContent = buildDocumentHeaderSection(PrintConfig, PDFInvoiceData);
96
+ const invoiceHeaderContent = SalesReceiptHeaderData(PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.Entity, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Image, (_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerStyles) === null || _a === void 0 ? void 0 : _a.OrgNameClr, (_b = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerStyles) === null || _b === void 0 ? void 0 : _b.AdrsClr, (_c = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) === null || _c === void 0 ? void 0 : _c.OrgName);
97
+ const invoiceHeadingContent = (0, pdf_header_footer_section_1.buildDocumentHeadingSection)(PDFInvoiceData, PrintConfig, availableWidth);
98
+ const invoicePartyDetailsContent = (0, pdf_party_details_section_1.buildInvoicePartyDetailsSection)(PDFInvoiceData, PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Customer, PrintConfig);
99
+ const invoiceTotalsAndNotesContent = (0, pdf_totals_section_1.buildInvoiceTotalsAndNotesSection)(PDFInvoiceData, availableWidth, PrintConfigData);
100
+ const signatureContent = (0, pdf_totals_section_1.buildSignatureSection)(PrintConfig, PDFInvoiceData, availableWidth);
101
+ const tableData = (0, pdf_table_section_1.buildInvoiceTableData)(PDFInvoiceData, PrintConfig, availableWidth);
98
102
  if (index > 0) {
99
103
  content.push({ text: '', pageBreak: 'before' });
100
104
  }
@@ -3,7 +3,6 @@ export declare function resolvePageSize(value: any, orientation?: 'portrait' | '
3
3
  width: number;
4
4
  height: number;
5
5
  };
6
- export declare function isHalfA4PageSize(value: any): boolean;
7
6
  export declare function deriveHeaderDataFromInvoice(PDFInvoiceData: any): {
8
7
  invoiceHeading: string;
9
8
  organization: {
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolvePageOrientation = resolvePageOrientation;
4
4
  exports.resolvePageSize = resolvePageSize;
5
- exports.isHalfA4PageSize = isHalfA4PageSize;
6
5
  exports.deriveHeaderDataFromInvoice = deriveHeaderDataFromInvoice;
7
6
  exports.normalizeHeaderData = normalizeHeaderData;
8
7
  exports.normalizeHeaderStyle = normalizeHeaderStyle;
@@ -32,7 +31,8 @@ function resolvePageSize(value, orientation = DEFAULT_PAGE_ORIENTATION) {
32
31
  const raw = String(value !== null && value !== void 0 ? value : '').trim().toLowerCase();
33
32
  const normalized = raw.replace(/[\s_-]/g, '');
34
33
  if (normalized === 'halfa4') {
35
- return { width: A4_WIDTH, height: HALF_A4_HEIGHT };
34
+ // return { width: A4_WIDTH, height: HALF_A4_HEIGHT };
35
+ return 'A4';
36
36
  }
37
37
  if (normalized === 'letter') {
38
38
  return 'LETTER';
@@ -42,11 +42,6 @@ function resolvePageSize(value, orientation = DEFAULT_PAGE_ORIENTATION) {
42
42
  }
43
43
  return 'A4';
44
44
  }
45
- function isHalfA4PageSize(value) {
46
- const raw = String(value !== null && value !== void 0 ? value : '').trim().toLowerCase();
47
- const normalized = raw.replace(/[\s_-]/g, '');
48
- return normalized === 'halfa4';
49
- }
50
45
  function deriveHeaderDataFromInvoice(PDFInvoiceData) {
51
46
  const entity = (PDFInvoiceData === null || PDFInvoiceData === void 0 ? void 0 : PDFInvoiceData.Entity) || {};
52
47
  return {
@@ -289,7 +289,7 @@ class SharedPDFService {
289
289
  }
290
290
  static GetEntityDetails(Entity) {
291
291
  let SetData = [];
292
- if (Entity.PrUPI && !Entity.IsProforma) {
292
+ if (Entity.PrUPI && !Entity.IsProforma && !tr_utils_1.TrUtils.IsEmpty(Entity.UPI)) {
293
293
  SetData.push({ qr: Entity.UPI, fit: '125', marginLeft: 150 });
294
294
  SetData.push({ text: 'Scan To Pay', fontSize: this.TermsandCond, marginLeft: 151, bold: true, marginTop: 2 });
295
295
  // SetData.push({ text: 'UPI Number: ' + Entity.UPIPhone, fontSize: 9, marginLeft: 151, bold: true, marginTop: 5 });
@@ -23,7 +23,6 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
23
23
  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);
24
24
  const dueInfo = resolveDueInfo(normalizedInvoice, totals);
25
25
  const qrPayload = resolveQrPayload(normalizedInvoice, PrintConfigData);
26
- const compactLayout = !!(PrintConfigData === null || PrintConfigData === void 0 ? void 0 : PrintConfigData.compactLayout) || (0, pdf_header_footer_section_1.isHalfA4PageSize)(PrintConfigData === null || PrintConfigData === void 0 ? void 0 : PrintConfigData.PSize);
27
26
  const hasTopSection = !hideTopSection && (taxSummary.hasData || bankDetails.hasData || totals.hasData);
28
27
  const hasBottomSection = !!(notes || terms || totalInWords || (showDueSection && dueInfo.hasData) || qrPayload);
29
28
  if (!hasTopSection && !hasBottomSection) {
@@ -33,12 +32,12 @@ function buildInvoiceTotalsAndNotesSection(invoiceData, availableWidth, PrintCon
33
32
  canvas: [
34
33
  { type: 'line', x1: 0, y1: 0, x2: Math.max(1, availableWidth), y2: 0, lineWidth: 1, lineColor: '#1f2937' }
35
34
  ],
36
- margin: compactLayout ? [0, 6, 0, 6] : [0, 10, 0, 10]
35
+ margin: [0, 10, 0, 10]
37
36
  };
38
37
  const topColumns = {
39
38
  columns: buildTopSectionColumns(taxSummary, sType, showBankDetails, bankDetails, totals),
40
39
  columnGap: 20,
41
- margin: compactLayout ? [0, 0, 0, 4] : [0, 0, 0, 8]
40
+ margin: [0, 0, 0, 8]
42
41
  };
43
42
  const bottomColumns = buildPostTotalsInfoSection({
44
43
  totalInWords,
@@ -160,18 +159,17 @@ function buildSignatureSection(PrintConfig, invoiceData, availableWidth) {
160
159
  const headerData = (0, pdf_header_footer_section_1.normalizeHeaderData)((_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) !== null && _a !== void 0 ? _a : {});
161
160
  const companyName = (0, pdf_shared_utils_1.firstValue)((_b = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _b === void 0 ? void 0 : _b.cName, (_c = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _c === void 0 ? void 0 : _c.CName, (_d = invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.Entity) === null || _d === void 0 ? void 0 : _d.Name, invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.CName);
162
161
  const withPass = !!((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.withPass) || (invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.withPass) || (invoiceData === null || invoiceData === void 0 ? void 0 : invoiceData.WithPass));
163
- const compactLayout = !!(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.compactLayout) || (0, pdf_header_footer_section_1.isHalfA4PageSize)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.PSize);
164
162
  const signatureRows = [
165
163
  {
166
164
  columns: [
167
165
  { width: '*', text: '' },
168
166
  { width: '*', text: `For ${companyName || ''}`.trim(), fontSize: 9, bold: true, color: '#111827', alignment: 'right' }
169
167
  ],
170
- margin: compactLayout ? [0, 6, 0, 0] : [0, 12, 0, 0]
168
+ margin: [0, 12, 0, 0]
171
169
  },
172
170
  {
173
171
  text: '',
174
- margin: compactLayout ? [0, 10, 0, 0] : [0, 18, 0, 0]
172
+ margin: [0, 18, 0, 0]
175
173
  },
176
174
  {
177
175
  columns: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.6.73",
3
+ "version": "1.6.75",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",