taxtank-core 2.1.25 → 2.1.27

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.
@@ -1888,6 +1888,9 @@ class FinancialYear {
1888
1888
  this.setStartDate(this.year);
1889
1889
  this.setEndDate(this.year);
1890
1890
  }
1891
+ static prev() {
1892
+ return new FinancialYear(new FinancialYear().year - 1);
1893
+ }
1891
1894
  static isCurrent(year = FinancialYear.year) {
1892
1895
  return FinancialYear.toFinYear(new Date()) === year;
1893
1896
  }
@@ -5420,14 +5423,15 @@ class SoleInvoiceItem extends SoleInvoiceItem$1 {
5420
5423
  const coefficient = this.isGST && taxType === SoleInvoiceTaxTypeEnum.TAX_INCLUSIVE ? ChartAccounts.GSTCoefficient : 1;
5421
5424
  return totalPrice / coefficient;
5422
5425
  }
5423
- toTransaction() {
5426
+ toTransaction(data = {}) {
5424
5427
  return plainToClass(Transaction, {
5425
5428
  chartAccounts: this.chartAccounts,
5426
5429
  description: this.description,
5427
5430
  source: TransactionSourceEnum.BANK_TRANSACTION,
5428
5431
  isGST: this.isGST,
5429
5432
  operation: TransactionOperationEnum.ALLOCATE_INVOICE,
5430
- invoiceItem: this
5433
+ invoiceItem: this,
5434
+ ...data
5431
5435
  });
5432
5436
  }
5433
5437
  }
@@ -8788,7 +8792,6 @@ class SolePlItem {
8788
8792
  else {
8789
8793
  this.varianceRatio = (this.amount - this.priorAmount) / this.priorAmount;
8790
8794
  }
8791
- this.transactions = transactions;
8792
8795
  }
8793
8796
  }
8794
8797
 
@@ -9254,6 +9257,13 @@ class SoleInvoiceCollection extends Collection {
9254
9257
  getGrossPrice() {
9255
9258
  return this.sumBy('grossPrice');
9256
9259
  }
9260
+ toTransactions() {
9261
+ return this.map(invoice => invoice.items.map(item => item.toTransaction({
9262
+ business: invoice.business,
9263
+ claimAmount: item.totalPrice,
9264
+ date: invoice.dateFrom,
9265
+ })).flat()).flat();
9266
+ }
9257
9267
  }
9258
9268
 
9259
9269
  class SoleContactItemCollection extends Collection {
@@ -27432,7 +27442,6 @@ class TransactionBaseFilter {
27432
27442
  constructor() {
27433
27443
  this.businesses = [];
27434
27444
  this.properties = [];
27435
- this.dateRange = [];
27436
27445
  }
27437
27446
  }
27438
27447