taxtank-core 0.32.108 → 0.32.111
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/esm2022/lib/collections/collection-dictionary.mjs +4 -1
- package/esm2022/lib/collections/property/property-valuation.collection.mjs +11 -1
- package/esm2022/lib/collections/report/property/property-report-item-depreciation.collection.mjs +2 -2
- package/esm2022/lib/collections/report/property/property-report-item-transaction.collection.mjs +2 -2
- package/esm2022/lib/collections/report/property/property-report-item.collection.mjs +1 -1
- package/esm2022/lib/forms/holding/holding-reinvest.form.mjs +24 -3
- package/esm2022/lib/forms/transaction/holding/holding-income.form.mjs +19 -9
- package/esm2022/lib/forms/transaction/work/work-transaction.form.mjs +2 -4
- package/esm2022/lib/models/property/property-equity-chart-data.mjs +11 -7
- package/esm2022/lib/models/report/property/property-report-item-transaction.mjs +1 -1
- package/esm2022/lib/services/http/bank/bank-connection/bank-connection-messages.enum.mjs +4 -4
- package/esm2022/lib/services/http/income-source/income-source.service.mjs +1 -2
- package/esm2022/lib/services/http/income-source/sole-forecast/sole-forecast.service.mjs +1 -3
- package/esm2022/lib/services/http/property/property-valuation/property-valuation.service.mjs +3 -3
- package/esm2022/lib/services/http/sole/bas-report/bas-report-messages.enum.mjs +8 -0
- package/esm2022/lib/services/http/sole/bas-report/index.mjs +3 -0
- package/esm2022/lib/services/http/sole/index.mjs +2 -2
- package/esm2022/lib/services/report/property/property-transaction-report.service.mjs +12 -3
- package/esm2022/lib/validators/fields-sum.validator.mjs +1 -1
- package/esm2022/lib/validators/greater-than.validator.mjs +1 -1
- package/esm2022/lib/validators/index.mjs +2 -1
- package/esm2022/lib/validators/match-sum.validator.mjs +16 -0
- package/fesm2022/taxtank-core.mjs +206 -163
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/lib/collections/collection-dictionary.d.ts +1 -0
- package/lib/collections/property/property-valuation.collection.d.ts +4 -0
- package/lib/collections/report/property/property-report-item-depreciation.collection.d.ts +2 -2
- package/lib/collections/report/property/property-report-item-transaction.collection.d.ts +3 -3
- package/lib/collections/report/property/property-report-item.collection.d.ts +1 -1
- package/lib/forms/holding/holding-reinvest.form.d.ts +7 -0
- package/lib/forms/transaction/holding/holding-income.form.d.ts +8 -1
- package/lib/forms/transaction/work/work-transaction.form.d.ts +1 -1
- package/lib/models/property/property-equity-chart-data.d.ts +7 -7
- package/lib/models/report/property/property-report-item-transaction.d.ts +3 -3
- package/lib/services/http/bank/bank-connection/bank-connection-messages.enum.d.ts +3 -3
- package/lib/services/http/property/property-valuation/property-valuation.service.d.ts +1 -2
- package/lib/services/http/sole/bas-report/bas-report-messages.enum.d.ts +6 -0
- package/lib/services/http/sole/bas-report/index.d.ts +2 -0
- package/lib/services/http/sole/index.d.ts +1 -1
- package/lib/services/report/property/property-transaction-report.service.d.ts +4 -3
- package/lib/validators/index.d.ts +1 -0
- package/lib/validators/match-sum.validator.d.ts +6 -0
- package/package.json +1 -1
- package/esm2022/lib/validators/transactions-meta-fields.validator.mjs +0 -33
- package/lib/validators/transactions-meta-fields.validator.d.ts +0 -5
@@ -1,4 +1,8 @@
|
|
1
1
|
import { Collection } from '../collection';
|
2
2
|
import { PropertyValuation } from '../../models';
|
3
3
|
export declare class PropertyValuationCollection extends Collection<PropertyValuation> {
|
4
|
+
/**
|
5
|
+
* @TODO vik find by year when backend refactored (all years would exist)
|
6
|
+
*/
|
7
|
+
getMarketValue(date: Date): number;
|
4
8
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Collection } from '../../collection';
|
2
|
-
import { ChartAccounts } from '../../../models
|
2
|
+
import { ChartAccounts } from '../../../models';
|
3
3
|
import { DepreciationCollection } from '../../depreciation.collection';
|
4
4
|
import { PropertyReportItemCollection } from './property-report-item.collection';
|
5
|
-
import { PropertyCollection } from '../../property
|
5
|
+
import { PropertyCollection } from '../../property';
|
6
6
|
/**
|
7
7
|
* Collection to work with depreciation-based property report items
|
8
8
|
*/
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Collection } from '../../collection';
|
2
|
-
import { TransactionCollection } from '../../transaction
|
3
|
-
import { ChartAccounts } from '../../../models
|
2
|
+
import { TransactionCollection } from '../../transaction';
|
3
|
+
import { ChartAccounts } from '../../../models';
|
4
4
|
import { PropertyReportItemCollection } from './property-report-item.collection';
|
5
|
-
import { PropertyCollection } from '../../property
|
5
|
+
import { PropertyCollection } from '../../property';
|
6
6
|
/**
|
7
7
|
* Collection to work with transaction-based property report items
|
8
8
|
*/
|
@@ -1,12 +1,19 @@
|
|
1
1
|
import { HoldingReinvest } from '../../models';
|
2
2
|
import { IEventListener } from '../../interfaces';
|
3
3
|
import { AbstractForm } from '../abstract.form';
|
4
|
+
/**
|
5
|
+
* @TODO vik TT-4048
|
6
|
+
*/
|
4
7
|
export declare class HoldingReinvestForm extends AbstractForm<HoldingReinvest> implements IEventListener {
|
5
8
|
private reinvest;
|
6
9
|
constructor(reinvest: HoldingReinvest);
|
7
10
|
listenEvents(): void;
|
8
11
|
private get transactionForm();
|
9
12
|
private get holdingForm();
|
13
|
+
/**
|
14
|
+
* calculated automatically as cashVariance=transactionAmount-frankedAmount-unfrankedAmount
|
15
|
+
*/
|
16
|
+
private listenAmountChanges;
|
10
17
|
/**
|
11
18
|
* Set transaction amount based on holding quantity and price
|
12
19
|
*/
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Transaction, TransactionAllocation } from '../../../models';
|
2
|
+
import { AbstractControl, FormArray } from '@angular/forms';
|
2
3
|
import { IEventListener } from '../../../interfaces';
|
3
4
|
import { WorkTransactionForm } from '../work/work-transaction.form';
|
4
5
|
export declare class HoldingIncomeForm extends WorkTransactionForm implements IEventListener {
|
@@ -6,12 +7,18 @@ export declare class HoldingIncomeForm extends WorkTransactionForm implements IE
|
|
6
7
|
* @TODO vik partial copyPast from workIncomeForm
|
7
8
|
*/
|
8
9
|
constructor(transaction: Transaction, registeredForGst: boolean, allocations: TransactionAllocation[]);
|
10
|
+
/**
|
11
|
+
* metafields components of transactionAmount
|
12
|
+
*/
|
13
|
+
getAmountComponents(): AbstractControl[];
|
9
14
|
listenEvents(): void;
|
15
|
+
get metaFields(): FormArray;
|
16
|
+
get frankingCredit(): AbstractControl;
|
10
17
|
/**
|
11
18
|
* @TODO Alex/Vik: probably we need some database changes related to metafields.
|
12
19
|
* Now we have the following custom metafields behaviour:
|
13
20
|
* - % of share field should be 100 by default (now handled by WorkTransactionForm)
|
14
|
-
* - Franked and Unfranked sum should be equal to transaction amount
|
21
|
+
* - Franked and Unfranked sum should be equal to transaction amount
|
15
22
|
* - Franked field has custom message (mat-hint) (now handled by HoldingIncomeFormComponent)
|
16
23
|
* - some metafields required, but some not (now handled by HoldingIncomeForm)
|
17
24
|
*/
|
@@ -3,7 +3,7 @@ import { IEventListener } from '../../../interfaces';
|
|
3
3
|
import { Transaction, TransactionAllocation } from '../../../models';
|
4
4
|
import { AbstractControl } from '@angular/forms';
|
5
5
|
export declare abstract class WorkTransactionForm extends TransactionForm implements IEventListener {
|
6
|
-
constructor(transaction: Transaction, registeredForGst: boolean, allocations: TransactionAllocation[], controls?: {
|
6
|
+
protected constructor(transaction: Transaction, registeredForGst: boolean, allocations: TransactionAllocation[], controls?: {
|
7
7
|
[key: string]: AbstractControl;
|
8
8
|
});
|
9
9
|
listenEvents(): void;
|
@@ -1,7 +1,5 @@
|
|
1
1
|
import { PropertyEquityChartItem } from './property-equity-chart-item';
|
2
|
-
import { PropertyCollection } from '../../collections
|
3
|
-
import { BankAccountCollection } from '../../collections/bank-account.collection';
|
4
|
-
import { LoanCollection } from '../../collections/loan/loan.collection';
|
2
|
+
import { BankAccountCollection, LoanCollection, PropertyCollection, PropertyValuationCollection } from '../../collections';
|
5
3
|
import { PropertyEquityChartTypeEnum } from './property-equity-chart-type.enum';
|
6
4
|
import { Property } from './property';
|
7
5
|
/**
|
@@ -11,13 +9,14 @@ import { Property } from './property';
|
|
11
9
|
* Also on hover appear equity positions point
|
12
10
|
*/
|
13
11
|
export declare class PropertyEquityChartData {
|
14
|
-
private registerDate;
|
15
|
-
list: PropertyEquityChartItem[];
|
16
|
-
currentYear: number;
|
17
12
|
private properties;
|
13
|
+
private valuations;
|
18
14
|
private bankAccounts;
|
19
15
|
private loans;
|
20
|
-
|
16
|
+
private registerDate;
|
17
|
+
list: PropertyEquityChartItem[];
|
18
|
+
currentYear: number;
|
19
|
+
constructor(properties: PropertyCollection, valuations: PropertyValuationCollection, bankAccounts: BankAccountCollection, loans: LoanCollection, registerDate: Date);
|
21
20
|
/**
|
22
21
|
* get items list in chart series format
|
23
22
|
* @param type
|
@@ -36,6 +35,7 @@ export declare class PropertyEquityChartData {
|
|
36
35
|
*/
|
37
36
|
private buildHistoryItems;
|
38
37
|
/**
|
38
|
+
* @TODO remove, there is no difference between actual and history calculations
|
39
39
|
* set actual year's real data
|
40
40
|
* @private
|
41
41
|
*/
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { PropertyReportItem } from './property-report-item';
|
2
|
-
import { TransactionCollection } from '../../../collections
|
3
|
-
import { Property } from '../../property
|
4
|
-
import { ChartAccounts } from '../../chart-accounts
|
2
|
+
import { TransactionCollection } from '../../../collections';
|
3
|
+
import { Property } from '../../property';
|
4
|
+
import { ChartAccounts } from '../../chart-accounts';
|
5
5
|
/**
|
6
6
|
* Class with transaction-based property transactions report entities
|
7
7
|
*/
|
@@ -4,7 +4,7 @@ export declare enum BankConnectionMessagesEnum {
|
|
4
4
|
DEACTIVATE = "Deactivate to stop receiving daily bank transactions",
|
5
5
|
CONFIRM_DEACTIVATE = "We are unable to deliver daily bank transactions to deactivated banks",
|
6
6
|
DEACTIVATED = "Your live bank feeds are deactivated",
|
7
|
-
RECONNECT = "
|
7
|
+
RECONNECT = "There has been an issue with your bank connection. Please reconnect to continue receiving bank transactions",
|
8
8
|
INVALID = "There has been an issue with your bank connection. Please reconnect to continue receiving bank transactions",
|
9
9
|
UPGRADE = "Upgrade needed from traditional feeds to an Open Banking connection to continue receiving bank transactions",
|
10
10
|
CONFIRM_UPGRADE = "Upgrading to open banking improves stability and data integrity",
|
@@ -19,6 +19,6 @@ export declare enum BankConnectionMessagesEnum {
|
|
19
19
|
ACCOUNTS_RETRIEVED = "Financial data received, you can add bank accounts now",
|
20
20
|
JOB_ID_RECEIVED = "Receiving information from bank",
|
21
21
|
TEMPORARY_UNAVAILABLE = "The bank is temporarily unavailable, please check back later",
|
22
|
-
EXPIRING = "
|
23
|
-
EXPIRED = "Your
|
22
|
+
EXPIRING = "Access to receiving data from this bank expires soon. To ensure uninterrupted access to your bank transactions and continue sharing data for another term, please Reauthorise",
|
23
|
+
EXPIRED = "Your bank has disconnected because your Access to receiving data from this bank has expired. Please Reauthorise to continue sharing"
|
24
24
|
}
|
@@ -1,13 +1,12 @@
|
|
1
1
|
import { RestMethod, RestService } from '../../rest';
|
2
2
|
import { PropertyValuation as PropertyValuationBase } from '../../../../db/Models';
|
3
3
|
import { PropertyValuation } from '../../../../models';
|
4
|
-
import { Collection } from '../../../../collections';
|
5
4
|
import { PropertyValuationCollection } from '../../../../collections';
|
6
5
|
import * as i0 from "@angular/core";
|
7
6
|
export declare class PropertyValuationService extends RestService<PropertyValuationBase, PropertyValuation, PropertyValuationCollection> {
|
8
7
|
protected endpointUri: string;
|
9
8
|
modelClass: typeof PropertyValuation;
|
10
|
-
collectionClass: typeof
|
9
|
+
collectionClass: typeof PropertyValuationCollection;
|
11
10
|
disabledMethods: RestMethod[];
|
12
11
|
static ɵfac: i0.ɵɵFactoryDeclaration<PropertyValuationService, never>;
|
13
12
|
static ɵprov: i0.ɵɵInjectableDeclaration<PropertyValuationService>;
|
@@ -7,4 +7,4 @@ export * from './sole-depreciation-method/sole-depreciation-method.service';
|
|
7
7
|
export * from './sole-details/sole-details.service';
|
8
8
|
export * from './sole-invoice/sole-invoice.service';
|
9
9
|
export * from './sole-invoice-template/sole-invoice-template.service';
|
10
|
-
export * from './bas-report
|
10
|
+
export * from './bas-report';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { ChartAccountsService, DepreciationService, PropertyService, TransactionService } from '../../http';
|
2
2
|
import { Observable } from 'rxjs';
|
3
|
-
import {
|
4
|
-
import {
|
3
|
+
import { ChartAccountsCollection, CollectionDictionary, DepreciationCollection, PropertyCollection, PropertyReportItemCollection, TransactionCollection } from '../../../collections';
|
4
|
+
import { TransactionBaseFilterForm } from '../../../forms';
|
5
5
|
import * as i0 from "@angular/core";
|
6
6
|
/**
|
7
7
|
* Service to handle Property transactions report items data (get income / expense report items, e.t.c.)
|
@@ -11,7 +11,7 @@ export declare class PropertyTransactionReportService {
|
|
11
11
|
private transactionService;
|
12
12
|
private depreciationService;
|
13
13
|
private chartAccountsService;
|
14
|
-
properties:
|
14
|
+
properties: PropertyCollection;
|
15
15
|
transactions: TransactionCollection;
|
16
16
|
depreciations: DepreciationCollection;
|
17
17
|
chartAccounts: ChartAccountsCollection;
|
@@ -20,6 +20,7 @@ export declare class PropertyTransactionReportService {
|
|
20
20
|
* Get collection of report items based on transactions & depreciations
|
21
21
|
*/
|
22
22
|
get(): Observable<CollectionDictionary<PropertyReportItemCollection>>;
|
23
|
+
filter(filterForm: TransactionBaseFilterForm): CollectionDictionary<PropertyReportItemCollection>;
|
23
24
|
private create;
|
24
25
|
/**
|
25
26
|
* Get collection of property transactions
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { AbstractControl, ValidatorFn } from '@angular/forms';
|
2
|
+
/**
|
3
|
+
* @param controlsFn function to get controls from target parent
|
4
|
+
* it's easier to pass controls instead of function, but it won't work with dynamic fields
|
5
|
+
*/
|
6
|
+
export declare function matchSumValidator(controlsFn: () => AbstractControl[]): ValidatorFn;
|
package/package.json
CHANGED
@@ -1,33 +0,0 @@
|
|
1
|
-
import { ChartAccountsMetaFieldListEnum } from '../db/Enums';
|
2
|
-
/**
|
3
|
-
* Validator that check fields for transaction meta
|
4
|
-
*/
|
5
|
-
export function transactionsMetaFieldsValidator() {
|
6
|
-
return (formGroup) => {
|
7
|
-
const chartAccounts = formGroup.get('chartAccounts').value;
|
8
|
-
if (!chartAccounts) {
|
9
|
-
return null;
|
10
|
-
}
|
11
|
-
const metaFields = chartAccounts.metaFields;
|
12
|
-
if (chartAccounts.isDividends()) {
|
13
|
-
return checkDividends(metaFields, formGroup);
|
14
|
-
}
|
15
|
-
return null;
|
16
|
-
};
|
17
|
-
}
|
18
|
-
/**
|
19
|
-
* the sum of the fields "Franked" and "Unfranked" must equal transactions amount
|
20
|
-
*/
|
21
|
-
function checkDividends(metaFields, formGroup) {
|
22
|
-
const frankedAndUnfrankedIds = [ChartAccountsMetaFieldListEnum.FRANKED, ChartAccountsMetaFieldListEnum.UNFRANKED];
|
23
|
-
const amount = Math.abs(formGroup.get('amount').value);
|
24
|
-
const frankedAndUnfrankedControls = formGroup.get('metaFields').controls
|
25
|
-
.filter((control) => frankedAndUnfrankedIds.includes(control.get('chartAccountsMetaField').value.id));
|
26
|
-
// no need to validate when one or both fields are empty
|
27
|
-
if (frankedAndUnfrankedControls.find((group) => group.get('value').value === null)) {
|
28
|
-
return null;
|
29
|
-
}
|
30
|
-
const frankedAndUnfrankedAmount = frankedAndUnfrankedControls.reduce((sum, group) => sum + (+group.get('value').value), 0);
|
31
|
-
return amount === frankedAndUnfrankedAmount ? null : { wrongAmountsSum: 'The total Franked and Unfranked amounts must equal the Total Payment received.' };
|
32
|
-
}
|
33
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNhY3Rpb25zLW1ldGEtZmllbGRzLnZhbGlkYXRvci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3R0LWNvcmUvc3JjL2xpYi92YWxpZGF0b3JzL3RyYW5zYWN0aW9ucy1tZXRhLWZpZWxkcy52YWxpZGF0b3IudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQ0EsT0FBTyxFQUFFLDhCQUE4QixFQUFFLE1BQU0sYUFBYSxDQ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