shareneus 1.5.57 → 1.5.59

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.
@@ -37,6 +37,7 @@ class ReceiptPrintService {
37
37
  }
38
38
  ReceiptData.PaidDate = my_date_1.MyDate.ConvertUTCDateToReadable(PaymentViewData.Date);
39
39
  ReceiptData.Ids = this.GetRecordIds(PaymentViewData);
40
+ ReceiptData.AllocRefs = PaymentViewData.AllocRefs;
40
41
  ReceiptData.Type = 'Receipt';
41
42
  ReceiptData.HeaderName = 'Receipt';
42
43
  ReceiptData.PaymentId = PaymentViewData.Code;
@@ -100,7 +100,7 @@ export declare function buildWatermark(PrintConfig: any): {
100
100
  opacity: number;
101
101
  bold: boolean;
102
102
  } | null;
103
- export declare function buildLogoWatermarkBackground(PrintConfig: any): (() => {
103
+ export declare function buildLogoWatermarkBackground(PrintConfig: any, DocumentData?: any): (() => {
104
104
  image: string;
105
105
  width: number;
106
106
  opacity: number;
@@ -92,8 +92,9 @@ function resolvePageMargins(value) {
92
92
  function buildDocumentHeaderSection(PrintConfig, DocumentData = {}) {
93
93
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
94
94
  const entity = (_a = DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.Entity) !== null && _a !== void 0 ? _a : {};
95
+ const documentLogoDataUrl = resolveDocumentLogoDataUrl(DocumentData);
95
96
  const headerData = normalizeHeaderData((_b = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) !== null && _b !== void 0 ? _b : {});
96
- const mergedHeaderData = normalizeHeaderData(Object.assign(Object.assign({}, headerData), { organization: Object.assign(Object.assign({}, ((_c = headerData === null || headerData === void 0 ? void 0 : headerData.organization) !== null && _c !== void 0 ? _c : {})), { cName: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.CName, (_d = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _d === void 0 ? void 0 : _d.cName), address1: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Adrs1, (_e = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _e === void 0 ? void 0 : _e.address1), address2: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Adrs2, (_f = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _f === void 0 ? void 0 : _f.address2), dlNo: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.DLNo, entity === null || entity === void 0 ? void 0 : entity.DLNO, (_g = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _g === void 0 ? void 0 : _g.dlNo), gstin: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.GSTIN, (_h = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _h === void 0 ? void 0 : _h.gstin), pan: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.PAN, (_j = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _j === void 0 ? void 0 : _j.pan), city: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.City, (_k = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _k === void 0 ? void 0 : _k.city), state: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.State, (_l = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _l === void 0 ? void 0 : _l.state), pin: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.PIN, entity === null || entity === void 0 ? void 0 : entity.Pin, (_m = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _m === void 0 ? void 0 : _m.pin), email: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Email, entity === null || entity === void 0 ? void 0 : entity.EMail, (_o = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _o === void 0 ? void 0 : _o.email), phone: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Phone, entity === null || entity === void 0 ? void 0 : entity.Ph, (_p = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _p === void 0 ? void 0 : _p.phone), phone2: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Phone2, entity === null || entity === void 0 ? void 0 : entity.Ph2, (_q = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _q === void 0 ? void 0 : _q.phone2) }) }));
97
+ const mergedHeaderData = normalizeHeaderData(Object.assign(Object.assign({}, headerData), { logoDataUrl: (0, pdf_shared_utils_1.firstValue)(documentLogoDataUrl, headerData === null || headerData === void 0 ? void 0 : headerData.logoDataUrl), organization: Object.assign(Object.assign({}, ((_c = headerData === null || headerData === void 0 ? void 0 : headerData.organization) !== null && _c !== void 0 ? _c : {})), { cName: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.CName, (_d = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _d === void 0 ? void 0 : _d.cName), address1: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Adrs1, (_e = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _e === void 0 ? void 0 : _e.address1), address2: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Adrs2, (_f = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _f === void 0 ? void 0 : _f.address2), dlNo: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.DLNo, entity === null || entity === void 0 ? void 0 : entity.DLNO, (_g = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _g === void 0 ? void 0 : _g.dlNo), gstin: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.GSTIN, (_h = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _h === void 0 ? void 0 : _h.gstin), pan: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.PAN, (_j = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _j === void 0 ? void 0 : _j.pan), city: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.City, (_k = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _k === void 0 ? void 0 : _k.city), state: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.State, (_l = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _l === void 0 ? void 0 : _l.state), pin: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.PIN, entity === null || entity === void 0 ? void 0 : entity.Pin, (_m = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _m === void 0 ? void 0 : _m.pin), email: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Email, entity === null || entity === void 0 ? void 0 : entity.EMail, (_o = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _o === void 0 ? void 0 : _o.email), phone: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Phone, entity === null || entity === void 0 ? void 0 : entity.Ph, (_p = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _p === void 0 ? void 0 : _p.phone), phone2: (0, pdf_shared_utils_1.firstValue)(entity === null || entity === void 0 ? void 0 : entity.Phone2, entity === null || entity === void 0 ? void 0 : entity.Ph2, (_q = headerData === null || headerData === void 0 ? void 0 : headerData.organization) === null || _q === void 0 ? void 0 : _q.phone2) }) }));
97
98
  const headerStyles = normalizeHeaderStyle((_r = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerStyles) !== null && _r !== void 0 ? _r : {});
98
99
  const headerSettings = normalizeHeaderSettings((_t = (_s = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.header) !== null && _s !== void 0 ? _s : PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Header) !== null && _t !== void 0 ? _t : {});
99
100
  if (!headerSettings.show) {
@@ -155,7 +156,7 @@ function buildWatermark(PrintConfig) {
155
156
  bold: true
156
157
  };
157
158
  }
158
- function buildLogoWatermarkBackground(PrintConfig) {
159
+ function buildLogoWatermarkBackground(PrintConfig, DocumentData = {}) {
159
160
  var _a;
160
161
  const value = (0, pdf_shared_utils_1.firstValue)(PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.watermarkText);
161
162
  const isEnabled = !!((PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.watermark) || (PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.watermarkEnabled) || value);
@@ -163,7 +164,7 @@ function buildLogoWatermarkBackground(PrintConfig) {
163
164
  return null;
164
165
  }
165
166
  const headerData = normalizeHeaderData((_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.headerData) !== null && _a !== void 0 ? _a : {});
166
- const logoDataUrl = headerData === null || headerData === void 0 ? void 0 : headerData.logoDataUrl;
167
+ const logoDataUrl = (0, pdf_shared_utils_1.firstValue)(resolveDocumentLogoDataUrl(DocumentData), headerData === null || headerData === void 0 ? void 0 : headerData.logoDataUrl);
167
168
  if (!logoDataUrl) {
168
169
  return null;
169
170
  }
@@ -175,6 +176,11 @@ function buildLogoWatermarkBackground(PrintConfig) {
175
176
  margin: [0, 180, 0, 0]
176
177
  });
177
178
  }
179
+ function resolveDocumentLogoDataUrl(DocumentData) {
180
+ var _a;
181
+ const entity = (_a = DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.Entity) !== null && _a !== void 0 ? _a : {};
182
+ return (0, pdf_shared_utils_1.firstValue)((0, pdf_shared_utils_1.asDataUrl)(DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.logoDataUrl), (0, pdf_shared_utils_1.asDataUrl)(DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.LogoDataUrl), (0, pdf_shared_utils_1.asDataUrl)(DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.Image), (0, pdf_shared_utils_1.asDataUrl)(DocumentData === null || DocumentData === void 0 ? void 0 : DocumentData.Logo), (0, pdf_shared_utils_1.asDataUrl)(entity === null || entity === void 0 ? void 0 : entity.Image), (0, pdf_shared_utils_1.asDataUrl)(entity === null || entity === void 0 ? void 0 : entity.Logo), (0, pdf_shared_utils_1.asDataUrl)(entity === null || entity === void 0 ? void 0 : entity.CLogo), (0, pdf_shared_utils_1.asDataUrl)(entity === null || entity === void 0 ? void 0 : entity.LogoDataUrl));
183
+ }
178
184
  function buildFooter(PrintConfig) {
179
185
  var _a, _b, _c, _d, _e;
180
186
  const footerConfig = (_b = (_a = PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.footer) !== null && _a !== void 0 ? _a : PrintConfig === null || PrintConfig === void 0 ? void 0 : PrintConfig.Footer) !== null && _b !== void 0 ? _b : {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.57",
3
+ "version": "1.5.59",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",