taxtank-core 0.0.1 → 0.1.1
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/.browserslistrc +16 -0
- package/karma.conf.js +44 -0
- package/ng-package.json +12 -0
- package/package.json +13 -12
- package/src/lib/collections/abstract.collection.ts +83 -0
- package/src/lib/collections/bank-account.collection.ts +171 -0
- package/src/lib/collections/bank-transaction.collection.ts +153 -0
- package/src/lib/collections/client-movement.collection.ts +42 -0
- package/src/lib/collections/client-portfolio-report.collection.ts +47 -0
- package/src/lib/collections/client.collection.ts +5 -0
- package/src/lib/collections/collection-dictionary.ts +112 -0
- package/src/lib/collections/depreciation-forecast.collection.ts +25 -0
- package/src/lib/collections/depreciation.collection.ts +113 -0
- package/src/lib/collections/employee.collection.ts +14 -0
- package/src/lib/collections/income-source.collection.ts +44 -0
- package/src/lib/collections/loan.collection.ts +22 -0
- package/src/lib/collections/logbook.collection.ts +129 -0
- package/src/lib/collections/message-document.collection.ts +16 -0
- package/src/lib/collections/message.collection.ts +27 -0
- package/src/lib/collections/property.collection.ts +88 -0
- package/src/lib/collections/service-price.collection.ts +13 -0
- package/src/lib/collections/service-subscription.collection.ts +20 -0
- package/src/lib/collections/tax-return-category-item.collection.ts +148 -0
- package/src/lib/collections/tax-review.collection.ts +64 -0
- package/src/lib/collections/transaction-allocation.collection.ts +54 -0
- package/src/lib/collections/transaction.collection.ts +170 -0
- package/src/lib/collections/user-event-setting.collection.ts +70 -0
- package/src/lib/db/Enums/address-type.enum.ts +4 -0
- package/src/lib/db/Enums/bank-account-status.enum.ts +4 -0
- package/src/lib/db/Enums/bank-account-type.enum.ts +10 -0
- package/src/lib/db/Enums/bank-connection-status.enum.ts +5 -0
- package/src/lib/db/Enums/bank-transaction-type.enum.ts +4 -0
- package/src/lib/db/Enums/chart-accounts-category.enum.ts +13 -0
- package/src/lib/db/Enums/chart-accounts-etp.enum.ts +7 -0
- package/src/lib/db/Enums/chart-accounts-heading-tax-deductible.enum.ts +6 -0
- package/src/lib/db/Enums/chart-accounts-heading-taxable.enum.ts +6 -0
- package/src/lib/db/Enums/chart-accounts-heading-vehicle-list.enum.ts +4 -0
- package/src/lib/db/Enums/chart-accounts-list.enum.ts +19 -0
- package/src/lib/db/Enums/chart-accounts-metadata-list.enum.ts +14 -0
- package/src/lib/db/Enums/chart-accounts-metadata-type.enum.ts +4 -0
- package/src/lib/db/Enums/chart-accounts-type.enum.ts +4 -0
- package/src/lib/db/Enums/chat-status.enum.ts +4 -0
- package/src/lib/db/Enums/client-details-medicare-exemption.enum.ts +5 -0
- package/src/lib/db/Enums/client-details-work-depreciation-calculation.enum.ts +4 -0
- package/src/lib/db/Enums/client-details-working-holiday-maker.enum.ts +5 -0
- package/src/lib/db/Enums/client-invite-status.enum.ts +4 -0
- package/src/lib/db/Enums/client-invite-type.enum.ts +4 -0
- package/src/lib/db/Enums/depreciation-calculation-percent.enum.ts +7 -0
- package/src/lib/db/Enums/depreciation-calculation.enum.ts +7 -0
- package/src/lib/db/Enums/depreciation-type.enum.ts +6 -0
- package/src/lib/db/Enums/depreciation-write-off-amount.enum.ts +4 -0
- package/src/lib/db/Enums/firm-type.enum.ts +4 -0
- package/src/lib/db/Enums/income-source-type-list-other.enum.ts +6 -0
- package/src/lib/db/Enums/income-source-type-list-salary.enum.ts +3 -0
- package/src/lib/db/Enums/income-source-type-list-work.enum.ts +8 -0
- package/src/lib/db/Enums/income-source-type.enum.ts +5 -0
- package/src/lib/db/Enums/invite-status.enum.ts +5 -0
- package/src/lib/db/Enums/loan-bank-type.enum.ts +10 -0
- package/src/lib/db/Enums/loan-frequency.enum.ts +6 -0
- package/src/lib/db/Enums/loan-interest-type.enum.ts +4 -0
- package/src/lib/db/Enums/loan-payout-type.enum.ts +4 -0
- package/src/lib/db/Enums/loan-repayment-frequency.enum.ts +5 -0
- package/src/lib/db/Enums/loan-repayment-type.enum.ts +4 -0
- package/src/lib/db/Enums/loan-type.enum.ts +12 -0
- package/src/lib/db/Enums/loan-vehicle-type.enum.ts +5 -0
- package/src/lib/db/Enums/phone-type.enum.ts +4 -0
- package/src/lib/db/Enums/property-depreciation-calculation.enum.ts +4 -0
- package/src/lib/db/Enums/property-owner-access.enum.ts +4 -0
- package/src/lib/db/Enums/property-owner-status.enum.ts +5 -0
- package/src/lib/db/Enums/registration-invite-status.enum.ts +4 -0
- package/src/lib/db/Enums/salary-forecast-frequency.enum.ts +6 -0
- package/src/lib/db/Enums/service-notification-status.enum.ts +5 -0
- package/src/lib/db/Enums/service-notification-type.enum.ts +4 -0
- package/src/lib/db/Enums/service-payment-status.enum.ts +4 -0
- package/src/lib/db/Enums/service-price-recurring-interval.enum.ts +6 -0
- package/src/lib/db/Enums/service-price-type.enum.ts +4 -0
- package/src/lib/db/Enums/service-subscription-status.enum.ts +8 -0
- package/src/lib/db/Enums/spare-document-spare-type.enum.ts +4 -0
- package/src/lib/db/Enums/tank-type.enum.ts +5 -0
- package/src/lib/db/Enums/tax-calculation-medicare-exemption.enum.ts +4 -0
- package/src/lib/db/Enums/tax-calculation-type.enum.ts +12 -0
- package/src/lib/db/Enums/tax-return-category-list.enum.ts +26 -0
- package/src/lib/db/Enums/tax-return-category-section.enum.ts +6 -0
- package/src/lib/db/Enums/tax-review-status.enum.ts +11 -0
- package/src/lib/db/Enums/tax-summary-list.enum.ts +15 -0
- package/src/lib/db/Enums/tax-summary-section.enum.ts +6 -0
- package/src/lib/db/Enums/tax-summary-tax-summary.enum.ts +15 -0
- package/src/lib/db/Enums/ticket-feedback.enum.ts +4 -0
- package/src/lib/db/Enums/ticket-status.enum.ts +7 -0
- package/src/lib/db/Enums/ticket-types.enum.ts +3 -0
- package/src/lib/db/Enums/transaction-operation.enum.ts +5 -0
- package/src/lib/db/Enums/transaction-source.enum.ts +4 -0
- package/src/lib/db/Enums/transaction-type.enum.ts +4 -0
- package/src/lib/db/Enums/user-event-status.enum.ts +6 -0
- package/src/lib/db/Enums/user-event-type-frequency.enum.ts +6 -0
- package/src/lib/db/Enums/user-event-type-reminder-type.enum.ts +6 -0
- package/src/lib/db/Enums/user-event-type-reminder.enum.ts +5 -0
- package/src/lib/db/Enums/user-event-type-type.enum.ts +33 -0
- package/src/lib/db/Enums/user-medicare-exemption.enum.ts +5 -0
- package/src/lib/db/Enums/user-roles.enum.ts +13 -0
- package/src/lib/db/Enums/user-status.enum.ts +6 -0
- package/src/lib/db/Enums/user-title.enum.ts +7 -0
- package/src/lib/db/Enums/user-work-depreciation-calculation.enum.ts +4 -0
- package/src/lib/db/Enums/user-working-holiday-maker.enum.ts +5 -0
- package/src/lib/db/Enums/vehicle-claim-method.enum.ts +4 -0
- package/src/lib/db/Enums/vehicle-logbook-purpose.enum.ts +4 -0
- package/src/lib/db/Models/address.ts +20 -0
- package/src/lib/db/Models/bank-account-balance.ts +13 -0
- package/src/lib/db/Models/bank-account-property.ts +9 -0
- package/src/lib/db/Models/bank-account.ts +34 -0
- package/src/lib/db/Models/bank-connection.ts +15 -0
- package/src/lib/db/Models/bank-provider-account.ts +13 -0
- package/src/lib/db/Models/bank-transaction-import.ts +12 -0
- package/src/lib/db/Models/bank-transaction-rule.ts +26 -0
- package/src/lib/db/Models/bank-transaction.ts +17 -0
- package/src/lib/db/Models/bank.ts +12 -0
- package/src/lib/db/Models/basiq-job.ts +9 -0
- package/src/lib/db/Models/borrowing-expense-loan.ts +15 -0
- package/src/lib/db/Models/borrowing-expense.ts +7 -0
- package/src/lib/db/Models/capital-cost-property.ts +14 -0
- package/src/lib/db/Models/capital-cost.ts +4 -0
- package/src/lib/db/Models/chart-accounts-depreciation.ts +11 -0
- package/src/lib/db/Models/chart-accounts-heading.ts +7 -0
- package/src/lib/db/Models/chart-accounts-metadata.ts +12 -0
- package/src/lib/db/Models/chart-accounts-value.ts +13 -0
- package/src/lib/db/Models/chart-accounts.ts +24 -0
- package/src/lib/db/Models/chat.ts +18 -0
- package/src/lib/db/Models/client-details.ts +30 -0
- package/src/lib/db/Models/client-invite.ts +17 -0
- package/src/lib/db/Models/client-movement.ts +13 -0
- package/src/lib/db/Models/country.ts +5 -0
- package/src/lib/db/Models/depreciation-capital-project.ts +14 -0
- package/src/lib/db/Models/depreciation-forecast.ts +19 -0
- package/src/lib/db/Models/depreciation-receipt.ts +12 -0
- package/src/lib/db/Models/depreciation.ts +43 -0
- package/src/lib/db/Models/document-base.ts +10 -0
- package/src/lib/db/Models/document-folder.ts +10 -0
- package/src/lib/db/Models/document.ts +12 -0
- package/src/lib/db/Models/employee-details.ts +8 -0
- package/src/lib/db/Models/employee-invite.ts +10 -0
- package/src/lib/db/Models/financial-data-system.ts +10 -0
- package/src/lib/db/Models/firm-invite.ts +15 -0
- package/src/lib/db/Models/firm.ts +29 -0
- package/src/lib/db/Models/income-source-forecast.ts +13 -0
- package/src/lib/db/Models/income-source-type.ts +9 -0
- package/src/lib/db/Models/income-source.ts +21 -0
- package/src/lib/db/Models/loan-payout.ts +13 -0
- package/src/lib/db/Models/loan.ts +34 -0
- package/src/lib/db/Models/message-document.ts +16 -0
- package/src/lib/db/Models/message.ts +16 -0
- package/src/lib/db/Models/occupation.ts +5 -0
- package/src/lib/db/Models/phone.ts +13 -0
- package/src/lib/db/Models/property-capital-cost.ts +14 -0
- package/src/lib/db/Models/property-category-movement.ts +18 -0
- package/src/lib/db/Models/property-category.ts +14 -0
- package/src/lib/db/Models/property-document.ts +14 -0
- package/src/lib/db/Models/property-forecast.ts +15 -0
- package/src/lib/db/Models/property-owner.ts +21 -0
- package/src/lib/db/Models/property-sold.ts +13 -0
- package/src/lib/db/Models/property-subscription.ts +10 -0
- package/src/lib/db/Models/property-valuation.ts +13 -0
- package/src/lib/db/Models/property.ts +42 -0
- package/src/lib/db/Models/registration-invite.ts +13 -0
- package/src/lib/db/Models/salary-forecast.ts +16 -0
- package/src/lib/db/Models/service-notification.ts +14 -0
- package/src/lib/db/Models/service-payment.ts +12 -0
- package/src/lib/db/Models/service-price.ts +16 -0
- package/src/lib/db/Models/service-product.ts +13 -0
- package/src/lib/db/Models/service-subscription-item.ts +10 -0
- package/src/lib/db/Models/service-subscription.ts +15 -0
- package/src/lib/db/Models/spare-document-category.ts +6 -0
- package/src/lib/db/Models/spare-document.ts +16 -0
- package/src/lib/db/Models/tax-calculation.ts +19 -0
- package/src/lib/db/Models/tax-return-category.ts +13 -0
- package/src/lib/db/Models/tax-return-item.ts +16 -0
- package/src/lib/db/Models/tax-return.ts +9 -0
- package/src/lib/db/Models/tax-review.ts +14 -0
- package/src/lib/db/Models/ticket.ts +20 -0
- package/src/lib/db/Models/transaction-allocation.ts +9 -0
- package/src/lib/db/Models/transaction-base.ts +33 -0
- package/src/lib/db/Models/transaction-metadata.ts +12 -0
- package/src/lib/db/Models/transaction-receipt.ts +12 -0
- package/src/lib/db/Models/transaction.ts +44 -0
- package/src/lib/db/Models/user-event-setting.ts +11 -0
- package/src/lib/db/Models/user-event-type.ts +16 -0
- package/src/lib/db/Models/user-event.ts +14 -0
- package/src/lib/db/Models/user.ts +52 -0
- package/src/lib/db/Models/vehicle-claim.ts +12 -0
- package/src/lib/db/Models/vehicle-logbook.ts +17 -0
- package/src/lib/db/Models/vehicle.ts +9 -0
- package/src/lib/functions/array/index.ts +3 -0
- package/src/lib/functions/array/replace.ts +5 -0
- package/src/lib/functions/array/sort-deep.ts +19 -0
- package/src/lib/functions/array/sort.ts +8 -0
- package/src/lib/functions/clone-deep.ts +4 -0
- package/src/lib/functions/create-date.ts +7 -0
- package/src/lib/functions/enum-to-list.ts +16 -0
- package/src/lib/functions/get-doc-icon.ts +21 -0
- package/src/lib/functions/mat-options-functions.ts +11 -0
- package/src/lib/functions/mat-sort-options.ts +9 -0
- package/src/lib/functions/round-to.ts +9 -0
- package/src/lib/functions/tax-review-filter-predicate.ts +11 -0
- package/src/lib/interfaces/asset-entity-type.enum.ts +10 -0
- package/src/lib/interfaces/asset-type.enum.ts +9 -0
- package/src/lib/interfaces/asset.interface.ts +18 -0
- package/src/lib/interfaces/chart-data.interface.ts +11 -0
- package/src/lib/interfaces/chart-serie.interface.ts +8 -0
- package/src/lib/interfaces/document.interface.ts +20 -0
- package/src/lib/interfaces/documentable.interface.ts +9 -0
- package/src/lib/interfaces/event-listener.interface.ts +9 -0
- package/src/lib/interfaces/income-source-forecast.interface.ts +7 -0
- package/src/lib/interfaces/option.interface.ts +4 -0
- package/src/lib/interfaces/photoable.ts +14 -0
- package/src/lib/interfaces/receipt.interface.ts +13 -0
- package/src/lib/interfaces/salary-forecast.interface.ts +17 -0
- package/src/lib/interfaces/tank.interface.ts +9 -0
- package/src/lib/models/address/address.ts +24 -0
- package/src/lib/models/address/country.ts +17 -0
- package/src/lib/models/bank/bank-account-chart-data.ts +42 -0
- package/src/lib/models/bank/bank-account-property.ts +8 -0
- package/src/lib/models/bank/bank-account-types.const.ts +15 -0
- package/src/lib/models/bank/bank-account.ts +136 -0
- package/src/lib/models/bank/bank-connection.ts +12 -0
- package/src/lib/models/bank/bank-transaction-chart-data.ts +132 -0
- package/src/lib/models/bank/bank-transaction-summary-fields.enum.ts +4 -0
- package/src/lib/models/bank/bank-transaction.ts +74 -0
- package/src/lib/models/bank/bank.ts +21 -0
- package/src/lib/models/bank/basiq-job.ts +4 -0
- package/src/lib/models/bank/basiq-token.ts +16 -0
- package/src/lib/models/bank/type-loan.const.ts +7 -0
- package/src/lib/models/borrowing-expense/borrowing-expense-loan.ts +4 -0
- package/src/lib/models/borrowing-expense/borrowing-expense.ts +4 -0
- package/src/lib/models/chart/chart-data.ts +13 -0
- package/src/lib/models/chart/chart-serie.ts +8 -0
- package/src/lib/models/chart-accounts/chart-accounts-categories.const.ts +85 -0
- package/src/lib/models/chart-accounts/chart-accounts-depreciation.ts +14 -0
- package/src/lib/models/chart-accounts/chart-accounts-heading.ts +6 -0
- package/src/lib/models/chart-accounts/chart-accounts-metadata.ts +15 -0
- package/src/lib/models/chart-accounts/chart-accounts-tax-labels.enum.ts +5 -0
- package/src/lib/models/chart-accounts/chart-accounts.ts +137 -0
- package/src/lib/models/chat/chat-view-type.enum.ts +4 -0
- package/src/lib/models/chat/chat.ts +23 -0
- package/src/lib/models/chat/message-document.ts +18 -0
- package/src/lib/models/chat/message.ts +40 -0
- package/src/lib/models/client/client-details.ts +4 -0
- package/src/lib/models/client/client-invite.ts +70 -0
- package/src/lib/models/client/client-movement.ts +25 -0
- package/src/lib/models/client/client-portfolio-chart-data.ts +65 -0
- package/src/lib/models/client/client-portfolio-report.ts +10 -0
- package/src/lib/models/depreciation/depreciation-capital-project.ts +10 -0
- package/src/lib/models/depreciation/depreciation-forecast.ts +31 -0
- package/src/lib/models/depreciation/depreciation-group-item.ts +20 -0
- package/src/lib/models/depreciation/depreciation-group.enum.ts +7 -0
- package/src/lib/models/depreciation/depreciation-group.ts +25 -0
- package/src/lib/models/depreciation/depreciation-groups.const.ts +35 -0
- package/src/lib/models/depreciation/depreciation-receipt.ts +9 -0
- package/src/lib/models/depreciation/depreciation.ts +174 -0
- package/src/lib/models/document/document-api-url-prefix.enum.ts +7 -0
- package/src/lib/models/document/document-file-types.const.ts +22 -0
- package/src/lib/models/document/document-folder.ts +11 -0
- package/src/lib/models/document/document.ts +29 -0
- package/src/lib/models/employee/employee-details.ts +8 -0
- package/src/lib/models/employee/employee-invite.ts +12 -0
- package/src/lib/models/endpoint/endpoint.ts +35 -0
- package/src/lib/models/endpoint/endpoints.const.ts +157 -0
- package/src/lib/models/event/app-event-type.enum.ts +37 -0
- package/src/lib/models/event/app-event.ts +9 -0
- package/src/lib/models/file/icons-file.enum.ts +5 -0
- package/src/lib/models/financial-year/financial-year.ts +57 -0
- package/src/lib/models/financial-year/month-name-short.enum.ts +19 -0
- package/src/lib/models/financial-year/month-number.enum.ts +19 -0
- package/src/lib/models/financial-year/months.const.ts +1 -0
- package/src/lib/models/firm/firm.ts +31 -0
- package/src/lib/models/income-position/income-position.ts +13 -0
- package/src/lib/models/income-source/income-source-chart-data.ts +57 -0
- package/src/lib/models/income-source/income-source-forecast.ts +35 -0
- package/src/lib/models/income-source/income-source-type.ts +30 -0
- package/src/lib/models/income-source/income-source.ts +57 -0
- package/src/lib/models/income-source/salary-forecast.ts +23 -0
- package/src/lib/models/loan/loan-max-number-of-payments.enum.ts +8 -0
- package/src/lib/models/loan/loan-payment.ts +17 -0
- package/src/lib/models/loan/loan-payout.ts +13 -0
- package/src/lib/models/loan/loan.ts +38 -0
- package/src/lib/models/logbook/default-vehicle-expense.ts +20 -0
- package/src/lib/models/logbook/logbook-period.ts +12 -0
- package/src/lib/models/logbook/logbook-purpose-options.const.ts +6 -0
- package/src/lib/models/logbook/vehicle-claim.ts +27 -0
- package/src/lib/models/logbook/vehicle-logbook.ts +16 -0
- package/src/lib/models/logbook/vehicle.ts +46 -0
- package/src/lib/models/notification/notification-event-types.const.ts +43 -0
- package/src/lib/models/notification/notification.ts +66 -0
- package/src/lib/models/phone/phone.ts +10 -0
- package/src/lib/models/property/calculation-form-item.ts +24 -0
- package/src/lib/models/property/calculation-form-type.enum.ts +7 -0
- package/src/lib/models/property/capital-costs-itmes.const.ts +57 -0
- package/src/lib/models/property/corelogic-suggestion.ts +18 -0
- package/src/lib/models/property/ownership-filter-options.enum.ts +8 -0
- package/src/lib/models/property/property-capital-cost.ts +4 -0
- package/src/lib/models/property/property-category-movement.ts +18 -0
- package/src/lib/models/property/property-category.ts +9 -0
- package/src/lib/models/property/property-document.ts +21 -0
- package/src/lib/models/property/property-equity-chart-data.ts +188 -0
- package/src/lib/models/property/property-equity-chart-item.ts +35 -0
- package/src/lib/models/property/property-equity-chart-type.enum.ts +4 -0
- package/src/lib/models/property/property-forecast.ts +55 -0
- package/src/lib/models/property/property-owner.ts +50 -0
- package/src/lib/models/property/property-sold.ts +10 -0
- package/src/lib/models/property/property-subscription.ts +11 -0
- package/src/lib/models/property/property-valuation.ts +24 -0
- package/src/lib/models/property/property.ts +157 -0
- package/src/lib/models/registration-invite/registration-invite.ts +12 -0
- package/src/lib/models/service-subscription/module-url-list.const.ts +11 -0
- package/src/lib/models/service-subscription/service-payment.ts +8 -0
- package/src/lib/models/service-subscription/service-price.ts +8 -0
- package/src/lib/models/service-subscription/service-product.ts +11 -0
- package/src/lib/models/service-subscription/service-subscription-item.ts +12 -0
- package/src/lib/models/service-subscription/service-subscription.ts +151 -0
- package/src/lib/models/service-subscription/subscription-description.const.ts +8 -0
- package/src/lib/models/service-subscription/subscription-title.const.ts +8 -0
- package/src/lib/models/service-subscription/subscription-type.enum.ts +6 -0
- package/src/lib/models/tax-review/tax-review.ts +96 -0
- package/src/lib/models/tax-summary/tax-return-category-item-details.ts +14 -0
- package/src/lib/models/tax-summary/tax-return-category-item.ts +22 -0
- package/src/lib/models/tax-summary/tax-summary-section.ts +32 -0
- package/src/lib/models/tax-summary/tax-summary-type.enum.ts +7 -0
- package/src/lib/models/tax-summary/tax-summary.ts +79 -0
- package/src/lib/models/transaction/income-amount-type.enum.ts +7 -0
- package/src/lib/models/transaction/transaction-allocation.ts +20 -0
- package/src/lib/models/transaction/transaction-metadata.ts +8 -0
- package/src/lib/models/transaction/transaction-receipt.ts +9 -0
- package/src/lib/models/transaction/transaction.ts +241 -0
- package/src/lib/models/user/my-account-history-initiated-by.enum.ts +4 -0
- package/src/lib/models/user/my-account-history-status.enum.ts +4 -0
- package/src/lib/models/user/my-account-history-type.enum.ts +5 -0
- package/src/lib/models/user/my-account-history.ts +12 -0
- package/src/lib/models/user/occupation.ts +4 -0
- package/src/lib/models/user/user-roles.const.ts +13 -0
- package/src/lib/models/user/user-to-register.ts +7 -0
- package/src/lib/models/user/user-work-position.const.ts +7 -0
- package/src/lib/models/user/user.ts +160 -0
- package/src/lib/models/user-event/user-event-category.enum.ts +9 -0
- package/src/lib/models/user-event/user-event-category.ts +9 -0
- package/src/lib/models/user-event/user-event-setting-field.enum.ts +8 -0
- package/src/lib/models/user-event/user-event-setting.ts +11 -0
- package/src/lib/models/user-event/user-event-type.ts +22 -0
- package/src/lib/services/address/address.service.spec.ts +12 -0
- package/src/lib/services/address/address.service.ts +36 -0
- package/src/lib/services/asset/assets.service.spec.ts +12 -0
- package/src/lib/services/asset/assets.service.ts +51 -0
- package/src/lib/services/auth/auth.service.ts +48 -0
- package/src/lib/services/auth/jwt.service.ts +37 -0
- package/src/lib/services/bank/bank-account-calculation.service.spec.ts +16 -0
- package/src/lib/services/bank/bank-account-calculation.service.ts +38 -0
- package/src/lib/services/bank/bank-account.service.spec.ts +12 -0
- package/src/lib/services/bank/bank-account.service.ts +120 -0
- package/src/lib/services/bank/bank-connection.service.spec.ts +12 -0
- package/src/lib/services/bank/bank-connection.service.ts +42 -0
- package/src/lib/services/bank/bank-transaction-calculation.service.spec.ts +16 -0
- package/src/lib/services/bank/bank-transaction-calculation.service.ts +71 -0
- package/src/lib/services/bank/bank-transaction.service.spec.ts +12 -0
- package/src/lib/services/bank/bank-transaction.service.ts +97 -0
- package/src/lib/services/bank/bank.service.spec.ts +12 -0
- package/src/lib/services/bank/bank.service.ts +16 -0
- package/src/lib/services/bank/basiq.service.spec.ts +12 -0
- package/src/lib/services/bank/basiq.service.ts +103 -0
- package/src/lib/services/base-rest.service.spec.ts +13 -0
- package/src/lib/services/base-rest.service.ts +229 -0
- package/src/lib/services/borrowing-expense/borrowing-expense.service.spec.ts +12 -0
- package/src/lib/services/borrowing-expense/borrowing-expense.service.ts +82 -0
- package/src/lib/services/chart-accounts/chart-accounts-depreciations.service.spec.ts +16 -0
- package/src/lib/services/chart-accounts/chart-accounts-depreciations.service.ts +34 -0
- package/src/lib/services/chart-accounts/chart-accounts.service.spec.ts +12 -0
- package/src/lib/services/chart-accounts/chart-accounts.service.ts +101 -0
- package/src/lib/services/chat/chat.service.spec.ts +16 -0
- package/src/lib/services/chat/chat.service.ts +79 -0
- package/src/lib/services/chat/message-document.service.spec.ts +16 -0
- package/src/lib/services/chat/message-document.service.ts +133 -0
- package/src/lib/services/chat/message.service.spec.ts +16 -0
- package/src/lib/services/chat/message.service.ts +61 -0
- package/src/lib/services/client/client-invite.service.spec.ts +16 -0
- package/src/lib/services/client/client-invite.service.ts +111 -0
- package/src/lib/services/client/client-movement.service.spec.ts +16 -0
- package/src/lib/services/client/client-movement.service.ts +114 -0
- package/src/lib/services/client/client-portfolio-report.service.spec.ts +16 -0
- package/src/lib/services/client/client-portfolio-report.service.ts +34 -0
- package/src/lib/services/depreciation/capital-project.service.spec.ts +16 -0
- package/src/lib/services/depreciation/capital-project.service.ts +69 -0
- package/src/lib/services/depreciation/depreciation.service.spec.ts +12 -0
- package/src/lib/services/depreciation/depreciation.service.ts +171 -0
- package/src/lib/services/document/document-folder.service.spec.ts +16 -0
- package/src/lib/services/document/document-folder.service.ts +95 -0
- package/src/lib/services/employee/employee-invite.service.spec.ts +16 -0
- package/src/lib/services/employee/employee-invite.service.ts +53 -0
- package/src/lib/services/employee/employee.service.spec.ts +16 -0
- package/src/lib/services/employee/employee.service.ts +35 -0
- package/src/lib/services/event/event-dispatcher.service.spec.ts +16 -0
- package/src/lib/services/event/event-dispatcher.service.ts +29 -0
- package/src/lib/services/event/sse.service.spec.ts +16 -0
- package/src/lib/services/event/sse.service.ts +42 -0
- package/src/lib/services/firm/firm.service.spec.ts +16 -0
- package/src/lib/services/firm/firm.service.ts +93 -0
- package/src/lib/services/header-title/header-title.service.spec.ts +12 -0
- package/src/lib/services/header-title/header-title.service.ts +31 -0
- package/src/lib/services/income-source/income-source-forecast.service.spec.ts +16 -0
- package/src/lib/services/income-source/income-source-forecast.service.ts +91 -0
- package/src/lib/services/income-source/income-source.service.spec.ts +12 -0
- package/src/lib/services/income-source/income-source.service.ts +127 -0
- package/src/lib/services/income-source/salary-forecast.service.spec.ts +16 -0
- package/src/lib/services/income-source/salary-forecast.service.ts +92 -0
- package/src/lib/services/intercom/intercom.service.spec.ts +16 -0
- package/src/lib/services/intercom/intercom.service.ts +37 -0
- package/src/lib/services/loan/loan.service.spec.ts +12 -0
- package/src/lib/services/loan/loan.service.ts +166 -0
- package/src/lib/services/notification/notification.service.spec.ts +12 -0
- package/src/lib/services/notification/notification.service.ts +60 -0
- package/src/lib/services/preloader/preloader.service.spec.ts +16 -0
- package/src/lib/services/preloader/preloader.service.ts +28 -0
- package/src/lib/services/property/corelogic.service.spec.ts +12 -0
- package/src/lib/services/property/corelogic.service.ts +47 -0
- package/src/lib/services/property/property-calculation.service.spec.ts +16 -0
- package/src/lib/services/property/property-calculation.service.ts +166 -0
- package/src/lib/services/property/property-capital-cost.service.ts +42 -0
- package/src/lib/services/property/property-category.service.spec.ts +16 -0
- package/src/lib/services/property/property-category.service.ts +15 -0
- package/src/lib/services/property/property-document.service.spec.ts +16 -0
- package/src/lib/services/property/property-document.service.ts +74 -0
- package/src/lib/services/property/property-owner.service.spec.ts +12 -0
- package/src/lib/services/property/property-owner.service.ts +134 -0
- package/src/lib/services/property/property-sold.service.spec.ts +16 -0
- package/src/lib/services/property/property-sold.service.ts +15 -0
- package/src/lib/services/property/property.service.spec.ts +12 -0
- package/src/lib/services/property/property.service.ts +136 -0
- package/src/lib/services/subscription/subscription.service.spec.ts +12 -0
- package/src/lib/services/subscription/subscription.service.ts +153 -0
- package/src/lib/services/tax-review/tax-review-history.service.spec.ts +16 -0
- package/src/lib/services/tax-review/tax-review-history.service.ts +35 -0
- package/src/lib/services/tax-review/tax-review.service.spec.ts +16 -0
- package/src/lib/services/tax-review/tax-review.service.ts +114 -0
- package/src/lib/services/tax-summary/tax-summary.service.ts +70 -0
- package/src/lib/services/transaction/transaction-allocation.service.spec.ts +12 -0
- package/src/lib/services/transaction/transaction-allocation.service.ts +92 -0
- package/src/lib/services/transaction/transaction-calculation.service.spec.ts +16 -0
- package/src/lib/services/transaction/transaction-calculation.service.ts +50 -0
- package/src/lib/services/transaction/transaction.service.spec.ts +12 -0
- package/src/lib/services/transaction/transaction.service.ts +374 -0
- package/src/lib/services/user/occupation.service.spec.ts +12 -0
- package/src/lib/services/user/occupation.service.ts +42 -0
- package/src/lib/services/user/user-switcher.service.ts +34 -0
- package/src/lib/services/user/user.service.spec.ts +12 -0
- package/src/lib/services/user/user.service.ts +140 -0
- package/src/lib/services/user-event/user-event-setting.service.spec.ts +16 -0
- package/src/lib/services/user-event/user-event-setting.service.ts +60 -0
- package/src/lib/services/user-event/user-event-type.service.spec.ts +16 -0
- package/src/lib/services/user-event/user-event-type.service.ts +24 -0
- package/src/lib/services/work/work-tank.service.spec.ts +12 -0
- package/src/lib/services/work/work-tank.service.ts +277 -0
- package/src/lib/tt-core.module.ts +22 -0
- package/src/lib/tt-core.service.spec.ts +16 -0
- package/src/lib/tt-core.service.ts +17 -0
- package/src/public-api.ts +425 -0
- package/src/test.ts +27 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/bundles/taxtank-core.umd.js +0 -97
- package/bundles/taxtank-core.umd.js.map +0 -1
- package/esm2015/lib/tt-core.module.js +0 -33
- package/esm2015/lib/tt-core.service.js +0 -23
- package/esm2015/public-api.js +0 -6
- package/esm2015/taxtank-core.js +0 -5
- package/fesm2015/taxtank-core.js +0 -64
- package/fesm2015/taxtank-core.js.map +0 -1
- package/lib/tt-core.module.d.ts +0 -9
- package/lib/tt-core.service.d.ts +0 -8
- package/public-api.d.ts +0 -2
- package/taxtank-core.d.ts +0 -5
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TaxReturnCategory } from '../../db/Models/tax-return-category';
|
|
2
|
+
import { TaxReturnCategoryItemDetails } from './tax-return-category-item-details';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Used in tax summary reports to show amounts relating to a tax return category entity and details of what this
|
|
6
|
+
* amount is comprised of. Example here shows an amount of $951.96 and also details of what this amount is comprised of:
|
|
7
|
+
*/
|
|
8
|
+
export class TaxReturnCategoryItem {
|
|
9
|
+
amount: number;
|
|
10
|
+
details: TaxReturnCategoryItemDetails[];
|
|
11
|
+
items: TaxReturnCategoryItem[];
|
|
12
|
+
taxReturnCategory: TaxReturnCategory;
|
|
13
|
+
taxWithheld: number;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Get amount for one income source
|
|
17
|
+
* @param name Name of income source for filter
|
|
18
|
+
*/
|
|
19
|
+
getAmountByIncomeSourceName(name: string): number {
|
|
20
|
+
return this.details.find((detail: TaxReturnCategoryItemDetails): boolean => detail.name === name)?.amount || 0;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TaxSummarySectionEnum } from '../../db/Enums/tax-summary-section.enum';
|
|
2
|
+
import { TaxReturnCategoryItem } from './tax-return-category-item';
|
|
3
|
+
import { TaxReturnCategoryItemCollection } from '../../collections/tax-return-category-item.collection';
|
|
4
|
+
import { Transform, Type } from 'class-transformer';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Base class for each sections of Tax Summary report, contains common properties/methods
|
|
8
|
+
* See also TaxSummary model
|
|
9
|
+
*/
|
|
10
|
+
export class TaxSummarySection {
|
|
11
|
+
section: TaxSummarySectionEnum;
|
|
12
|
+
netAmount: number;
|
|
13
|
+
|
|
14
|
+
@Type(() => TaxReturnCategoryItem)
|
|
15
|
+
@Transform(({value}) => new TaxReturnCategoryItemCollection(value))
|
|
16
|
+
items: TaxReturnCategoryItemCollection;
|
|
17
|
+
|
|
18
|
+
// id that will be added as HTML Id
|
|
19
|
+
@Transform(({obj}) => {
|
|
20
|
+
switch (obj.section) {
|
|
21
|
+
case TaxSummarySectionEnum.WORK_TANK:
|
|
22
|
+
return 'taxSummaryWorkTank';
|
|
23
|
+
case TaxSummarySectionEnum.PROPERTY_TANK:
|
|
24
|
+
return 'taxSummaryPropertyTank';
|
|
25
|
+
case TaxSummarySectionEnum.OTHER_INCOME:
|
|
26
|
+
return 'taxSummaryOtherIncome';
|
|
27
|
+
default:
|
|
28
|
+
return 'taxSummaryTotal';
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
id?: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { TaxReturnCategorySectionEnum } from '../../db/Enums/tax-return-category-section.enum';
|
|
2
|
+
import { TaxSummarySection } from './tax-summary-section';
|
|
3
|
+
import { Type } from 'class-transformer';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @Todo refactor with base model when it will be provided
|
|
7
|
+
* Tax summary report structure
|
|
8
|
+
*/
|
|
9
|
+
export class TaxSummary {
|
|
10
|
+
@Type(() => TaxSummarySection)
|
|
11
|
+
work: TaxSummarySection;
|
|
12
|
+
|
|
13
|
+
@Type(() => TaxSummarySection)
|
|
14
|
+
property: TaxSummarySection;
|
|
15
|
+
|
|
16
|
+
@Type(() => TaxSummarySection)
|
|
17
|
+
otherIncome: TaxSummarySection;
|
|
18
|
+
|
|
19
|
+
@Type(() => TaxSummarySection)
|
|
20
|
+
summary: TaxSummarySection;
|
|
21
|
+
|
|
22
|
+
projectedTaxPosition: number;
|
|
23
|
+
|
|
24
|
+
get sections(): TaxSummarySection[] {
|
|
25
|
+
return [this.work, this.property, this.otherIncome, this.summary];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get taxPercent(): number {
|
|
29
|
+
return this.summary.items.grossTaxPayable / this.summary.netAmount;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Work Net Cash = Income - tax withheld - expenses - interest
|
|
34
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
|
|
35
|
+
*/
|
|
36
|
+
get workNetCash(): number {
|
|
37
|
+
return this.workNetTotal - Math.abs(this.summary.items.getTaxWithheld(TaxReturnCategorySectionEnum.WORK_TANK));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Work Net Total = Income - expenses - interest
|
|
42
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
|
|
43
|
+
*/
|
|
44
|
+
get workNetTotal(): number {
|
|
45
|
+
return this.work.items.salary - Math.abs(this.work.items.workExpenses);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Property Net Cash (Cash Position) = Rental Income - expenses - interest
|
|
50
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
|
|
51
|
+
*/
|
|
52
|
+
get propertyNetCash(): number {
|
|
53
|
+
return this.property.items.rentalIncome - Math.abs(this.property.items.rentalDeductions) - Math.abs(this.property.items.interestDeductions);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Property Net Total (Tax Position) = Rental Income - expenses - interest - depreciation
|
|
58
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
|
|
59
|
+
*/
|
|
60
|
+
get propertyNetTotal(): number {
|
|
61
|
+
return this.propertyNetCash - Math.abs(this.property.items.propertyDepreciations);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Other Net Cash = gross income – expenses – tax withheld - tax instalments
|
|
66
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
|
|
67
|
+
*/
|
|
68
|
+
get otherNetCash(): number {
|
|
69
|
+
return this.otherIncome.items.otherIncome - Math.abs(this.otherIncome.items.otherDeductions) - Math.abs(this.summary.items.getTaxWithheld(TaxReturnCategorySectionEnum.OTHER_INCOME)) - Math.abs(this.summary.items.taxInstalments);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Other Net Total = Gross income - expenses + tax offsets + tax instalments + franking credits
|
|
74
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
|
|
75
|
+
*/
|
|
76
|
+
get otherNetTotal(): number {
|
|
77
|
+
return this.otherIncome.items.otherIncome - Math.abs(this.otherIncome.items.otherDeductions) + Math.abs(this.summary.items.taxOffsets) + Math.abs(this.summary.items.taxInstalments) + Math.abs(this.summary.items.frankingCredits);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { TransactionAllocation as TransactionAllocationBase } from '../../db/Models/transaction-allocation';
|
|
2
|
+
import { BankTransaction } from '../bank/bank-transaction';
|
|
3
|
+
import { Transaction } from './transaction';
|
|
4
|
+
import { plainToClass, Type } from 'class-transformer';
|
|
5
|
+
|
|
6
|
+
export class TransactionAllocation extends TransactionAllocationBase {
|
|
7
|
+
@Type(() => BankTransaction)
|
|
8
|
+
bankTransaction: BankTransaction;
|
|
9
|
+
|
|
10
|
+
@Type(() => Transaction)
|
|
11
|
+
transaction: Transaction;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Create a new instance of transaction allocation
|
|
15
|
+
* transaction could be empty since we can POST allocation inside a new transaction
|
|
16
|
+
*/
|
|
17
|
+
static create(amount: number, bankTransaction: BankTransaction, transaction?: Transaction): TransactionAllocation {
|
|
18
|
+
return plainToClass(TransactionAllocation, {amount, transaction, bankTransaction});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TransactionMetadata as TransactionMetadataBase } from '../../db/Models/transaction-metadata';
|
|
2
|
+
import { Type } from 'class-transformer';
|
|
3
|
+
import { ChartAccountsMetadata } from '../chart-accounts/chart-accounts-metadata';
|
|
4
|
+
|
|
5
|
+
export class TransactionMetadata extends TransactionMetadataBase {
|
|
6
|
+
@Type(() => ChartAccountsMetadata)
|
|
7
|
+
metadata: ChartAccountsMetadata;
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TransactionReceipt as TransactionReceiptBase } from '../../db/Models/transaction-receipt';
|
|
2
|
+
import { IAsset } from '../../interfaces/asset.interface';
|
|
3
|
+
import { AssetTypeEnum } from '../../interfaces/asset-type.enum';
|
|
4
|
+
import { AssetEntityTypeEnum } from '../../interfaces/asset-entity-type.enum';
|
|
5
|
+
|
|
6
|
+
export class TransactionReceipt extends TransactionReceiptBase implements IAsset {
|
|
7
|
+
type: AssetTypeEnum = AssetTypeEnum.RECEIPTS;
|
|
8
|
+
entityType: AssetEntityTypeEnum = AssetEntityTypeEnum.TRANSACTIONS;
|
|
9
|
+
}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Transaction as TransactionBase } from '../../db/Models/transaction';
|
|
2
|
+
import { TransactionTypeEnum } from '../../db/Enums/transaction-type.enum';
|
|
3
|
+
import { ChartAccountsCategoryEnum } from '../../db/Enums/chart-accounts-category.enum';
|
|
4
|
+
import { TransactionOperationEnum } from '../../db/Enums/transaction-operation.enum';
|
|
5
|
+
import { ChartAccountsListEnum } from '../../db/Enums/chart-accounts-list.enum';
|
|
6
|
+
import { ChartAccountsMetadataListEnum } from '../../db/Enums/chart-accounts-metadata-list.enum';
|
|
7
|
+
import { TransactionSourceEnum } from '../../db/Enums/transaction-source.enum';
|
|
8
|
+
import { DepreciationTypeEnum } from '../../db/Enums/depreciation-type.enum';
|
|
9
|
+
import { DepreciationCalculationEnum } from '../../db/Enums/depreciation-calculation.enum';
|
|
10
|
+
import { Exclude, plainToClass, Type } from 'class-transformer';
|
|
11
|
+
import { Property } from '../property/property';
|
|
12
|
+
import { TransactionReceipt } from './transaction-receipt';
|
|
13
|
+
import { ChartAccounts } from '../chart-accounts/chart-accounts';
|
|
14
|
+
import { IncomeSource } from '../income-source/income-source';
|
|
15
|
+
import { TransactionMetadata } from './transaction-metadata';
|
|
16
|
+
import { Loan } from '../loan/loan';
|
|
17
|
+
import { TransactionAllocation } from './transaction-allocation';
|
|
18
|
+
import { CHART_ACCOUNTS_CATEGORIES } from '../chart-accounts/chart-accounts-categories.const';
|
|
19
|
+
import { IncomeAmountTypeEnum } from './income-amount-type.enum';
|
|
20
|
+
import { IReceipt } from '../../interfaces/receipt.interface';
|
|
21
|
+
import { ITank } from '../../interfaces/tank.interface';
|
|
22
|
+
import { TransactionAllocationCollection } from '../../collections/transaction-allocation.collection';
|
|
23
|
+
import { Depreciation } from '../depreciation/depreciation';
|
|
24
|
+
|
|
25
|
+
// @TODO refactor with baseModel in constructor
|
|
26
|
+
export class Transaction extends TransactionBase implements IReceipt, ITank {
|
|
27
|
+
// list of child transactions (fees)
|
|
28
|
+
@Type(() => Transaction)
|
|
29
|
+
transactions: Transaction[] = [];
|
|
30
|
+
|
|
31
|
+
@Type(() => Property)
|
|
32
|
+
property: Property;
|
|
33
|
+
|
|
34
|
+
@Type(() => TransactionReceipt)
|
|
35
|
+
receipt: TransactionReceipt;
|
|
36
|
+
|
|
37
|
+
@Type(() => ChartAccounts)
|
|
38
|
+
chartAccounts: ChartAccounts;
|
|
39
|
+
|
|
40
|
+
@Type(() => IncomeSource)
|
|
41
|
+
incomeSource: IncomeSource;
|
|
42
|
+
|
|
43
|
+
@Type(() => TransactionMetadata)
|
|
44
|
+
metadata: TransactionMetadata[] = [];
|
|
45
|
+
|
|
46
|
+
@Type(() => Transaction)
|
|
47
|
+
transfer: Transaction;
|
|
48
|
+
|
|
49
|
+
@Type(() => Loan)
|
|
50
|
+
loan: Loan;
|
|
51
|
+
|
|
52
|
+
@Type(() => Date)
|
|
53
|
+
date: Date;
|
|
54
|
+
|
|
55
|
+
@Type(() => TransactionAllocation)
|
|
56
|
+
allocations: TransactionAllocation[] = [];
|
|
57
|
+
|
|
58
|
+
// could be File when just added new image
|
|
59
|
+
@Exclude({toPlainOnly: true})
|
|
60
|
+
file: File;
|
|
61
|
+
|
|
62
|
+
tax: number = 0;
|
|
63
|
+
operation: TransactionOperationEnum = TransactionOperationEnum.FIND_AND_MATCH;
|
|
64
|
+
allocatedAmount: number;
|
|
65
|
+
unallocatedAmount: number;
|
|
66
|
+
isSelected: boolean;
|
|
67
|
+
claimPercent: number = 100;
|
|
68
|
+
amount: number = 0;
|
|
69
|
+
|
|
70
|
+
isDebit(): boolean {
|
|
71
|
+
return this.type === TransactionTypeEnum.DEBIT;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
isCredit(): boolean {
|
|
75
|
+
return this.type === TransactionTypeEnum.CREDIT;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
isIncome(): boolean {
|
|
79
|
+
if (!this.chartAccounts) {
|
|
80
|
+
return this.isCredit();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return CHART_ACCOUNTS_CATEGORIES.income.includes(this.chartAccounts.category);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
isExpense(): boolean {
|
|
87
|
+
if (!this.chartAccounts) {
|
|
88
|
+
return this.isDebit();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return CHART_ACCOUNTS_CATEGORIES.expense.includes(this.chartAccounts.category);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
isPersonal(): boolean {
|
|
95
|
+
return !this.tankType;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
get chartAccountsCategories(): ChartAccountsCategoryEnum[] {
|
|
99
|
+
switch (true) {
|
|
100
|
+
case this.isPersonal():
|
|
101
|
+
return CHART_ACCOUNTS_CATEGORIES.personal;
|
|
102
|
+
|
|
103
|
+
case this.isPropertyTank():
|
|
104
|
+
return CHART_ACCOUNTS_CATEGORIES.property;
|
|
105
|
+
|
|
106
|
+
default:
|
|
107
|
+
return CHART_ACCOUNTS_CATEGORIES.work;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Check if transaction has 'Klms travelled for work' chart accounts category
|
|
113
|
+
*/
|
|
114
|
+
get isKlmsChartAccountsCategory(): boolean {
|
|
115
|
+
return this.chartAccounts.id === ChartAccountsListEnum.KLMS_TRAVELLED_FOR_WORK;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get transaction date
|
|
120
|
+
*/
|
|
121
|
+
getDate(): Date {
|
|
122
|
+
return this.date;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Check if transaction type is vehicle
|
|
127
|
+
*/
|
|
128
|
+
isVehicleTransaction(): boolean {
|
|
129
|
+
return this.chartAccounts.isVehicleExpense();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Get net amount (clean amount after all deductions)
|
|
134
|
+
*/
|
|
135
|
+
getNetAmount(): number {
|
|
136
|
+
// @TODO fix hack while transactions refactoring (use class-transformer)
|
|
137
|
+
return +(Math.round(this.getIncomeAmountByType(IncomeAmountTypeEnum.NET) * 100) / 100).toFixed(2);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Get gross income amount
|
|
142
|
+
*/
|
|
143
|
+
getGrossIncome(): number {
|
|
144
|
+
// @TODO fix hack while transactions refactoring (use class-transformer)
|
|
145
|
+
return +(Math.round(this.getIncomeAmountByType(IncomeAmountTypeEnum.GROSS) * 100) / 100).toFixed(2);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* find franking credits metadata and return value
|
|
150
|
+
*/
|
|
151
|
+
get frankingCredit(): number {
|
|
152
|
+
return this.getMetadataFieldValue(ChartAccountsMetadataListEnum.FRANKING_CREDIT);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
get untaxedElement(): number {
|
|
156
|
+
return this.getMetadataFieldValue(ChartAccountsMetadataListEnum.UNTAXED_ELEMENT);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Check if transaction reconcile operation if TRANSFER
|
|
161
|
+
* @TODO bad usage of get (and all is* methods), getter should sound like a noun
|
|
162
|
+
*/
|
|
163
|
+
get isTransfer(): boolean {
|
|
164
|
+
return this.operation === TransactionOperationEnum.TRANSFER;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Get value of transaction metadata field
|
|
169
|
+
* @param field for which value should be returned
|
|
170
|
+
*/
|
|
171
|
+
private getMetadataFieldValue(field: ChartAccountsMetadataListEnum): number {
|
|
172
|
+
return +this.metadata.find((transactionMetadata: TransactionMetadata): boolean => {
|
|
173
|
+
return transactionMetadata.chartAccountsMetadata.id === field;
|
|
174
|
+
})?.value || 0;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Returns Net or Gross income amount based on provided income type
|
|
179
|
+
* @param incomeType by which amount should be returned
|
|
180
|
+
*/
|
|
181
|
+
private getIncomeAmountByType(incomeType: IncomeAmountTypeEnum): number {
|
|
182
|
+
// modifier that determines whether the values of the transaction fields will be added or subtracted
|
|
183
|
+
const modifier: number = incomeType === IncomeAmountTypeEnum.GROSS ? 1 : -1;
|
|
184
|
+
|
|
185
|
+
switch (true) {
|
|
186
|
+
case this.isPropertyTank():
|
|
187
|
+
return this.amount +
|
|
188
|
+
(this.transactions
|
|
189
|
+
.reduce((sum: number, transaction: Transaction): number => sum + Math.abs(transaction.amount), 0) * modifier);
|
|
190
|
+
case this.isWorkTank():
|
|
191
|
+
return this.amount + ((this.tax + this.frankingCredit) * modifier);
|
|
192
|
+
default:
|
|
193
|
+
return this.amount || 0;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
isInterest(): boolean {
|
|
198
|
+
return this.chartAccounts.id === ChartAccountsListEnum.INTEREST_ON_LOAN;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
isCash(): boolean {
|
|
202
|
+
return this.source === TransactionSourceEnum.CASH;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Create Depreciation instance based on Transaction
|
|
207
|
+
*/
|
|
208
|
+
toDepreciation(): Depreciation {
|
|
209
|
+
return plainToClass(Depreciation, {
|
|
210
|
+
date: this.date,
|
|
211
|
+
amount: this.amount,
|
|
212
|
+
chartAccounts: this.chartAccounts,
|
|
213
|
+
description: this.description,
|
|
214
|
+
type: DepreciationTypeEnum.PLANT_EQUIPMENT,
|
|
215
|
+
claimPercent: this.claimPercent,
|
|
216
|
+
property: this.property,
|
|
217
|
+
calculation: this.property ? this.property.depreciationCalculation : DepreciationCalculationEnum.PRIME_COST
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Check if transaction is completely allocated
|
|
223
|
+
*/
|
|
224
|
+
isAllocated(allocations: TransactionAllocationCollection): boolean {
|
|
225
|
+
return this.getNetAmount() === this.getAllocatedAmount(allocations);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Get transaction allocated amount
|
|
230
|
+
*/
|
|
231
|
+
getAllocatedAmount(allocations: TransactionAllocationCollection): number {
|
|
232
|
+
return allocations.getByTransactionsIds([this.id]).amount;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Get transaction unallocated amount
|
|
237
|
+
*/
|
|
238
|
+
getUnallocatedAmount(allocations: TransactionAllocationCollection): number {
|
|
239
|
+
return this.getNetAmount() - this.getAllocatedAmount(allocations);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MyAccountHistoryTypeEnum } from './my-account-history-type.enum';
|
|
2
|
+
import { MyAccountHistoryInitiatedByEnum } from './my-account-history-initiated-by.enum';
|
|
3
|
+
import { MyAccountHistoryStatusEnum } from './my-account-history-status.enum';
|
|
4
|
+
|
|
5
|
+
export class MyAccountHistory {
|
|
6
|
+
id: number;
|
|
7
|
+
name: string;
|
|
8
|
+
type: MyAccountHistoryTypeEnum;
|
|
9
|
+
initiatedBy: MyAccountHistoryInitiatedByEnum;
|
|
10
|
+
date: Date;
|
|
11
|
+
status: MyAccountHistoryStatusEnum;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UserRolesEnum } from '../../db/Enums/user-roles.enum';
|
|
2
|
+
|
|
3
|
+
export const USER_ROLES: {[key: string]: UserRolesEnum[]} = {
|
|
4
|
+
ROLE_FIRM_OWNER: [UserRolesEnum.FIRM_OWNER],
|
|
5
|
+
ROLE_FIRM_MANAGER: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.FIRM_OWNER],
|
|
6
|
+
ROLE_ACCOUNTANT: [UserRolesEnum.FIRM_MANAGER, UserRolesEnum.FIRM_OWNER, UserRolesEnum.ACCOUNTANT],
|
|
7
|
+
ROLE_CLIENT: [UserRolesEnum.CLIENT],
|
|
8
|
+
ROLE_USER: [UserRolesEnum.USER],
|
|
9
|
+
ROLE_USER_SUBSCRIPTION: [UserRolesEnum.SUBSCRIPTION],
|
|
10
|
+
ROLE_USER_WORK: [UserRolesEnum.WORK_TANK],
|
|
11
|
+
ROLE_USER_PROPERTY: [UserRolesEnum.PROPERTY_TANK],
|
|
12
|
+
ROLE_PREVIOUS_ADMIN: [UserRolesEnum.SWITCH_USER]
|
|
13
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { User as BaseUser } from '../../db/Models/user';
|
|
2
|
+
import { UserStatusEnum } from '../../db/Enums/user-status.enum';
|
|
3
|
+
import { UserRolesEnum } from '../../db/Enums/user-roles.enum';
|
|
4
|
+
import { Address } from '../address/address';
|
|
5
|
+
import { USER_WORK_POSITION } from './user-work-position.const';
|
|
6
|
+
import { ClientDetails } from '../client/client-details';
|
|
7
|
+
import { EmployeeDetails } from '../employee/employee-details';
|
|
8
|
+
import { Type } from 'class-transformer';
|
|
9
|
+
import { Phone } from '../phone/phone';
|
|
10
|
+
import { ServiceSubscription } from '../service-subscription/service-subscription';
|
|
11
|
+
import { ServiceSubscriptionItem } from '../service-subscription/service-subscription-item';
|
|
12
|
+
import { Photoable } from '../../interfaces/photoable';
|
|
13
|
+
|
|
14
|
+
export class User extends BaseUser implements Photoable {
|
|
15
|
+
@Type(() => ServiceSubscription)
|
|
16
|
+
subscriptions: ServiceSubscription[];
|
|
17
|
+
|
|
18
|
+
@Type(() => ClientDetails)
|
|
19
|
+
clientDetails: ClientDetails;
|
|
20
|
+
|
|
21
|
+
@Type(() => EmployeeDetails)
|
|
22
|
+
employeeDetails: EmployeeDetails;
|
|
23
|
+
|
|
24
|
+
@Type(() => Address)
|
|
25
|
+
address: Address;
|
|
26
|
+
|
|
27
|
+
@Type(() => Phone)
|
|
28
|
+
phone: Phone;
|
|
29
|
+
|
|
30
|
+
@Type(() => Date)
|
|
31
|
+
createdAt: Date;
|
|
32
|
+
|
|
33
|
+
// @TODO Alex remove this hack
|
|
34
|
+
@Type(() => User)
|
|
35
|
+
clients: User[];
|
|
36
|
+
|
|
37
|
+
get fullName(): string {
|
|
38
|
+
return `${this.firstName} ${this.lastName}`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get activeSubscription(): ServiceSubscription {
|
|
42
|
+
return this.subscriptions.find((ss: ServiceSubscription): boolean => ss.isActive);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get lastSubscription(): ServiceSubscription {
|
|
46
|
+
return this.subscriptions[this.subscriptions.length - 1];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @TODO refactor
|
|
51
|
+
*
|
|
52
|
+
*/
|
|
53
|
+
get position(): string {
|
|
54
|
+
switch (true) {
|
|
55
|
+
case this.isFirmOwner():
|
|
56
|
+
return USER_WORK_POSITION[UserRolesEnum.FIRM_OWNER];
|
|
57
|
+
case this.isManager():
|
|
58
|
+
return USER_WORK_POSITION[UserRolesEnum.FIRM_MANAGER];
|
|
59
|
+
case this.isEmployee():
|
|
60
|
+
return USER_WORK_POSITION[UserRolesEnum.EMPLOYEE];
|
|
61
|
+
default:
|
|
62
|
+
return '';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
hasRole(role: UserRolesEnum): boolean {
|
|
67
|
+
return this.roles.includes(role);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
isOnboarding(): boolean {
|
|
71
|
+
return this.status === UserStatusEnum.ON_BOARDING;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
hasSubscription(): boolean {
|
|
75
|
+
return this.roles.includes(UserRolesEnum.SUBSCRIPTION);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
isLoggedIn(): boolean {
|
|
79
|
+
return this.id === +localStorage.getItem('userId');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
isClient(): boolean {
|
|
83
|
+
return this.roles.includes(UserRolesEnum.CLIENT);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
isEmployee(): boolean {
|
|
87
|
+
return this.isAccountant() || this.isAdvisor();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
isAccountant(): boolean {
|
|
91
|
+
return this.roles.includes(UserRolesEnum.ACCOUNTANT);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
isAdvisor(): boolean {
|
|
95
|
+
return this.roles.includes(UserRolesEnum.ADVISOR);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
isImpersonator(): boolean {
|
|
99
|
+
return this.roles.includes(UserRolesEnum.SWITCH_USER);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Check if current user is firm owner
|
|
104
|
+
*/
|
|
105
|
+
isFirmOwner(): boolean {
|
|
106
|
+
return this.roles.includes(UserRolesEnum.FIRM_OWNER);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Check if current user is firm manager
|
|
111
|
+
*/
|
|
112
|
+
isManager(): boolean {
|
|
113
|
+
return this.roles.includes(UserRolesEnum.FIRM_MANAGER) || this.roles.includes(UserRolesEnum.FIRM_OWNER);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* check if user has property tank access
|
|
118
|
+
*/
|
|
119
|
+
hasPropertyTank(): boolean {
|
|
120
|
+
return this.roles ?
|
|
121
|
+
this.roles.includes(UserRolesEnum.PROPERTY_TANK) :
|
|
122
|
+
!!this.getSubscriptionRole(UserRolesEnum.PROPERTY_TANK);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* check if user has property tank access
|
|
127
|
+
*/
|
|
128
|
+
hasWorkTank(): boolean {
|
|
129
|
+
return this.roles ?
|
|
130
|
+
this.roles.includes(UserRolesEnum.WORK_TANK) :
|
|
131
|
+
!!this.getSubscriptionRole(UserRolesEnum.WORK_TANK);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Get user subscription role by provided role type
|
|
136
|
+
* @param roleType by which role should be returned
|
|
137
|
+
*/
|
|
138
|
+
getSubscriptionRole(roleType: UserRolesEnum): ServiceSubscriptionItem {
|
|
139
|
+
/**
|
|
140
|
+
* Add @TODO for Alex to check if we should use getLastSubscription here
|
|
141
|
+
*/
|
|
142
|
+
return this.activeSubscription?.items
|
|
143
|
+
.find((subscriptionItem: ServiceSubscriptionItem) => subscriptionItem.price.product.role.includes(roleType));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Get user's photo link
|
|
148
|
+
*/
|
|
149
|
+
getPhoto(): string {
|
|
150
|
+
return this.photo;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* get user's initials
|
|
155
|
+
*/
|
|
156
|
+
getInitials(): string {
|
|
157
|
+
return `${this.firstName[0].toUpperCase()}${this.lastName[0].toUpperCase()}`;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|