taxtank-core 2.1.28 → 2.1.30

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.
@@ -613,6 +613,7 @@ let SoleBusiness$1 = class SoleBusiness extends ObservableModel {
613
613
  super(...arguments);
614
614
  this.isPrimaryProduction = false;
615
615
  this.isTaxFree = false;
616
+ this.isGST = false;
616
617
  }
617
618
  static { this.className = 'SoleBusiness'; }
618
619
  };
@@ -8782,16 +8783,18 @@ class SoleBusinessLossReport extends AbstractModel {
8782
8783
  * profit/loss report item
8783
8784
  */
8784
8785
  class SolePlItem {
8785
- constructor(transactions, priorTransactions) {
8786
- this.chartAccounts = (transactions.first ?? priorTransactions.first).chartAccounts;
8787
- this.amount = Math.abs(transactions.claimAmount);
8788
- this.priorAmount = Math.abs(priorTransactions.claimAmount);
8786
+ constructor(transactions, data = {}) {
8787
+ this.chartAccounts = transactions.first.chartAccounts;
8788
+ this.name = transactions.first.chartAccounts.name;
8789
+ this.amount = Math.abs(transactions.filterByFinancialYear('date').claimAmount);
8790
+ this.priorAmount = Math.abs(transactions.filterByFinancialYear('date', null, FinancialYear.prev()).claimAmount);
8789
8791
  if (!this.priorAmount) {
8790
8792
  this.varianceRatio = NaN;
8791
8793
  }
8792
8794
  else {
8793
8795
  this.varianceRatio = (this.amount - this.priorAmount) / this.priorAmount;
8794
8796
  }
8797
+ Object.assign(this, data);
8795
8798
  }
8796
8799
  }
8797
8800
 
@@ -9155,10 +9158,13 @@ class BudgetRuleItemCollection extends Collection {
9155
9158
  }
9156
9159
 
9157
9160
  class SolePlItemCollection extends Collection {
9158
- static fromTransactions(transactions, priorTransactions) {
9161
+ static fromTransactions(transactions) {
9159
9162
  const transactionsByChartAccounts = transactions.groupBy('chartAccounts.id');
9160
- const priorTransactionsByChartAccounts = priorTransactions.groupBy('chartAccounts.id');
9161
- return new SolePlItemCollection([...new Set([...transactionsByChartAccounts.keys, ...priorTransactionsByChartAccounts.keys])].map(chartAccountsId => new SolePlItem(transactionsByChartAccounts.get(chartAccountsId), priorTransactionsByChartAccounts.get(chartAccountsId))));
9163
+ const collection = new SolePlItemCollection(transactionsByChartAccounts.keys.map(chartAccountsId => new SolePlItem(transactionsByChartAccounts.get(chartAccountsId))));
9164
+ // collection.push(
9165
+ // new SolePlItem(transactions.filterBy('chartAccounts.category', ChartAccountsCategoryEnum.SOLE_DEPRECIATION))
9166
+ // );
9167
+ return collection;
9162
9168
  }
9163
9169
  get amount() {
9164
9170
  return this.sumBy('amount');
@@ -9168,7 +9174,7 @@ class SolePlItemCollection extends Collection {
9168
9174
  }
9169
9175
  get varianceRatio() {
9170
9176
  const priorAmount = this.priorAmount;
9171
- return this.priorAmount ? (this.amount - priorAmount) / priorAmount : NaN;
9177
+ return priorAmount ? (this.amount - priorAmount) / priorAmount : NaN;
9172
9178
  }
9173
9179
  }
9174
9180