taxtank-core 0.33.6 → 0.33.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/esm2022/src/lib/collections/bank-account.collection.mjs +5 -41
  2. package/esm2022/src/lib/collections/depreciation.collection.mjs +15 -21
  3. package/esm2022/src/lib/collections/exportable.collection.mjs +2 -6
  4. package/esm2022/src/lib/collections/property/property.collection.mjs +8 -4
  5. package/esm2022/src/lib/collections/transaction/index.mjs +2 -1
  6. package/esm2022/src/lib/collections/transaction/transaction-base.collection.mjs +4 -0
  7. package/esm2022/src/lib/collections/transaction/transaction.collection.mjs +5 -17
  8. package/esm2022/src/lib/db/Enums/bank/bank-account-type.enum.mjs +2 -2
  9. package/esm2022/src/lib/db/Models/bank/bank-account.mjs +1 -1
  10. package/esm2022/src/lib/db/Models/transaction/transaction-base.mjs +6 -40
  11. package/esm2022/src/lib/forms/property/property-share.form.mjs +2 -2
  12. package/esm2022/src/lib/forms/transaction/transaction-base-filter.form.mjs +7 -2
  13. package/esm2022/src/lib/models/bank/bank-account.mjs +6 -3
  14. package/esm2022/src/lib/models/bank/type-loan.const.mjs +2 -5
  15. package/esm2022/src/lib/models/depreciation/depreciation.mjs +8 -22
  16. package/esm2022/src/lib/models/property/property.mjs +1 -4
  17. package/esm2022/src/lib/models/report/report.interface.mjs +1 -1
  18. package/esm2022/src/lib/models/report/reports.const.mjs +107 -72
  19. package/esm2022/src/lib/models/transaction/transaction.mjs +1 -19
  20. package/esm2022/src/lib/models/user/user.mjs +18 -28
  21. package/esm2022/src/lib/services/http/holding/holding-sale.service.mjs +3 -1
  22. package/esm2022/src/lib/services/http/property/property-sale/property-sale.service.mjs +3 -1
  23. package/esm2022/src/lib/services/http/property/property.service.mjs +3 -2
  24. package/esm2022/src/lib/services/http/transaction/transaction.service.mjs +1 -18
  25. package/fesm2022/taxtank-core.mjs +182 -287
  26. package/fesm2022/taxtank-core.mjs.map +1 -1
  27. package/package.json +1 -1
  28. package/src/lib/collections/bank-account.collection.d.ts +1 -21
  29. package/src/lib/collections/depreciation.collection.d.ts +6 -3
  30. package/src/lib/collections/exportable.collection.d.ts +2 -2
  31. package/src/lib/collections/property/property.collection.d.ts +1 -1
  32. package/src/lib/collections/transaction/index.d.ts +1 -0
  33. package/src/lib/collections/transaction/transaction-base.collection.d.ts +4 -0
  34. package/src/lib/collections/transaction/transaction.collection.d.ts +2 -2
  35. package/src/lib/db/Enums/bank/bank-account-type.enum.d.ts +1 -0
  36. package/src/lib/db/Models/bank/bank-account.d.ts +0 -1
  37. package/src/lib/db/Models/transaction/transaction-base.d.ts +0 -9
  38. package/src/lib/forms/transaction/transaction-base-filter.form.d.ts +3 -2
  39. package/src/lib/models/bank/bank-account.d.ts +1 -0
  40. package/src/lib/models/bank/type-loan.const.d.ts +0 -3
  41. package/src/lib/models/depreciation/depreciation.d.ts +3 -11
  42. package/src/lib/models/property/property.d.ts +0 -1
  43. package/src/lib/models/report/report.interface.d.ts +4 -3
  44. package/src/lib/models/report/reports.const.d.ts +2 -2
  45. package/src/lib/models/transaction/transaction.d.ts +1 -6
  46. package/src/lib/models/user/user.d.ts +2 -14
  47. package/src/lib/services/http/holding/holding-sale.service.d.ts +2 -0
  48. package/src/lib/services/http/property/property-sale/property-sale.service.d.ts +2 -0
  49. package/src/lib/services/http/property/property.service.d.ts +2 -0
  50. package/src/lib/services/http/transaction/transaction.service.d.ts +0 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.33.6",
3
+ "version": "0.33.8",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^17.0.0",
@@ -1,5 +1,4 @@
1
1
  import { Collection } from './collection';
2
- import { BankAccountTypeEnum } from '../db/Enums';
3
2
  import { TankTypeEnum } from '../db/Enums/tank-type.enum';
4
3
  import { BankAccount, BankAccountProperty, Property } from '../models';
5
4
  import { CollectionDictionary } from './collection-dictionary';
@@ -8,14 +7,6 @@ import { LoanCollection } from './loan';
8
7
  * Collection of bank accounts.
9
8
  */
10
9
  export declare class BankAccountCollection extends Collection<BankAccount> {
11
- /**
12
- * get list of bank accounts with passed types
13
- */
14
- getByType(types: BankAccountTypeEnum | BankAccountTypeEnum[], isExclude?: boolean): BankAccount[];
15
- /**
16
- * get amount of current loans
17
- */
18
- getCurrentLoanAmount(): number;
19
10
  /**
20
11
  * get collection filtered by property id
21
12
  */
@@ -30,23 +21,12 @@ export declare class BankAccountCollection extends Collection<BankAccount> {
30
21
  * get collection of active bank accounts
31
22
  */
32
23
  getActive(): BankAccountCollection;
33
- /**
34
- * Get collection of loan bank accounts
35
- */
36
24
  getLoanAccounts(): BankAccountCollection;
25
+ getDebitAccounts(): BankAccountCollection;
37
26
  get loans(): LoanCollection;
38
- getSavingsAccounts(): BankAccountCollection;
39
27
  getOpeningBalance(): number;
40
28
  get currentBalance(): number;
41
29
  get bankShortNames(): string;
42
- /**
43
- * Get Collection of bank accounts with property tank type
44
- */
45
- getPropertyBankAccounts(): BankAccountCollection;
46
- /**
47
- * Get Collection of bank accounts with work tank type
48
- */
49
- getWorkBankAccounts(): BankAccountCollection;
50
30
  /**
51
31
  * Get Collection of bank accounts by tank type
52
32
  */
@@ -1,13 +1,14 @@
1
1
  import { TankTypeEnum } from '../db/Enums/tank-type.enum';
2
- import { Collection } from './collection';
3
2
  import { Depreciation } from '../models';
4
3
  import { DepreciationCapitalProject } from '../models';
5
4
  import { TransactionCollection } from './transaction';
6
5
  import { ChartAccountsCategoryEnum } from '../db/Enums';
7
6
  import { VehicleClaim } from '../models';
8
- export declare class DepreciationCollection extends Collection<Depreciation> {
7
+ import { TransactionBaseCollection } from './transaction';
8
+ import { ExportCell } from '../models/export/export-cell';
9
+ export declare class DepreciationCollection extends TransactionBaseCollection<Depreciation> {
9
10
  getSoleDepreciations(): this;
10
- getNew(): this;
11
+ getCurrentYearBuy(): this;
11
12
  /**
12
13
  * Get total amount of all depreciations in the collection
13
14
  */
@@ -44,4 +45,6 @@ export declare class DepreciationCollection extends Collection<Depreciation> {
44
45
  * Get depreciations by vehicle claim. Only vehicle depreciations may be related to vehicle claim
45
46
  */
46
47
  getByVehicleClaim(vehicleClaim: VehicleClaim): this;
48
+ getExportBody(params: object): ExportCell[][];
49
+ getExportHeader(): string[];
47
50
  }
@@ -1,10 +1,10 @@
1
1
  import { Collection } from './collection';
2
2
  import { ExportDataTable } from '../models/export/export-data-table';
3
3
  import { ExportCell } from '../models/export/export-cell';
4
- import { AbstractModel } from '../db/Models/abstract-model';
4
+ import { AbstractModel } from '../db/Models';
5
5
  export declare abstract class ExportableCollection<Model extends AbstractModel> extends Collection<Model> {
6
6
  abstract getExportHeader(): string[];
7
- abstract getExportBody(params: {}): ExportCell[][];
7
+ abstract getExportBody(params: object): ExportCell[][];
8
8
  getExportFooter(): ExportCell[];
9
9
  getBodyAoa(exportData: any): any;
10
10
  export(params?: any): ExportDataTable;
@@ -20,7 +20,7 @@ export declare class PropertyCollection extends Collection<Property> {
20
20
  get purchasePrice(): number;
21
21
  get growthPercent(): number;
22
22
  get marketValue(): number;
23
- get marketValueGrowth(): number;
23
+ get sharedMarketValue(): number;
24
24
  /**
25
25
  * Get list of unique property categories from collection
26
26
  */
@@ -1,2 +1,3 @@
1
1
  export * from './transaction.collection';
2
2
  export * from './transaction-allocation.collection';
3
+ export * from './transaction-base.collection';
@@ -0,0 +1,4 @@
1
+ import { ExportableCollection } from '../exportable.collection';
2
+ import { TransactionBase } from '../../db/Models';
3
+ export declare abstract class TransactionBaseCollection<Model extends TransactionBase> extends ExportableCollection<Model> {
4
+ }
@@ -2,16 +2,16 @@ import { Dictionary, Transaction, TransactionMetaField, VehicleClaim } from '../
2
2
  import { TransactionAllocationCollection } from './transaction-allocation.collection';
3
3
  import { ChartAccountsCategoryEnum } from '../../db/Enums';
4
4
  import { TankTypeEnum } from '../../db/Enums/tank-type.enum';
5
- import { ExportableCollection } from '../exportable.collection';
6
5
  import { ExportCell } from '../../models/export/export-cell';
7
6
  import { Collection } from '../collection';
8
7
  import { ChartData } from '../../models/chart/chart-data';
9
8
  import { Depreciation } from '../../models';
10
9
  import { SoleInvoiceCollection } from '../sole';
10
+ import { TransactionBaseCollection } from './transaction-base.collection';
11
11
  /**
12
12
  * Collection of transactions
13
13
  */
14
- export declare class TransactionCollection extends ExportableCollection<Transaction> {
14
+ export declare class TransactionCollection extends TransactionBaseCollection<Transaction> {
15
15
  /**
16
16
  * we use depreciations as expense transactions a lot
17
17
  */
@@ -2,6 +2,7 @@ export declare enum BankAccountTypeEnum {
2
2
  TRANSACTION = 1,
3
3
  SAVINGS = 2,
4
4
  CREDIT_CARD = 3,
5
+ MORTGAGE = 4,
5
6
  LOAN = 5,
6
7
  INVESTMENT = 6,
7
8
  TERM_DEPOSIT = 7,
@@ -16,7 +16,6 @@ export declare class BankAccount extends ObservableModel {
16
16
  accountNumber?: string;
17
17
  currentBalance?: number;
18
18
  currency?: string;
19
- isManual?: boolean;
20
19
  migrateFrom?: Date;
21
20
  migrateTo?: Date;
22
21
  lastTransactionDate?: Date;
@@ -25,17 +25,8 @@ export declare abstract class TransactionBase extends ObservableModel {
25
25
  * @TODO remove when AllocateForm is refactored and not merging with Transaction class which cause the issue
26
26
  */
27
27
  set tankType(tankType: TankTypeEnum);
28
- /**
29
- * Check if current tank is Property
30
- */
31
28
  isPropertyTank(): boolean;
32
- /**
33
- * Check if current tank is Work
34
- */
35
29
  isWorkTank(): boolean;
36
- /**
37
- * Check if current tank is Sole
38
- */
39
30
  isSoleTank(): boolean;
40
31
  isHoldingTank(): boolean;
41
32
  isOtherTank(): boolean;
@@ -2,17 +2,18 @@ import { FormControl, FormGroup } from '@angular/forms';
2
2
  import { ControlsInterface } from '../abstract.form';
3
3
  import { Collection } from '../../collections';
4
4
  import { TankTypeEnum } from '../../db/Enums/tank-type.enum';
5
- import { SoleBusiness } from '../../models';
5
+ import { Property, SoleBusiness } from '../../models';
6
6
  import { IEventListener } from '../../interfaces';
7
7
  import { TransactionBase } from '../../db/Models';
8
8
  interface ITransactionBaseFilterControls extends ControlsInterface {
9
9
  tankType: FormControl<TankTypeEnum>;
10
10
  business: FormControl<SoleBusiness>;
11
+ properties: FormControl<Property[]>;
11
12
  dateFrom: FormControl<Date>;
12
13
  dateTo: FormControl<Date>;
13
14
  }
14
15
  export declare class TransactionBaseFilterForm extends FormGroup<ITransactionBaseFilterControls> implements IEventListener {
15
- constructor(tankType?: TankTypeEnum, business?: SoleBusiness);
16
+ constructor(tankType?: TankTypeEnum, business?: SoleBusiness, properties?: Property[]);
16
17
  listenEvents(): void;
17
18
  filter<ModelClass extends TransactionBase, CollectionClass extends Collection<ModelClass>>(collection: CollectionClass): CollectionClass;
18
19
  }
@@ -92,4 +92,5 @@ export declare class BankAccount extends BankAccountBase {
92
92
  * Loan is paid if it has no unallocated transactions and the bank balance is $0.
93
93
  */
94
94
  isLoanPaid(taxTankBalance: number): boolean;
95
+ isManual(): boolean;
95
96
  }
@@ -1,5 +1,2 @@
1
1
  import { BankAccountTypeEnum } from '../../db/Enums';
2
- /**
3
- * @TODO credit card has nothing to do with loan
4
- */
5
2
  export declare const TYPE_LOAN: BankAccountTypeEnum[];
@@ -10,8 +10,8 @@ import { Expense } from '../../interfaces';
10
10
  * @TODO Alex: clarify grouping rules and refactor
11
11
  */
12
12
  export declare class Depreciation extends DepreciationBase implements Expense {
13
- static WRITTEN_OFF_THRESHOLD: number;
14
- static LOW_VALUE_POOL_THRESHOLD: number;
13
+ static writtenOffThreshold: number;
14
+ static lowValuePoolThreshold: number;
15
15
  purchaseDate: Date;
16
16
  date: Date;
17
17
  lowValuePoolDate: Date;
@@ -22,9 +22,6 @@ export declare class Depreciation extends DepreciationBase implements Expense {
22
22
  chartAccounts: ChartAccounts;
23
23
  bankTransaction: BankTransaction;
24
24
  type: DepreciationTypeEnum;
25
- /**
26
- * @TODO remove after ? signs removed from db models
27
- */
28
25
  amount: number;
29
26
  isCapital(): boolean;
30
27
  isBorrowingExpense(): boolean;
@@ -41,10 +38,6 @@ export declare class Depreciation extends DepreciationBase implements Expense {
41
38
  * Check if depreciation chart accounts heading related to vehicles category
42
39
  */
43
40
  isVehicleDepreciation(): boolean;
44
- /**
45
- * Get depreciation purchase date
46
- */
47
- getDate(): Date;
48
41
  /**
49
42
  * @TODO Vik: Research a problem with depreciations without current year forecast
50
43
  */
@@ -52,7 +45,6 @@ export declare class Depreciation extends DepreciationBase implements Expense {
52
45
  getForecastByYear(year: number): DepreciationForecast;
53
46
  getClaimAmountByYear(year: number): number;
54
47
  getCloseBalanceByYear(year: number): number;
55
- isBuildingAtCost(): boolean;
56
48
  /**
57
49
  * Create a new transaction from current depreciation
58
50
  */
@@ -66,5 +58,5 @@ export declare class Depreciation extends DepreciationBase implements Expense {
66
58
  /**
67
59
  * assets purchased in the current financial year
68
60
  */
69
- isNew(): boolean;
61
+ isCurrentYearBuy(): boolean;
70
62
  }
@@ -49,7 +49,6 @@ export declare class Property extends PropertyBase {
49
49
  get forecastedRentalReturn(): number;
50
50
  get forecastedTaxPosition(): number;
51
51
  get forecastedCashPosition(): number;
52
- get marketValueGrowth(): number;
53
52
  get myShare(): PropertyShare;
54
53
  get claimPercent(): number;
55
54
  get claimCoefficient(): number;
@@ -1,7 +1,8 @@
1
- import { UserRolesEnum } from 'taxtank-core/common';
2
1
  export interface IReport {
3
2
  title: string;
4
3
  description: string;
5
- route: string;
6
- roles: UserRolesEnum[];
4
+ routerLink: string;
5
+ queryParams?: {
6
+ [key: string]: number;
7
+ };
7
8
  }
@@ -1,3 +1,3 @@
1
1
  import { IReport } from './report.interface';
2
- import { Collection } from '../../collections';
3
- export declare const REPORTS: Collection<IReport>;
2
+ import { UserRolesEnum } from 'taxtank-core/common';
3
+ export declare const REPORTS: Partial<Record<UserRolesEnum, IReport[]>>;
@@ -1,5 +1,5 @@
1
1
  import { Transaction as TransactionBase } from '../../db/Models/transaction/transaction';
2
- import { ChartAccountsCategoryEnum, ChartAccountsMetaFieldListEnum } from '../../db/Enums';
2
+ import { ChartAccountsMetaFieldListEnum } from '../../db/Enums';
3
3
  import { TransactionOperationEnum } from '../../db/Enums/transaction-operation.enum';
4
4
  import { Property } from '../property';
5
5
  import { ChartAccounts } from '../chart-accounts';
@@ -43,11 +43,6 @@ export declare class Transaction extends TransactionBase implements Expense {
43
43
  isExpense(): boolean;
44
44
  isPersonal(): boolean;
45
45
  isInterest(): boolean;
46
- get chartAccountsCategories(): ChartAccountsCategoryEnum[];
47
- /**
48
- * Get transaction date
49
- */
50
- getDate(): Date;
51
46
  /**
52
47
  * Check if transaction type is vehicle
53
48
  */
@@ -5,10 +5,10 @@ import { ClientDetails } from '../client';
5
5
  import { EmployeeDetails } from '../employee/employee-details';
6
6
  import { Phone } from '../phone/phone';
7
7
  import { ServiceSubscription } from '../service-subscription';
8
- import { ServiceSubscriptionItem } from '../service-subscription';
9
8
  import { SoleDetails } from '../sole';
10
9
  import { AppFile } from '../file';
11
10
  import { AccountSetupItem } from '../account-setup/account-setup-item';
11
+ import { TankTypeEnum } from '../../db/Enums/tank-type.enum';
12
12
  export declare class User extends BaseUser {
13
13
  subscriptions: ServiceSubscription[];
14
14
  clientDetails: ClientDetails;
@@ -33,6 +33,7 @@ export declare class User extends BaseUser {
33
33
  * search roles including hierarchy
34
34
  */
35
35
  hasRoles(roles: UserRolesEnum | UserRolesEnum[]): boolean;
36
+ getTankTypes(): TankTypeEnum[];
36
37
  isOnboarding(): boolean;
37
38
  isInactive(): boolean;
38
39
  hasSubscription(): boolean;
@@ -48,19 +49,6 @@ export declare class User extends BaseUser {
48
49
  isFirmOwner(): boolean;
49
50
  isTopManager(): boolean;
50
51
  isManager(): boolean;
51
- /**
52
- * check if user has property tank access
53
- */
54
- hasPropertyTank(): boolean;
55
- /**
56
- * check if user has property tank access
57
- */
58
- hasWorkTank(): boolean;
59
- /**
60
- * Get user subscription role by provided role type
61
- * @param roleType by which role should be returned
62
- */
63
- getSubscriptionRole(roleType: UserRolesEnum): ServiceSubscriptionItem;
64
52
  isCurrentFinancialYear(): boolean;
65
53
  /**
66
54
  * financial years available in the app for user
@@ -2,12 +2,14 @@ import { HoldingSale as HoldingSaleBase } from '../../../db/Models';
2
2
  import { HoldingSale } from '../../../models';
3
3
  import { RestMethod, RestService } from '../rest';
4
4
  import { HoldingSaleCollection } from '../../../collections';
5
+ import { UserRolesEnum } from 'taxtank-core/common';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class HoldingSaleService extends RestService<HoldingSaleBase, HoldingSale, HoldingSaleCollection> {
7
8
  modelClass: typeof HoldingSale;
8
9
  collectionClass: typeof HoldingSaleCollection;
9
10
  endpointUri: string;
10
11
  disabledMethods: RestMethod[];
12
+ roles: UserRolesEnum[];
11
13
  static ɵfac: i0.ɵɵFactoryDeclaration<HoldingSaleService, never>;
12
14
  static ɵprov: i0.ɵɵInjectableDeclaration<HoldingSaleService>;
13
15
  }
@@ -2,12 +2,14 @@ import { PropertySale as PropertySaleBase } from '../../../../db/Models';
2
2
  import { PropertySale } from '../../../../models';
3
3
  import { RestMethod, RestService } from '../../rest';
4
4
  import { PropertySaleCollection } from '../../../../collections';
5
+ import { UserRolesEnum } from 'taxtank-core/common';
5
6
  import * as i0 from "@angular/core";
6
7
  export declare class PropertySaleService extends RestService<PropertySaleBase, PropertySale, PropertySaleCollection> {
7
8
  modelClass: typeof PropertySale;
8
9
  collectionClass: typeof PropertySaleCollection;
9
10
  endpointUri: string;
10
11
  disabledMethods: RestMethod[];
12
+ roles: UserRolesEnum[];
11
13
  static ɵfac: i0.ɵɵFactoryDeclaration<PropertySaleService, never>;
12
14
  static ɵprov: i0.ɵɵInjectableDeclaration<PropertySaleService>;
13
15
  }
@@ -4,6 +4,7 @@ import { Property } from '../../../models';
4
4
  import { IEventListener } from '../../../interfaces';
5
5
  import { RestMethod, RestService } from '../rest';
6
6
  import { PropertyCollection } from '../../../collections';
7
+ import { UserRolesEnum } from 'taxtank-core/common';
7
8
  import * as i0 from "@angular/core";
8
9
  /**
9
10
  * @Todo Alex remove functionality related to PropertyShare
@@ -16,6 +17,7 @@ export declare class PropertyService extends RestService<PropertyBase, Property,
16
17
  collectionClass: typeof PropertyCollection;
17
18
  endpointUri: string;
18
19
  disabledMethods: RestMethod[];
20
+ roles: UserRolesEnum[];
19
21
  constructor(environment: any);
20
22
  /**
21
23
  * @TODO remove when forecast moved to separated api
@@ -69,12 +69,6 @@ export declare class TransactionService extends RestService<TransactionBase, Tra
69
69
  * @param model
70
70
  */
71
71
  delete(model: Transaction): Observable<void>;
72
- /**
73
- * @TODO Alex wrong place for this logic, move to model
74
- * calculate gross income amount based on transaction amount and taxes (fees)
75
- * @param transaction Transaction instance for calculation
76
- */
77
- calculateGrossAmount(transaction: Transaction): number;
78
72
  /**
79
73
  * Listen to EventDispatcherService event related to Depreciation changing
80
74
  */