taxtank-core 0.33.110 → 0.33.112
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.
- package/esm2022/src/lib/collections/transaction/transaction.collection.mjs +3 -3
- package/esm2022/src/lib/db/Models/depreciation/depreciation.mjs +7 -1
- package/esm2022/src/lib/db/Models/property/property.mjs +1 -1
- package/esm2022/src/lib/forms/depreciation/depreciation.form.mjs +2 -2
- package/esm2022/src/lib/models/property/property-equity-chart-data.mjs +5 -4
- package/esm2022/src/lib/models/property/property.mjs +8 -5
- package/esm2022/src/lib/services/http/holding/holding-trade-import/holding-trade-import.service.mjs +3 -1
- package/esm2022/src/lib/services/http/property/property.service.mjs +5 -5
- package/esm2022/src/lib/services/http/rest/rest.service.mjs +8 -8
- package/esm2022/src/lib/services/property/property-calculation/property-calculation.service.mjs +2 -2
- package/esm2022/src/lib/services/report/property/property-transaction-report.service.mjs +2 -1
- package/fesm2022/taxtank-core.mjs +40 -29
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/collections/transaction/transaction.collection.d.ts +1 -1
- package/src/lib/db/Models/property/property.d.ts +0 -1
- package/src/lib/forms/depreciation/depreciation.form.d.ts +1 -1
- package/src/lib/models/property/property.d.ts +2 -1
- package/src/lib/services/http/property/property.service.d.ts +1 -2
@@ -352,6 +352,11 @@ __decorate([
|
|
352
352
|
], TransactionBase.prototype, "gstClaimAmount", null);
|
353
353
|
|
354
354
|
let Depreciation$1 = class Depreciation extends TransactionBase {
|
355
|
+
constructor() {
|
356
|
+
super(...arguments);
|
357
|
+
this.financialYear = new FinancialYear().year;
|
358
|
+
this.closeBalance = 0;
|
359
|
+
}
|
355
360
|
};
|
356
361
|
|
357
362
|
let DocumentFolder$1 = class DocumentFolder extends AbstractModel {
|
@@ -5778,6 +5783,12 @@ class Property extends Property$1 {
|
|
5778
5783
|
getForecastByYear(year) {
|
5779
5784
|
return this.forecasts.find((forecast) => forecast.financialYear === year) ?? plainToClass(PropertyForecast, {});
|
5780
5785
|
}
|
5786
|
+
getValuationByYear(year) {
|
5787
|
+
return new PropertyValuationCollection(this.valuations).filter(valuation => valuation.date <= new FinancialYear(year).endDate).last;
|
5788
|
+
}
|
5789
|
+
get valuation() {
|
5790
|
+
return this.getValuationByYear(new FinancialYear().year);
|
5791
|
+
}
|
5781
5792
|
get isShared() {
|
5782
5793
|
return this.shares.length > 1;
|
5783
5794
|
}
|
@@ -5933,9 +5944,6 @@ __decorate([
|
|
5933
5944
|
__decorate([
|
5934
5945
|
Type(() => PropertyValuation)
|
5935
5946
|
], Property.prototype, "valuations", void 0);
|
5936
|
-
__decorate([
|
5937
|
-
Type(() => PropertyValuation)
|
5938
|
-
], Property.prototype, "valuation", void 0);
|
5939
5947
|
__decorate([
|
5940
5948
|
Type(() => User)
|
5941
5949
|
], Property.prototype, "user", void 0);
|
@@ -6210,13 +6218,15 @@ class PropertyEquityChartData {
|
|
6210
6218
|
if (year > this.currentYear) {
|
6211
6219
|
return bankAccounts.items.reduce((totalSum, bankAccount) => totalSum + (bankAccount.getPropertyPercentage(property.id) * (loans.getByBankAccountId(bankAccount.id)?.getLastPaymentByYear(year)?.totalOwed || 0)), 0) - offset;
|
6212
6220
|
}
|
6213
|
-
return
|
6221
|
+
return property.getForecastByYear(year).loanBalance;
|
6222
|
+
// @TODO TT-4888 no idea why it was calculated like that
|
6223
|
+
// return property.getValuationByYear(year).marketValue - offset;
|
6214
6224
|
}
|
6215
6225
|
getMarketValueForPropertyByYear(property, year) {
|
6216
6226
|
if (new FinancialYear(property.contractDate).year > year) {
|
6217
6227
|
return 0;
|
6218
6228
|
}
|
6219
|
-
return
|
6229
|
+
return property.getValuationByYear(year).marketValue;
|
6220
6230
|
}
|
6221
6231
|
/**
|
6222
6232
|
* Check if loan balance is 0 and set it as null (to not to draw point on the chart)
|
@@ -6981,8 +6991,8 @@ class TransactionCollection extends TransactionBaseCollection {
|
|
6981
6991
|
getExpenseTransactions() {
|
6982
6992
|
return new TransactionCollection(this.items.filter((transaction) => transaction.isExpense() && !transaction.isInterest()));
|
6983
6993
|
}
|
6984
|
-
get
|
6985
|
-
return this.getIncomeTransactions().
|
6994
|
+
get grossClaimIncome() {
|
6995
|
+
return this.getIncomeTransactions().grossClaimAmount;
|
6986
6996
|
}
|
6987
6997
|
get claimExpense() {
|
6988
6998
|
return this.getExpenseTransactions().claimAmount;
|
@@ -11557,7 +11567,7 @@ let RestService$1 = class RestService extends DataService {
|
|
11557
11567
|
post(model, path = this.apiUrl) {
|
11558
11568
|
this.handleAccessError('post');
|
11559
11569
|
return this.http.post(path, classToPlain(model))
|
11560
|
-
.pipe(map((response) => {
|
11570
|
+
.pipe(first$1(), map((response) => {
|
11561
11571
|
const result = this.createModelInstance(response);
|
11562
11572
|
if (!this.mercureTopic) {
|
11563
11573
|
this.handleResponse([result], 'post');
|
@@ -11571,7 +11581,7 @@ let RestService$1 = class RestService extends DataService {
|
|
11571
11581
|
postBatch(models) {
|
11572
11582
|
this.handleAccessError('postBatch');
|
11573
11583
|
return this.http.post(this.apiUrl, classToPlain(models))
|
11574
|
-
.pipe(map((response) => {
|
11584
|
+
.pipe(first$1(), map((response) => {
|
11575
11585
|
const result = response.map((item) => this.createModelInstance(item));
|
11576
11586
|
if (!this.mercureTopic) {
|
11577
11587
|
this.handleResponse(result, 'post');
|
@@ -11585,7 +11595,7 @@ let RestService$1 = class RestService extends DataService {
|
|
11585
11595
|
put(model, path = `${this.apiUrl}/${model.id}`) {
|
11586
11596
|
this.handleAccessError('put');
|
11587
11597
|
return this.http.put(path, classToPlain(model))
|
11588
|
-
.pipe(map((response) => {
|
11598
|
+
.pipe(first$1(), map((response) => {
|
11589
11599
|
const result = this.createModelInstance(response);
|
11590
11600
|
if (!this.mercureTopic) {
|
11591
11601
|
this.handleResponse([result], 'put');
|
@@ -11599,7 +11609,7 @@ let RestService$1 = class RestService extends DataService {
|
|
11599
11609
|
putBatch(models) {
|
11600
11610
|
this.handleAccessError('putBatch');
|
11601
11611
|
return this.http.put(this.apiUrl, classToPlain(models))
|
11602
|
-
.pipe(map((response) => {
|
11612
|
+
.pipe(first$1(), map((response) => {
|
11603
11613
|
const result = response.map((item) => this.createModelInstance(item));
|
11604
11614
|
if (!this.mercureTopic) {
|
11605
11615
|
this.handleResponse(result, 'put');
|
@@ -11613,7 +11623,7 @@ let RestService$1 = class RestService extends DataService {
|
|
11613
11623
|
delete(model, path = `${this.apiUrl}/${model.id}`) {
|
11614
11624
|
this.handleAccessError('delete');
|
11615
11625
|
return this.http.delete(path)
|
11616
|
-
.pipe(map(() => {
|
11626
|
+
.pipe(first$1(), map(() => {
|
11617
11627
|
if (!this.mercureTopic) {
|
11618
11628
|
this.handleResponse([model], 'delete');
|
11619
11629
|
}
|
@@ -11625,7 +11635,7 @@ let RestService$1 = class RestService extends DataService {
|
|
11625
11635
|
deleteBatch(models) {
|
11626
11636
|
this.handleAccessError('deleteBatch');
|
11627
11637
|
return this.http.post(`${this.apiUrl}/delete`, classToPlain(models))
|
11628
|
-
.pipe(map(() => {
|
11638
|
+
.pipe(first$1(), map(() => {
|
11629
11639
|
if (!this.mercureTopic) {
|
11630
11640
|
this.handleResponse(models, 'delete');
|
11631
11641
|
}
|
@@ -11637,7 +11647,7 @@ let RestService$1 = class RestService extends DataService {
|
|
11637
11647
|
deleteBatchV2(models) {
|
11638
11648
|
this.handleAccessError('deleteBatch');
|
11639
11649
|
return this.http.delete(`${this.apiUrl}`, { body: { ids: models.map(model => model.id) } })
|
11640
|
-
.pipe(map(() => {
|
11650
|
+
.pipe(first$1(), map(() => {
|
11641
11651
|
if (!this.mercureTopic) {
|
11642
11652
|
this.handleResponse(models, 'delete');
|
11643
11653
|
}
|
@@ -14474,10 +14484,9 @@ class PropertyService extends RestService$1 {
|
|
14474
14484
|
// property caches child entities to improve performance
|
14475
14485
|
this.listenCSE(PropertyValuation, (valuations) => {
|
14476
14486
|
const property = this.getCache().findBy('id', valuations[0].property.id);
|
14477
|
-
|
14478
|
-
|
14479
|
-
|
14480
|
-
}
|
14487
|
+
property.valuations.push(valuations[0]);
|
14488
|
+
property.valuations = orderBy(property.valuations, 'date');
|
14489
|
+
this.updateCache([property], 'put');
|
14481
14490
|
});
|
14482
14491
|
this.listenCSE(PropertyCategoryMovement, this.refreshCache);
|
14483
14492
|
}
|
@@ -16671,6 +16680,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
16671
16680
|
}]
|
16672
16681
|
}] });
|
16673
16682
|
|
16683
|
+
var HoldingTradeImportMessagesEnum;
|
16684
|
+
(function (HoldingTradeImportMessagesEnum) {
|
16685
|
+
HoldingTradeImportMessagesEnum["CREATED"] = "Import created successfully";
|
16686
|
+
HoldingTradeImportMessagesEnum["UPDATED"] = "Import updated successfully";
|
16687
|
+
HoldingTradeImportMessagesEnum["CONFIRM_DELETE"] = "Are you sure you want to delete this import?";
|
16688
|
+
HoldingTradeImportMessagesEnum["DELETED"] = "Import deleted successfully";
|
16689
|
+
HoldingTradeImportMessagesEnum["DELETE_ERROR"] = "Import including sold assets can not be deleted";
|
16690
|
+
})(HoldingTradeImportMessagesEnum || (HoldingTradeImportMessagesEnum = {}));
|
16691
|
+
|
16674
16692
|
class HoldingTradeImportService extends RestService$1 {
|
16675
16693
|
constructor() {
|
16676
16694
|
super(...arguments);
|
@@ -16688,6 +16706,7 @@ class HoldingTradeImportService extends RestService$1 {
|
|
16688
16706
|
return this.http.post(this.apiUrl, formData).pipe(map((response) => {
|
16689
16707
|
const holdingTradeImport = this.createModelInstance(response);
|
16690
16708
|
this.handleResponse([holdingTradeImport], 'post');
|
16709
|
+
this.toastService.success(HoldingTradeImportMessagesEnum.CREATED);
|
16691
16710
|
return holdingTradeImport;
|
16692
16711
|
}), catchError((error) => {
|
16693
16712
|
if (error.status === 400) {
|
@@ -16706,15 +16725,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
|
|
16706
16725
|
}]
|
16707
16726
|
}] });
|
16708
16727
|
|
16709
|
-
var HoldingTradeImportMessagesEnum;
|
16710
|
-
(function (HoldingTradeImportMessagesEnum) {
|
16711
|
-
HoldingTradeImportMessagesEnum["CREATED"] = "Import created successfully";
|
16712
|
-
HoldingTradeImportMessagesEnum["UPDATED"] = "Import updated successfully";
|
16713
|
-
HoldingTradeImportMessagesEnum["CONFIRM_DELETE"] = "Are you sure you want to delete this import?";
|
16714
|
-
HoldingTradeImportMessagesEnum["DELETED"] = "Import deleted successfully";
|
16715
|
-
HoldingTradeImportMessagesEnum["DELETE_ERROR"] = "Import including sold assets can not be deleted";
|
16716
|
-
})(HoldingTradeImportMessagesEnum || (HoldingTradeImportMessagesEnum = {}));
|
16717
|
-
|
16718
16728
|
var HoldingTypeExchanges = [
|
16719
16729
|
{
|
16720
16730
|
id: 2,
|
@@ -19898,7 +19908,7 @@ class PropertyCalculationService {
|
|
19898
19908
|
]).pipe(map(([properties, transactions, depreciations]) => this.taxPositionGrowth(properties, transactions, depreciations)));
|
19899
19909
|
}
|
19900
19910
|
getRentalReturn(properties, transactions) {
|
19901
|
-
return transactions.
|
19911
|
+
return transactions.grossClaimIncome / properties.marketValue;
|
19902
19912
|
}
|
19903
19913
|
getLoanAmount(properties, bankAccounts, loans) {
|
19904
19914
|
return properties.items.reduce((totalAmount, property) => totalAmount + bankAccounts.items
|
@@ -20058,6 +20068,7 @@ class PropertyTransactionReportService {
|
|
20058
20068
|
* Get collection of property transactions
|
20059
20069
|
*/
|
20060
20070
|
getTransactions() {
|
20071
|
+
// @TODO TT-4886
|
20061
20072
|
return this.transactionService.getWithoutTaxFreeProperty().pipe(map((transactions) => new TransactionCollection(transactions)
|
20062
20073
|
.getByChartAccountsCategories(CHART_ACCOUNTS_CATEGORIES.property)
|
20063
20074
|
.filter(transaction => transaction.claimPercent > 0)));
|
@@ -24891,7 +24902,7 @@ class DepreciationForm extends TransactionBaseForm {
|
|
24891
24902
|
this.setEnabledState(this.get('claimStartDate'), chartAccounts.isBuildingAtCost());
|
24892
24903
|
});
|
24893
24904
|
}
|
24894
|
-
submit(data = {}
|
24905
|
+
submit(data = {}) {
|
24895
24906
|
return super.submit(data, true);
|
24896
24907
|
}
|
24897
24908
|
}
|