taxtank-core 0.28.20 → 0.28.22
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/bundles/taxtank-core.umd.js +225 -180
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/index.js +2 -1
- package/esm2015/lib/collections/property/index.js +4 -0
- package/esm2015/lib/collections/property/property-category-movement.collection.js +17 -0
- package/esm2015/lib/collections/property/property-sale/index.js +3 -0
- package/esm2015/lib/db/Enums/property/property-category-list.enum.js +2 -1
- package/esm2015/lib/models/chart-accounts/chart-accounts.js +12 -6
- package/esm2015/lib/models/depreciation/depreciation-group-item.js +5 -1
- package/esm2015/lib/models/depreciation/depreciation-group.js +4 -1
- package/esm2015/lib/models/endpoint/endpoints.const.js +2 -1
- package/esm2015/lib/models/financial-year/financial-year.js +7 -2
- package/esm2015/lib/models/property/property-category.js +7 -3
- package/esm2015/public-api.js +1 -3
- package/fesm2015/taxtank-core.js +181 -143
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/index.d.ts +1 -0
- package/lib/collections/property/index.d.ts +3 -0
- package/lib/collections/property/property-category-movement.collection.d.ts +11 -0
- package/lib/collections/property/property-sale/index.d.ts +2 -0
- package/lib/db/Enums/property/property-category-list.enum.d.ts +1 -0
- package/lib/models/chart-accounts/chart-accounts.d.ts +6 -1
- package/lib/models/depreciation/depreciation-group-item.d.ts +2 -0
- package/lib/models/depreciation/depreciation-group.d.ts +1 -0
- package/lib/models/financial-year/financial-year.d.ts +1 -1
- package/lib/models/property/property-category.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +0 -2
|
@@ -1034,6 +1034,7 @@
|
|
|
1034
1034
|
PROPERTIES_CATEGORIES_GET: new Endpoint('GET', '\\/properties\\/categories'),
|
|
1035
1035
|
PROPERTIES_CATEGORIES_PUT: new Endpoint('PUT', '\\/properties\\/categories\\/\\d+'),
|
|
1036
1036
|
PROPERTIES_CATEGORIES_POST: new Endpoint('POST', '\\/properties\\/categories'),
|
|
1037
|
+
PROPERTIES_CATEGORIES_MOVEMENTS_GET: new Endpoint('GET', '\\/properties\\/\\d+\\/category-movements'),
|
|
1037
1038
|
PROPERTIES_CATEGORY_MOVEMENTS_POST: new Endpoint('POST', '\\/properties\\/\\d+\\/category-movements'),
|
|
1038
1039
|
PROPERTIES_CATEGORY_MOVEMENTS_PUT: new Endpoint('PUT', '\\/properties\\/\\d+\\/category-movements\\/\\d+'),
|
|
1039
1040
|
PROPERTIES_SHARES_PUT: new Endpoint('PUT', '\\/properties\\/shares\\/\\d+'),
|
|
@@ -1639,7 +1640,12 @@
|
|
|
1639
1640
|
function FinancialYear(date) {
|
|
1640
1641
|
this.yearStartDate = '-07-01';
|
|
1641
1642
|
this.yearEndDate = '-06-30';
|
|
1642
|
-
|
|
1643
|
+
if (date) {
|
|
1644
|
+
this.year = date instanceof Date ? FinancialYear.toFinYear(date) : date;
|
|
1645
|
+
}
|
|
1646
|
+
else {
|
|
1647
|
+
this.year = +localStorage.getItem('financialYear') || FinancialYear.toFinYear(new Date());
|
|
1648
|
+
}
|
|
1643
1649
|
this.setStartDate(this.year);
|
|
1644
1650
|
this.setEndDate(this.year);
|
|
1645
1651
|
}
|
|
@@ -3076,6 +3082,9 @@
|
|
|
3076
3082
|
ChartAccounts.prototype.isIncome = function () {
|
|
3077
3083
|
return CHART_ACCOUNTS_CATEGORIES.income.includes(this.category);
|
|
3078
3084
|
};
|
|
3085
|
+
ChartAccounts.prototype.isExpense = function () {
|
|
3086
|
+
return CHART_ACCOUNTS_CATEGORIES.expense.includes(this.category);
|
|
3087
|
+
};
|
|
3079
3088
|
ChartAccounts.prototype.isProperty = function () {
|
|
3080
3089
|
return CHART_ACCOUNTS_CATEGORIES.property.includes(this.category);
|
|
3081
3090
|
};
|
|
@@ -3091,7 +3100,7 @@
|
|
|
3091
3100
|
* Check if chart accounts is property expense
|
|
3092
3101
|
*/
|
|
3093
3102
|
ChartAccounts.prototype.isPropertyExpense = function () {
|
|
3094
|
-
return this.
|
|
3103
|
+
return this.isProperty() && this.isExpense();
|
|
3095
3104
|
};
|
|
3096
3105
|
/**
|
|
3097
3106
|
* Check if chart accounts is property income
|
|
@@ -3105,10 +3114,6 @@
|
|
|
3105
3114
|
ChartAccounts.prototype.isPersonalExpense = function () {
|
|
3106
3115
|
return this.category === exports.ChartAccountsCategoryEnum.PERSONAL_EXPENSE;
|
|
3107
3116
|
};
|
|
3108
|
-
ChartAccounts.prototype.isPropertyDepreciation = function () {
|
|
3109
|
-
return [exports.ChartAccountsCategoryEnum.PROPERTY_DEPRECIATION, exports.ChartAccountsCategoryEnum.PROPERTY_CAPITAL_WORKS]
|
|
3110
|
-
.includes(this.category);
|
|
3111
|
-
};
|
|
3112
3117
|
/**
|
|
3113
3118
|
* Check if chart accounts category is depreciation
|
|
3114
3119
|
*/
|
|
@@ -3133,6 +3138,13 @@
|
|
|
3133
3138
|
ChartAccounts.prototype.getValueByYear = function (year) {
|
|
3134
3139
|
return this.values.find(function (value) { return value.financialYear === year; });
|
|
3135
3140
|
};
|
|
3141
|
+
/**
|
|
3142
|
+
* no way to check how much used for work/sole, so we let user adjust it
|
|
3143
|
+
* except vehicle expense, which is equal to vehicleClaim.workUsage and personal, which is equal to 0
|
|
3144
|
+
*/
|
|
3145
|
+
ChartAccounts.prototype.isClaimPercentEditable = function () {
|
|
3146
|
+
return (this.isWorkExpense() || this.isSoleExpense()) && (!this.isVehicleExpense() && !this.isPersonalExpense());
|
|
3147
|
+
};
|
|
3136
3148
|
return ChartAccounts;
|
|
3137
3149
|
}(ChartAccounts$1));
|
|
3138
3150
|
__decorate([
|
|
@@ -5006,6 +5018,13 @@
|
|
|
5006
5018
|
return PropertyCategory;
|
|
5007
5019
|
}(AbstractModel));
|
|
5008
5020
|
|
|
5021
|
+
exports.PropertyCategoryListEnum = void 0;
|
|
5022
|
+
(function (PropertyCategoryListEnum) {
|
|
5023
|
+
PropertyCategoryListEnum[PropertyCategoryListEnum["OWNER_OCCUPIED"] = 3] = "OWNER_OCCUPIED";
|
|
5024
|
+
PropertyCategoryListEnum[PropertyCategoryListEnum["SHARED"] = 4] = "SHARED";
|
|
5025
|
+
PropertyCategoryListEnum[PropertyCategoryListEnum["VACANT_LAND"] = 5] = "VACANT_LAND";
|
|
5026
|
+
})(exports.PropertyCategoryListEnum || (exports.PropertyCategoryListEnum = {}));
|
|
5027
|
+
|
|
5009
5028
|
var PropertyCategory = /** @class */ (function (_super) {
|
|
5010
5029
|
__extends(PropertyCategory, _super);
|
|
5011
5030
|
function PropertyCategory() {
|
|
@@ -5013,10 +5032,13 @@
|
|
|
5013
5032
|
}
|
|
5014
5033
|
// @Todo check if category is Owner Occupied. If will be needed to check more categories - move the checking to the backend
|
|
5015
5034
|
PropertyCategory.prototype.isOwnerOccupied = function () {
|
|
5016
|
-
return this.
|
|
5035
|
+
return this.id === exports.PropertyCategoryListEnum.OWNER_OCCUPIED;
|
|
5017
5036
|
};
|
|
5018
5037
|
PropertyCategory.prototype.isVacantLand = function () {
|
|
5019
|
-
return this.
|
|
5038
|
+
return this.id === exports.PropertyCategoryListEnum.VACANT_LAND;
|
|
5039
|
+
};
|
|
5040
|
+
PropertyCategory.prototype.isShared = function () {
|
|
5041
|
+
return this.id === exports.PropertyCategoryListEnum.SHARED;
|
|
5020
5042
|
};
|
|
5021
5043
|
return PropertyCategory;
|
|
5022
5044
|
}(PropertyCategory$1));
|
|
@@ -5218,12 +5240,6 @@
|
|
|
5218
5240
|
TaxExemptionEnum[TaxExemptionEnum["OTHER"] = 7] = "OTHER";
|
|
5219
5241
|
})(exports.TaxExemptionEnum || (exports.TaxExemptionEnum = {}));
|
|
5220
5242
|
|
|
5221
|
-
exports.PropertyCategoryListEnum = void 0;
|
|
5222
|
-
(function (PropertyCategoryListEnum) {
|
|
5223
|
-
PropertyCategoryListEnum[PropertyCategoryListEnum["OWNER_OCCUPIED"] = 3] = "OWNER_OCCUPIED";
|
|
5224
|
-
PropertyCategoryListEnum[PropertyCategoryListEnum["VACANT_LAND"] = 5] = "VACANT_LAND";
|
|
5225
|
-
})(exports.PropertyCategoryListEnum || (exports.PropertyCategoryListEnum = {}));
|
|
5226
|
-
|
|
5227
5243
|
exports.TaxExemptionMetadataEnum = void 0;
|
|
5228
5244
|
(function (TaxExemptionMetadataEnum) {
|
|
5229
5245
|
// principle place of residence
|
|
@@ -6915,6 +6931,192 @@
|
|
|
6915
6931
|
return SoleInvoiceCollection;
|
|
6916
6932
|
}(Collection));
|
|
6917
6933
|
|
|
6934
|
+
var PropertySaleCollection = /** @class */ (function (_super) {
|
|
6935
|
+
__extends(PropertySaleCollection, _super);
|
|
6936
|
+
function PropertySaleCollection() {
|
|
6937
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6938
|
+
}
|
|
6939
|
+
Object.defineProperty(PropertySaleCollection.prototype, "grossCGT", {
|
|
6940
|
+
get: function () {
|
|
6941
|
+
return this.create(this.items.filter(function (propertySale) { return propertySale.grossCGT > 0; })).sumBy('grossCGT');
|
|
6942
|
+
},
|
|
6943
|
+
enumerable: false,
|
|
6944
|
+
configurable: true
|
|
6945
|
+
});
|
|
6946
|
+
/**
|
|
6947
|
+
* Property sales are CGT applicable unless it has "Principle place of residence" exemption type
|
|
6948
|
+
*/
|
|
6949
|
+
PropertySaleCollection.prototype.getCGTApplicable = function () {
|
|
6950
|
+
return this.create(this.items.filter(function (propertySale) { return propertySale.isCGTApplicable(); }));
|
|
6951
|
+
};
|
|
6952
|
+
PropertySaleCollection.prototype.getByPropertyShareIds = function (ids) {
|
|
6953
|
+
return this.filterBy('share.id', ids);
|
|
6954
|
+
};
|
|
6955
|
+
return PropertySaleCollection;
|
|
6956
|
+
}(Collection));
|
|
6957
|
+
|
|
6958
|
+
var PropertyCollection = /** @class */ (function (_super) {
|
|
6959
|
+
__extends(PropertyCollection, _super);
|
|
6960
|
+
function PropertyCollection() {
|
|
6961
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
6962
|
+
}
|
|
6963
|
+
/**
|
|
6964
|
+
* Get new property collection filtered by category id
|
|
6965
|
+
* @param id id of category for filter
|
|
6966
|
+
*/
|
|
6967
|
+
PropertyCollection.prototype.getByCategoryId = function (id) {
|
|
6968
|
+
return new PropertyCollection(this.items.filter(function (property) { return property.category.id === id; }));
|
|
6969
|
+
};
|
|
6970
|
+
/**
|
|
6971
|
+
* Get new property collection filtered by active status
|
|
6972
|
+
*/
|
|
6973
|
+
PropertyCollection.prototype.getActiveProperties = function () {
|
|
6974
|
+
return new PropertyCollection(this.items.filter(function (property) { return property.isActive; }));
|
|
6975
|
+
};
|
|
6976
|
+
PropertyCollection.prototype.getCreatedProperties = function () {
|
|
6977
|
+
return new PropertyCollection(this.items.filter(function (property) { return property.isOwn(); }));
|
|
6978
|
+
};
|
|
6979
|
+
/**
|
|
6980
|
+
* Get new property collection filtered by shared
|
|
6981
|
+
*/
|
|
6982
|
+
PropertyCollection.prototype.getSharedProperties = function () {
|
|
6983
|
+
return new PropertyCollection(this.items.filter(function (property) { return !property.isOwn(); }));
|
|
6984
|
+
};
|
|
6985
|
+
/**
|
|
6986
|
+
* Properties that are taxed and will be included in reports (Tax summary, My tax report, e.t.c.)
|
|
6987
|
+
*/
|
|
6988
|
+
PropertyCollection.prototype.getTaxInclusive = function () {
|
|
6989
|
+
return this.create(this.items.filter(function (property) { return property.category.isTaxInclusive; }));
|
|
6990
|
+
};
|
|
6991
|
+
PropertyCollection.prototype.getUnsold = function () {
|
|
6992
|
+
return this.create(this.items.filter(function (property) { return !property.isSold(); }));
|
|
6993
|
+
};
|
|
6994
|
+
Object.defineProperty(PropertyCollection.prototype, "purchasePrice", {
|
|
6995
|
+
/**
|
|
6996
|
+
* Get total purchase price for all properties in the collection
|
|
6997
|
+
*/
|
|
6998
|
+
get: function () {
|
|
6999
|
+
return this.sumBy('purchasePrice');
|
|
7000
|
+
},
|
|
7001
|
+
enumerable: false,
|
|
7002
|
+
configurable: true
|
|
7003
|
+
});
|
|
7004
|
+
Object.defineProperty(PropertyCollection.prototype, "growthPercent", {
|
|
7005
|
+
get: function () {
|
|
7006
|
+
return this.sumBy('growthPercent');
|
|
7007
|
+
},
|
|
7008
|
+
enumerable: false,
|
|
7009
|
+
configurable: true
|
|
7010
|
+
});
|
|
7011
|
+
Object.defineProperty(PropertyCollection.prototype, "marketValue", {
|
|
7012
|
+
get: function () {
|
|
7013
|
+
return this.sumBy('marketValue');
|
|
7014
|
+
},
|
|
7015
|
+
enumerable: false,
|
|
7016
|
+
configurable: true
|
|
7017
|
+
});
|
|
7018
|
+
Object.defineProperty(PropertyCollection.prototype, "firstForecastYear", {
|
|
7019
|
+
get: function () {
|
|
7020
|
+
return this.items.reduce(function (min, property) {
|
|
7021
|
+
var current = property.firstForecastYear;
|
|
7022
|
+
return min > current ? current : min;
|
|
7023
|
+
}, new FinancialYear().year);
|
|
7024
|
+
},
|
|
7025
|
+
enumerable: false,
|
|
7026
|
+
configurable: true
|
|
7027
|
+
});
|
|
7028
|
+
Object.defineProperty(PropertyCollection.prototype, "marketValueGrowth", {
|
|
7029
|
+
get: function () {
|
|
7030
|
+
return (this.marketValue - this.purchasePrice) / this.purchasePrice;
|
|
7031
|
+
},
|
|
7032
|
+
enumerable: false,
|
|
7033
|
+
configurable: true
|
|
7034
|
+
});
|
|
7035
|
+
/**
|
|
7036
|
+
* list of properties
|
|
7037
|
+
*/
|
|
7038
|
+
PropertyCollection.prototype.getCGTApplicable = function () {
|
|
7039
|
+
return this.create(this.items.filter(function (property) { return property.isCGTApplicable(); }));
|
|
7040
|
+
};
|
|
7041
|
+
PropertyCollection.prototype.getOwnerOccupiedProperties = function () {
|
|
7042
|
+
return new PropertyCollection(this.items.filter(function (property) { return property.category.isOwnerOccupied(); }));
|
|
7043
|
+
};
|
|
7044
|
+
Object.defineProperty(PropertyCollection.prototype, "earliestContractDate", {
|
|
7045
|
+
get: function () {
|
|
7046
|
+
return this.items.reduce(function (min, property) {
|
|
7047
|
+
return min < property.contractDate ? min : property.contractDate;
|
|
7048
|
+
}, new FinancialYear(new Date()).startDate);
|
|
7049
|
+
},
|
|
7050
|
+
enumerable: false,
|
|
7051
|
+
configurable: true
|
|
7052
|
+
});
|
|
7053
|
+
/**
|
|
7054
|
+
* Get list of unique property categories from collection
|
|
7055
|
+
*/
|
|
7056
|
+
PropertyCollection.prototype.getCategories = function () {
|
|
7057
|
+
return uniqBy__default["default"](this.items.map(function (property) { return property.category; }), 'id');
|
|
7058
|
+
};
|
|
7059
|
+
/**
|
|
7060
|
+
* Get property with the highest growth percent
|
|
7061
|
+
*/
|
|
7062
|
+
PropertyCollection.prototype.getBestPerformanceGrowthProperty = function () {
|
|
7063
|
+
return this.items.reduce(function (max, current) {
|
|
7064
|
+
return max.growthPercent < current.growthPercent ? current : max;
|
|
7065
|
+
}, this.first);
|
|
7066
|
+
};
|
|
7067
|
+
/**
|
|
7068
|
+
* Get property with the lowest tax position
|
|
7069
|
+
*/
|
|
7070
|
+
PropertyCollection.prototype.getBestPerformanceTaxProperty = function (transactions, depreciations) {
|
|
7071
|
+
var transactionsByProperty = transactions.groupBy('property.id');
|
|
7072
|
+
var depreciationsByProperty = depreciations.groupBy('property.id');
|
|
7073
|
+
return this.items.reduce(function (min, current) {
|
|
7074
|
+
var minTaxPosition = min.getTaxPosition(transactionsByProperty.get(min.id), depreciationsByProperty.get(min.id));
|
|
7075
|
+
var currentTaxPosition = current.getTaxPosition(transactionsByProperty.get(current.id), depreciationsByProperty.get(current.id));
|
|
7076
|
+
return minTaxPosition > currentTaxPosition ? current : min;
|
|
7077
|
+
}, this.first);
|
|
7078
|
+
};
|
|
7079
|
+
/**
|
|
7080
|
+
* Show best performance properties first
|
|
7081
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677997/Property+Tank+Dashboard
|
|
7082
|
+
*/
|
|
7083
|
+
PropertyCollection.prototype.sortByBestPerformance = function (transactions, depreciations) {
|
|
7084
|
+
var activeProperties = this.getActiveProperties();
|
|
7085
|
+
// nothing to sort when no active properties
|
|
7086
|
+
if (!activeProperties.length) {
|
|
7087
|
+
return this;
|
|
7088
|
+
}
|
|
7089
|
+
var bestProperties = uniqBy__default["default"](this.create([
|
|
7090
|
+
activeProperties.getBestPerformanceGrowthProperty(),
|
|
7091
|
+
activeProperties.getBestPerformanceTaxProperty(transactions, depreciations)
|
|
7092
|
+
]).toArray(), 'id');
|
|
7093
|
+
var newItems = this.remove(bestProperties).toArray();
|
|
7094
|
+
newItems.unshift.apply(newItems, __spreadArray([], __read(bestProperties)));
|
|
7095
|
+
return this.create(newItems);
|
|
7096
|
+
};
|
|
7097
|
+
return PropertyCollection;
|
|
7098
|
+
}(Collection));
|
|
7099
|
+
|
|
7100
|
+
var PropertyCategoryMovementCollection = /** @class */ (function (_super) {
|
|
7101
|
+
__extends(PropertyCategoryMovementCollection, _super);
|
|
7102
|
+
function PropertyCategoryMovementCollection() {
|
|
7103
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
7104
|
+
}
|
|
7105
|
+
/**
|
|
7106
|
+
* @TODO TT-2355 Alex refactor propertyForecast, use separated api (then I can remove property from param)
|
|
7107
|
+
*/
|
|
7108
|
+
PropertyCategoryMovementCollection.prototype.getByForecast = function (property, forecast) {
|
|
7109
|
+
var financialYear = new FinancialYear(forecast.financialYear);
|
|
7110
|
+
return this.filterBy('property.id', property.id).filter(function (movement) {
|
|
7111
|
+
return movement.fromDate <= financialYear.endDate && movement.toDate >= financialYear.startDate;
|
|
7112
|
+
});
|
|
7113
|
+
};
|
|
7114
|
+
PropertyCategoryMovementCollection.prototype.hasCategory = function (categoryId) {
|
|
7115
|
+
return !!this.findBy('propertyCategory.id', categoryId);
|
|
7116
|
+
};
|
|
7117
|
+
return PropertyCategoryMovementCollection;
|
|
7118
|
+
}(Collection));
|
|
7119
|
+
|
|
6918
7120
|
// @TODO Alex move here all collections
|
|
6919
7121
|
|
|
6920
7122
|
var AccountSetupItemCollection = /** @class */ (function (_super) {
|
|
@@ -7862,172 +8064,6 @@
|
|
|
7862
8064
|
return MessageDocumentCollection;
|
|
7863
8065
|
}(Collection));
|
|
7864
8066
|
|
|
7865
|
-
var PropertyCollection = /** @class */ (function (_super) {
|
|
7866
|
-
__extends(PropertyCollection, _super);
|
|
7867
|
-
function PropertyCollection() {
|
|
7868
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
7869
|
-
}
|
|
7870
|
-
/**
|
|
7871
|
-
* Get new property collection filtered by category id
|
|
7872
|
-
* @param id id of category for filter
|
|
7873
|
-
*/
|
|
7874
|
-
PropertyCollection.prototype.getByCategoryId = function (id) {
|
|
7875
|
-
return new PropertyCollection(this.items.filter(function (property) { return property.category.id === id; }));
|
|
7876
|
-
};
|
|
7877
|
-
/**
|
|
7878
|
-
* Get new property collection filtered by active status
|
|
7879
|
-
*/
|
|
7880
|
-
PropertyCollection.prototype.getActiveProperties = function () {
|
|
7881
|
-
return new PropertyCollection(this.items.filter(function (property) { return property.isActive; }));
|
|
7882
|
-
};
|
|
7883
|
-
PropertyCollection.prototype.getCreatedProperties = function () {
|
|
7884
|
-
return new PropertyCollection(this.items.filter(function (property) { return property.isOwn(); }));
|
|
7885
|
-
};
|
|
7886
|
-
/**
|
|
7887
|
-
* Get new property collection filtered by shared
|
|
7888
|
-
*/
|
|
7889
|
-
PropertyCollection.prototype.getSharedProperties = function () {
|
|
7890
|
-
return new PropertyCollection(this.items.filter(function (property) { return !property.isOwn(); }));
|
|
7891
|
-
};
|
|
7892
|
-
/**
|
|
7893
|
-
* Properties that are taxed and will be included in reports (Tax summary, My tax report, e.t.c.)
|
|
7894
|
-
*/
|
|
7895
|
-
PropertyCollection.prototype.getTaxInclusive = function () {
|
|
7896
|
-
return this.create(this.items.filter(function (property) { return property.category.isTaxInclusive; }));
|
|
7897
|
-
};
|
|
7898
|
-
PropertyCollection.prototype.getUnsold = function () {
|
|
7899
|
-
return this.create(this.items.filter(function (property) { return !property.isSold(); }));
|
|
7900
|
-
};
|
|
7901
|
-
Object.defineProperty(PropertyCollection.prototype, "purchasePrice", {
|
|
7902
|
-
/**
|
|
7903
|
-
* Get total purchase price for all properties in the collection
|
|
7904
|
-
*/
|
|
7905
|
-
get: function () {
|
|
7906
|
-
return this.sumBy('purchasePrice');
|
|
7907
|
-
},
|
|
7908
|
-
enumerable: false,
|
|
7909
|
-
configurable: true
|
|
7910
|
-
});
|
|
7911
|
-
Object.defineProperty(PropertyCollection.prototype, "growthPercent", {
|
|
7912
|
-
get: function () {
|
|
7913
|
-
return this.sumBy('growthPercent');
|
|
7914
|
-
},
|
|
7915
|
-
enumerable: false,
|
|
7916
|
-
configurable: true
|
|
7917
|
-
});
|
|
7918
|
-
Object.defineProperty(PropertyCollection.prototype, "marketValue", {
|
|
7919
|
-
get: function () {
|
|
7920
|
-
return this.sumBy('marketValue');
|
|
7921
|
-
},
|
|
7922
|
-
enumerable: false,
|
|
7923
|
-
configurable: true
|
|
7924
|
-
});
|
|
7925
|
-
Object.defineProperty(PropertyCollection.prototype, "firstForecastYear", {
|
|
7926
|
-
get: function () {
|
|
7927
|
-
return this.items.reduce(function (min, property) {
|
|
7928
|
-
var current = property.firstForecastYear;
|
|
7929
|
-
return min > current ? current : min;
|
|
7930
|
-
}, new FinancialYear().year);
|
|
7931
|
-
},
|
|
7932
|
-
enumerable: false,
|
|
7933
|
-
configurable: true
|
|
7934
|
-
});
|
|
7935
|
-
Object.defineProperty(PropertyCollection.prototype, "marketValueGrowth", {
|
|
7936
|
-
get: function () {
|
|
7937
|
-
return (this.marketValue - this.purchasePrice) / this.purchasePrice;
|
|
7938
|
-
},
|
|
7939
|
-
enumerable: false,
|
|
7940
|
-
configurable: true
|
|
7941
|
-
});
|
|
7942
|
-
/**
|
|
7943
|
-
* list of properties
|
|
7944
|
-
*/
|
|
7945
|
-
PropertyCollection.prototype.getCGTApplicable = function () {
|
|
7946
|
-
return this.create(this.items.filter(function (property) { return property.isCGTApplicable(); }));
|
|
7947
|
-
};
|
|
7948
|
-
PropertyCollection.prototype.getOwnerOccupiedProperties = function () {
|
|
7949
|
-
return new PropertyCollection(this.items.filter(function (property) { return property.category.isOwnerOccupied(); }));
|
|
7950
|
-
};
|
|
7951
|
-
Object.defineProperty(PropertyCollection.prototype, "earliestContractDate", {
|
|
7952
|
-
get: function () {
|
|
7953
|
-
return this.items.reduce(function (min, property) {
|
|
7954
|
-
return min < property.contractDate ? min : property.contractDate;
|
|
7955
|
-
}, new FinancialYear(new Date()).startDate);
|
|
7956
|
-
},
|
|
7957
|
-
enumerable: false,
|
|
7958
|
-
configurable: true
|
|
7959
|
-
});
|
|
7960
|
-
/**
|
|
7961
|
-
* Get list of unique property categories from collection
|
|
7962
|
-
*/
|
|
7963
|
-
PropertyCollection.prototype.getCategories = function () {
|
|
7964
|
-
return uniqBy__default["default"](this.items.map(function (property) { return property.category; }), 'id');
|
|
7965
|
-
};
|
|
7966
|
-
/**
|
|
7967
|
-
* Get property with the highest growth percent
|
|
7968
|
-
*/
|
|
7969
|
-
PropertyCollection.prototype.getBestPerformanceGrowthProperty = function () {
|
|
7970
|
-
return this.items.reduce(function (max, current) {
|
|
7971
|
-
return max.growthPercent < current.growthPercent ? current : max;
|
|
7972
|
-
}, this.first);
|
|
7973
|
-
};
|
|
7974
|
-
/**
|
|
7975
|
-
* Get property with the lowest tax position
|
|
7976
|
-
*/
|
|
7977
|
-
PropertyCollection.prototype.getBestPerformanceTaxProperty = function (transactions, depreciations) {
|
|
7978
|
-
var transactionsByProperty = transactions.groupBy('property.id');
|
|
7979
|
-
var depreciationsByProperty = depreciations.groupBy('property.id');
|
|
7980
|
-
return this.items.reduce(function (min, current) {
|
|
7981
|
-
var minTaxPosition = min.getTaxPosition(transactionsByProperty.get(min.id), depreciationsByProperty.get(min.id));
|
|
7982
|
-
var currentTaxPosition = current.getTaxPosition(transactionsByProperty.get(current.id), depreciationsByProperty.get(current.id));
|
|
7983
|
-
return minTaxPosition > currentTaxPosition ? current : min;
|
|
7984
|
-
}, this.first);
|
|
7985
|
-
};
|
|
7986
|
-
/**
|
|
7987
|
-
* Show best performance properties first
|
|
7988
|
-
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677997/Property+Tank+Dashboard
|
|
7989
|
-
*/
|
|
7990
|
-
PropertyCollection.prototype.sortByBestPerformance = function (transactions, depreciations) {
|
|
7991
|
-
var activeProperties = this.getActiveProperties();
|
|
7992
|
-
// nothing to sort when no active properties
|
|
7993
|
-
if (!activeProperties.length) {
|
|
7994
|
-
return this;
|
|
7995
|
-
}
|
|
7996
|
-
var bestProperties = uniqBy__default["default"](this.create([
|
|
7997
|
-
activeProperties.getBestPerformanceGrowthProperty(),
|
|
7998
|
-
activeProperties.getBestPerformanceTaxProperty(transactions, depreciations)
|
|
7999
|
-
]).toArray(), 'id');
|
|
8000
|
-
var newItems = this.remove(bestProperties).toArray();
|
|
8001
|
-
newItems.unshift.apply(newItems, __spreadArray([], __read(bestProperties)));
|
|
8002
|
-
return this.create(newItems);
|
|
8003
|
-
};
|
|
8004
|
-
return PropertyCollection;
|
|
8005
|
-
}(Collection));
|
|
8006
|
-
|
|
8007
|
-
var PropertySaleCollection = /** @class */ (function (_super) {
|
|
8008
|
-
__extends(PropertySaleCollection, _super);
|
|
8009
|
-
function PropertySaleCollection() {
|
|
8010
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
8011
|
-
}
|
|
8012
|
-
Object.defineProperty(PropertySaleCollection.prototype, "grossCGT", {
|
|
8013
|
-
get: function () {
|
|
8014
|
-
return this.create(this.items.filter(function (propertySale) { return propertySale.grossCGT > 0; })).sumBy('grossCGT');
|
|
8015
|
-
},
|
|
8016
|
-
enumerable: false,
|
|
8017
|
-
configurable: true
|
|
8018
|
-
});
|
|
8019
|
-
/**
|
|
8020
|
-
* Property sales are CGT applicable unless it has "Principle place of residence" exemption type
|
|
8021
|
-
*/
|
|
8022
|
-
PropertySaleCollection.prototype.getCGTApplicable = function () {
|
|
8023
|
-
return this.create(this.items.filter(function (propertySale) { return propertySale.isCGTApplicable(); }));
|
|
8024
|
-
};
|
|
8025
|
-
PropertySaleCollection.prototype.getByPropertyShareIds = function (ids) {
|
|
8026
|
-
return this.filterBy('share.id', ids);
|
|
8027
|
-
};
|
|
8028
|
-
return PropertySaleCollection;
|
|
8029
|
-
}(Collection));
|
|
8030
|
-
|
|
8031
8067
|
/**
|
|
8032
8068
|
* Enum with symbols based on depreciation LVP asset type
|
|
8033
8069
|
*/
|
|
@@ -9944,10 +9980,14 @@
|
|
|
9944
9980
|
DepreciationGroup.prototype.getClaimAmount = function () {
|
|
9945
9981
|
return this.children.reduce(function (sum, child) { return sum + child.getClaimAmount(); }, 0);
|
|
9946
9982
|
};
|
|
9983
|
+
DepreciationGroup.prototype.getAmount = function () {
|
|
9984
|
+
return this.children.reduce(function (sum, child) { return sum + child.getAmount(); }, 0);
|
|
9985
|
+
};
|
|
9947
9986
|
return DepreciationGroup;
|
|
9948
9987
|
}());
|
|
9949
9988
|
|
|
9950
9989
|
/**
|
|
9990
|
+
* @TODO Alex useless class, use parent instead
|
|
9951
9991
|
* Depreciation Tree node with depreciation details
|
|
9952
9992
|
*/
|
|
9953
9993
|
var DepreciationGroupItem = /** @class */ (function (_super) {
|
|
@@ -9960,6 +10000,9 @@
|
|
|
9960
10000
|
DepreciationGroupItem.prototype.getClaimAmount = function () {
|
|
9961
10001
|
return this.depreciation.currentYearForecast.claimAmount;
|
|
9962
10002
|
};
|
|
10003
|
+
DepreciationGroupItem.prototype.getAmount = function () {
|
|
10004
|
+
return this.depreciation.currentYearForecast.amount;
|
|
10005
|
+
};
|
|
9963
10006
|
return DepreciationGroupItem;
|
|
9964
10007
|
}(DepreciationGroup));
|
|
9965
10008
|
|
|
@@ -19087,6 +19130,7 @@
|
|
|
19087
19130
|
exports.PropertyCalculationService = PropertyCalculationService;
|
|
19088
19131
|
exports.PropertyCategory = PropertyCategory;
|
|
19089
19132
|
exports.PropertyCategoryMovement = PropertyCategoryMovement;
|
|
19133
|
+
exports.PropertyCategoryMovementCollection = PropertyCategoryMovementCollection;
|
|
19090
19134
|
exports.PropertyCategoryMovementService = PropertyCategoryMovementService;
|
|
19091
19135
|
exports.PropertyCategoryService = PropertyCategoryService;
|
|
19092
19136
|
exports.PropertyCollection = PropertyCollection;
|
|
@@ -19109,6 +19153,7 @@
|
|
|
19109
19153
|
exports.PropertySaleExemptionsForm = PropertySaleExemptionsForm;
|
|
19110
19154
|
exports.PropertySaleService = PropertySaleService;
|
|
19111
19155
|
exports.PropertySaleTaxExemptionMetadata = PropertySaleTaxExemptionMetadata;
|
|
19156
|
+
exports.PropertySaleTaxExemptionMetadataCollection = PropertySaleTaxExemptionMetadataCollection;
|
|
19112
19157
|
exports.PropertyService = PropertyService;
|
|
19113
19158
|
exports.PropertyShare = PropertyShare;
|
|
19114
19159
|
exports.PropertyShareService = PropertyShareService;
|