shareneus 1.7.7 → 1.7.8

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.
@@ -284,6 +284,7 @@ export declare class RoprintService {
284
284
  marginBottom: number;
285
285
  };
286
286
  static CompanyDetails(Entity: any): any;
287
+ static GetEntityGSTIN(Entity: any): any;
287
288
  static GetFileName(ROPrintData: any): string;
288
289
  static CustomersparePartsTable(ROPrintData: any): any;
289
290
  static GetCustomerIndPartsTable(Colli: any, Type: any, Status: any, PrintPartNo: any, ShowTaxColumn: any): any;
@@ -99,12 +99,13 @@ class RoprintService {
99
99
  };
100
100
  }
101
101
  static CompanyDetails(Entity) {
102
+ const gstin = this.GetEntityGSTIN(Entity);
102
103
  let Details = [
103
104
  { text: Entity.CName, alignment: 'right', lineHeight: 1.5, fontSize: 8 },
104
105
  { text: Entity.Adrs1 + ',', alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
105
106
  { text: '' + Entity.City + shared_pdf_service_1.SharedPDFService.getPinCode(Entity.PIN) + ', ' + 'Ph: ' + Entity.Phone, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
106
107
  { text: '' + shared_pdf_service_1.SharedPDFService.GetEmail(Entity.Email) + '', alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
107
- { text: 'GSTIN : ' + Entity.GSTIN, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
108
+ { text: 'GSTIN : ' + gstin, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
108
109
  { text: 'PAN No : ' + Entity.PAN, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 }
109
110
  ];
110
111
  if (!tr_utils_1.TrUtils.IsEmpty(Entity.Adrs2)) {
@@ -112,6 +113,19 @@ class RoprintService {
112
113
  }
113
114
  return Details;
114
115
  }
116
+ static GetEntityGSTIN(Entity) {
117
+ if (!tr_utils_1.TrUtils.IsNull(Entity) && Array.isArray(Entity.TaxIds)) {
118
+ const gstinEntry = Entity.TaxIds.find((taxId) => {
119
+ const label = ((taxId === null || taxId === void 0 ? void 0 : taxId.Label) || (taxId === null || taxId === void 0 ? void 0 : taxId.label) || '').toString().trim().toUpperCase();
120
+ const value = (taxId === null || taxId === void 0 ? void 0 : taxId.Value) || (taxId === null || taxId === void 0 ? void 0 : taxId.value);
121
+ return label === 'GSTIN' && !tr_utils_1.TrUtils.IsEmpty(value);
122
+ });
123
+ if (!tr_utils_1.TrUtils.IsNull(gstinEntry)) {
124
+ return gstinEntry.Value || gstinEntry.value;
125
+ }
126
+ }
127
+ return tr_utils_1.TrUtils.IsNull(Entity === null || Entity === void 0 ? void 0 : Entity.GSTIN) ? '' : Entity.GSTIN;
128
+ }
115
129
  static GetFileName(ROPrintData) {
116
130
  let fileName = ROPrintData.HeaderName;
117
131
  if (!tr_utils_1.TrUtils.IsEmpty(ROPrintData.Vehicle.RegNo)) {
@@ -1235,8 +1235,10 @@ class SharedPDFService {
1235
1235
  }
1236
1236
  }
1237
1237
  static GetCustomerGSTIN(Customer) {
1238
- if (!tr_utils_1.TrUtils.IsEmpty(Customer.GSTIN)) {
1239
- let GSTIN = { columns: [{ text: 'GSTIN :', width: 33, style: 'hed' }, { text: Customer.GSTIN, marginTop: 1.5 }] };
1238
+ var _a;
1239
+ const customerTaxId = tr_utils_1.TrUtils.IsEmpty((_a = Customer === null || Customer === void 0 ? void 0 : Customer.TaxId) === null || _a === void 0 ? void 0 : _a.Value) ? Customer === null || Customer === void 0 ? void 0 : Customer.GSTIN : Customer.TaxId.Value;
1240
+ if (!tr_utils_1.TrUtils.IsEmpty(customerTaxId)) {
1241
+ let GSTIN = { columns: [{ text: 'GSTIN :', width: 33, style: 'hed' }, { text: customerTaxId, marginTop: 1.5 }] };
1240
1242
  return GSTIN;
1241
1243
  }
1242
1244
  else {
@@ -67,7 +67,7 @@ function GetSalesOrderPDF(salesOrderData, entityData, headerConfig, printConfig,
67
67
  const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
68
68
  const soPrintData = sales_print_service_1.SalesPrintService.GetSalesPrintInfo(salesOrderData, entityData, image, options.ShowGST, options.ConsolidateGST, taxCodes, false, options.isOtherIndustry);
69
69
  let soPrint;
70
- if (options.ConsolidateGST || !options.ShowGST) {
70
+ if (options.ConsolidateGST) {
71
71
  soPrint = sales_pdf_service_1.SalesPdfService.GetSalesPrint(salesOrderData, numberofCopies, options.isOtherIndustry, entityData, options.Design, options.SoItems, image, options.MoreDiscDetails);
72
72
  }
73
73
  else {
@@ -93,7 +93,7 @@ function GetDeliveryChallanPDF(deliveryChallanData, entityData, headerConfig, pr
93
93
  const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
94
94
  const dcPrintData = delivery_challan_print_service_1.DeliveryChallanPrintService.GetChallanDataPrintInfo(deliveryChallanData, entityData, image, options.ShowGST, options.ConsolidateGST, taxCodes, false);
95
95
  let dcPrint;
96
- if (options.ConsolidateGST || !options.ShowGST) {
96
+ if (options.ConsolidateGST) {
97
97
  dcPrint = delivery_challan_pdf_service_1.DeliveryChallanPdfService.GetDeliveryChallanPrint(deliveryChallanData, numberofCopies, false);
98
98
  }
99
99
  else {
@@ -119,7 +119,7 @@ function GetCreditNotePDF(creditNoteData, entityData, headerConfig, printConfig,
119
119
  const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
120
120
  const creditNotePrintData = cn_print_service_1.CNPrintService.GetCreditNotePrintInfo(creditNoteData, entityData, image, options.ShowGST, options.ConsolidateGST, taxCodes, false);
121
121
  let cnPrint;
122
- if (options.ConsolidateGST || !options.ShowGST) {
122
+ if (options.ConsolidateGST) {
123
123
  cnPrint = credit_note_pdf_service_1.CreditNotePdfService.GetInvoicePrint(creditNotePrintData, null, false);
124
124
  }
125
125
  else {
@@ -151,7 +151,7 @@ function GetSalesReceiptPDF(salesReceiptData, entityData, headerConfig, printCon
151
151
  posPrintData.TotalTax = (0, math_operations_1.Add)(posPrintData.CustPartCGST, posPrintData.CustPartSGST, posPrintData.CustPartIGST);
152
152
  posPrintData.Customer.Code = salesReceiptData.BillTo.Code;
153
153
  let posPrint;
154
- if (options.ConsolidateGST || !options.ShowGST) {
154
+ if (options.ConsolidateGST) {
155
155
  posPrint = pos_receipt_pdf_1.PosReceiptPrintService.GetPrint(posPrintData, options.Size);
156
156
  }
157
157
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.07",
3
+ "version": "1.7.08",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -136,12 +136,13 @@ export class RoprintService {
136
136
  }
137
137
 
138
138
  static CompanyDetails(Entity: any) {
139
+ const gstin = this.GetEntityGSTIN(Entity);
139
140
  let Details: any = [
140
141
  { text: Entity.CName, alignment: 'right', lineHeight: 1.5, fontSize: 8 },
141
142
  { text: Entity.Adrs1 + ',', alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
142
143
  { text: '' + Entity.City + SharedPDFService.getPinCode(Entity.PIN) + ', ' + 'Ph: ' + Entity.Phone, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
143
144
  { text: '' + SharedPDFService.GetEmail(Entity.Email) + '', alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
144
- { text: 'GSTIN : ' + Entity.GSTIN, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
145
+ { text: 'GSTIN : ' + gstin, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 },
145
146
  { text: 'PAN No : ' + Entity.PAN, alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 }]
146
147
  if (!TrUtils.IsEmpty(Entity.Adrs2)) {
147
148
  Details.splice(2, 0, { text: Entity.Adrs2 + '', alignment: 'right', color: 'gray', lineHeight: 1.5, fontSize: 8 });
@@ -149,6 +150,20 @@ export class RoprintService {
149
150
  return Details;
150
151
  }
151
152
 
153
+ static GetEntityGSTIN(Entity: any) {
154
+ if (!TrUtils.IsNull(Entity) && Array.isArray(Entity.TaxIds)) {
155
+ const gstinEntry = Entity.TaxIds.find((taxId: any) => {
156
+ const label = (taxId?.Label || taxId?.label || '').toString().trim().toUpperCase();
157
+ const value = taxId?.Value || taxId?.value;
158
+ return label === 'GSTIN' && !TrUtils.IsEmpty(value);
159
+ });
160
+ if (!TrUtils.IsNull(gstinEntry)) {
161
+ return gstinEntry.Value || gstinEntry.value;
162
+ }
163
+ }
164
+ return TrUtils.IsNull(Entity?.GSTIN) ? '' : Entity.GSTIN;
165
+ }
166
+
152
167
  static GetFileName(ROPrintData: any) {
153
168
  let fileName: string = ROPrintData.HeaderName;
154
169
  if (!TrUtils.IsEmpty(ROPrintData.Vehicle.RegNo)) {
@@ -1323,8 +1323,9 @@ export class SharedPDFService {
1323
1323
  }
1324
1324
 
1325
1325
  static GetCustomerGSTIN(Customer: any) {
1326
- if (!TrUtils.IsEmpty(Customer.GSTIN)) {
1327
- let GSTIN = { columns: [{ text: 'GSTIN :', width: 33, style: 'hed' }, { text: Customer.GSTIN, marginTop: 1.5 }] };
1326
+ const customerTaxId = TrUtils.IsEmpty(Customer?.TaxId?.Value) ? Customer?.GSTIN : Customer.TaxId.Value;
1327
+ if (!TrUtils.IsEmpty(customerTaxId)) {
1328
+ let GSTIN = { columns: [{ text: 'GSTIN :', width: 33, style: 'hed' }, { text: customerTaxId, marginTop: 1.5 }] };
1328
1329
  return GSTIN;
1329
1330
  } else {
1330
1331
  return this.emptyObject();
@@ -68,7 +68,7 @@ export function GetSalesOrderPDF(salesOrderData: any, entityData: any, headerCon
68
68
  const soPrintData: any = SalesPrintService.GetSalesPrintInfo(salesOrderData, entityData, image,
69
69
  options.ShowGST, options.ConsolidateGST, taxCodes, false, options.isOtherIndustry);
70
70
  let soPrint: any;
71
- if (options.ConsolidateGST || !options.ShowGST) {
71
+ if (options.ConsolidateGST) {
72
72
  soPrint = SalesPdfService.GetSalesPrint(salesOrderData, numberofCopies, options.isOtherIndustry,
73
73
  entityData, options.Design, options.SoItems, image, options.MoreDiscDetails);
74
74
  } else {
@@ -100,7 +100,7 @@ export function GetDeliveryChallanPDF(deliveryChallanData: any, entityData: any,
100
100
  const dcPrintData: any = DeliveryChallanPrintService.GetChallanDataPrintInfo(deliveryChallanData, entityData, image,
101
101
  options.ShowGST, options.ConsolidateGST, taxCodes, false);
102
102
  let dcPrint: any;
103
- if (options.ConsolidateGST || !options.ShowGST) {
103
+ if (options.ConsolidateGST) {
104
104
  dcPrint = DeliveryChallanPdfService.GetDeliveryChallanPrint(deliveryChallanData, numberofCopies, false);
105
105
  } else {
106
106
  dcPrintData.Round = TrUtils.FixedTo(deliveryChallanData.Round);
@@ -130,7 +130,7 @@ export function GetCreditNotePDF(creditNoteData: any, entityData: any, headerCon
130
130
  const creditNotePrintData: any = CNPrintService.GetCreditNotePrintInfo(creditNoteData, entityData, image,
131
131
  options.ShowGST, options.ConsolidateGST, taxCodes, false);
132
132
  let cnPrint: any;
133
- if (options.ConsolidateGST || !options.ShowGST) {
133
+ if (options.ConsolidateGST) {
134
134
  cnPrint = CreditNotePdfService.GetInvoicePrint(creditNotePrintData, null, false);
135
135
  } else {
136
136
  creditNotePrintData.Round = TrUtils.FixedTo(creditNoteData.Round);
@@ -168,7 +168,7 @@ export function GetSalesReceiptPDF(salesReceiptData: any, entityData: any, heade
168
168
  posPrintData.TotalTax = Add(posPrintData.CustPartCGST, posPrintData.CustPartSGST, posPrintData.CustPartIGST);
169
169
  posPrintData.Customer.Code = salesReceiptData.BillTo.Code;
170
170
  let posPrint: any;
171
- if (options.ConsolidateGST || !options.ShowGST) {
171
+ if (options.ConsolidateGST) {
172
172
  posPrint = PosReceiptPrintService.GetPrint(posPrintData, options.Size);
173
173
  } else {
174
174
  posPrint = CreateInvoicePDFService(posPrintData, printConfigData, numberofCopies);