taxtank-core 0.31.52 → 0.31.53

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.
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, Inject, inject, EventEmitter, NgModule, Pipe } from '@angular/core';
3
3
  import * as i1$1 from '@angular/common';
4
- import { CommonModule, CurrencyPipe, DatePipe } from '@angular/common';
4
+ import { formatDate, CommonModule, CurrencyPipe, DatePipe } from '@angular/common';
5
5
  import * as i1 from '@angular/common/http';
6
6
  import { HttpParams, HttpErrorResponse, HTTP_INTERCEPTORS } from '@angular/common/http';
7
7
  import { map, mergeMap, filter, first as first$1, catchError, skip, take, switchMap, finalize, debounceTime, distinctUntilChanged, delay } from 'rxjs/operators';
@@ -166,6 +166,9 @@ class AbstractModel {
166
166
  hasValue(value, path = 'id') {
167
167
  return get(path) === value;
168
168
  }
169
+ formatDate(date, format = 'MMM d, y') {
170
+ return formatDate(date, format, 'en-AU');
171
+ }
169
172
  }
170
173
 
171
174
  let Country$1 = class Country extends AbstractModel {
@@ -8175,16 +8178,16 @@ class VehicleExpense extends AbstractModel {
8175
8178
  }
8176
8179
 
8177
8180
  class VehicleExpenseCollection extends Collection {
8178
- constructor(transactions, depreciations, vehicleClaim) {
8181
+ constructor(transactions, depreciations) {
8179
8182
  super();
8180
- this.setItems(transactions, depreciations, vehicleClaim);
8183
+ this.setItems(transactions, depreciations);
8181
8184
  }
8182
- setItems(transactions, depreciations, vehicleClaim) {
8185
+ setItems(transactions, depreciations) {
8183
8186
  this.items = [];
8184
8187
  const transactionsByChartAccounts = transactions.groupBy('chartAccounts.name');
8185
- const transactionExpenses = transactionsByChartAccounts.keys.map((chartAccountsName) => new VehicleExpense(transactionsByChartAccounts.get(chartAccountsName).amount, vehicleClaim.workUsage, chartAccountsName));
8188
+ const transactionExpenses = transactionsByChartAccounts.keys.map((chartAccountsName) => new VehicleExpense(transactionsByChartAccounts.get(chartAccountsName).amount, transactionsByChartAccounts.get(chartAccountsName).first.claimPercent, chartAccountsName));
8186
8189
  // group all depreciations into one expense item
8187
- const depreciationExpense = new VehicleExpense(-depreciations.getCurrentYearForecastAmount(), vehicleClaim.workUsage, 'Depreciation');
8190
+ const depreciationExpense = new VehicleExpense(-depreciations.getCurrentYearForecastAmount(), depreciations.first?.claimPercent ?? 0, 'Depreciation');
8188
8191
  this.items.push(...[depreciationExpense, ...transactionExpenses]);
8189
8192
  }
8190
8193
  }
@@ -9287,7 +9290,7 @@ class HoldingSaleCollection extends ExportableCollection {
9287
9290
  plainToClass(ExportCell, { value: sale.totalCapitalGain, type: ExportCellTypeEnum.CURRENCY }),
9288
9291
  plainToClass(ExportCell, { value: sale.grossCapitalGain, type: ExportCellTypeEnum.CURRENCY }),
9289
9292
  plainToClass(ExportCell, {
9290
- value: sale.isOneYearExemptionApplicable() ? '50% (1 year rule)' : 'None',
9293
+ value: sale.concession,
9291
9294
  type: ExportCellTypeEnum.STRING
9292
9295
  }),
9293
9296
  ]);
@@ -10147,6 +10150,9 @@ class HoldingType extends AbstractModel {
10147
10150
  isCrypto() {
10148
10151
  return this.category === HoldingTypeCategoryEnum.CRYPTO;
10149
10152
  }
10153
+ getMpData() {
10154
+ return { category: HoldingTypeCategoryEnum[this.category], name: this.name };
10155
+ }
10150
10156
  }
10151
10157
  __decorate([
10152
10158
  Type(() => AppFile)
@@ -10171,6 +10177,9 @@ class HoldingSale extends AssetSale {
10171
10177
  isOneYearExemptionApplicable() {
10172
10178
  return this.grossCapitalGain !== this.netCapitalGain;
10173
10179
  }
10180
+ get concession() {
10181
+ return this.isOneYearExemptionApplicable() ? '50% (1 year rule)' : 'None';
10182
+ }
10174
10183
  getCostBase(holding) {
10175
10184
  return this.getPurchasePrice(holding) + holding.fee;
10176
10185
  }
@@ -10186,6 +10195,9 @@ class HoldingSale extends AssetSale {
10186
10195
  get cost() {
10187
10196
  return this.price * this.quantity;
10188
10197
  }
10198
+ getMpData(type) {
10199
+ return { holding: type.name, concession: this.concession };
10200
+ }
10189
10201
  }
10190
10202
  __decorate([
10191
10203
  Transform(({ value }) => ({ id: value.id }), { toPlainOnly: true })
@@ -10230,6 +10242,9 @@ class Holding extends AbstractModel {
10230
10242
  isSold() {
10231
10243
  return this.currentQuantity === 0;
10232
10244
  }
10245
+ getMpData() {
10246
+ return { type: this.type.name, date: this.formatDate(this.date) };
10247
+ }
10233
10248
  }
10234
10249
  __decorate([
10235
10250
  Type(() => Date)