taxtank-core 0.28.8 → 0.28.11
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 +101 -30
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/bank-transaction.collection.js +2 -2
- package/esm2015/lib/collections/transaction/transaction.collection.js +26 -1
- package/esm2015/lib/models/depreciation/depreciation.js +2 -2
- package/esm2015/lib/models/endpoint/endpoints.const.js +2 -1
- package/esm2015/lib/models/report/depreciation/index.js +4 -0
- package/esm2015/lib/models/report/index.js +6 -0
- package/esm2015/lib/models/report/property/index.js +4 -0
- package/esm2015/lib/models/report/sole/index.js +2 -0
- package/esm2015/lib/models/report/sole/sole-business/sole-business-loss-report.js +18 -0
- package/esm2015/lib/services/bank/bank-account-calculation.service.js +9 -3
- package/esm2015/lib/services/bank/bank-transaction-calculation.service.js +2 -2
- package/esm2015/lib/services/http/sole/index.js +2 -1
- package/esm2015/lib/services/http/sole/sole-business-loss/sole-business-loss.service.js +21 -0
- package/esm2015/lib/services/http/sole/sole-invoice/sole-invoice.service.js +1 -1
- package/esm2015/public-api.js +2 -8
- package/fesm2015/taxtank-core.js +86 -25
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/bank-transaction.collection.d.ts +1 -1
- package/lib/collections/transaction/transaction.collection.d.ts +7 -0
- package/lib/models/report/depreciation/index.d.ts +3 -0
- package/lib/models/report/index.d.ts +5 -0
- package/lib/models/report/property/index.d.ts +3 -0
- package/lib/models/report/sole/index.d.ts +1 -0
- package/lib/models/report/sole/sole-business/sole-business-loss-report.d.ts +25 -0
- package/lib/services/bank/bank-account-calculation.service.d.ts +2 -1
- package/lib/services/bank/bank-transaction-calculation.service.d.ts +1 -1
- package/lib/services/http/sole/index.d.ts +1 -0
- package/lib/services/http/sole/sole-business-loss/sole-business-loss.service.d.ts +11 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -7
|
@@ -1061,6 +1061,7 @@
|
|
|
1061
1061
|
SOLE_BUSINESSES_GET: new Endpoint('GET', '\\/sole-businesses'),
|
|
1062
1062
|
SOLE_BUSINESSES_POST: new Endpoint('POST', '\\/sole-businesses'),
|
|
1063
1063
|
SOLE_BUSINESSES_PUT: new Endpoint('PUT', '\\/sole-businesses\\/\\d+'),
|
|
1064
|
+
SOLE_BUSINESSES_LOSSES_GET: new Endpoint('GET', '\\/sole-business-losses'),
|
|
1064
1065
|
BUSINESS_ACTIVITIES_GET: new Endpoint('GET', '\\/sole-business-activities'),
|
|
1065
1066
|
SOLE_DEPRECIATION_METHODS_GET: new Endpoint('GET', '\\/sole-depreciation-methods'),
|
|
1066
1067
|
SOLE_DEPRECIATION_METHODS_PUT: new Endpoint('PUT', '\\/sole-depreciation-methods\\/\\d+'),
|
|
@@ -4543,7 +4544,7 @@
|
|
|
4543
4544
|
*/
|
|
4544
4545
|
Depreciation.prototype.toTransaction = function (params) {
|
|
4545
4546
|
if (params === void 0) { params = {}; }
|
|
4546
|
-
return classTransformer.plainToClass(Transaction, Object.assign(params, this, { amount: this.
|
|
4547
|
+
return classTransformer.plainToClass(Transaction, Object.assign(params, this, { amount: -this.claimAmount, claimAmount: -this.amount * (this.claimPercent / 100) }));
|
|
4547
4548
|
};
|
|
4548
4549
|
Object.defineProperty(Depreciation.prototype, "claimAmount", {
|
|
4549
4550
|
/**
|
|
@@ -6838,7 +6839,7 @@
|
|
|
6838
6839
|
/**
|
|
6839
6840
|
* Get collection of unallocated bankTransactions
|
|
6840
6841
|
*/
|
|
6841
|
-
BankTransactionCollection.prototype.
|
|
6842
|
+
BankTransactionCollection.prototype.getUnallocated = function (allocations) {
|
|
6842
6843
|
return new BankTransactionCollection(this.items.filter(function (bankTransaction) { return !bankTransaction.isAllocated(allocations); }));
|
|
6843
6844
|
};
|
|
6844
6845
|
return BankTransactionCollection;
|
|
@@ -7014,6 +7015,31 @@
|
|
|
7014
7015
|
return ClientPortfolioReportCollection;
|
|
7015
7016
|
}(Collection));
|
|
7016
7017
|
|
|
7018
|
+
/**
|
|
7019
|
+
* Chart serie class: chart data item
|
|
7020
|
+
* @TODO consider rename to ChartSerieData
|
|
7021
|
+
*/
|
|
7022
|
+
var ChartSerie = /** @class */ (function () {
|
|
7023
|
+
function ChartSerie() {
|
|
7024
|
+
}
|
|
7025
|
+
return ChartSerie;
|
|
7026
|
+
}());
|
|
7027
|
+
|
|
7028
|
+
/**
|
|
7029
|
+
* Chart data class
|
|
7030
|
+
* @TODO consider rename to ChartSerie
|
|
7031
|
+
*/
|
|
7032
|
+
var ChartData = /** @class */ (function () {
|
|
7033
|
+
function ChartData() {
|
|
7034
|
+
}
|
|
7035
|
+
return ChartData;
|
|
7036
|
+
}());
|
|
7037
|
+
__decorate([
|
|
7038
|
+
classTransformer.Type(function () { return ChartSerie; })
|
|
7039
|
+
], ChartData.prototype, "data", void 0);
|
|
7040
|
+
|
|
7041
|
+
var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan'];
|
|
7042
|
+
|
|
7017
7043
|
/**
|
|
7018
7044
|
* Collection of transactions
|
|
7019
7045
|
*/
|
|
@@ -7230,6 +7256,29 @@
|
|
|
7230
7256
|
.getVehicleTransactions()
|
|
7231
7257
|
.removeBy('chartAccounts.id', [exports.ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK, exports.ChartAccountsListEnum.KLMS_TRAVELLED]);
|
|
7232
7258
|
};
|
|
7259
|
+
/**
|
|
7260
|
+
* Build chart data with transactions cash position.
|
|
7261
|
+
* Cash position = Income - Expenses (include depreciations)
|
|
7262
|
+
* Chart data for each month from fin year start till current month
|
|
7263
|
+
*/
|
|
7264
|
+
TransactionCollection.prototype.getCashPositionChartData = function () {
|
|
7265
|
+
var _this = this;
|
|
7266
|
+
var chartData = [
|
|
7267
|
+
classTransformer.plainToClass(ChartData, { name: 'Income', data: [] }),
|
|
7268
|
+
classTransformer.plainToClass(ChartData, { name: 'Expense', data: [] })
|
|
7269
|
+
];
|
|
7270
|
+
new FinancialYear().getPastMonths().forEach(function (month) {
|
|
7271
|
+
chartData[0].data.push({
|
|
7272
|
+
label: MONTHS[month],
|
|
7273
|
+
value: _this.getIncomeTransactions().getByMonth(month).claimAmount
|
|
7274
|
+
});
|
|
7275
|
+
chartData[1].data.push({
|
|
7276
|
+
label: MONTHS[month],
|
|
7277
|
+
value: Math.abs(_this.getExpenseTransactions().getByMonth(month).claimAmount)
|
|
7278
|
+
});
|
|
7279
|
+
});
|
|
7280
|
+
return chartData;
|
|
7281
|
+
};
|
|
7233
7282
|
return TransactionCollection;
|
|
7234
7283
|
}(ExportableCollection));
|
|
7235
7284
|
|
|
@@ -9146,29 +9195,6 @@
|
|
|
9146
9195
|
return BorrowingExpenseLoan;
|
|
9147
9196
|
}(BorrowingExpenseLoan$1));
|
|
9148
9197
|
|
|
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
9198
|
var ChartAccountsDepreciation$1 = /** @class */ (function (_super) {
|
|
9173
9199
|
__extends(ChartAccountsDepreciation, _super);
|
|
9174
9200
|
function ChartAccountsDepreciation() {
|
|
@@ -9841,8 +9867,6 @@
|
|
|
9841
9867
|
IconsFileEnum["DOC"] = "icon-doc";
|
|
9842
9868
|
})(exports.IconsFileEnum || (exports.IconsFileEnum = {}));
|
|
9843
9869
|
|
|
9844
|
-
var MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan'];
|
|
9845
|
-
|
|
9846
9870
|
// Todo extend from the base model when the backend is ready TT-555
|
|
9847
9871
|
var IncomePosition = /** @class */ (function () {
|
|
9848
9872
|
function IncomePosition() {
|
|
@@ -10981,6 +11005,26 @@
|
|
|
10981
11005
|
* 'My Tax' report related data (classes, enums, const, e.t.c)
|
|
10982
11006
|
*/
|
|
10983
11007
|
|
|
11008
|
+
/**
|
|
11009
|
+
* Class with business loss details
|
|
11010
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4641357930/Rules+when+a+business+makes+a+loss+Tax+Summary
|
|
11011
|
+
*/
|
|
11012
|
+
var SoleBusinessLossReport = /** @class */ (function (_super) {
|
|
11013
|
+
__extends(SoleBusinessLossReport, _super);
|
|
11014
|
+
function SoleBusinessLossReport(loss, transactions, depreciations) {
|
|
11015
|
+
var _this = _super.call(this) || this;
|
|
11016
|
+
_this.openBalance = loss.openBalance;
|
|
11017
|
+
_this.netIncome = transactions.sumBy('claimAmount') + depreciations.sumBy('claimAmount');
|
|
11018
|
+
_this.taxableIncome = _this.calculateTaxableIncome();
|
|
11019
|
+
_this.closeBalance = Math.max(_this.taxableIncome, 0);
|
|
11020
|
+
return _this;
|
|
11021
|
+
}
|
|
11022
|
+
SoleBusinessLossReport.prototype.calculateTaxableIncome = function () {
|
|
11023
|
+
return this.netIncome - this.openBalance;
|
|
11024
|
+
};
|
|
11025
|
+
return SoleBusinessLossReport;
|
|
11026
|
+
}(AbstractModel));
|
|
11027
|
+
|
|
10984
11028
|
/**
|
|
10985
11029
|
* Constant with list of URLs
|
|
10986
11030
|
*/
|
|
@@ -11515,6 +11559,26 @@
|
|
|
11515
11559
|
}]
|
|
11516
11560
|
}] });
|
|
11517
11561
|
|
|
11562
|
+
var SoleBusinessLossService = /** @class */ (function (_super) {
|
|
11563
|
+
__extends(SoleBusinessLossService, _super);
|
|
11564
|
+
function SoleBusinessLossService() {
|
|
11565
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
11566
|
+
_this.modelClass = SoleBusinessLoss;
|
|
11567
|
+
_this.url = 'sole-business-losses';
|
|
11568
|
+
_this.isHydra = true;
|
|
11569
|
+
return _this;
|
|
11570
|
+
}
|
|
11571
|
+
return SoleBusinessLossService;
|
|
11572
|
+
}(RestService));
|
|
11573
|
+
SoleBusinessLossService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessLossService, deps: null, target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
11574
|
+
SoleBusinessLossService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessLossService, providedIn: 'root' });
|
|
11575
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessLossService, decorators: [{
|
|
11576
|
+
type: i0.Injectable,
|
|
11577
|
+
args: [{
|
|
11578
|
+
providedIn: 'root'
|
|
11579
|
+
}]
|
|
11580
|
+
}] });
|
|
11581
|
+
|
|
11518
11582
|
var SoleContactService = /** @class */ (function (_super) {
|
|
11519
11583
|
__extends(SoleContactService, _super);
|
|
11520
11584
|
function SoleContactService() {
|
|
@@ -13472,7 +13536,7 @@
|
|
|
13472
13536
|
* Get collection of unallocated bank transactions
|
|
13473
13537
|
* @TODO Alex: consider to move to collection
|
|
13474
13538
|
*/
|
|
13475
|
-
BankTransactionCalculationService.prototype.
|
|
13539
|
+
BankTransactionCalculationService.prototype.getUnallocated = function (bankTransactions, allocations) {
|
|
13476
13540
|
var _this = this;
|
|
13477
13541
|
return new BankTransactionCollection(bankTransactions.items.filter(function (bankTransaction) {
|
|
13478
13542
|
return !_this.isAllocated(bankTransaction, allocations);
|
|
@@ -13509,8 +13573,12 @@
|
|
|
13509
13573
|
* Sum of bank accounts opening balances and their bank transactions allocated amounts
|
|
13510
13574
|
*/
|
|
13511
13575
|
BankAccountCalculationService.prototype.getTaxTankBalance = function (bankAccounts, bankTransactions, allocations) {
|
|
13512
|
-
|
|
13513
|
-
|
|
13576
|
+
// wrap in a collection if a single bank account was provided
|
|
13577
|
+
var bankAccountCollection = bankAccounts instanceof BankAccount ?
|
|
13578
|
+
new BankAccountCollection([bankAccounts]) :
|
|
13579
|
+
bankAccounts;
|
|
13580
|
+
return bankAccountCollection.getOpeningBalance() +
|
|
13581
|
+
this.bankTransactionCalculationService.getAllocatedAmount(bankTransactions.getByBankAccountsIds(bankAccountCollection.getIds()), allocations);
|
|
13514
13582
|
};
|
|
13515
13583
|
/**
|
|
13516
13584
|
* get difference between total loans amount and total cash amount
|
|
@@ -18676,6 +18744,7 @@
|
|
|
18676
18744
|
exports.PropertyForecast = PropertyForecast;
|
|
18677
18745
|
exports.PropertyReportItem = PropertyReportItem;
|
|
18678
18746
|
exports.PropertyReportItemCollection = PropertyReportItemCollection;
|
|
18747
|
+
exports.PropertyReportItemDepreciation = PropertyReportItemDepreciation;
|
|
18679
18748
|
exports.PropertyReportItemDepreciationCollection = PropertyReportItemDepreciationCollection;
|
|
18680
18749
|
exports.PropertyReportItemTransaction = PropertyReportItemTransaction;
|
|
18681
18750
|
exports.PropertyReportItemTransactionCollection = PropertyReportItemTransactionCollection;
|
|
@@ -18720,6 +18789,8 @@
|
|
|
18720
18789
|
exports.SoleBusinessAllocationsForm = SoleBusinessAllocationsForm;
|
|
18721
18790
|
exports.SoleBusinessForm = SoleBusinessForm;
|
|
18722
18791
|
exports.SoleBusinessLoss = SoleBusinessLoss;
|
|
18792
|
+
exports.SoleBusinessLossReport = SoleBusinessLossReport;
|
|
18793
|
+
exports.SoleBusinessLossService = SoleBusinessLossService;
|
|
18723
18794
|
exports.SoleBusinessService = SoleBusinessService;
|
|
18724
18795
|
exports.SoleContact = SoleContact;
|
|
18725
18796
|
exports.SoleContactForm = SoleContactForm;
|