shareneus 1.7.348 → 1.7.350

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.
@@ -11,7 +11,8 @@ const tr_utils_1 = require("../utils/tr-utils");
11
11
  class SalesReceivePrintService {
12
12
  static GetSalesReceivePrintInfo(OriginalSalesReceiveData, OriginalEntityData, image, IncludeGST, ConsolidateGST, TaxCodes, IsProforma, HeaderName) {
13
13
  var _a, _b;
14
- let ForInsurance = !tr_utils_1.TrUtils.IsNull(OriginalSalesReceiveData.BillTo.InsId);
14
+ // let ForInsurance: boolean = !TrUtils.IsNull(OriginalSalesReceiveData.BillTo.InsId);
15
+ let ForInsurance = false;
15
16
  let SalesReceivePrintData = {};
16
17
  let argSalesReceiveData = tr_utils_1.TrUtils.Stringify(OriginalSalesReceiveData);
17
18
  if (!IncludeGST) {
@@ -75,6 +76,7 @@ class SalesReceivePrintService {
75
76
  const itemSGST = this.GetTaxAmountFromTaxes(Item, 'SGST', Item.SGST);
76
77
  const itemIGST = this.GetTaxAmountFromTaxes(Item, 'IGST', Item.IGST);
77
78
  Item.TCode = this.GetTCodeFromTaxes(Item);
79
+ Item.AfterPartDisc = (0, math_operations_1.Subtract)(Item.UnAmt, Item.Disc, Item.RecDisc);
78
80
  if (Consolidate) {
79
81
  let AfterPartDisc = (0, math_operations_1.Subtract)(Item.UnAmt, Item.Disc, Item.RecDisc);
80
82
  let AfterDiscForEach = (0, math_operations_1.Divide)(AfterPartDisc, Item.Qty);
@@ -168,30 +170,32 @@ class SalesReceivePrintService {
168
170
  return SalesReceivePrintData;
169
171
  }
170
172
  static GetBillNameForSalesReceivePrint(OriginalSalesReceiveData, SalesReceivePrintData) {
173
+ var _a;
174
+ const BillTo = (_a = OriginalSalesReceiveData.BillTo) !== null && _a !== void 0 ? _a : OriginalSalesReceiveData.BFrom;
171
175
  let Customer = {};
172
- Customer.Name = OriginalSalesReceiveData.BillTo.Name;
176
+ Customer.Name = BillTo.Name;
173
177
  Customer.Adrs = [];
174
178
  Customer.Cons = [];
175
- if (!tr_utils_1.TrUtils.IsNull(OriginalSalesReceiveData.BillTo.Adrs)) {
176
- Customer.Adrs.push(OriginalSalesReceiveData.BillTo.Adrs.A1);
177
- if (!tr_utils_1.TrUtils.IsEmpty(OriginalSalesReceiveData.BillTo.Adrs.A2)) {
178
- Customer.Adrs.push(OriginalSalesReceiveData.BillTo.Adrs.A2);
179
+ if (!tr_utils_1.TrUtils.IsNull(BillTo.Adrs)) {
180
+ Customer.Adrs.push(BillTo.Adrs.A1);
181
+ if (!tr_utils_1.TrUtils.IsEmpty(BillTo.Adrs.A2)) {
182
+ Customer.Adrs.push(BillTo.Adrs.A2);
179
183
  }
180
- if (!tr_utils_1.TrUtils.IsEmpty(OriginalSalesReceiveData.BillTo.Adrs.Ct)) {
181
- Customer.Adrs.push(OriginalSalesReceiveData.BillTo.Adrs.Ct);
184
+ if (!tr_utils_1.TrUtils.IsEmpty(BillTo.Adrs.Ct)) {
185
+ Customer.Adrs.push(BillTo.Adrs.Ct);
182
186
  }
183
187
  }
184
- Customer.GSTIN = OriginalSalesReceiveData.BillTo.GSTIN;
185
- if (!tr_utils_1.TrUtils.IsEmpty(OriginalSalesReceiveData.BillTo.Ph)) {
188
+ Customer.GSTIN = BillTo.GSTIN;
189
+ if (!tr_utils_1.TrUtils.IsEmpty(BillTo.Ph)) {
186
190
  Customer.Cons = [
187
191
  {
188
192
  Type: 'M',
189
- No: OriginalSalesReceiveData.BillTo.Ph
193
+ No: BillTo.Ph
190
194
  }
191
195
  ];
192
196
  }
193
197
  SalesReceivePrintData.Customer = Customer;
194
- if (!tr_utils_1.TrUtils.IsNull(OriginalSalesReceiveData.BillTo.InsId)) {
198
+ if (!tr_utils_1.TrUtils.IsNull(BillTo.InsId)) {
195
199
  SalesReceivePrintData.Cust = this.GetCustomerDetails(OriginalSalesReceiveData);
196
200
  }
197
201
  return SalesReceivePrintData;
@@ -1296,6 +1296,21 @@ class SharedPDFService {
1296
1296
  else if (Type === 'SalesOrder') {
1297
1297
  id = 'SO#';
1298
1298
  }
1299
+ else if (Type === 'Sales Return') {
1300
+ id = 'SR#';
1301
+ }
1302
+ else if (Type === 'Sales Receive') {
1303
+ id = 'SRR#';
1304
+ }
1305
+ else if (Type === 'Purchase Return') {
1306
+ id = 'PR#';
1307
+ }
1308
+ else if (Type === 'Purchase Shipment') {
1309
+ id = 'PS#';
1310
+ }
1311
+ else if (Type === 'Purchase Order') {
1312
+ id = 'PO#';
1313
+ }
1299
1314
  else if (Type === 'Sales Estimate') {
1300
1315
  id = 'Estimate#';
1301
1316
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shareneus",
3
- "version": "1.7.348",
3
+ "version": "1.7.350",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -12,7 +12,8 @@ export class SalesReceivePrintService {
12
12
  static GetSalesReceivePrintInfo(OriginalSalesReceiveData: any, OriginalEntityData: any, image: any,
13
13
  IncludeGST: boolean, ConsolidateGST: boolean, TaxCodes: any, IsProforma: boolean, HeaderName: string) {
14
14
 
15
- let ForInsurance: boolean = !TrUtils.IsNull(OriginalSalesReceiveData.BillTo.InsId);
15
+ // let ForInsurance: boolean = !TrUtils.IsNull(OriginalSalesReceiveData.BillTo.InsId);
16
+ let ForInsurance: boolean = false;
16
17
  let SalesReceivePrintData: any = {};
17
18
  let argSalesReceiveData = TrUtils.Stringify(OriginalSalesReceiveData);
18
19
  if (!IncludeGST) {
@@ -80,12 +81,13 @@ export class SalesReceivePrintService {
80
81
  return SalesReceivePrintData;
81
82
  }
82
83
 
83
- static GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, IsTaxable:boolean, DecimalsNumber: number) {
84
+ static GetItemsPrintInfo(Items: any, Consolidate: boolean, TaxCodes: any, LineTotal: string, IsTaxable: boolean, DecimalsNumber: number) {
84
85
  Items.forEach((Item: any) => {
85
86
  const itemCGST = this.GetTaxAmountFromTaxes(Item, 'CGST', Item.CGST);
86
87
  const itemSGST = this.GetTaxAmountFromTaxes(Item, 'SGST', Item.SGST);
87
88
  const itemIGST = this.GetTaxAmountFromTaxes(Item, 'IGST', Item.IGST);
88
89
  Item.TCode = this.GetTCodeFromTaxes(Item);
90
+ Item.AfterPartDisc = Subtract(Item.UnAmt, Item.Disc, Item.RecDisc);
89
91
  if (Consolidate) {
90
92
  let AfterPartDisc = Subtract(Item.UnAmt, Item.Disc, Item.RecDisc);
91
93
  let AfterDiscForEach = Divide(AfterPartDisc, Item.Qty);
@@ -102,7 +104,7 @@ export class SalesReceivePrintService {
102
104
  Item.CGSTPerc = this.GetTaxRateFromTaxes(Item, 'CGST', PrintSharedService.GetCGSTValueBasedOnTaxCode(Item.TCode, TaxCodes));
103
105
  Item.SGSTPerc = this.GetTaxRateFromTaxes(Item, 'SGST', PrintSharedService.GetSGSTValueBasedOnTaxCode(Item.TCode, TaxCodes));
104
106
  Item.IGSTPerc = this.GetTaxRateFromTaxes(Item, 'IGST', PrintSharedService.GetIGSTValueBasedOnTaxCode(Item.TCode, TaxCodes));
105
- // Calculate amount after tax based on tax type
107
+ // Calculate amount after tax based on tax type
106
108
  if (IsTaxable) {
107
109
  Item.AfterPartTax = Add(Item.AfterPartDisc, itemCGST, itemSGST, itemIGST);
108
110
  } else {
@@ -188,32 +190,33 @@ export class SalesReceivePrintService {
188
190
  }
189
191
 
190
192
  static GetBillNameForSalesReceivePrint(OriginalSalesReceiveData: any, SalesReceivePrintData: any) {
193
+ const BillTo: any = OriginalSalesReceiveData.BillTo ?? OriginalSalesReceiveData.BFrom;
191
194
  let Customer: any = {};
192
- Customer.Name = OriginalSalesReceiveData.BillTo.Name;
195
+ Customer.Name = BillTo.Name;
193
196
  Customer.Adrs = [];
194
197
  Customer.Cons = [];
195
- if (!TrUtils.IsNull(OriginalSalesReceiveData.BillTo.Adrs)) {
196
- Customer.Adrs.push(OriginalSalesReceiveData.BillTo.Adrs.A1);
197
- if (!TrUtils.IsEmpty(OriginalSalesReceiveData.BillTo.Adrs.A2)) {
198
- Customer.Adrs.push(OriginalSalesReceiveData.BillTo.Adrs.A2);
198
+ if (!TrUtils.IsNull(BillTo.Adrs)) {
199
+ Customer.Adrs.push(BillTo.Adrs.A1);
200
+ if (!TrUtils.IsEmpty(BillTo.Adrs.A2)) {
201
+ Customer.Adrs.push(BillTo.Adrs.A2);
199
202
  }
200
- if (!TrUtils.IsEmpty(OriginalSalesReceiveData.BillTo.Adrs.Ct)) {
201
- Customer.Adrs.push(OriginalSalesReceiveData.BillTo.Adrs.Ct);
203
+ if (!TrUtils.IsEmpty(BillTo.Adrs.Ct)) {
204
+ Customer.Adrs.push(BillTo.Adrs.Ct);
202
205
  }
203
206
  }
204
- Customer.GSTIN = OriginalSalesReceiveData.BillTo.GSTIN;
207
+ Customer.GSTIN = BillTo.GSTIN;
205
208
 
206
- if (!TrUtils.IsEmpty(OriginalSalesReceiveData.BillTo.Ph)) {
209
+ if (!TrUtils.IsEmpty(BillTo.Ph)) {
207
210
  Customer.Cons = [
208
211
  {
209
212
  Type: 'M',
210
- No: OriginalSalesReceiveData.BillTo.Ph
213
+ No: BillTo.Ph
211
214
  }
212
215
  ];
213
216
  }
214
217
  SalesReceivePrintData.Customer = Customer;
215
218
 
216
- if (!TrUtils.IsNull(OriginalSalesReceiveData.BillTo.InsId)) {
219
+ if (!TrUtils.IsNull(BillTo.InsId)) {
217
220
  SalesReceivePrintData.Cust = this.GetCustomerDetails(OriginalSalesReceiveData);
218
221
  }
219
222
  return SalesReceivePrintData;
@@ -1325,7 +1325,7 @@ export class SharedPDFService {
1325
1325
  static GetCustomerGSTIN(Customer: any) {
1326
1326
  const customerTaxId = TrUtils.IsEmpty(Customer?.TaxId?.Value) ? Customer?.GSTIN : Customer.TaxId.Value;
1327
1327
  if (!TrUtils.IsEmpty(customerTaxId)) {
1328
- let GSTIN = { columns: [{ text: Customer?.TaxId?.Label ||'GSTIN :', width: 33, style: 'hed' }, { text: customerTaxId, marginTop: 1.5 }] };
1328
+ let GSTIN = { columns: [{ text: Customer?.TaxId?.Label || 'GSTIN :', width: 33, style: 'hed' }, { text: customerTaxId, marginTop: 1.5 }] };
1329
1329
  return GSTIN;
1330
1330
  } else {
1331
1331
  return this.emptyObject();
@@ -1385,6 +1385,16 @@ export class SharedPDFService {
1385
1385
  id = 'WO#';
1386
1386
  } else if (Type === 'SalesOrder') {
1387
1387
  id = 'SO#';
1388
+ } else if (Type === 'Sales Return') {
1389
+ id = 'SR#';
1390
+ } else if (Type === 'Sales Receive') {
1391
+ id = 'SRR#';
1392
+ } else if (Type === 'Purchase Return') {
1393
+ id = 'PR#';
1394
+ } else if (Type === 'Purchase Shipment') {
1395
+ id = 'PS#';
1396
+ } else if (Type === 'Purchase Order') {
1397
+ id = 'PO#';
1388
1398
  } else if (Type === 'Sales Estimate') {
1389
1399
  id = 'Estimate#';
1390
1400
  } else if (Type === 'Debit Notes') {