shareneus 1.7.7 → 1.7.9

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 {
@@ -42,10 +42,12 @@ function GetInvoicePDF(invoiceData, entityData, headerConfig, printConfig, taxCo
42
42
  invPrint = (0, unified_invoice_pdf_service_1.GetInvoicePrint)(invoicePrintData, numberofCopies, withPass, options.Size, options.MoreDiscDetails, options.Orientation);
43
43
  }
44
44
  else {
45
- invoicePrintData.Round = tr_utils_1.TrUtils.FixedTo(invoiceData.Round);
46
- invoicePrintData.Total = tr_utils_1.TrUtils.FixedTo(invoiceData.Total);
47
- invoicePrintData.SubToal = tr_utils_1.TrUtils.FixedTo(invoiceData.SubToal);
48
- invoicePrintData.TaxTotal = tr_utils_1.TrUtils.FixedTo(invoiceData.TaxTotal);
45
+ if (options.PartInvoice && options.LaborInvoice) {
46
+ invoicePrintData.Round = tr_utils_1.TrUtils.FixedTo(invoiceData.Round);
47
+ invoicePrintData.Total = tr_utils_1.TrUtils.FixedTo(invoiceData.Total);
48
+ invoicePrintData.SubToal = tr_utils_1.TrUtils.FixedTo(invoiceData.SubToal);
49
+ invoicePrintData.TaxTotal = tr_utils_1.TrUtils.FixedTo(invoiceData.TaxTotal);
50
+ }
49
51
  delete invoicePrintData.SIndTotal;
50
52
  invPrint = (0, invoice_pdf_service_1.CreateInvoicePDFService)(invoicePrintData, printConfigData, numberofCopies);
51
53
  }
@@ -67,7 +69,7 @@ function GetSalesOrderPDF(salesOrderData, entityData, headerConfig, printConfig,
67
69
  const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
68
70
  const soPrintData = sales_print_service_1.SalesPrintService.GetSalesPrintInfo(salesOrderData, entityData, image, options.ShowGST, options.ConsolidateGST, taxCodes, false, options.isOtherIndustry);
69
71
  let soPrint;
70
- if (options.ConsolidateGST || !options.ShowGST) {
72
+ if (options.ConsolidateGST) {
71
73
  soPrint = sales_pdf_service_1.SalesPdfService.GetSalesPrint(salesOrderData, numberofCopies, options.isOtherIndustry, entityData, options.Design, options.SoItems, image, options.MoreDiscDetails);
72
74
  }
73
75
  else {
@@ -93,7 +95,7 @@ function GetDeliveryChallanPDF(deliveryChallanData, entityData, headerConfig, pr
93
95
  const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
94
96
  const dcPrintData = delivery_challan_print_service_1.DeliveryChallanPrintService.GetChallanDataPrintInfo(deliveryChallanData, entityData, image, options.ShowGST, options.ConsolidateGST, taxCodes, false);
95
97
  let dcPrint;
96
- if (options.ConsolidateGST || !options.ShowGST) {
98
+ if (options.ConsolidateGST) {
97
99
  dcPrint = delivery_challan_pdf_service_1.DeliveryChallanPdfService.GetDeliveryChallanPrint(deliveryChallanData, numberofCopies, false);
98
100
  }
99
101
  else {
@@ -119,7 +121,7 @@ function GetCreditNotePDF(creditNoteData, entityData, headerConfig, printConfig,
119
121
  const printConfigData = tr_utils_1.TrUtils.ConcatObjects(tr_utils_1.TrUtils.Stringify(headerConfig), tr_utils_1.TrUtils.Stringify(printConfig));
120
122
  const creditNotePrintData = cn_print_service_1.CNPrintService.GetCreditNotePrintInfo(creditNoteData, entityData, image, options.ShowGST, options.ConsolidateGST, taxCodes, false);
121
123
  let cnPrint;
122
- if (options.ConsolidateGST || !options.ShowGST) {
124
+ if (options.ConsolidateGST) {
123
125
  cnPrint = credit_note_pdf_service_1.CreditNotePdfService.GetInvoicePrint(creditNotePrintData, null, false);
124
126
  }
125
127
  else {
@@ -151,7 +153,7 @@ function GetSalesReceiptPDF(salesReceiptData, entityData, headerConfig, printCon
151
153
  posPrintData.TotalTax = (0, math_operations_1.Add)(posPrintData.CustPartCGST, posPrintData.CustPartSGST, posPrintData.CustPartIGST);
152
154
  posPrintData.Customer.Code = salesReceiptData.BillTo.Code;
153
155
  let posPrint;
154
- if (options.ConsolidateGST || !options.ShowGST) {
156
+ if (options.ConsolidateGST) {
155
157
  posPrint = pos_receipt_pdf_1.PosReceiptPrintService.GetPrint(posPrintData, options.Size);
156
158
  }
157
159
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.07",
3
+ "version": "1.7.09",
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();
@@ -39,10 +39,12 @@ export function GetInvoicePDF(invoiceData: any, entityData: any, headerConfig: a
39
39
  if (options.ConsolidateGST) {
40
40
  invPrint = GetInvoicePrint(invoicePrintData, numberofCopies, withPass, options.Size, options.MoreDiscDetails, options.Orientation);
41
41
  } else {
42
+ if(options.PartInvoice && options.LaborInvoice){
42
43
  invoicePrintData.Round = TrUtils.FixedTo(invoiceData.Round);
43
44
  invoicePrintData.Total = TrUtils.FixedTo(invoiceData.Total);
44
45
  invoicePrintData.SubToal = TrUtils.FixedTo(invoiceData.SubToal);
45
46
  invoicePrintData.TaxTotal = TrUtils.FixedTo(invoiceData.TaxTotal);
47
+ }
46
48
  delete invoicePrintData.SIndTotal;
47
49
  invPrint = CreateInvoicePDFService(invoicePrintData, printConfigData, numberofCopies);
48
50
  }
@@ -68,7 +70,7 @@ export function GetSalesOrderPDF(salesOrderData: any, entityData: any, headerCon
68
70
  const soPrintData: any = SalesPrintService.GetSalesPrintInfo(salesOrderData, entityData, image,
69
71
  options.ShowGST, options.ConsolidateGST, taxCodes, false, options.isOtherIndustry);
70
72
  let soPrint: any;
71
- if (options.ConsolidateGST || !options.ShowGST) {
73
+ if (options.ConsolidateGST) {
72
74
  soPrint = SalesPdfService.GetSalesPrint(salesOrderData, numberofCopies, options.isOtherIndustry,
73
75
  entityData, options.Design, options.SoItems, image, options.MoreDiscDetails);
74
76
  } else {
@@ -100,7 +102,7 @@ export function GetDeliveryChallanPDF(deliveryChallanData: any, entityData: any,
100
102
  const dcPrintData: any = DeliveryChallanPrintService.GetChallanDataPrintInfo(deliveryChallanData, entityData, image,
101
103
  options.ShowGST, options.ConsolidateGST, taxCodes, false);
102
104
  let dcPrint: any;
103
- if (options.ConsolidateGST || !options.ShowGST) {
105
+ if (options.ConsolidateGST) {
104
106
  dcPrint = DeliveryChallanPdfService.GetDeliveryChallanPrint(deliveryChallanData, numberofCopies, false);
105
107
  } else {
106
108
  dcPrintData.Round = TrUtils.FixedTo(deliveryChallanData.Round);
@@ -130,7 +132,7 @@ export function GetCreditNotePDF(creditNoteData: any, entityData: any, headerCon
130
132
  const creditNotePrintData: any = CNPrintService.GetCreditNotePrintInfo(creditNoteData, entityData, image,
131
133
  options.ShowGST, options.ConsolidateGST, taxCodes, false);
132
134
  let cnPrint: any;
133
- if (options.ConsolidateGST || !options.ShowGST) {
135
+ if (options.ConsolidateGST) {
134
136
  cnPrint = CreditNotePdfService.GetInvoicePrint(creditNotePrintData, null, false);
135
137
  } else {
136
138
  creditNotePrintData.Round = TrUtils.FixedTo(creditNoteData.Round);
@@ -168,7 +170,7 @@ export function GetSalesReceiptPDF(salesReceiptData: any, entityData: any, heade
168
170
  posPrintData.TotalTax = Add(posPrintData.CustPartCGST, posPrintData.CustPartSGST, posPrintData.CustPartIGST);
169
171
  posPrintData.Customer.Code = salesReceiptData.BillTo.Code;
170
172
  let posPrint: any;
171
- if (options.ConsolidateGST || !options.ShowGST) {
173
+ if (options.ConsolidateGST) {
172
174
  posPrint = PosReceiptPrintService.GetPrint(posPrintData, options.Size);
173
175
  } else {
174
176
  posPrint = CreateInvoicePDFService(posPrintData, printConfigData, numberofCopies);