taxtank-core 0.28.7 → 0.28.8-2
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 +69 -27
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/transaction/transaction.collection.js +26 -1
- package/esm2015/lib/models/depreciation/depreciation.js +2 -2
- package/esm2015/lib/models/report/property/property-report-item-transaction.js +2 -2
- package/esm2015/lib/models/service-subscription/service-subscription.js +20 -1
- package/esm2015/lib/services/http/sole/sole-invoice/sole-invoice.service.js +1 -1
- package/fesm2015/taxtank-core.js +62 -21
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/transaction/transaction.collection.d.ts +7 -0
- package/lib/models/service-subscription/service-subscription.d.ts +9 -0
- package/package.json +1 -1
|
@@ -2623,6 +2623,25 @@
|
|
|
2623
2623
|
ServiceSubscription.prototype.isPastDue = function () {
|
|
2624
2624
|
return this.status === exports.ServiceSubscriptionStatusEnum.PAST_DUE;
|
|
2625
2625
|
};
|
|
2626
|
+
/**
|
|
2627
|
+
* Check if current subscription has provided subscription item
|
|
2628
|
+
*/
|
|
2629
|
+
ServiceSubscription.prototype.hasItem = function (itemToCheck) {
|
|
2630
|
+
return !!this.items.find(function (item) { return item.price.id === itemToCheck.price.id; });
|
|
2631
|
+
};
|
|
2632
|
+
/**
|
|
2633
|
+
* Recommended number of properties to buy,
|
|
2634
|
+
* based on the property service product and the number of properties the user has
|
|
2635
|
+
*/
|
|
2636
|
+
ServiceSubscription.prototype.getRecommendedPropertiesQty = function (propertyItem, propertiesQty) {
|
|
2637
|
+
var max = propertyItem.price.product.maxQty;
|
|
2638
|
+
var min = propertyItem.price.product.minQty;
|
|
2639
|
+
// if user has property subscription and number of properties doesn't exceed the maximum in the service product - return one more
|
|
2640
|
+
if (this.hasItem(propertyItem)) {
|
|
2641
|
+
propertiesQty = propertiesQty < max ? propertiesQty + 1 : max;
|
|
2642
|
+
}
|
|
2643
|
+
return Math.max(min, propertiesQty);
|
|
2644
|
+
};
|
|
2626
2645
|
return ServiceSubscription;
|
|
2627
2646
|
}(ServiceSubscription$1));
|
|
2628
2647
|
__decorate([
|
|
@@ -4543,7 +4562,7 @@
|
|
|
4543
4562
|
*/
|
|
4544
4563
|
Depreciation.prototype.toTransaction = function (params) {
|
|
4545
4564
|
if (params === void 0) { params = {}; }
|
|
4546
|
-
return classTransformer.plainToClass(Transaction, Object.assign(params, this, { amount: this.
|
|
4565
|
+
return classTransformer.plainToClass(Transaction, Object.assign(params, this, { amount: -this.claimAmount, claimAmount: -this.amount * (this.claimPercent / 100) }));
|
|
4547
4566
|
};
|
|
4548
4567
|
Object.defineProperty(Depreciation.prototype, "claimAmount", {
|
|
4549
4568
|
/**
|
|
@@ -7014,6 +7033,31 @@
|
|
|
7014
7033
|
return ClientPortfolioReportCollection;
|
|
7015
7034
|
}(Collection));
|
|
7016
7035
|
|
|
7036
|
+
/**
|
|
7037
|
+
* Chart serie class: chart data item
|
|
7038
|
+
* @TODO consider rename to ChartSerieData
|
|
7039
|
+
*/
|
|
7040
|
+
var ChartSerie = /** @class */ (function () {
|
|
7041
|
+
function ChartSerie() {
|
|
7042
|
+
}
|
|
7043
|
+
return ChartSerie;
|
|
7044
|
+
}());
|
|
7045
|
+
|
|
7046
|
+
/**
|
|
7047
|
+
* Chart data class
|
|
7048
|
+
* @TODO consider rename to ChartSerie
|
|
7049
|
+
*/
|
|
7050
|
+
var ChartData = /** @class */ (function () {
|
|
7051
|
+
function ChartData() {
|
|
7052
|
+
}
|
|
7053
|
+
return ChartData;
|
|
7054
|
+
}());
|
|
7055
|
+
__decorate([
|
|
7056
|
+
classTransformer.Type(function () { return ChartSerie; })
|
|
7057
|
+
], ChartData.prototype, "data", void 0);
|
|
7058
|
+
|
|
7059
|
+
var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan'];
|
|
7060
|
+
|
|
7017
7061
|
/**
|
|
7018
7062
|
* Collection of transactions
|
|
7019
7063
|
*/
|
|
@@ -7230,6 +7274,29 @@
|
|
|
7230
7274
|
.getVehicleTransactions()
|
|
7231
7275
|
.removeBy('chartAccounts.id', [exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK, exports.ChartAccountsListEnum.KLMS_TRAVELLED]);
|
|
7232
7276
|
};
|
|
7277
|
+
/**
|
|
7278
|
+
* Build chart data with transactions cash position.
|
|
7279
|
+
* Cash position = Income - Expenses (include depreciations)
|
|
7280
|
+
* Chart data for each month from fin year start till current month
|
|
7281
|
+
*/
|
|
7282
|
+
TransactionCollection.prototype.getCashPositionChartData = function () {
|
|
7283
|
+
var _this = this;
|
|
7284
|
+
var chartData = [
|
|
7285
|
+
classTransformer.plainToClass(ChartData, { name: 'Income', data: [] }),
|
|
7286
|
+
classTransformer.plainToClass(ChartData, { name: 'Expense', data: [] })
|
|
7287
|
+
];
|
|
7288
|
+
new FinancialYear().getPastMonths().forEach(function (month) {
|
|
7289
|
+
chartData[0].data.push({
|
|
7290
|
+
label: MONTHS[month],
|
|
7291
|
+
value: _this.getIncomeTransactions().getByMonth(month).claimAmount
|
|
7292
|
+
});
|
|
7293
|
+
chartData[1].data.push({
|
|
7294
|
+
label: MONTHS[month],
|
|
7295
|
+
value: Math.abs(_this.getExpenseTransactions().getByMonth(month).claimAmount)
|
|
7296
|
+
});
|
|
7297
|
+
});
|
|
7298
|
+
return chartData;
|
|
7299
|
+
};
|
|
7233
7300
|
return TransactionCollection;
|
|
7234
7301
|
}(ExportableCollection));
|
|
7235
7302
|
|
|
@@ -7846,7 +7913,7 @@
|
|
|
7846
7913
|
__extends(PropertyReportItemTransaction, _super);
|
|
7847
7914
|
function PropertyReportItemTransaction(transactions, property, chartAccounts) {
|
|
7848
7915
|
var _this = _super.call(this, property, chartAccounts) || this;
|
|
7849
|
-
_this.amount = Math.abs(transactions.
|
|
7916
|
+
_this.amount = Math.abs(transactions.grossAmount);
|
|
7850
7917
|
_this.description = chartAccounts.name;
|
|
7851
7918
|
return _this;
|
|
7852
7919
|
}
|
|
@@ -9146,29 +9213,6 @@
|
|
|
9146
9213
|
return BorrowingExpenseLoan;
|
|
9147
9214
|
}(BorrowingExpenseLoan$1));
|
|
9148
9215
|
|
|
9149
|
-
/**
|
|
9150
|
-
* Chart serie class: chart data item
|
|
9151
|
-
* @TODO consider rename to ChartSerieData
|
|
9152
|
-
*/
|
|
9153
|
-
var ChartSerie = /** @class */ (function () {
|
|
9154
|
-
function ChartSerie() {
|
|
9155
|
-
}
|
|
9156
|
-
return ChartSerie;
|
|
9157
|
-
}());
|
|
9158
|
-
|
|
9159
|
-
/**
|
|
9160
|
-
* Chart data class
|
|
9161
|
-
* @TODO consider rename to ChartSerie
|
|
9162
|
-
*/
|
|
9163
|
-
var ChartData = /** @class */ (function () {
|
|
9164
|
-
function ChartData() {
|
|
9165
|
-
}
|
|
9166
|
-
return ChartData;
|
|
9167
|
-
}());
|
|
9168
|
-
__decorate([
|
|
9169
|
-
classTransformer.Type(function () { return ChartSerie; })
|
|
9170
|
-
], ChartData.prototype, "data", void 0);
|
|
9171
|
-
|
|
9172
9216
|
var ChartAccountsDepreciation$1 = /** @class */ (function (_super) {
|
|
9173
9217
|
__extends(ChartAccountsDepreciation, _super);
|
|
9174
9218
|
function ChartAccountsDepreciation() {
|
|
@@ -9841,8 +9885,6 @@
|
|
|
9841
9885
|
IconsFileEnum["DOC"] = "icon-doc";
|
|
9842
9886
|
})(exports.IconsFileEnum || (exports.IconsFileEnum = {}));
|
|
9843
9887
|
|
|
9844
|
-
var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan'];
|
|
9845
|
-
|
|
9846
9888
|
// Todo extend from the base model when the backend is ready TT-555
|
|
9847
9889
|
var IncomePosition = /** @class */ (function () {
|
|
9848
9890
|
function IncomePosition() {
|