taxtank-core 0.33.16 → 0.33.17
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/src/lib/collections/sole/index.mjs +2 -2
- package/esm2022/src/lib/collections/sole/sole-business-loss.collection.mjs +41 -0
- package/esm2022/src/lib/db/Models/sole/sole-details.mjs +3 -3
- package/esm2022/src/lib/forms/holding/holding-reinvest.form.mjs +2 -2
- package/esm2022/src/lib/forms/report/my-tax/my-tax-partnerships-and-trusts.form.mjs +1 -1
- package/esm2022/src/lib/models/event/app-event-type.enum.mjs +15 -17
- package/esm2022/src/lib/models/report/my-tax/my-tax-business-income-or-losses/my-tax-business-losses/my-tax-business-losses.mjs +1 -1
- package/esm2022/src/lib/models/report/my-tax/my-tax-losses/my-tax-losses.mjs +1 -1
- package/esm2022/src/lib/models/transaction/allocation-rule-transaction.mjs +1 -1
- package/esm2022/src/lib/services/http/bank/basiq/basiq.service.mjs +2 -1
- package/esm2022/src/lib/services/http/property/property-category-movement/property-category-movement.service.mjs +1 -1
- package/esm2022/src/lib/services/http/sole/sole-business-loss/sole-business-loss.service.mjs +8 -3
- package/esm2022/src/lib/services/http/sole/sole-depreciation-method/sole-depreciation-method.service.mjs +3 -3
- package/esm2022/src/lib/services/http/sole/sole-details/sole-details.service.mjs +15 -51
- package/fesm2022/taxtank-core.mjs +35 -66
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/collections/sole/index.d.ts +1 -1
- package/src/lib/collections/sole/{sole-business-losses.collection.d.ts → sole-business-loss.collection.d.ts} +1 -1
- package/src/lib/db/Models/sole/sole-details.d.ts +2 -2
- package/src/lib/forms/report/my-tax/my-tax-partnerships-and-trusts.form.d.ts +1 -1
- package/src/lib/models/event/app-event-type.enum.d.ts +14 -16
- package/src/lib/models/report/my-tax/my-tax-business-income-or-losses/my-tax-business-losses/my-tax-business-losses.d.ts +2 -2
- package/src/lib/models/report/my-tax/my-tax-losses/my-tax-losses.d.ts +2 -2
- package/src/lib/services/http/bank/basiq/basiq.service.d.ts +1 -0
- package/src/lib/services/http/sole/sole-business-loss/sole-business-loss.service.d.ts +8 -3
- package/src/lib/services/http/sole/sole-details/sole-details.service.d.ts +10 -13
- package/esm2022/src/lib/collections/sole/sole-business-losses.collection.mjs +0 -41
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Collection } from '../collection';
|
2
2
|
import { SoleBusinessLoss } from '../../models';
|
3
3
|
import { TransactionCollection } from '../transaction';
|
4
|
-
export declare class
|
4
|
+
export declare class SoleBusinessLossCollection extends Collection<SoleBusinessLoss> {
|
5
5
|
/**
|
6
6
|
* Business loss applied in current year, includes previous year losses and current year losses for businesses matching offset rule
|
7
7
|
*/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { User } from '../user/user';
|
2
|
-
import { AbstractModel } from '../abstract-model';
|
3
2
|
import { AnnualFrequencyEnum } from '../../Enums';
|
4
|
-
|
3
|
+
import { ObservableModel } from '../observable-model';
|
4
|
+
export declare class SoleDetails extends ObservableModel {
|
5
5
|
abn?: string;
|
6
6
|
isGST?: boolean;
|
7
7
|
createdAt?: Date;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AbstractForm } from '../../abstract.form';
|
2
|
-
import { MyTaxPartnershipsAndTrusts } from '../../../models/report
|
2
|
+
import { MyTaxPartnershipsAndTrusts } from '../../../models/report';
|
3
3
|
export declare class MyTaxPartnershipsAndTrustsForm extends AbstractForm<MyTaxPartnershipsAndTrusts> {
|
4
4
|
constructor(partnershipsAndTrusts: MyTaxPartnershipsAndTrusts);
|
5
5
|
}
|
@@ -42,20 +42,18 @@ export declare enum AppEventTypeEnum {
|
|
42
42
|
PROPERTY_SUBSCRIPTION_DELETED = 37,
|
43
43
|
PROPERTY_VALUATION_DOCUMENT_CREATED = 38,
|
44
44
|
SOLE_DEPRECIATION_METHOD_UPDATED = 39,
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
VEHICLE_LOGBOOK_DELETED = 54,
|
60
|
-
VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED = 55
|
45
|
+
SOLE_INVOICE_PUBLISHED = 40,
|
46
|
+
TAX_REVIEW_UPDATED = 41,
|
47
|
+
TRANSACTION_ALLOCATION_CREATED = 42,
|
48
|
+
TRANSACTION_ALLOCATION_DELETED = 43,
|
49
|
+
TRANSACTION_CREATED = 44,
|
50
|
+
TRANSACTION_DELETED = 45,
|
51
|
+
TRANSACTION_UPDATED = 46,
|
52
|
+
TRANSACTIONS_CREATED = 47,
|
53
|
+
VEHICLE_CLAIM_DETAILS_UPDATED = 48,
|
54
|
+
VEHICLE_CLAIM_DETAILS_CREATED = 49,
|
55
|
+
VEHICLE_LOGBOOK_CREATED = 50,
|
56
|
+
VEHICLE_LOGBOOK_UPDATED = 51,
|
57
|
+
VEHICLE_LOGBOOK_DELETED = 52,
|
58
|
+
VEHICLE_LOGBOOK_BEST_PERIOD_UPDATED = 53
|
61
59
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { DepreciationCollection, TransactionCollection } from '../../../../../collections';
|
2
2
|
import { SoleBusinessLoss } from '../../../../sole';
|
3
|
-
import {
|
3
|
+
import { SoleBusinessLossCollection } from '../../../../../collections';
|
4
4
|
import { TaxSummary } from '../../../../tax-summary/tax-summary';
|
5
5
|
/**
|
6
6
|
* Sole business information related to expense transactions (losses)
|
@@ -27,5 +27,5 @@ export declare class MyTaxBusinessLosses {
|
|
27
27
|
netNonPrimaryIncomeOrLossesAmount: number;
|
28
28
|
currentYearNetNonPrimaryIncomeOrLossesAmount: number;
|
29
29
|
deferredLossesAmount: number;
|
30
|
-
constructor(transactions: TransactionCollection, depreciations: DepreciationCollection, businessLosses:
|
30
|
+
constructor(transactions: TransactionCollection, depreciations: DepreciationCollection, businessLosses: SoleBusinessLossCollection, currentLoss: SoleBusinessLoss, taxSummary: TaxSummary);
|
31
31
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { SoleBusinessLossCollection, TransactionCollection } from '../../../../collections';
|
2
2
|
/**
|
3
3
|
* Sole business losses report
|
4
4
|
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Losses" section)
|
@@ -12,5 +12,5 @@ export declare class MyTaxLosses {
|
|
12
12
|
* Losses applied to the current year (until profit gets to $0)
|
13
13
|
*/
|
14
14
|
businessLossApplied: number;
|
15
|
-
constructor(businessLosses:
|
15
|
+
constructor(businessLosses: SoleBusinessLossCollection, transactions: TransactionCollection);
|
16
16
|
}
|
@@ -77,6 +77,7 @@ export declare class BasiqService extends RestService<BankAccountBase, BankAccou
|
|
77
77
|
*/
|
78
78
|
retrieveJob(jobId: string): Observable<BasiqJobResponse>;
|
79
79
|
/**
|
80
|
+
* @TODO not used, remove?
|
80
81
|
* Recoursive method, watch basiq job retrieve accounts status
|
81
82
|
* @param jobId id of basiq job to check
|
82
83
|
* @returns observable boolean. True - accounts retrieved, false - accounts not retrieved (time is out)
|
@@ -1,12 +1,17 @@
|
|
1
|
-
import { RestService } from '../../rest/rest-old.service';
|
2
1
|
import { SoleBusinessLoss as SoleBusinessLossBase } from '../../../../db/Models/sole/sole-business-loss';
|
3
2
|
import { SoleBusinessLoss } from '../../../../models';
|
4
3
|
import { IEventListener } from '../../../../interfaces';
|
4
|
+
import { SoleBusinessLossCollection } from '../../../../collections';
|
5
|
+
import { RestMethod, RestService } from '../../rest';
|
6
|
+
import { UserRolesEnum } from 'taxtank-core/common';
|
5
7
|
import * as i0 from "@angular/core";
|
6
|
-
export declare class SoleBusinessLossService extends RestService<SoleBusinessLossBase, SoleBusinessLoss> implements IEventListener {
|
8
|
+
export declare class SoleBusinessLossService extends RestService<SoleBusinessLossBase, SoleBusinessLoss, SoleBusinessLossCollection> implements IEventListener {
|
7
9
|
protected environment: any;
|
8
10
|
modelClass: typeof SoleBusinessLoss;
|
9
|
-
|
11
|
+
collectionClass: typeof SoleBusinessLossCollection;
|
12
|
+
endpointUri: string;
|
13
|
+
disabledMethods: RestMethod[];
|
14
|
+
roles: UserRolesEnum[];
|
10
15
|
constructor(environment: any);
|
11
16
|
listenEvents(): void;
|
12
17
|
/**
|
@@ -1,21 +1,18 @@
|
|
1
1
|
import { SoleDetails } from '../../../../models';
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
2
|
+
import { SoleDetails as SoleDetailsBase } from '../../../../db/Models/sole/sole-details';
|
3
|
+
import { RestMethod, RestService } from '../../rest';
|
4
|
+
import { Collection } from '../../../../collections';
|
5
|
+
import { UserRolesEnum } from 'taxtank-core/common';
|
5
6
|
import * as i0 from "@angular/core";
|
6
7
|
/**
|
7
8
|
* @TODO TT-1777 Alex: extend from rest service when it refactored
|
8
9
|
*/
|
9
|
-
export declare class SoleDetailsService {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
constructor(http: HttpClient, environment: any, eventDispatcherService: EventDispatcherService);
|
16
|
-
get(): Observable<SoleDetails>;
|
17
|
-
add(soleDetails: SoleDetails): Observable<SoleDetails>;
|
18
|
-
update(soleDetails: SoleDetails): Observable<SoleDetails>;
|
10
|
+
export declare class SoleDetailsService extends RestService<SoleDetailsBase, SoleDetails, Collection<SoleDetails>> {
|
11
|
+
modelClass: typeof SoleDetails;
|
12
|
+
collectionClass: typeof Collection;
|
13
|
+
endpointUri: string;
|
14
|
+
disabledMethods: RestMethod[];
|
15
|
+
roles: UserRolesEnum[];
|
19
16
|
static ɵfac: i0.ɵɵFactoryDeclaration<SoleDetailsService, never>;
|
20
17
|
static ɵprov: i0.ɵɵInjectableDeclaration<SoleDetailsService>;
|
21
18
|
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import { Collection } from '../collection';
|
2
|
-
import { Dictionary } from '../../models';
|
3
|
-
export class SoleBusinessLossesCollection extends Collection {
|
4
|
-
/**
|
5
|
-
* Business loss applied in current year, includes previous year losses and current year losses for businesses matching offset rule
|
6
|
-
*/
|
7
|
-
calculateBusinessLossApplied(transactions) {
|
8
|
-
// claim amounts for businesses that can be applied to be reduced by prior year business losses
|
9
|
-
const claimAmountsByBusinessId = this.getClaimAmountsByBusinessId(transactions);
|
10
|
-
return Object.keys(claimAmountsByBusinessId.items).reduce((sum, businessId) => {
|
11
|
-
const loss = this.findBy('business.id', +businessId);
|
12
|
-
const lossOpenBalance = loss?.openBalance || 0;
|
13
|
-
// business loss can be applied to business profit or other income types profit in case in offset rule met
|
14
|
-
return sum + (loss?.offsetRule ? lossOpenBalance : Math.min(lossOpenBalance, claimAmountsByBusinessId.get(businessId)));
|
15
|
-
}, 0);
|
16
|
-
}
|
17
|
-
/**
|
18
|
-
* Get business claim amounts that can be applied to be reduced by prior year business losses:
|
19
|
-
* businesses with income or businesses with a loss, but which met the non-commercial loss rules
|
20
|
-
* https://www.ato.gov.au/Business/Non-commercial-losses/
|
21
|
-
*/
|
22
|
-
getClaimAmountsByBusinessId(transactions) {
|
23
|
-
const claimAmountsByBusinessId = new Dictionary([]);
|
24
|
-
const transactionsByBusinessId = transactions.groupBy('business.id');
|
25
|
-
transactionsByBusinessId.keys.forEach((businessId) => {
|
26
|
-
// business loss may not exist if, when creating a business, user didn't add losses for previous years
|
27
|
-
const lossOffsetRule = this.findBy('business.id', +businessId)?.offsetRule;
|
28
|
-
const businessClaimAmount = transactionsByBusinessId
|
29
|
-
.get(businessId)
|
30
|
-
.getBusinessClaimAmount(+businessId);
|
31
|
-
// @TODO vik it has nothing to do with getClaimAmountsByBusinessId
|
32
|
-
// no way to apply loss for business without profit if offset rules not met
|
33
|
-
if (businessClaimAmount < 0 && !lossOffsetRule) {
|
34
|
-
return;
|
35
|
-
}
|
36
|
-
claimAmountsByBusinessId.add(businessId, businessClaimAmount);
|
37
|
-
});
|
38
|
-
return claimAmountsByBusinessId;
|
39
|
-
}
|
40
|
-
}
|
41
|
-
//# sourceM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