taxtank-core 0.28.7 → 0.28.10
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 +59 -6
- package/bundles/taxtank-core.umd.js.map +1 -1
- package/esm2015/lib/collections/bank-transaction.collection.js +2 -2
- package/esm2015/lib/forms/bank/bank-account/bank-account-import.form.js +3 -3
- package/esm2015/lib/forms/loan/loan.form.js +5 -1
- package/esm2015/lib/models/endpoint/endpoints.const.js +2 -1
- package/esm2015/lib/models/loan/loan-max-number-of-payments.enum.js +3 -2
- 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/public-api.js +2 -8
- package/fesm2015/taxtank-core.js +51 -7
- package/fesm2015/taxtank-core.js.map +1 -1
- package/lib/collections/bank-transaction.collection.d.ts +1 -1
- package/lib/forms/loan/loan.form.d.ts +1 -0
- package/lib/models/loan/loan-max-number-of-payments.enum.d.ts +2 -1
- 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+'),
|
|
@@ -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;
|
|
@@ -9897,7 +9898,8 @@
|
|
|
9897
9898
|
}());
|
|
9898
9899
|
|
|
9899
9900
|
/**
|
|
9900
|
-
* Enum with maximum number of payments, depending on the frequency
|
|
9901
|
+
* Enum with maximum number of payments, depending on the frequency.
|
|
9902
|
+
* Used only for vehicle loans
|
|
9901
9903
|
*/
|
|
9902
9904
|
exports.LoanMaxNumberOfPaymentsEnum = void 0;
|
|
9903
9905
|
(function (LoanMaxNumberOfPaymentsEnum) {
|
|
@@ -10980,6 +10982,26 @@
|
|
|
10980
10982
|
* 'My Tax' report related data (classes, enums, const, e.t.c)
|
|
10981
10983
|
*/
|
|
10982
10984
|
|
|
10985
|
+
/**
|
|
10986
|
+
* Class with business loss details
|
|
10987
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4641357930/Rules+when+a+business+makes+a+loss+Tax+Summary
|
|
10988
|
+
*/
|
|
10989
|
+
var SoleBusinessLossReport = /** @class */ (function (_super) {
|
|
10990
|
+
__extends(SoleBusinessLossReport, _super);
|
|
10991
|
+
function SoleBusinessLossReport(loss, transactions, depreciations) {
|
|
10992
|
+
var _this = _super.call(this) || this;
|
|
10993
|
+
_this.openBalance = loss.openBalance;
|
|
10994
|
+
_this.netIncome = transactions.sumBy('claimAmount') + depreciations.sumBy('claimAmount');
|
|
10995
|
+
_this.taxableIncome = _this.calculateTaxableIncome();
|
|
10996
|
+
_this.closeBalance = Math.max(_this.taxableIncome, 0);
|
|
10997
|
+
return _this;
|
|
10998
|
+
}
|
|
10999
|
+
SoleBusinessLossReport.prototype.calculateTaxableIncome = function () {
|
|
11000
|
+
return this.netIncome - this.openBalance;
|
|
11001
|
+
};
|
|
11002
|
+
return SoleBusinessLossReport;
|
|
11003
|
+
}(AbstractModel));
|
|
11004
|
+
|
|
10983
11005
|
/**
|
|
10984
11006
|
* Constant with list of URLs
|
|
10985
11007
|
*/
|
|
@@ -11514,6 +11536,26 @@
|
|
|
11514
11536
|
}]
|
|
11515
11537
|
}] });
|
|
11516
11538
|
|
|
11539
|
+
var SoleBusinessLossService = /** @class */ (function (_super) {
|
|
11540
|
+
__extends(SoleBusinessLossService, _super);
|
|
11541
|
+
function SoleBusinessLossService() {
|
|
11542
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
11543
|
+
_this.modelClass = SoleBusinessLoss;
|
|
11544
|
+
_this.url = 'sole-business-losses';
|
|
11545
|
+
_this.isHydra = true;
|
|
11546
|
+
return _this;
|
|
11547
|
+
}
|
|
11548
|
+
return SoleBusinessLossService;
|
|
11549
|
+
}(RestService));
|
|
11550
|
+
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 });
|
|
11551
|
+
SoleBusinessLossService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessLossService, providedIn: 'root' });
|
|
11552
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: SoleBusinessLossService, decorators: [{
|
|
11553
|
+
type: i0.Injectable,
|
|
11554
|
+
args: [{
|
|
11555
|
+
providedIn: 'root'
|
|
11556
|
+
}]
|
|
11557
|
+
}] });
|
|
11558
|
+
|
|
11517
11559
|
var SoleContactService = /** @class */ (function (_super) {
|
|
11518
11560
|
__extends(SoleContactService, _super);
|
|
11519
11561
|
function SoleContactService() {
|
|
@@ -13471,7 +13513,7 @@
|
|
|
13471
13513
|
* Get collection of unallocated bank transactions
|
|
13472
13514
|
* @TODO Alex: consider to move to collection
|
|
13473
13515
|
*/
|
|
13474
|
-
BankTransactionCalculationService.prototype.
|
|
13516
|
+
BankTransactionCalculationService.prototype.getUnallocated = function (bankTransactions, allocations) {
|
|
13475
13517
|
var _this = this;
|
|
13476
13518
|
return new BankTransactionCollection(bankTransactions.items.filter(function (bankTransaction) {
|
|
13477
13519
|
return !_this.isAllocated(bankTransaction, allocations);
|
|
@@ -13508,8 +13550,12 @@
|
|
|
13508
13550
|
* Sum of bank accounts opening balances and their bank transactions allocated amounts
|
|
13509
13551
|
*/
|
|
13510
13552
|
BankAccountCalculationService.prototype.getTaxTankBalance = function (bankAccounts, bankTransactions, allocations) {
|
|
13511
|
-
|
|
13512
|
-
|
|
13553
|
+
// wrap in a collection if a single bank account was provided
|
|
13554
|
+
var bankAccountCollection = bankAccounts instanceof BankAccount ?
|
|
13555
|
+
new BankAccountCollection([bankAccounts]) :
|
|
13556
|
+
bankAccounts;
|
|
13557
|
+
return bankAccountCollection.getOpeningBalance() +
|
|
13558
|
+
this.bankTransactionCalculationService.getAllocatedAmount(bankTransactions.getByBankAccountsIds(bankAccountCollection.getIds()), allocations);
|
|
13513
13559
|
};
|
|
13514
13560
|
/**
|
|
13515
13561
|
* get difference between total loans amount and total cash amount
|
|
@@ -16927,6 +16973,10 @@
|
|
|
16927
16973
|
* For vehicle loans term has a maximum value depended of repayment frequency
|
|
16928
16974
|
*/
|
|
16929
16975
|
LoanForm.prototype.updateTermValidation = function () {
|
|
16976
|
+
// no need terms for bank loans
|
|
16977
|
+
if (!!this.loan.bankAccount) {
|
|
16978
|
+
return;
|
|
16979
|
+
}
|
|
16930
16980
|
var currentRepaymentFrequency = this.get('repaymentFrequency').value;
|
|
16931
16981
|
// term validation depends on selected repayment frequency, so can not validate when frequency is empty
|
|
16932
16982
|
// repaymentType is required field, so we don't need to clear validation
|
|
@@ -17469,7 +17519,7 @@
|
|
|
17469
17519
|
if (bankAccount.isLoan()) {
|
|
17470
17520
|
// Attach bank account to loan for LoanForm's logic
|
|
17471
17521
|
// @TODO Alex/Vik: we should use separated API for bank accounts and loans
|
|
17472
|
-
var loan = classTransformer.plainToClass(Loan, Object.assign(bankAccount.loan, { bankAccount:
|
|
17522
|
+
var loan = classTransformer.plainToClass(Loan, Object.assign(bankAccount.loan, { bankAccount: { accountId: bankAccount.accountId } }));
|
|
17473
17523
|
_this.addControl('loan', new LoanForm(loan));
|
|
17474
17524
|
}
|
|
17475
17525
|
// basiq account import form should be disabled (unchecked) by default
|
|
@@ -18671,6 +18721,7 @@
|
|
|
18671
18721
|
exports.PropertyForecast = PropertyForecast;
|
|
18672
18722
|
exports.PropertyReportItem = PropertyReportItem;
|
|
18673
18723
|
exports.PropertyReportItemCollection = PropertyReportItemCollection;
|
|
18724
|
+
exports.PropertyReportItemDepreciation = PropertyReportItemDepreciation;
|
|
18674
18725
|
exports.PropertyReportItemDepreciationCollection = PropertyReportItemDepreciationCollection;
|
|
18675
18726
|
exports.PropertyReportItemTransaction = PropertyReportItemTransaction;
|
|
18676
18727
|
exports.PropertyReportItemTransactionCollection = PropertyReportItemTransactionCollection;
|
|
@@ -18715,6 +18766,8 @@
|
|
|
18715
18766
|
exports.SoleBusinessAllocationsForm = SoleBusinessAllocationsForm;
|
|
18716
18767
|
exports.SoleBusinessForm = SoleBusinessForm;
|
|
18717
18768
|
exports.SoleBusinessLoss = SoleBusinessLoss;
|
|
18769
|
+
exports.SoleBusinessLossReport = SoleBusinessLossReport;
|
|
18770
|
+
exports.SoleBusinessLossService = SoleBusinessLossService;
|
|
18718
18771
|
exports.SoleBusinessService = SoleBusinessService;
|
|
18719
18772
|
exports.SoleContact = SoleContact;
|
|
18720
18773
|
exports.SoleContactForm = SoleContactForm;
|