shareneus 1.7.16 → 1.7.18

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.
@@ -261,11 +261,18 @@ function buildPdfDocDefinition(PDFInvoiceData = {}, PrintConfigData = {}, printC
261
261
  }, ...invoiceTotalsAndNotesContent, ...signatureContent);
262
262
  });
263
263
  const dd = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ pageSize: pageSize }, (typeof pageSize === 'string' ? { pageOrientation: requestedPageOrientation } : {})), { pageMargins: pageMargins, content: content, info: {
264
- title: 'invoice',
264
+ title: GetFileName(PDFInvoiceData),
265
265
  subject: Array.isArray(printCopies) ? printCopies.join(', ') : ''
266
266
  } }), (background ? { background } : {})), (watermark ? { watermark } : {})), (pageHeader !== null ? { header: pageHeader } : {})), (pageFooter !== null ? { footer: pageFooter } : {}));
267
267
  return dd;
268
268
  }
269
+ function GetFileName(ROPrintData) {
270
+ let fileName = ROPrintData.HeaderName;
271
+ if (!tr_utils_1.TrUtils.IsNull(ROPrintData.Product) && !tr_utils_1.TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
272
+ fileName = fileName + '-' + ROPrintData.Product.RegNo;
273
+ }
274
+ return fileName;
275
+ }
269
276
  function normalizeCopyLabels(printCopies = []) {
270
277
  const labels = Array.isArray(printCopies)
271
278
  ? printCopies
@@ -179,7 +179,7 @@ function buildDocumentHeadingSection(PDFInvoiceData, PrintConfig, availableWidth
179
179
  }
180
180
  function buildWatermark(PrintConfig, DocumentData = {}) {
181
181
  const value = (DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.IsProforma) ? 'Not a final invoice' : (0, pdf_shared_utils_1.firstValue)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.WatermarkText);
182
- const isEnabled = !!((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Watermark) || (PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.WatermarkEnabled) || value);
182
+ const isEnabled = !!(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Watermark);
183
183
  if (!isEnabled) {
184
184
  return null;
185
185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.16",
3
+ "version": "1.7.18",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -296,7 +296,7 @@ function buildPdfDocDefinition(PDFInvoiceData: any = {}, PrintConfigData: any =
296
296
  pageMargins: pageMargins,
297
297
  content: content,
298
298
  info: {
299
- title: 'invoice',
299
+ title: GetFileName(PDFInvoiceData),
300
300
  subject: Array.isArray(printCopies) ? printCopies.join(', ') : ''
301
301
  },
302
302
  ...(background ? { background } : {}),
@@ -308,6 +308,14 @@ function buildPdfDocDefinition(PDFInvoiceData: any = {}, PrintConfigData: any =
308
308
  return dd;
309
309
  }
310
310
 
311
+ function GetFileName(ROPrintData: any) {
312
+ let fileName: string = ROPrintData.HeaderName;
313
+ if (!TrUtils.IsNull(ROPrintData.Product) && !TrUtils.IsEmpty(ROPrintData.Product.RegNo)) {
314
+ fileName = fileName + '-' + ROPrintData.Product.RegNo;
315
+ }
316
+ return fileName;
317
+ }
318
+
311
319
  function normalizeCopyLabels(printCopies: string[] = []) {
312
320
  const labels = Array.isArray(printCopies)
313
321
  ? printCopies
@@ -202,7 +202,7 @@ export function buildDocumentHeadingSection(PDFInvoiceData: any, PrintConfig: an
202
202
 
203
203
  export function buildWatermark(PrintConfig: any, DocumentData: any = {}) {
204
204
  const value = DocumentData?.IsProforma ? 'Not a final invoice' : firstValue(PrintConfig?.WatermarkText);
205
- const isEnabled = !!(PrintConfig?.Watermark || PrintConfig?.WatermarkEnabled || value);
205
+ const isEnabled = !!(PrintConfig?.Watermark);
206
206
  if (!isEnabled) {
207
207
  return null;
208
208
  }