shareneus 1.5.50 → 1.5.52

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.
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetInvoicePDF = GetInvoicePDF;
4
4
  const inv_print_service_1 = require("./inv-print.service");
5
5
  const unified_invoice_pdf_service_1 = require("./unified-invoice-pdf.service");
6
- function GetInvoicePDF(invoiceData, entityData, taxCodes, image = null, numberofCopies = ['Original For Recipient'], withPass = false, options = null) {
6
+ function GetInvoicePDF(invoiceData, entityData, taxCodes, image = null, numberofCopies = ['Original'], withPass = false, options = null) {
7
7
  if (!options) {
8
8
  options = {
9
9
  ShowGST: true,
@@ -35,7 +35,7 @@ const tr_utils_1 = require("../../utils/tr-utils");
35
35
  function GetInvoicePrint(invoicePdfData, numberofCopies, withPass, size = null, moreDiscDetails, orientation = 'portrait') {
36
36
  const isotherIndustry = false;
37
37
  var contents = [];
38
- if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0) {
38
+ if (tr_utils_1.TrUtils.IsNull(numberofCopies) || numberofCopies.length === 0 || numberofCopies.length === 1) {
39
39
  contents.push(CommonHeaderDetails(invoicePdfData, null, isotherIndustry, orientation), PreparesparePartsTable(invoicePdfData, orientation), CommonTotalDetails(invoicePdfData, null, numberofCopies, withPass, moreDiscDetails, orientation));
40
40
  }
41
41
  else {
@@ -192,42 +192,38 @@ class SharedPDFService {
192
192
  return Details;
193
193
  }
194
194
  static GetAddresDetailsAndLogo(Entity, Image, AColor, HColor, text, orientation = 'portrait') {
195
- const headerWidth = orientation === 'landscape' ? 400 : 300;
196
- const emptyWidth = orientation === 'landscape' ? 200 : 150;
197
- const noImageEmptyWidth = orientation === 'landscape' ? 170 : 130;
198
- let Details = [
195
+ const logoWidth = 120;
196
+ const logoHeight = 80;
197
+ const headerStyle = this.GetMainHeaderStyleForLeftAlignHeader(Entity.CName || '');
198
+ const extras = [];
199
+ if (!tr_utils_1.TrUtils.IsNull(Entity.PageCount)) {
200
+ extras.push({ text: 'Page: ' + Entity.PageCount, color: 'grey', alignment: 'center', fontSize: this.TermsandCond, margin: [0, 1, 0, 0] });
201
+ }
202
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.Extra1)) {
203
+ extras.push({ text: Entity.Extra1, color: 'grey', alignment: 'center', fontSize: this.TermsandCond, margin: [0, 1, 0, 0] });
204
+ }
205
+ if (!tr_utils_1.TrUtils.IsEmpty(Entity.Extra2)) {
206
+ extras.push({ text: Entity.Extra2, color: 'grey', alignment: 'center', fontSize: this.TermsandCond, margin: [0, 1, 0, 0] });
207
+ }
208
+ const centerStack = [
209
+ { text: '' + (Entity.CName || '') + '', color: HColor, fontSize: headerStyle.fontSize, bold: true, alignment: 'center' },
199
210
  {
200
- stack: [
201
- { columns: [this.MainHeading(Entity.CName, Entity, Image, HColor, text)] },
202
- {
203
- columns: [{
204
- width: headerWidth,
205
- margin: [0, 0, 0, 5],
206
- stack: this.GetHeader(Entity, HColor),
207
- color: AColor,
208
- style: 'header'
209
- },
210
- this.emptyObject()]
211
- }
212
- ]
211
+ stack: this.GetHeader(Entity, HColor),
212
+ color: AColor,
213
+ style: 'header',
214
+ alignment: 'center',
215
+ margin: [0, 0, 0, 2]
213
216
  }
214
217
  ];
215
- if (!tr_utils_1.TrUtils.IsNull(Image) && Entity.PrLogo) {
216
- // Details.unshift({ text: '', width: 120 });
217
- if (Entity.CName.length < 28) {
218
- Details[0].stack[0].columns.push({ text: '', width: emptyWidth });
219
- }
220
- if (!tr_utils_1.TrUtils.IsNull(text)) {
221
- Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 7 });
222
- }
223
- Details.unshift({ image: Image, width: 120, height: 80 });
224
- }
225
- else {
226
- Details[0].stack[1].columns.unshift({ text: '', width: noImageEmptyWidth });
227
- if (!tr_utils_1.TrUtils.IsNull(text)) {
228
- Details[0].stack.unshift({ text: text, color: 'grey', alignment: 'right', width: 100, marginBottom: -15, fontSize: 7 });
229
- }
218
+ if (!tr_utils_1.TrUtils.IsNull(text)) {
219
+ centerStack.push({ text: text, color: 'grey', alignment: 'center', fontSize: 7, margin: [0, 0, 0, 1] });
230
220
  }
221
+ extras.forEach((row) => centerStack.push(row));
222
+ let Details = [
223
+ !tr_utils_1.TrUtils.IsNull(Image) && Entity.PrLogo ? { image: Image, width: logoWidth, height: logoHeight } : { text: '', width: logoWidth },
224
+ { width: '*', stack: centerStack },
225
+ { text: '', width: logoWidth }
226
+ ];
231
227
  return Details;
232
228
  }
233
229
  static GetHeader(Entity, HColor) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.5.50",
3
+ "version": "1.5.52",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",