taxtank-core 0.16.13 → 0.17.2

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 (80) hide show
  1. package/bundles/taxtank-core.umd.js +363 -383
  2. package/bundles/taxtank-core.umd.js.map +1 -1
  3. package/esm2015/lib/collections/bank-transaction.collection.js +1 -1
  4. package/esm2015/lib/collections/depreciation.collection.js +2 -2
  5. package/esm2015/lib/collections/exportable.collection.js +17 -0
  6. package/esm2015/lib/collections/loan/loan-payment.collection.js +31 -0
  7. package/esm2015/lib/collections/loan/loan.collection.js +18 -0
  8. package/esm2015/lib/collections/report/property/property-report-item-transaction.collection.js +1 -1
  9. package/esm2015/lib/collections/report/vehicle-expense/vehicle-expense.collection.js +1 -1
  10. package/esm2015/lib/collections/tax-summary/report-item.collection.js +50 -120
  11. package/esm2015/lib/collections/tax-summary/tax-return-categories.const.js +65 -0
  12. package/esm2015/lib/collections/transaction/transaction-allocation.collection.js +40 -0
  13. package/esm2015/lib/collections/transaction/transaction.collection.js +167 -0
  14. package/esm2015/lib/db/Enums/tax-return-category-list.enum.js +21 -7
  15. package/esm2015/lib/models/bank/bank-transaction.js +1 -1
  16. package/esm2015/lib/models/export/export-cell-type.enum.js +10 -0
  17. package/esm2015/lib/models/export/export-cell.js +6 -0
  18. package/esm2015/lib/models/export/export-data-table.js +1 -7
  19. package/esm2015/lib/models/income-source/income-source-chart-data.js +1 -1
  20. package/esm2015/lib/models/loan/loan-payment.js +2 -24
  21. package/esm2015/lib/models/logbook/vehicle-claim.js +1 -1
  22. package/esm2015/lib/models/property/property-equity-chart-data.js +1 -1
  23. package/esm2015/lib/models/property/property-sale/property-sale.js +10 -1
  24. package/esm2015/lib/models/report/property/property-report-item-transaction.js +1 -1
  25. package/esm2015/lib/models/tax-summary/report-item.js +8 -1
  26. package/esm2015/lib/models/tax-summary/tax-summary.js +28 -9
  27. package/esm2015/lib/models/transaction/transaction.js +1 -1
  28. package/esm2015/lib/services/account-setup/account-setup.service.js +2 -2
  29. package/esm2015/lib/services/bank/bank-account-calculation.service.js +1 -1
  30. package/esm2015/lib/services/bank/bank-transaction-calculation.service.js +1 -1
  31. package/esm2015/lib/services/export/export-formatter.service.js +31 -0
  32. package/esm2015/lib/services/pdf/pdf.service.js +9 -4
  33. package/esm2015/lib/services/property/property-calculation/property-calculation.service.js +1 -1
  34. package/esm2015/lib/services/report/property/property-transaction-report.service.js +2 -2
  35. package/esm2015/lib/services/transaction/transaction-calculation.service.js +2 -2
  36. package/esm2015/public-api.js +8 -10
  37. package/fesm2015/taxtank-core.js +301 -286
  38. package/fesm2015/taxtank-core.js.map +1 -1
  39. package/lib/collections/bank-transaction.collection.d.ts +1 -1
  40. package/lib/collections/depreciation.collection.d.ts +1 -1
  41. package/lib/collections/exportable.collection.d.ts +9 -0
  42. package/lib/collections/loan/loan-payment.collection.d.ts +7 -0
  43. package/lib/collections/{loan.collection.d.ts → loan/loan.collection.d.ts} +2 -2
  44. package/lib/collections/report/property/property-report-item-transaction.collection.d.ts +1 -1
  45. package/lib/collections/report/vehicle-expense/vehicle-expense.collection.d.ts +1 -1
  46. package/lib/collections/tax-summary/report-item.collection.d.ts +17 -51
  47. package/lib/collections/tax-summary/tax-return-categories.const.d.ts +6 -0
  48. package/lib/collections/{transaction-allocation.collection.d.ts → transaction/transaction-allocation.collection.d.ts} +6 -6
  49. package/lib/collections/{transaction.collection.d.ts → transaction/transaction.collection.d.ts} +9 -5
  50. package/lib/db/Enums/tax-return-category-list.enum.d.ts +20 -6
  51. package/lib/models/bank/bank-transaction.d.ts +1 -1
  52. package/lib/models/export/export-cell-type.enum.d.ts +8 -0
  53. package/lib/models/export/export-cell.d.ts +8 -0
  54. package/lib/models/export/export-data-table.d.ts +3 -2
  55. package/lib/models/income-source/income-source-chart-data.d.ts +1 -1
  56. package/lib/models/loan/loan-payment.d.ts +1 -5
  57. package/lib/models/logbook/vehicle-claim.d.ts +1 -1
  58. package/lib/models/property/property-equity-chart-data.d.ts +1 -1
  59. package/lib/models/property/property-sale/property-sale.d.ts +3 -0
  60. package/lib/models/report/property/property-report-item-transaction.d.ts +1 -1
  61. package/lib/models/tax-summary/report-item.d.ts +3 -2
  62. package/lib/models/transaction/transaction.d.ts +1 -1
  63. package/lib/services/bank/bank-account-calculation.service.d.ts +1 -1
  64. package/lib/services/bank/bank-transaction-calculation.service.d.ts +1 -1
  65. package/lib/services/export/export-formatter.service.d.ts +11 -0
  66. package/lib/services/pdf/pdf.service.d.ts +3 -0
  67. package/lib/services/property/property-calculation/property-calculation.service.d.ts +2 -2
  68. package/lib/services/report/property/property-transaction-report.service.d.ts +1 -1
  69. package/lib/services/transaction/transaction-calculation.service.d.ts +2 -2
  70. package/package.json +1 -1
  71. package/public-api.d.ts +7 -9
  72. package/esm2015/lib/collections/loan.collection.js +0 -18
  73. package/esm2015/lib/collections/transaction-allocation.collection.js +0 -40
  74. package/esm2015/lib/collections/transaction.collection.js +0 -143
  75. package/esm2015/lib/interfaces/exportable.interface.js +0 -2
  76. package/esm2015/lib/services/data-table/data-table.service.js +0 -47
  77. package/esm2015/lib/services/property/property-holding-costs/property-holding-costs.service.js +0 -53
  78. package/lib/interfaces/exportable.interface.d.ts +0 -9
  79. package/lib/services/data-table/data-table.service.d.ts +0 -19
  80. package/lib/services/property/property-holding-costs/property-holding-costs.service.d.ts +0 -24
@@ -4,7 +4,7 @@ import { IncomeSource } from '../models/income-source/income-source';
4
4
  import { BankAccount } from '../models/bank/bank-account';
5
5
  import { Collection } from './collection';
6
6
  import { CollectionDictionary } from './collection-dictionary';
7
- import { TransactionAllocationCollection } from './transaction-allocation.collection';
7
+ import { TransactionAllocationCollection } from './transaction/transaction-allocation.collection';
8
8
  /**
9
9
  * Collection of bank transactions.
10
10
  * IMPORTANT: Create this collection based on bank transactions from TransactionAllocationService
@@ -2,7 +2,7 @@ import { TankTypeEnum } from '../db/Enums/tank-type.enum';
2
2
  import { Collection } from './collection';
3
3
  import { Depreciation } from '../models/depreciation/depreciation';
4
4
  import { DepreciationCapitalProject } from '../models/depreciation/depreciation-capital-project';
5
- import { TransactionCollection } from './transaction.collection';
5
+ import { TransactionCollection } from './transaction/transaction.collection';
6
6
  import { ChartAccountsCategoryEnum } from '../db/Enums/chart-accounts-category.enum';
7
7
  export declare class DepreciationCollection extends Collection<Depreciation> {
8
8
  /**
@@ -0,0 +1,9 @@
1
+ import { Collection } from './collection';
2
+ import { ExportDataTable } from '../models/export/export-data-table';
3
+ import { ExportCell } from '../models/export/export-cell';
4
+ export declare abstract class ExportableCollection<Model extends object> extends Collection<Model> {
5
+ abstract getExportHeader(type?: string): string[];
6
+ abstract getExportBody(type?: string): ExportCell[][];
7
+ getExportFooter(type?: string): ExportCell[];
8
+ export(type?: string): ExportDataTable;
9
+ }
@@ -0,0 +1,7 @@
1
+ import { ExportableCollection } from '../exportable.collection';
2
+ import { ExportCell } from '../../models/export/export-cell';
3
+ import { LoanPayment } from '../../models/loan/loan-payment';
4
+ export declare class LoanPaymentCollection extends ExportableCollection<LoanPayment> {
5
+ getExportHeader(): string[];
6
+ getExportBody(): ExportCell[][];
7
+ }
@@ -1,5 +1,5 @@
1
- import { Collection } from './collection';
2
- import { Loan } from '../models/loan/loan';
1
+ import { Collection } from '../collection';
2
+ import { Loan } from '../../models/loan/loan';
3
3
  export declare class LoanCollection extends Collection<Loan> {
4
4
  /**
5
5
  * Get new collection of loans filtered by bank accounts ids
@@ -1,5 +1,5 @@
1
1
  import { Collection } from '../../collection';
2
- import { TransactionCollection } from '../../transaction.collection';
2
+ import { TransactionCollection } from '../../transaction/transaction.collection';
3
3
  import { ChartAccounts } from '../../../models/chart-accounts/chart-accounts';
4
4
  import { PropertyReportItemCollection } from './property-report-item.collection';
5
5
  import { PropertyCollection } from '../../property/property.collection';
@@ -1,6 +1,6 @@
1
1
  import { Collection } from '../../collection';
2
2
  import { VehicleExpense } from '../../../models/report/vehicle-expense/vehicle-expense';
3
- import { TransactionCollection } from '../../transaction.collection';
3
+ import { TransactionCollection } from '../../transaction/transaction.collection';
4
4
  import { DepreciationCollection } from '../../depreciation.collection';
5
5
  import { VehicleClaim } from '../../../models/logbook/vehicle-claim';
6
6
  export declare class VehicleExpenseCollection extends Collection<VehicleExpense> {
@@ -1,68 +1,34 @@
1
1
  import { Collection } from '../collection';
2
2
  import { ReportItem } from '../../models/tax-summary/report-item';
3
- import { TaxReturnCategorySectionEnum } from '../../db/Enums/tax-return-category-section.enum';
3
+ import { TaxReturnCategoryListEnum } from '../../db/Enums/tax-return-category-list.enum';
4
+ import { ReportItemDetails } from '../../models/tax-summary/report-item-details';
5
+ import { TaxSummarySectionEnum } from '../../db/Enums/tax-summary-section.enum';
6
+ import { IncomeSource } from '../../models/income-source/income-source';
4
7
  /**
5
8
  * collection for tax return category items
6
9
  */
7
10
  export declare class ReportItemCollection extends Collection<ReportItem> {
8
11
  /**
9
- * Work income
12
+ * Recursively get collection of report items by Tax Summary Section.
13
+ * Search items which has details
10
14
  */
11
- get salary(): number;
15
+ getBySection(section: TaxSummarySectionEnum): ReportItemCollection;
12
16
  /**
13
- * Work expenses
17
+ * Recursively find report item by Tax Return Category ID
14
18
  */
15
- get workExpenses(): number;
19
+ findByCategory(categoryId: TaxReturnCategoryListEnum): ReportItem;
16
20
  /**
17
- * Property income
21
+ * Get Collection of report items by Tax Return Categories IDs
18
22
  */
19
- get rentalIncome(): number;
23
+ getByCategories(categories: TaxReturnCategoryListEnum[]): ReportItemCollection;
20
24
  /**
21
- * Property rental deductions
25
+ * A short call to a chain of methods that we often use.
26
+ * Get total amount of report items by Tax Return categories and Tax Summary Section.
22
27
  */
23
- get rentalDeductions(): number;
28
+ sumByCategoriesAndSection(categories: TaxReturnCategoryListEnum[], section: TaxSummarySectionEnum): number;
24
29
  /**
25
- * Property expenses
30
+ * Get collection of all report item details related to passed income source
31
+ * @TODO Alex: consider to create and move to ReportItemDetailsCollection
26
32
  */
27
- get propertyExpenses(): number;
28
- /**
29
- * Property interest
30
- */
31
- get interestDeductions(): number;
32
- /**
33
- * Property capital works depreciations
34
- */
35
- get capitalWorks(): number;
36
- /**
37
- * Property plant & equipment depreciations
38
- */
39
- get plantEquipment(): number;
40
- /**
41
- * Total property depreciaions
42
- */
43
- get propertyDepreciations(): number;
44
- get partnershipsAndTrusts(): number;
45
- get pciAndSbeIncome(): number;
46
- get capitalGains(): number;
47
- get foreignSourceIncome(): number;
48
- /**
49
- * Other income
50
- */
51
- get otherIncome(): number;
52
- /**
53
- * Other expenses
54
- */
55
- get otherDeductions(): number;
56
- get taxInstalments(): number;
57
- get frankingCredits(): number;
58
- get taxOffsets(): number;
59
- get borrowingExpenses(): number;
60
- get grossTaxPayable(): number;
61
- /**
62
- * taxWithheld by section (work or other)
63
- */
64
- getTaxWithheld(section?: TaxReturnCategorySectionEnum): number;
65
- getTaxCreditsCollection(): ReportItemCollection;
66
- getTotalAmountByIncomeSourceName(name: string): number;
67
- private getByCategory;
33
+ getDetailsByIncomeSource(incomeSource: IncomeSource): Collection<ReportItemDetails>;
68
34
  }
@@ -0,0 +1,6 @@
1
+ import { TaxReturnCategoryListEnum } from '../../db/Enums/tax-return-category-list.enum';
2
+ export declare const TAX_RETURN_CATEGORIES: {
3
+ [key: string]: {
4
+ [key: string]: TaxReturnCategoryListEnum[];
5
+ };
6
+ };
@@ -1,9 +1,9 @@
1
- import { Collection } from './collection';
2
- import { TransactionAllocation } from '../models/transaction/transaction-allocation';
3
- import { BankTransactionCollection } from './bank-transaction.collection';
4
- import { CollectionDictionary } from './collection-dictionary';
5
- import { Transaction } from '../models/transaction/transaction';
6
- import { BankTransaction } from '../models/bank/bank-transaction';
1
+ import { Collection } from '../collection';
2
+ import { TransactionAllocation } from '../../models/transaction/transaction-allocation';
3
+ import { BankTransactionCollection } from '../bank-transaction.collection';
4
+ import { CollectionDictionary } from '../collection-dictionary';
5
+ import { Transaction } from '../../models/transaction/transaction';
6
+ import { BankTransaction } from '../../models/bank/bank-transaction';
7
7
  export declare class TransactionAllocationCollection extends Collection<TransactionAllocation> {
8
8
  get amount(): number;
9
9
  getByTransactionsIds(ids: number[]): TransactionAllocationCollection;
@@ -1,12 +1,13 @@
1
- import { Collection } from './collection';
2
- import { Transaction } from '../models/transaction/transaction';
1
+ import { Transaction } from '../../models/transaction/transaction';
3
2
  import { TransactionAllocationCollection } from './transaction-allocation.collection';
4
- import { ChartAccountsCategoryEnum } from '../db/Enums/chart-accounts-category.enum';
5
- import { TankTypeEnum } from '../db/Enums/tank-type.enum';
3
+ import { ChartAccountsCategoryEnum } from '../../db/Enums/chart-accounts-category.enum';
4
+ import { TankTypeEnum } from '../../db/Enums/tank-type.enum';
5
+ import { ExportCell } from '../../models/export/export-cell';
6
+ import { ExportableCollection } from '../exportable.collection';
6
7
  /**
7
8
  * Collection of transactions
8
9
  */
9
- export declare class TransactionCollection extends Collection<Transaction> {
10
+ export declare class TransactionCollection extends ExportableCollection<Transaction> {
10
11
  /**
11
12
  * Get total amount of all transactions in the collection
12
13
  */
@@ -77,4 +78,7 @@ export declare class TransactionCollection extends Collection<Transaction> {
77
78
  * Get new transaction collection filtered by tank type
78
79
  */
79
80
  getByTankType(tankType: TankTypeEnum): this;
81
+ getExportHeader(): string[];
82
+ getExportFooter(): ExportCell[];
83
+ getExportBody(): ExportCell[][];
80
84
  }
@@ -1,26 +1,40 @@
1
1
  export declare enum TaxReturnCategoryListEnum {
2
2
  SALARY = 1,
3
+ ALLOWANCES_EARNINGS_TIPS_DIRECTOR_FEES = 30,
4
+ EMPLOYER_LUMP_SUM_PAYMENTS = 31,
5
+ ETP = 32,
6
+ GOVERNMENT_ALLOWANCES = 2,
7
+ GOVERNMENT_PENSIONS = 33,
8
+ ANNUITIES_SUPER_INCOME_STREAMS = 3,
9
+ SUPERANNUATION_LUMP_SUM_PAYMENTS = 34,
10
+ ATTRIBUTED_PSI_INCOME = 4,
3
11
  WORK_EXPENSES = 7,
4
12
  GROSS_RENT = 8,
13
+ OTHER_RENTAL_DEDUCTIONS = 12,
5
14
  INTEREST_DEDUCTIONS = 9,
6
15
  CAPITAL_WORKS = 10,
7
16
  DEPRECIATION = 11,
8
- OTHER_RENTAL_DEDUCTIONS = 12,
9
- BORROWING_EXPENSES = 29,
17
+ GROSS_INTEREST = 5,
18
+ DIVIDENDS = 6,
19
+ SHARE_SCHEMES = 35,
10
20
  PARTNERSHIPS_TRUSTS = 13,
11
- PCI_SBE_INCOME = 14,
21
+ PSI_SBE_INCOME = 14,
22
+ SOLE_TRADER_BUSINESS_INCOME = 38,
12
23
  CAPITAL_GAINS = 15,
13
24
  FOREIGN_SOURCE_INCOME = 16,
14
- OTHER_INCOME = 17,
25
+ BONUSES_FROM_LIFE_INSURANCE = 17,
26
+ FORESTRY_MANAGED_INVESTMENT_SCHEMES = 39,
27
+ OTHER_INCOME = 40,
28
+ TAX_CREDITS = 23,
15
29
  OTHER_DEDUCTIONS = 18,
30
+ TAX_OFFSETS = 27,
31
+ BORROWING_EXPENSES = 29,
16
32
  GROSS_TAX_PAYABLE = 19,
17
33
  TAX_ON_TAXABLE_INCOME = 20,
18
34
  MEDICARE = 21,
19
35
  STUDENT_LOAN_REPAYMENT = 22,
20
- TAX_CREDITS = 23,
21
36
  TAX_WITHHELD = 24,
22
37
  TAX_INSTALMENTS = 25,
23
38
  FRANKING_CREDITS = 26,
24
- TAX_OFFSETS = 27,
25
39
  TAX_PAYABLE = 28
26
40
  }
@@ -1,7 +1,7 @@
1
1
  import { BankTransaction as BankTransactionBase } from '../../db/Models/bank/bank-transaction';
2
2
  import { TransactionOperationEnum } from '../../db/Enums/transaction-operation.enum';
3
3
  import { Transaction } from '../transaction/transaction';
4
- import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
4
+ import { TransactionAllocationCollection } from '../../collections/transaction/transaction-allocation.collection';
5
5
  export declare class BankTransaction extends BankTransactionBase {
6
6
  allocatedAmount: number;
7
7
  unallocatedAmount: number;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * type of export table column value
3
+ */
4
+ export declare enum ExportCellTypeEnum {
5
+ STRING = 0,
6
+ CURRENCY = 1,
7
+ DATE = 2
8
+ }
@@ -0,0 +1,8 @@
1
+ import { ExportCellTypeEnum } from './export-cell-type.enum';
2
+ /**
3
+ * export table column
4
+ */
5
+ export declare class ExportCell {
6
+ value: any;
7
+ type: ExportCellTypeEnum;
8
+ }
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Data table structure suitable for export
3
3
  */
4
+ import { ExportCell } from './export-cell';
4
5
  export declare class ExportDataTable {
5
6
  caption?: string;
6
7
  header: string[];
7
- rows: string[][];
8
- footer: string[];
8
+ body: ExportCell[][];
9
+ footer: ExportCell[][];
9
10
  }
@@ -1,4 +1,4 @@
1
- import { TransactionCollection } from '../../collections/transaction.collection';
1
+ import { TransactionCollection } from '../../collections/transaction/transaction.collection';
2
2
  import { IChartData } from '../../interfaces/chart-data.interface';
3
3
  /**
4
4
  * Income sources chart data
@@ -1,10 +1,7 @@
1
- import { DataTableExportable } from '../../interfaces/table-exportable.interface';
2
- import { ExportRow } from '../export/export-row';
3
- export declare const EXPORT_DATA_TABLE_COLUMNS: string[];
4
1
  /**
5
2
  * Loan payment class
6
3
  */
7
- export declare class LoanPayment implements DataTableExportable {
4
+ export declare class LoanPayment {
8
5
  date: Date;
9
6
  interestAccrued: number;
10
7
  interestBalance: number;
@@ -14,5 +11,4 @@ export declare class LoanPayment implements DataTableExportable {
14
11
  principalPaid: number;
15
12
  payout: number;
16
13
  totalOwed: number;
17
- toDataTableRows(): ExportRow[];
18
14
  }
@@ -2,7 +2,7 @@ import { VehicleClaim as VehicleClaimBase } from '../../db/Models/vehicle/vehicl
2
2
  import { VehicleClaimMethodEnum } from '../../db/Enums/vehicle-claim-method.enum';
3
3
  import { TankTypeEnum } from '../../db/Enums/tank-type.enum';
4
4
  import { Transaction } from '../transaction/transaction';
5
- import { TransactionCollection } from '../../collections/transaction.collection';
5
+ import { TransactionCollection } from '../../collections/transaction/transaction.collection';
6
6
  export declare class VehicleClaim extends VehicleClaimBase {
7
7
  kmsLimit: number;
8
8
  financialYear: number;
@@ -1,7 +1,7 @@
1
1
  import { PropertyEquityChartItem } from './property-equity-chart-item';
2
2
  import { PropertyCollection } from '../../collections/property/property.collection';
3
3
  import { BankAccountCollection } from '../../collections/bank-account.collection';
4
- import { LoanCollection } from '../../collections/loan.collection';
4
+ import { LoanCollection } from '../../collections/loan/loan.collection';
5
5
  import { PropertyEquityChartTypeEnum } from './property-equity-chart-type.enum';
6
6
  import { Property } from './property';
7
7
  /**
@@ -1,6 +1,9 @@
1
1
  import { PropertySale as BasePropertySale } from '../../../db/Models/property/property-sale/property-sale';
2
2
  import { PropertySaleTaxExemptionMetadata } from '../../../db/Models/property/property-sale/property-sale-tax-exemption-metadata';
3
3
  export declare class PropertySale extends BasePropertySale {
4
+ commission: number;
5
+ legalFees: number;
6
+ otherCost: number;
4
7
  settlementDate: Date;
5
8
  contractDate: Date;
6
9
  taxExemptionMetadata: PropertySaleTaxExemptionMetadata[];
@@ -1,5 +1,5 @@
1
1
  import { PropertyReportItem } from './property-report-item';
2
- import { TransactionCollection } from '../../../collections/transaction.collection';
2
+ import { TransactionCollection } from '../../../collections/transaction/transaction.collection';
3
3
  import { Property } from '../../property/property';
4
4
  import { ChartAccounts } from '../../chart-accounts/chart-accounts';
5
5
  /**
@@ -1,5 +1,6 @@
1
1
  import { TaxReturnCategory } from '../../db/Models/tax-return/tax-return-category';
2
2
  import { ReportItemDetails } from './report-item-details';
3
+ import { ReportItemCollection } from '../../collections/tax-summary/report-item.collection';
3
4
  /**
4
5
  * Used in tax summary reports to show amounts relating to a tax return category entity and details of what this
5
6
  * amount is comprised of. Example here shows an amount of $951.96 and also details of what this amount is comprised of:
@@ -7,9 +8,9 @@ import { ReportItemDetails } from './report-item-details';
7
8
  export declare class ReportItem {
8
9
  amount: number;
9
10
  details: ReportItemDetails[];
10
- items: ReportItem[];
11
11
  taxReturnCategory: TaxReturnCategory;
12
- taxWithheld: number;
12
+ title: string;
13
+ items: ReportItemCollection;
13
14
  /**
14
15
  * Get amount for one income source
15
16
  * @param name Name of income source for filter
@@ -9,7 +9,7 @@ import { TransactionMetadata } from './transaction-metadata';
9
9
  import { Loan } from '../loan/loan';
10
10
  import { TransactionAllocation } from './transaction-allocation';
11
11
  import { IReceipt } from '../../interfaces/receipt.interface';
12
- import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
12
+ import { TransactionAllocationCollection } from '../../collections/transaction/transaction-allocation.collection';
13
13
  import { Depreciation } from '../depreciation/depreciation';
14
14
  import { Expense } from '../../interfaces/expense.interface';
15
15
  export declare class Transaction extends TransactionBase implements Expense, IReceipt {
@@ -1,6 +1,6 @@
1
1
  import { BankAccountCollection } from '../../collections/bank-account.collection';
2
2
  import { BankTransactionCollection } from '../../collections/bank-transaction.collection';
3
- import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
3
+ import { TransactionAllocationCollection } from '../../collections/transaction/transaction-allocation.collection';
4
4
  import { BankTransactionCalculationService } from './bank-transaction-calculation.service';
5
5
  import * as i0 from "@angular/core";
6
6
  export declare class BankAccountCalculationService {
@@ -1,6 +1,6 @@
1
1
  import { BankTransactionCollection } from '../../collections/bank-transaction.collection';
2
2
  import { BankTransaction } from '../../models/bank/bank-transaction';
3
- import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
3
+ import { TransactionAllocationCollection } from '../../collections/transaction/transaction-allocation.collection';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
6
6
  * @TODO move to collection
@@ -0,0 +1,11 @@
1
+ import { ExportCell } from '../../models/export/export-cell';
2
+ import { CurrencyPipe, DatePipe } from '@angular/common';
3
+ import * as i0 from "@angular/core";
4
+ export declare class ExportFormatterService {
5
+ private currencyPipe;
6
+ private datePipe;
7
+ constructor(currencyPipe: CurrencyPipe, datePipe: DatePipe);
8
+ format(rows: ExportCell[][]): string[][];
9
+ static ɵfac: i0.ɵɵFactoryDeclaration<ExportFormatterService, never>;
10
+ static ɵprov: i0.ɵɵInjectableDeclaration<ExportFormatterService>;
11
+ }
@@ -1,7 +1,10 @@
1
1
  import { ExportDataTable } from '../../models/export/export-data-table';
2
2
  import { PdfSettings } from '../../models/pdf/pdf-settings';
3
+ import { ExportFormatterService } from '../export/export-formatter.service';
3
4
  import * as i0 from "@angular/core";
4
5
  export declare class PdfService {
6
+ private formatter;
7
+ constructor(formatter: ExportFormatterService);
5
8
  /**
6
9
  * Export file from provided HTML tables
7
10
  */
@@ -1,9 +1,9 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { BankAccountCollection } from '../../../collections/bank-account.collection';
3
3
  import { DepreciationCollection } from '../../../collections/depreciation.collection';
4
- import { LoanCollection } from '../../../collections/loan.collection';
4
+ import { LoanCollection } from '../../../collections/loan/loan.collection';
5
5
  import { PropertyCollection } from '../../../collections/property/property.collection';
6
- import { TransactionCollection } from '../../../collections/transaction.collection';
6
+ import { TransactionCollection } from '../../../collections/transaction/transaction.collection';
7
7
  import * as i0 from "@angular/core";
8
8
  /**
9
9
  * Service with calculations methods for properties related with other entities.
@@ -8,7 +8,7 @@ import { ChartAccounts } from '../../../models/chart-accounts/chart-accounts';
8
8
  import { DepreciationCollection } from '../../../collections/depreciation.collection';
9
9
  import { Collection } from '../../../collections/collection';
10
10
  import { CollectionDictionary } from '../../../collections/collection-dictionary';
11
- import { TransactionCollection } from '../../../collections/transaction.collection';
11
+ import { TransactionCollection } from '../../../collections/transaction/transaction.collection';
12
12
  import { PropertyReportItemCollection } from '../../../collections/report/property/property-report-item.collection';
13
13
  import * as i0 from "@angular/core";
14
14
  /**
@@ -1,5 +1,5 @@
1
- import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
2
- import { TransactionCollection } from '../../collections/transaction.collection';
1
+ import { TransactionAllocationCollection } from '../../collections/transaction/transaction-allocation.collection';
2
+ import { TransactionCollection } from '../../collections/transaction/transaction.collection';
3
3
  import { Transaction } from '../../models/transaction/transaction';
4
4
  import * as i0 from "@angular/core";
5
5
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taxtank-core",
3
- "version": "0.16.13",
3
+ "version": "0.17.2",
4
4
  "private": false,
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^12.2.3 || ~13.0.0",
package/public-api.d.ts CHANGED
@@ -1,6 +1,3 @@
1
- /**
2
- * Public API Surface of tt-core
3
- */
4
1
  export * from './lib/tt-core.module';
5
2
  /**
6
3
  * Collections
@@ -17,7 +14,8 @@ export * from './lib/collections/depreciation.collection';
17
14
  export * from './lib/collections/depreciation-forecast.collection';
18
15
  export * from './lib/collections/employee.collection';
19
16
  export * from './lib/collections/income-source.collection';
20
- export * from './lib/collections/loan.collection';
17
+ export * from './lib/collections/loan/loan.collection';
18
+ export * from './lib/collections/loan/loan-payment.collection';
21
19
  export * from './lib/collections/message.collection';
22
20
  export * from './lib/collections/message-document.collection';
23
21
  export * from './lib/collections/property/property.collection';
@@ -29,12 +27,14 @@ export * from './lib/collections/report/property/property-report-item-depreciati
29
27
  export * from './lib/collections/report/vehicle-expense/vehicle-expense.collection';
30
28
  export * from './lib/collections/subscription/service-subscription.collection';
31
29
  export * from './lib/collections/tax-summary/report-item.collection';
30
+ export * from './lib/collections/tax-summary/tax-return-categories.const';
32
31
  export * from './lib/collections/tax-review.collection';
33
- export * from './lib/collections/transaction-allocation.collection';
34
- export * from './lib/collections/transaction.collection';
32
+ export * from './lib/collections/transaction/transaction-allocation.collection';
33
+ export * from './lib/collections/transaction/transaction.collection';
35
34
  export * from './lib/collections/user-event-setting.collection';
36
35
  export * from './lib/collections/vehicle.collection';
37
36
  export * from './lib/collections/vehicle-logbook.collection';
37
+ export * from './lib/collections/exportable.collection';
38
38
  /**
39
39
  * DB models
40
40
  */
@@ -310,7 +310,7 @@ export * from './lib/services/http/firm/client-income/client-income-types.servic
310
310
  export * from './lib/services/event/event-dispatcher.service';
311
311
  export * from './lib/services/event/sse.service';
312
312
  export * from './lib/services/http/firm/firm.service';
313
- export * from './lib/services/data-table/data-table.service';
313
+ export * from './lib/services/export/export-formatter.service';
314
314
  export * from './lib/services/header-title/header-title.service';
315
315
  export * from './lib/services/http/income-source/income-source.service';
316
316
  export * from './lib/services/http/income-source/income-source-forecast/income-source-forecast.service';
@@ -326,7 +326,6 @@ export * from './lib/services/report/property/property-transaction-report.servic
326
326
  export * from './lib/services/property/corelogic/corelogic.service';
327
327
  export * from './lib/services/http/property/property.service';
328
328
  export * from './lib/services/property/property-calculation/property-calculation.service';
329
- export * from './lib/services/property/property-holding-costs/property-holding-costs.service';
330
329
  export * from './lib/services/http/property/property-category/property-category.service';
331
330
  export * from './lib/services/http/property/property-document/property-document.service';
332
331
  export * from './lib/services/http/property/property-share/property-share.service';
@@ -367,7 +366,6 @@ export * from './lib/interfaces/event-listener.interface';
367
366
  export * from './lib/interfaces/income-source-forecast.interface';
368
367
  export * from './lib/interfaces/option.interface';
369
368
  export * from './lib/interfaces/photoable';
370
- export * from './lib/interfaces/exportable.interface';
371
369
  export * from './lib/interfaces/receipt.interface';
372
370
  export * from './lib/interfaces/tank.interface';
373
371
  export * from './lib/interfaces/table-exportable.interface';
@@ -1,18 +0,0 @@
1
- import { Collection } from './collection';
2
- export class LoanCollection extends Collection {
3
- /**
4
- * Get new collection of loans filtered by bank accounts ids
5
- * @param ids list of bank accounts ids for filter
6
- */
7
- getByBankAccountsIds(ids) {
8
- return new LoanCollection(this.items.filter((loan) => { var _a; return ids.includes((_a = loan.bankAccount) === null || _a === void 0 ? void 0 : _a.id); }));
9
- }
10
- /**
11
- * Get single loan by bank account id
12
- * @param id id of bank account
13
- */
14
- getByBankAccountId(id) {
15
- return this.items.find((loan) => { var _a; return ((_a = loan.bankAccount) === null || _a === void 0 ? void 0 : _a.id) === id; });
16
- }
17
- }
18
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9hbi5jb2xsZWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJv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yYW0gaWRzIGxpc3Qgb2YgYmFuayBhY2NvdW50cyBpZHMgZm9yIGZpbHRlclxuICAgKi9cbiAgZ2V0QnlCYW5rQWNjb3VudHNJZHMoaWRzOiBudW1iZXJbXSk6IExvYW5Db2xsZWN0aW9uIHtcbiAgICByZXR1cm4gbmV3IExvYW5Db2xsZWN0aW9uKFxuICAgICAgdGhpcy5pdGVtcy5maWx0ZXIoKGxvYW46IExvYW4pOiBib29sZWFuID0+IGlkcy5pbmNsdWRlcyhsb2FuLmJhbmtBY2NvdW50Py5pZCkpXG4gICAgKTtcbiAgfVxuXG4gIC8qKlxuICAgKiBHZXQgc2luZ2xlIGxvYW4gYnkgYmFuayBhY2NvdW50IGlkXG4gICAqIEBwYXJhbSBpZCBpZCBvZiBiYW5rIGFjY291bnRcbiAgICovXG4gIGdldEJ5QmFua0FjY291bnRJZChpZDogbnVtYmVyKTogTG9hbiB7XG4gICAgcmV0dXJuIHRoaXMuaXRlbXMuZmluZCgobG9hbjogTG9hbik6IGJvb2xlYW4gPT4gbG9hbi5iYW5rQWNjb3VudD8uaWQgPT09IGlkKTtcbiAgfVxufVxuIl19
@@ -1,40 +0,0 @@
1
- import { Collection } from './collection';
2
- import { CollectionDictionary } from './collection-dictionary';
3
- export class TransactionAllocationCollection extends Collection {
4
- get amount() {
5
- return this.sumBy('amount');
6
- }
7
- getByTransactionsIds(ids) {
8
- return new TransactionAllocationCollection(this.items.filter((allocation) => ids.includes(allocation.transaction.id)));
9
- }
10
- getByBankTransactionsIds(ids) {
11
- return new TransactionAllocationCollection(this.items.filter((allocation) => ids.includes(allocation.bankTransaction.id)));
12
- }
13
- /**
14
- * Group allocations by bank account via bank transactions collection
15
- */
16
- groupByBankAccount(bankTransactions) {
17
- // Group bank transactions by bank account id
18
- const bankTransactionsByBankAccount = new CollectionDictionary(bankTransactions, 'bankAccount.id');
19
- // Create empty dictionary of transaction allocations
20
- const allocationsByBankAccount = new CollectionDictionary(new TransactionAllocationCollection([]));
21
- // Fill allocations dictionary with bank transactions dictionary keys and allocations related with each bank transaction collection
22
- bankTransactionsByBankAccount.keys.forEach((key) => {
23
- allocationsByBankAccount.add(key, this.getByBankTransactionsIds(bankTransactionsByBankAccount.get(key).getIds()));
24
- });
25
- return allocationsByBankAccount;
26
- }
27
- /**
28
- * check if collection includes allocation of passed transaction
29
- */
30
- hasTransaction(transaction) {
31
- return !!this.items.find((allocation) => allocation.transaction.id === transaction.id);
32
- }
33
- /**
34
- * Check if bank transaction is related with current allocations
35
- */
36
- hasBankTransaction(bankTransaction) {
37
- return !!this.items.find((allocation) => allocation.bankTransaction.id === bankTransaction.id);
38
- }
39
- }
40
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNhY3Rpb24tYWxsb2NhdGlvbi5jb2xsZWN0aW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvdHQtY29yZS9zcmMvbGliL2NvbGxlY3Rpb25zL3RyYW5zYWN0aW9uLWFsbG9jYXRpb24uY29sbGVjdGlvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBRzFDLE9BQU8sRUFBRSxvQkFBb0IsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBSy9ELE1BQU0sT0FBTywrQkFBZ0MsU0FBUSxVQUFpQztJQUNwRixJQUFJLE1BQU07UUFDUixPQUFPLElBQUksQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFDLENBQUM7SUFDOUIsQ0FBQztJQUVELG9CQUFvQixDQUFDLEdBQWE7UUFDaEMsT0FBTyxJQUFJLCtCQUErQixDQUN4QyxJQUFJLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxDQUFDLFVBQWlDLEVBQVcsRUFBRSxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUM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