taxtank-core 0.28.65 → 0.28.66

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.
Files changed (41) hide show
  1. package/bundles/taxtank-core.umd.js +310 -74
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/depreciation.collection.js +17 -1
  4. package/esm2015/lib/collections/transaction/transaction-base.collection.js +13 -1
  5. package/esm2015/lib/collections/transaction/transaction.collection.js +36 -8
  6. package/esm2015/lib/db/Enums/annual-frequency.enum.js +9 -0
  7. package/esm2015/lib/db/Enums/index.js +2 -1
  8. package/esm2015/lib/db/Models/sole/bas-report.js +3 -0
  9. package/esm2015/lib/db/Models/sole/sole-details.js +1 -1
  10. package/esm2015/lib/db/Models/transaction/transaction-base.js +25 -4
  11. package/esm2015/lib/forms/abstract.form.js +5 -2
  12. package/esm2015/lib/forms/sole/bas-report.form.js +62 -0
  13. package/esm2015/lib/forms/sole/index.js +2 -1
  14. package/esm2015/lib/models/depreciation/depreciation.js +25 -3
  15. package/esm2015/lib/models/report/property/property-report-item-transaction.js +2 -2
  16. package/esm2015/lib/models/sole/bas-report.js +21 -0
  17. package/esm2015/lib/models/sole/index.js +2 -1
  18. package/esm2015/lib/models/transaction/transaction.js +21 -42
  19. package/esm2015/lib/services/http/sole/bas-report/bas-report.service.js +21 -0
  20. package/esm2015/lib/services/http/sole/index.js +2 -1
  21. package/esm2015/lib/services/http/sole/sole-invoice/sole-invoice.service.js +1 -2
  22. package/fesm2015/taxtank-core.js +248 -64
  23. package/fesm2015/taxtank-core.js.map +1 -1
  24. package/lib/collections/depreciation.collection.d.ts +11 -0
  25. package/lib/collections/transaction/transaction-base.collection.d.ts +7 -0
  26. package/lib/collections/transaction/transaction.collection.d.ts +19 -2
  27. package/lib/db/Enums/annual-frequency.enum.d.ts +7 -0
  28. package/lib/db/Enums/index.d.ts +1 -0
  29. package/lib/db/Models/sole/bas-report.d.ts +15 -0
  30. package/lib/db/Models/sole/sole-details.d.ts +2 -0
  31. package/lib/db/Models/transaction/transaction-base.d.ts +6 -2
  32. package/lib/forms/abstract.form.d.ts +1 -0
  33. package/lib/forms/sole/bas-report.form.d.ts +16 -0
  34. package/lib/forms/sole/index.d.ts +1 -0
  35. package/lib/models/depreciation/depreciation.d.ts +5 -0
  36. package/lib/models/sole/bas-report.d.ts +10 -0
  37. package/lib/models/sole/index.d.ts +1 -0
  38. package/lib/models/transaction/transaction.d.ts +7 -16
  39. package/lib/services/http/sole/bas-report/bas-report.service.d.ts +11 -0
  40. package/lib/services/http/sole/index.d.ts +1 -0
  41. package/package.json +1 -1
@@ -5,7 +5,18 @@ import { DepreciationCapitalProject } from '../models/depreciation/depreciation-
5
5
  import { TransactionCollection } from './transaction/transaction.collection';
6
6
  import { ChartAccountsCategoryEnum } from '../db/Enums/chart-accounts-category.enum';
7
7
  import { VehicleClaim } from '../models';
8
+ /**
9
+ * @TODO extend from TransactionBaseCollection
10
+ */
8
11
  export declare class DepreciationCollection extends Collection<Depreciation> {
12
+ /**
13
+ * Get business related transactions
14
+ */
15
+ getWithBusiness(): this;
16
+ /**
17
+ * assets purchased in the current financial year
18
+ */
19
+ getNew(): this;
9
20
  /**
10
21
  * Get total amount of all depreciations in the collection
11
22
  */
@@ -1,9 +1,16 @@
1
1
  import { TransactionBase } from '../../db/Models/transaction/transaction-base';
2
2
  import { Collection } from '../collection';
3
+ import { SoleBusiness } from '../../models';
4
+ /**
5
+ * used to combine transactions/depreciations
6
+ */
3
7
  export declare class TransactionBaseCollection extends Collection<TransactionBase> {
8
+ filterByBusiness(business: SoleBusiness): this;
4
9
  getClaimAmountByBusinessId(businessId: number): number;
5
10
  /**
6
11
  * Get business related transactions
7
12
  */
8
13
  getWithBusiness(): this;
14
+ getIncomeTransactions(): this;
15
+ getExpenseTransactions(): this;
9
16
  }
@@ -8,10 +8,21 @@ import { Collection } from '../collection';
8
8
  import { TransactionMetadata } from '../../models/transaction/transaction-metadata';
9
9
  import { VehicleClaim } from '../../models';
10
10
  import { ChartData } from '../../models/chart/chart-data';
11
+ import { Depreciation } from '../../models/depreciation/depreciation';
11
12
  /**
13
+ * @TODO extend from TransactionBaseCollection
12
14
  * Collection of transactions
13
15
  */
14
16
  export declare class TransactionCollection extends ExportableCollection<Transaction> {
17
+ /**
18
+ * @TODO use TransactionBaseCollection instead
19
+ * we use depreciations as expense transactions a lot
20
+ */
21
+ constructor(transactions?: Transaction[], depreciations?: Depreciation[]);
22
+ /**
23
+ * Get business related transactions
24
+ */
25
+ getWithBusiness(): this;
15
26
  /**
16
27
  * Get total amount of all transactions in the collection
17
28
  */
@@ -34,7 +45,6 @@ export declare class TransactionCollection extends ExportableCollection<Transact
34
45
  * Get summary of claim amounts
35
46
  */
36
47
  get claimAmount(): number;
37
- get grossAmount(): number;
38
48
  getByChartAccountsCategories(categories: ChartAccountsCategoryEnum[]): TransactionCollection;
39
49
  /**
40
50
  * Get transactions by month
@@ -46,8 +56,8 @@ export declare class TransactionCollection extends ExportableCollection<Transact
46
56
  */
47
57
  getTransactionsMetadata(): Collection<TransactionMetadata>;
48
58
  getIncomeTransactions(): TransactionCollection;
49
- get claimIncome(): number;
50
59
  getExpenseTransactions(): TransactionCollection;
60
+ get claimIncome(): number;
51
61
  get claimExpense(): number;
52
62
  getInterestTransactions(): TransactionCollection;
53
63
  get claimInterest(): number;
@@ -98,4 +108,11 @@ export declare class TransactionCollection extends ExportableCollection<Transact
98
108
  * Chart data for each month from fin year start till current month
99
109
  */
100
110
  getCashPositionChartData(): ChartData[];
111
+ /**
112
+ * user pays GST only from allocated part of income (the rest user didn't get, so don't have to pay)
113
+ *
114
+ * @param allocations
115
+ */
116
+ calculateAllocatedGST(allocations: TransactionAllocationCollection): number;
117
+ getAllocatedAmount(allocations: TransactionAllocationCollection): number;
101
118
  }
@@ -0,0 +1,7 @@
1
+ export declare enum AnnualFrequencyEnum {
2
+ ANNUAL = 1,
3
+ QUARTERLY = 3,
4
+ MONTHLY = 12,
5
+ FORTNIGHTLY = 26,
6
+ WEEKLY = 52
7
+ }
@@ -1 +1,2 @@
1
1
  export * from './document-type.enum';
2
+ export * from './annual-frequency.enum';
@@ -0,0 +1,15 @@
1
+ import { User } from '../user/user';
2
+ export declare class BasReport {
3
+ dateFrom?: Date;
4
+ dateTo?: Date;
5
+ income?: number;
6
+ incomeGST?: number;
7
+ expenseGST?: number;
8
+ salary?: number;
9
+ taxWithheldSalary?: number;
10
+ taxWithheldNoABN?: number;
11
+ paygTaxInstalment?: number;
12
+ fuelTaxCredit?: number;
13
+ id?: number;
14
+ user?: User;
15
+ }
@@ -1,5 +1,6 @@
1
1
  import { User } from '../user/user';
2
2
  import { AbstractModel } from '../abstract-model';
3
+ import { AnnualFrequencyEnum } from '../../Enums/annual-frequency.enum';
3
4
  export declare class SoleDetails extends AbstractModel {
4
5
  abn?: string;
5
6
  id?: number;
@@ -8,4 +9,5 @@ export declare class SoleDetails extends AbstractModel {
8
9
  updatedAt?: Date;
9
10
  deletedAt?: Date;
10
11
  user?: User;
12
+ reportingFrequency?: AnnualFrequencyEnum;
11
13
  }
@@ -21,6 +21,7 @@ export declare class TransactionBase extends AbstractModel {
21
21
  */
22
22
  file: File;
23
23
  claimPercent?: number;
24
+ get claimRatio(): number;
24
25
  get tankType(): TankTypeEnum;
25
26
  /**
26
27
  * Check if current tank is Property
@@ -34,6 +35,9 @@ export declare class TransactionBase extends AbstractModel {
34
35
  * Check if current tank is Sole
35
36
  */
36
37
  isSoleTank(): boolean;
37
- getAmountWithGst(): number;
38
- getGstAmount(): number;
38
+ get amountWithGst(): number;
39
+ get gstAmount(): number;
40
+ get gstClaimAmount(): number;
41
+ get grossAmount(): number;
42
+ get grossClaimAmount(): number;
39
43
  }
@@ -10,6 +10,7 @@ export declare abstract class AbstractForm<Model> extends FormGroup {
10
10
  * Initial form value for comparison with changes to check saved/unsaved state
11
11
  */
12
12
  initialValue: Model;
13
+ submitDisabledFields: boolean;
13
14
  protected modelClass: Type<Model>;
14
15
  model: Model;
15
16
  submitted: boolean;
@@ -0,0 +1,16 @@
1
+ import { AbstractForm } from '../abstract.form';
2
+ import { BasReport } from '../../models';
3
+ import { TransactionAllocationCollection, TransactionCollection } from '../../collections';
4
+ import { DepreciationCollection } from '../../collections/depreciation.collection';
5
+ /**
6
+ * business activity statement report
7
+ * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/268533936/BAS+Report
8
+ */
9
+ export declare class BasReportForm extends AbstractForm<BasReport> {
10
+ private report;
11
+ submitDisabledFields: boolean;
12
+ /**
13
+ * @TODO vik TransactionBaseCollection here and everywhere
14
+ */
15
+ constructor(report: BasReport, transactions: TransactionCollection, allocations: TransactionAllocationCollection, depreciations: DepreciationCollection);
16
+ }
@@ -7,3 +7,4 @@ export * from './sole-details.form';
7
7
  export * from './sole-invoice.form';
8
8
  export * from './sole-invoice-item.form';
9
9
  export * from './sole-invoice-template.form';
10
+ export * from './bas-report.form';
@@ -64,4 +64,9 @@ export declare class Depreciation extends DepreciationBase implements Expense, I
64
64
  * @TODO Michael: remove and check everywhere in reports
65
65
  */
66
66
  get claimAmount(): number;
67
+ get amountWithGst(): number;
68
+ /**
69
+ * @TODO temporary hack, in future backend should return negative numbers
70
+ */
71
+ get grossAmount(): number;
67
72
  }
@@ -0,0 +1,10 @@
1
+ import { BasReport as BasReportBase } from "../../db/Models/sole/bas-report";
2
+ export declare class BasReport extends BasReportBase {
3
+ dateFrom: Date;
4
+ dateTo: Date;
5
+ get taxWithheldTotal(): number;
6
+ /**
7
+ * GST payable to the ATO, or refundable from the ATO in case it's negative
8
+ */
9
+ get gst(): number;
10
+ }
@@ -10,3 +10,4 @@ export * from './sole-invoice';
10
10
  export * from './sole-invoice-item';
11
11
  export * from './sole-invoice-send-data.interface';
12
12
  export * from './sole-invoice-template';
13
+ export * from './bas-report';
@@ -33,9 +33,16 @@ export declare class Transaction extends TransactionBase implements Expense, IRe
33
33
  amount: number;
34
34
  isDebit(): boolean;
35
35
  isCredit(): boolean;
36
+ /**
37
+ * @TODO move to base collection
38
+ */
36
39
  isIncome(): boolean;
40
+ /**
41
+ * @TODO move to base collection
42
+ */
37
43
  isExpense(): boolean;
38
44
  isPersonal(): boolean;
45
+ isInterest(): boolean;
39
46
  get chartAccountsCategories(): ChartAccountsCategoryEnum[];
40
47
  /**
41
48
  * Check if transaction has 'Kms travelled for work' chart accounts category
@@ -49,15 +56,6 @@ export declare class Transaction extends TransactionBase implements Expense, IRe
49
56
  * Check if transaction type is vehicle
50
57
  */
51
58
  isVehicleTransaction(): boolean;
52
- /**
53
- * Get net amount (clean amount after all deductions)
54
- * @TODO Alex: remove, this.amount should be netAmount actually
55
- */
56
- getNetAmount(): number;
57
- /**
58
- * Get gross income amount
59
- */
60
- getGrossIncome(): number;
61
59
  get taxFreeComponent(): number;
62
60
  get frankingCredit(): number;
63
61
  get eligibleForReduction(): number;
@@ -77,12 +75,6 @@ export declare class Transaction extends TransactionBase implements Expense, IRe
77
75
  * @Todo modify 'metadata' property from array to Collection
78
76
  */
79
77
  getMetadataFieldValue(field: ChartAccountsMetadataListEnum): number;
80
- /**
81
- * Returns Net or Gross income amount based on provided income type
82
- * @param incomeType by which amount should be returned
83
- */
84
- private getIncomeAmountByType;
85
- isInterest(): boolean;
86
78
  isCash(): boolean;
87
79
  /**
88
80
  * Create Depreciation instance based on Transaction
@@ -102,7 +94,6 @@ export declare class Transaction extends TransactionBase implements Expense, IRe
102
94
  getUnallocatedAmount(allocations: TransactionAllocationCollection): number;
103
95
  /**
104
96
  * Total transaction amount including taxes and other additional amounts
105
- * @TODO Alex: refactor everything related to amounts
106
97
  */
107
98
  get grossAmount(): number;
108
99
  }
@@ -0,0 +1,11 @@
1
+ import { RestService } from '../../rest/rest.service';
2
+ import { BasReport as BasReportBase } from '../../../../db/Models/sole/bas-report';
3
+ import { BasReport } from '../../../../models';
4
+ import * as i0 from "@angular/core";
5
+ export declare class BasReportService extends RestService<BasReportBase, BasReport> {
6
+ modelClass: typeof BasReport;
7
+ url: string;
8
+ isHydra: boolean;
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<BasReportService, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<BasReportService>;
11
+ }
@@ -7,3 +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/bas-report.service';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.28.65",
3
+ "version": "0.28.66",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^12.2.3 || ~13.0.0",