taxtank-core 0.32.47 → 0.32.48

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 (55) hide show
  1. package/esm2022/lib/collections/bank-account.collection.mjs +1 -1
  2. package/esm2022/lib/collections/sole/sole-business-losses.collection.mjs +6 -6
  3. package/esm2022/lib/collections/sole/sole-invoice-item.collection.mjs +4 -1
  4. package/esm2022/lib/collections/sole/sole-invoice.collection.mjs +17 -32
  5. package/esm2022/lib/collections/transaction/transaction-allocation.collection.mjs +1 -8
  6. package/esm2022/lib/collections/transaction/transaction.collection.mjs +14 -30
  7. package/esm2022/lib/db/Enums/sole-invoice-statuses.enum.mjs +2 -4
  8. package/esm2022/lib/db/Enums/transaction-operation.enum.mjs +3 -2
  9. package/esm2022/lib/db/Models/sole/sole-invoice-item.mjs +1 -1
  10. package/esm2022/lib/db/Models/transaction/transaction.mjs +1 -1
  11. package/esm2022/lib/forms/sole/bas-report.form.mjs +4 -5
  12. package/esm2022/lib/models/bank/allocation-group.mjs +2 -5
  13. package/esm2022/lib/models/bank/bank.mjs +1 -1
  14. package/esm2022/lib/models/report/my-tax/my-tax-business-income-or-losses/my-tax-business-losses/my-tax-business-losses.mjs +4 -5
  15. package/esm2022/lib/models/report/my-tax/my-tax-losses/my-tax-losses.mjs +3 -6
  16. package/esm2022/lib/models/report/sole/sole-business/sole-business-loss-report.mjs +4 -4
  17. package/esm2022/lib/models/sole/sole-invoice-item.mjs +25 -3
  18. package/esm2022/lib/models/sole/sole-invoice.mjs +51 -65
  19. package/esm2022/lib/models/transaction/transaction-allocation.mjs +1 -1
  20. package/esm2022/lib/models/transaction/transaction.mjs +3 -16
  21. package/esm2022/lib/services/account-setup/account-setup.service.mjs +1 -1
  22. package/esm2022/lib/services/http/property/property-share/property-share.service.mjs +1 -1
  23. package/esm2022/lib/services/http/service-notification/service-notification.service.mjs +1 -1
  24. package/esm2022/lib/services/http/sole/sole-invoice/sole-invoice.service.mjs +2 -39
  25. package/esm2022/lib/services/http/transaction/transaction.service.mjs +6 -7
  26. package/esm2022/lib/services/http/user/user.service.mjs +1 -1
  27. package/esm2022/lib/services/index.mjs +1 -2
  28. package/esm2022/lib/validators/unique-email.validator.mjs +3 -3
  29. package/fesm2022/taxtank-core.mjs +288 -396
  30. package/fesm2022/taxtank-core.mjs.map +1 -1
  31. package/lib/collections/sole/sole-business-losses.collection.d.ts +2 -2
  32. package/lib/collections/sole/sole-invoice-item.collection.d.ts +2 -0
  33. package/lib/collections/sole/sole-invoice.collection.d.ts +8 -9
  34. package/lib/collections/transaction/transaction-allocation.collection.d.ts +0 -2
  35. package/lib/collections/transaction/transaction.collection.d.ts +4 -10
  36. package/lib/db/Enums/sole-invoice-statuses.enum.d.ts +1 -3
  37. package/lib/db/Enums/transaction-operation.enum.d.ts +2 -1
  38. package/lib/db/Models/sole/sole-invoice-item.d.ts +1 -1
  39. package/lib/db/Models/transaction/transaction.d.ts +1 -1
  40. package/lib/forms/sole/bas-report.form.d.ts +2 -3
  41. package/lib/models/bank/allocation-group.d.ts +0 -1
  42. package/lib/models/report/my-tax/my-tax-business-income-or-losses/my-tax-business-losses/my-tax-business-losses.d.ts +2 -3
  43. package/lib/models/report/my-tax/my-tax-losses/my-tax-losses.d.ts +2 -5
  44. package/lib/models/report/sole/sole-business/sole-business-loss-report.d.ts +1 -2
  45. package/lib/models/sole/sole-invoice-item.d.ts +4 -1
  46. package/lib/models/sole/sole-invoice.d.ts +18 -27
  47. package/lib/models/transaction/transaction.d.ts +1 -9
  48. package/lib/services/http/sole/sole-invoice/sole-invoice.service.d.ts +1 -6
  49. package/lib/services/http/transaction/transaction.service.d.ts +1 -1
  50. package/lib/services/index.d.ts +0 -1
  51. package/package.json +1 -1
  52. package/esm2022/lib/services/transaction/index.mjs +0 -2
  53. package/esm2022/lib/services/transaction/transaction-calculation.service.mjs +0 -24
  54. package/lib/services/transaction/index.d.ts +0 -1
  55. package/lib/services/transaction/transaction-calculation.service.d.ts +0 -11
@@ -863,7 +863,8 @@ var TransactionOperationEnum;
863
863
  TransactionOperationEnum[TransactionOperationEnum["ALLOCATE"] = 1] = "ALLOCATE";
864
864
  TransactionOperationEnum[TransactionOperationEnum["FIND_AND_MATCH"] = 2] = "FIND_AND_MATCH";
865
865
  TransactionOperationEnum[TransactionOperationEnum["TRANSFER"] = 3] = "TRANSFER";
866
- TransactionOperationEnum[TransactionOperationEnum["MATCH_INVOICE"] = 5] = "MATCH_INVOICE";
866
+ TransactionOperationEnum[TransactionOperationEnum["PERSONAL"] = 4] = "PERSONAL";
867
+ TransactionOperationEnum[TransactionOperationEnum["ALLOCATE_INVOICE"] = 5] = "ALLOCATE_INVOICE";
867
868
  })(TransactionOperationEnum || (TransactionOperationEnum = {}));
868
869
 
869
870
  /**
@@ -876,7 +877,7 @@ class AllocationGroup extends AbstractModel {
876
877
  static fromInvoice(invoice, bankTransactions, allocations) {
877
878
  return plainToClass(AllocationGroup, {
878
879
  date: invoice.dateFrom,
879
- operation: TransactionOperationEnum.MATCH_INVOICE,
880
+ operation: TransactionOperationEnum.ALLOCATE_INVOICE,
880
881
  description: invoice.reference,
881
882
  invoiceNumber: invoice.getNumber(),
882
883
  tankType: TankTypeEnum.SOLE,
@@ -902,9 +903,6 @@ class AllocationGroup extends AbstractModel {
902
903
  isFindMatch() {
903
904
  return this.operation === TransactionOperationEnum.FIND_AND_MATCH;
904
905
  }
905
- isMatchInvoice() {
906
- return this.operation === TransactionOperationEnum.MATCH_INVOICE;
907
- }
908
906
  isTransfer() {
909
907
  return this.operation === TransactionOperationEnum.TRANSFER;
910
908
  }
@@ -4763,6 +4761,13 @@ __decorate([
4763
4761
  Type(() => SoleBusinessLossOffsetRule)
4764
4762
  ], SoleBusinessLoss.prototype, "offsetRule", void 0);
4765
4763
 
4764
+ var SoleInvoiceTaxTypeEnum;
4765
+ (function (SoleInvoiceTaxTypeEnum) {
4766
+ SoleInvoiceTaxTypeEnum[SoleInvoiceTaxTypeEnum["TAX_EXCLUSIVE"] = 0] = "TAX_EXCLUSIVE";
4767
+ SoleInvoiceTaxTypeEnum[SoleInvoiceTaxTypeEnum["TAX_INCLUSIVE"] = 1] = "TAX_INCLUSIVE";
4768
+ SoleInvoiceTaxTypeEnum[SoleInvoiceTaxTypeEnum["NO_TAX"] = 2] = "NO_TAX";
4769
+ })(SoleInvoiceTaxTypeEnum || (SoleInvoiceTaxTypeEnum = {}));
4770
+
4766
4771
  class SoleInvoiceItem extends SoleInvoiceItem$1 {
4767
4772
  constructor() {
4768
4773
  super(...arguments);
@@ -4771,6 +4776,25 @@ class SoleInvoiceItem extends SoleInvoiceItem$1 {
4771
4776
  get totalPrice() {
4772
4777
  return this.price * this.quantity;
4773
4778
  }
4779
+ getTotalPrice(taxType, includeGST = false) {
4780
+ const totalPrice = this.totalPrice;
4781
+ if (includeGST) {
4782
+ const coefficient = this.isGST && taxType === SoleInvoiceTaxTypeEnum.TAX_EXCLUSIVE ? ChartAccounts.GSTCoefficient : 1;
4783
+ return totalPrice * coefficient;
4784
+ }
4785
+ const coefficient = this.isGST && taxType === SoleInvoiceTaxTypeEnum.TAX_INCLUSIVE ? ChartAccounts.GSTCoefficient : 1;
4786
+ return totalPrice / coefficient;
4787
+ }
4788
+ toTransaction() {
4789
+ return plainToClass(Transaction, {
4790
+ chartAccounts: this.chartAccounts,
4791
+ description: this.description,
4792
+ source: TransactionSourceEnum.BANK_TRANSACTION,
4793
+ isGST: this.isGST,
4794
+ operation: TransactionOperationEnum.ALLOCATE_INVOICE,
4795
+ invoiceItem: this
4796
+ });
4797
+ }
4774
4798
  }
4775
4799
  __decorate([
4776
4800
  Type(() => SoleInvoice)
@@ -4780,7 +4804,7 @@ __decorate([
4780
4804
  ], SoleInvoiceItem.prototype, "chartAccounts", void 0);
4781
4805
  __decorate([
4782
4806
  Type(() => Transaction)
4783
- ], SoleInvoiceItem.prototype, "transaction", void 0);
4807
+ ], SoleInvoiceItem.prototype, "transactions", void 0);
4784
4808
 
4785
4809
  // @TODO Alex/Vik: Create some base class for User and SoleContact with common methods and properties
4786
4810
  class SoleContact extends SoleContact$1 {
@@ -4808,25 +4832,16 @@ var SoleInvoiceStatusesEnum;
4808
4832
  (function (SoleInvoiceStatusesEnum) {
4809
4833
  SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["CANCELED"] = 0] = "CANCELED";
4810
4834
  SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["DRAFT"] = 1] = "DRAFT";
4811
- SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PENDING"] = 2] = "PENDING";
4812
- SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PAID"] = 3] = "PAID";
4813
- SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["PAID_CASH"] = 4] = "PAID_CASH";
4835
+ SoleInvoiceStatusesEnum[SoleInvoiceStatusesEnum["OPEN"] = 2] = "OPEN";
4814
4836
  })(SoleInvoiceStatusesEnum || (SoleInvoiceStatusesEnum = {}));
4815
4837
 
4816
- var SoleInvoiceTaxTypeEnum;
4817
- (function (SoleInvoiceTaxTypeEnum) {
4818
- SoleInvoiceTaxTypeEnum[SoleInvoiceTaxTypeEnum["TAX_EXCLUSIVE"] = 0] = "TAX_EXCLUSIVE";
4819
- SoleInvoiceTaxTypeEnum[SoleInvoiceTaxTypeEnum["TAX_INCLUSIVE"] = 1] = "TAX_INCLUSIVE";
4820
- SoleInvoiceTaxTypeEnum[SoleInvoiceTaxTypeEnum["NO_TAX"] = 2] = "NO_TAX";
4821
- })(SoleInvoiceTaxTypeEnum || (SoleInvoiceTaxTypeEnum = {}));
4822
-
4823
4838
  class SoleInvoice extends SoleInvoice$1 {
4824
4839
  constructor() {
4825
4840
  super(...arguments);
4826
4841
  this.status = SoleInvoiceStatusesEnum.DRAFT;
4827
4842
  this.taxType = SoleInvoiceTaxTypeEnum.NO_TAX;
4828
4843
  }
4829
- static { this.NUMBER_LENGTH = 4; }
4844
+ static { this.numberLength = 4; }
4830
4845
  /**
4831
4846
  * Get items array as collection
4832
4847
  */
@@ -4834,55 +4849,19 @@ class SoleInvoice extends SoleInvoice$1 {
4834
4849
  return new SoleInvoiceItemCollection(this.items);
4835
4850
  }
4836
4851
  /**
4837
- * Total price of all items
4838
- */
4839
- get price() {
4840
- return this.itemsCollection.sumBy('totalPrice');
4841
- }
4842
- /**
4843
- * Total invoice price without GST
4852
+ * total without GST
4844
4853
  */
4845
4854
  get netPrice() {
4846
- if (this.isTaxInclusive()) {
4847
- // round up to make sure invoice is fully paid
4848
- return ceil(this.price - this.GSTAmount, 2);
4849
- }
4850
- return this.price;
4855
+ return ceil(this.itemsCollection.getTotalPrice(this.taxType), 2);
4851
4856
  }
4852
4857
  /**
4853
- * Total final price (net + GST)
4858
+ * total + GST
4854
4859
  */
4855
4860
  get grossPrice() {
4856
- if (this.isTaxExclusive()) {
4857
- // round up to make sure invoice is fully paid
4858
- return ceil(this.price + this.GSTAmount, 2);
4859
- }
4860
- return this.price;
4861
+ return ceil(this.itemsCollection.getTotalPrice(this.taxType, true), 2);
4861
4862
  }
4862
- /**
4863
- * Total GST amount
4864
- */
4865
- get GSTAmount() {
4866
- switch (this.taxType) {
4867
- case SoleInvoiceTaxTypeEnum.TAX_INCLUSIVE:
4868
- return this.inclusiveGSTAmount;
4869
- case SoleInvoiceTaxTypeEnum.TAX_EXCLUSIVE:
4870
- return this.exclusiveGSTAmount;
4871
- case SoleInvoiceTaxTypeEnum.NO_TAX:
4872
- return 0;
4873
- }
4874
- }
4875
- /**
4876
- * When tax inclusive, GST amount is included to total price
4877
- */
4878
- get inclusiveGSTAmount() {
4879
- return this.itemsCollection.gstItems.reduce((sum, item) => sum + item.totalPrice - (item.totalPrice / (1 + ChartAccounts.GSTRatio)));
4880
- }
4881
- /**
4882
- * When tax exclusive, GST amount should be added additionally to total price
4883
- */
4884
- get exclusiveGSTAmount() {
4885
- return this.itemsCollection.gstItems.reduce((sum, item) => sum + item.totalPrice * ChartAccounts.GSTRatio);
4863
+ get gstAmount() {
4864
+ return this.grossPrice - this.netPrice;
4886
4865
  }
4887
4866
  isDraft() {
4888
4867
  return this.status === SoleInvoiceStatusesEnum.DRAFT;
@@ -4890,26 +4869,23 @@ class SoleInvoice extends SoleInvoice$1 {
4890
4869
  isCancelled() {
4891
4870
  return this.status === SoleInvoiceStatusesEnum.CANCELED;
4892
4871
  }
4893
- isPending() {
4894
- return this.status === SoleInvoiceStatusesEnum.PENDING;
4872
+ isOpen() {
4873
+ return this.status === SoleInvoiceStatusesEnum.OPEN;
4895
4874
  }
4896
- isAllocated() {
4897
- return this.status === SoleInvoiceStatusesEnum.PAID;
4875
+ isPending() {
4876
+ return this.isOpen() && this.dateTo > new Date(Date.now() - (60 * 60 * 24 * 1000));
4898
4877
  }
4899
- isPaidCash() {
4900
- return this.status === SoleInvoiceStatusesEnum.PAID_CASH;
4878
+ /**
4879
+ * overdue next day after dateTo
4880
+ */
4881
+ isOverdue() {
4882
+ return this.isOpen() && this.dateTo < new Date(Date.now() - (60 * 60 * 24 * 1000));
4901
4883
  }
4902
- isPaid() {
4903
- return this.isAllocated() || this.isPaidCash();
4884
+ getUnpaidAmount(transactions) {
4885
+ return this.grossPrice - transactions.filterBy('invoiceItem.id', this.itemsCollection.getIds()).sumBy('grossAmount');
4904
4886
  }
4905
4887
  isEditable() {
4906
- return this.isDraft() || this.isPending();
4907
- }
4908
- isOverdue() {
4909
- return this.isPending() && this.dateTo < new Date();
4910
- }
4911
- isUnpaid() {
4912
- return this.isPending() && this.dateTo >= new Date();
4888
+ return this.isDraft() || this.isOpen();
4913
4889
  }
4914
4890
  /**
4915
4891
  * GST is not available for invoices without taxes
@@ -4932,13 +4908,37 @@ class SoleInvoice extends SoleInvoice$1 {
4932
4908
  return this.taxType === SoleInvoiceTaxTypeEnum.TAX_INCLUSIVE;
4933
4909
  }
4934
4910
  getNumber() {
4935
- return String(this.number).padStart(SoleInvoice.NUMBER_LENGTH, '0');
4911
+ return String(this.number).padStart(SoleInvoice.numberLength, '0');
4936
4912
  }
4937
4913
  get name() {
4938
4914
  return `invoice-${this.getNumber()}.pdf`;
4939
4915
  }
4940
- getTransactionsIds() {
4941
- return new Collection(this.items).mapBy('transaction.id');
4916
+ /**
4917
+ * allocate invoice to bankTransaction = create transactions/allocations for specific amount or full
4918
+ */
4919
+ allocate(bankTransaction, amount) {
4920
+ // Percent of allocation: When amount is less than invoice unallocated amount then we have to allocate its items proportianally
4921
+ const allocationCoefficient = amount ? amount / this.grossPrice : 1;
4922
+ return this.items.map((item) => {
4923
+ const transaction = plainToClass(Transaction, item.toTransaction());
4924
+ transaction.date = bankTransaction.date;
4925
+ transaction.amount = round(item.getTotalPrice(this.taxType) * allocationCoefficient, 2);
4926
+ transaction.allocations = [plainToClass(TransactionAllocation, {
4927
+ amount: transaction.grossAmount,
4928
+ bankTransaction: bankTransaction,
4929
+ })];
4930
+ return transaction;
4931
+ });
4932
+ }
4933
+ createTransactions(date, amount) {
4934
+ // Percent of allocation: When amount is less than invoice unallocated amount then we have to allocate its items proportianally
4935
+ const allocationCoefficient = amount ? amount / this.grossPrice : 1;
4936
+ return this.items.map((item) => {
4937
+ const transaction = plainToClass(Transaction, item.toTransaction());
4938
+ transaction.date = date;
4939
+ transaction.amount = round(item.getTotalPrice(this.taxType) * allocationCoefficient, 2);
4940
+ return transaction;
4941
+ });
4942
4942
  }
4943
4943
  }
4944
4944
  __decorate([
@@ -6275,7 +6275,7 @@ class Transaction extends Transaction$1 {
6275
6275
  this.amount = 0;
6276
6276
  }
6277
6277
  get invoiceId() {
6278
- return this.soleInvoiceItem?.invoice.id;
6278
+ return this.invoiceItem?.invoice.id;
6279
6279
  }
6280
6280
  isDebit() {
6281
6281
  return this.type === TransactionTypeEnum.DEBIT;
@@ -6355,9 +6355,6 @@ class Transaction extends Transaction$1 {
6355
6355
  isFindAndMatch() {
6356
6356
  return this.operation === TransactionOperationEnum.FIND_AND_MATCH;
6357
6357
  }
6358
- isMatchInvoice() {
6359
- return this.operation === TransactionOperationEnum.MATCH_INVOICE;
6360
- }
6361
6358
  get debit() {
6362
6359
  return this.isDebit() ? Math.abs(this.grossAmount) : 0;
6363
6360
  }
@@ -6408,16 +6405,6 @@ class Transaction extends Transaction$1 {
6408
6405
  getAllocatedAmount(allocations) {
6409
6406
  return allocations.filterBy('transaction.id', this.id).sumBy('amount');
6410
6407
  }
6411
- /**
6412
- * @TODO vik TT-3363
6413
- */
6414
- getAllocatedClaimAmount(allocations) {
6415
- let coef = 1;
6416
- if (this.isSoleTank() && this.isIncome() && this.isGST) {
6417
- coef = ChartAccounts.GSTCoefficient;
6418
- }
6419
- return this.getAllocatedAmount(allocations) * this.claimRatio / coef;
6420
- }
6421
6408
  getUnallocatedAmount(allocations) {
6422
6409
  return this.netAmount - this.getAllocatedAmount(allocations);
6423
6410
  }
@@ -6485,7 +6472,7 @@ __decorate([
6485
6472
  ], Transaction.prototype, "allocations", void 0);
6486
6473
  __decorate([
6487
6474
  Type(() => SoleInvoiceItem)
6488
- ], Transaction.prototype, "soleInvoiceItem", void 0);
6475
+ ], Transaction.prototype, "invoiceItem", void 0);
6489
6476
  __decorate([
6490
6477
  Transform(({ value }) => +value)
6491
6478
  ], Transaction.prototype, "tax", void 0);
@@ -6804,17 +6791,17 @@ class TransactionCollection extends ExportableCollection {
6804
6791
  getByAllocations(allocations) {
6805
6792
  return new TransactionCollection(this.items.filter((transaction) => allocations.hasTransaction(transaction)));
6806
6793
  }
6807
- setAllocatedClaimAmount(allocations, invoices) {
6808
- const allocationsByTransaction = allocations.groupBy('transaction.id');
6809
- const paidCacheTransactionsIds = invoices.getPaidCash().getTransactionsIds();
6810
- this.items.forEach((transaction) => {
6811
- // for paidCash invoices we haven't allocations and should use just claim amount
6812
- if (paidCacheTransactionsIds.includes(transaction.id)) {
6813
- return;
6814
- }
6815
- transaction.claimAmount = transaction.getAllocatedClaimAmount(allocationsByTransaction.get(transaction.id));
6794
+ getByInvoices(invoices) {
6795
+ return this.filterBy('invoiceItem.id', invoices.getInvoiceItemsIds());
6796
+ }
6797
+ getAmountPerInvoice() {
6798
+ // @TODO invoiceItem.invoice will be removed on backend
6799
+ const transactionsByInvoice = this.groupBy('invoiceItem.invoice.id');
6800
+ const dictionary = new Dictionary([]);
6801
+ transactionsByInvoice.keys.forEach((key) => {
6802
+ dictionary.add(key, transactionsByInvoice.get(key).sumBy('grossAmount'));
6816
6803
  });
6817
- return this;
6804
+ return dictionary;
6818
6805
  }
6819
6806
  /**
6820
6807
  * Get transactions related to Vehicle category
@@ -6906,33 +6893,17 @@ class TransactionCollection extends ExportableCollection {
6906
6893
  });
6907
6894
  return chartData;
6908
6895
  }
6909
- /**
6910
- * user pays GST only from allocated part (or paid) of income
6911
- */
6912
- calculateAllocatedClaimAmount(allocations) {
6913
- return this.reduce((sum, transaction) => sum + transaction.getAllocatedClaimAmount(allocations));
6914
- }
6915
- calculateAllocatedGST(allocations) {
6916
- return this.filterBy('isGST', true).reduce((sum, transaction) => sum + transaction.getAllocatedClaimAmount(allocations)) * ChartAccounts.GSTRatio;
6917
- }
6918
6896
  getAllocatedAmount(allocations) {
6919
6897
  return allocations.getByTransactionsIds(this.getIds()).sumBy('amount');
6920
6898
  }
6921
6899
  /**
6922
6900
  * @TODO vik business transactions calculated differently, separated collection?
6923
6901
  */
6924
- getBusinessClaimAmount(allocations, businessId = null) {
6902
+ getBusinessClaimAmount(businessId = null) {
6925
6903
  const transactions = businessId ? this.filterBy('business.id', businessId) : this;
6926
6904
  const expenses = transactions.getExpenseTransactions();
6927
6905
  const incomes = transactions.getIncomeTransactions();
6928
- return incomes.calculateAllocatedClaimAmount(allocations) + expenses.sumBy('claimAmount');
6929
- }
6930
- groupByInvoice(invoices) {
6931
- const transactionsByInvoices = new TransactionCollection([]).groupBy();
6932
- invoices.toArray().forEach((invoice) => {
6933
- transactionsByInvoices.add(invoice.id, this.filterBy('id', invoice.getTransactionsIds()));
6934
- });
6935
- return transactionsByInvoices;
6906
+ return incomes.sumBy('grossClaimAmount') + expenses.sumBy('claimAmount');
6936
6907
  }
6937
6908
  }
6938
6909
 
@@ -6972,13 +6943,6 @@ class TransactionAllocationCollection extends Collection {
6972
6943
  hasBankTransaction(bankTransaction) {
6973
6944
  return !!this.items.find((allocation) => allocation.bankTransaction.id === bankTransaction.id);
6974
6945
  }
6975
- groupByInvoice(invoices) {
6976
- const allocationsByInvoices = new TransactionAllocationCollection([]).groupBy();
6977
- invoices.toArray().forEach((invoice) => {
6978
- allocationsByInvoices.add(invoice.id, this.filterBy('transaction.id', invoice.getTransactionsIds()));
6979
- });
6980
- return allocationsByInvoices;
6981
- }
6982
6946
  }
6983
6947
 
6984
6948
  class DepreciationCollection extends Collection {
@@ -7377,118 +7341,6 @@ class MyTaxBusinessIncome {
7377
7341
  }
7378
7342
  }
7379
7343
 
7380
- const TAX_RETURN_CATEGORIES = {
7381
- work: {
7382
- income: [
7383
- TaxReturnCategoryListEnum.SALARY,
7384
- TaxReturnCategoryListEnum.ALLOWANCES_EARNINGS_TIPS_DIRECTOR_FEES,
7385
- TaxReturnCategoryListEnum.EMPLOYER_LUMP_SUM_PAYMENTS,
7386
- TaxReturnCategoryListEnum.ETP,
7387
- TaxReturnCategoryListEnum.GOVERNMENT_ALLOWANCES,
7388
- TaxReturnCategoryListEnum.GOVERNMENT_PENSIONS,
7389
- TaxReturnCategoryListEnum.ANNUITIES_SUPER_INCOME_STREAMS,
7390
- TaxReturnCategoryListEnum.SUPERANNUATION_LUMP_SUM_PAYMENTS,
7391
- TaxReturnCategoryListEnum.ATTRIBUTED_PSI_INCOME,
7392
- TaxReturnCategoryListEnum.DIVIDENDS,
7393
- TaxReturnCategoryListEnum.GROSS_INTEREST
7394
- ],
7395
- expenses: [
7396
- TaxReturnCategoryListEnum.WORK_EXPENSES
7397
- ],
7398
- interest: [],
7399
- taxWithheld: [
7400
- TaxReturnCategoryListEnum.TAX_WITHHELD
7401
- ]
7402
- },
7403
- property: {
7404
- income: [
7405
- TaxReturnCategoryListEnum.GROSS_RENT
7406
- ],
7407
- expenses: [
7408
- TaxReturnCategoryListEnum.OTHER_RENTAL_DEDUCTIONS
7409
- ],
7410
- interest: [
7411
- TaxReturnCategoryListEnum.INTEREST_DEDUCTIONS
7412
- ],
7413
- depreciation: [
7414
- TaxReturnCategoryListEnum.CAPITAL_WORKS,
7415
- // @TODO Nik/Alex (it was TaxReturnCategoryListEnum.DEPRECIATION which doesn't exist)
7416
- TaxReturnCategoryListEnum.PLANT_AND_EQUIPMENT
7417
- ]
7418
- },
7419
- other: {
7420
- income: [
7421
- TaxReturnCategoryListEnum.GROSS_INTEREST,
7422
- TaxReturnCategoryListEnum.SHARE_SCHEMES,
7423
- TaxReturnCategoryListEnum.PARTNERSHIPS,
7424
- TaxReturnCategoryListEnum.PARTNERSHIPS_TRUSTS,
7425
- TaxReturnCategoryListEnum.TRUSTS,
7426
- TaxReturnCategoryListEnum.PSI_SBE_INCOME,
7427
- TaxReturnCategoryListEnum.SOLE_TRADER_BUSINESS_INCOME,
7428
- TaxReturnCategoryListEnum.CAPITAL_GAINS,
7429
- TaxReturnCategoryListEnum.FOREIGN_SOURCE_INCOME,
7430
- TaxReturnCategoryListEnum.BONUSES_FROM_LIFE_INSURANCE,
7431
- TaxReturnCategoryListEnum.FORESTRY_MANAGED_INVESTMENT_SCHEMES,
7432
- TaxReturnCategoryListEnum.OTHER_INCOME
7433
- ],
7434
- expenses: [
7435
- TaxReturnCategoryListEnum.OTHER_DEDUCTIONS
7436
- ],
7437
- taxCredits: [
7438
- TaxReturnCategoryListEnum.TAX_CREDITS
7439
- ],
7440
- taxOffsets: [
7441
- TaxReturnCategoryListEnum.TAX_OFFSETS,
7442
- TaxReturnCategoryListEnum.TAX_OFFSETS_LOW,
7443
- TaxReturnCategoryListEnum.TAX_OFFSETS_MIDDLE,
7444
- ]
7445
- },
7446
- sole: {
7447
- income: [
7448
- TaxReturnCategoryListEnum.GROSS_PAYMENTS_NO_ABN_GIVEN,
7449
- TaxReturnCategoryListEnum.GROSS_PAYMENTS_VOLUNTARY_AGREEMENT,
7450
- TaxReturnCategoryListEnum.GROSS_PAYMENTS_LABOUR_HIRE_OR_OTHER,
7451
- TaxReturnCategoryListEnum.ASSESSABLE_GOVERNMENT_PAYMENTS,
7452
- TaxReturnCategoryListEnum.OTHER_BUSINESS_INCOME
7453
- ],
7454
- expenses: [
7455
- TaxReturnCategoryListEnum.PURCHASES_AND_OTHER_COSTS,
7456
- TaxReturnCategoryListEnum.CONTRACTORS_SUBCONTRACTORS_COMMISSION_EXPENSES,
7457
- TaxReturnCategoryListEnum.SUPERANNUATION_EXPENSES,
7458
- TaxReturnCategoryListEnum.BAD_DEBTS,
7459
- TaxReturnCategoryListEnum.LEASE_EXPENSES,
7460
- TaxReturnCategoryListEnum.RENT_EXPENSES,
7461
- TaxReturnCategoryListEnum.INTEREST_EXPENSES_WITHIN_AUSTRALIA,
7462
- TaxReturnCategoryListEnum.INTEREST_EXPENSES_OVERSEAS,
7463
- TaxReturnCategoryListEnum.MOTOR_VEHICLE_EXPENSES,
7464
- TaxReturnCategoryListEnum.ALL_OTHER_EXPENSES
7465
- ],
7466
- depreciation: [
7467
- TaxReturnCategoryListEnum.DEPRECIATION_EXPENSES,
7468
- ],
7469
- loss: [
7470
- TaxReturnCategoryListEnum.DEFERRED_BUSINESS_LOSSES_FROM_PRIOR_YEAR,
7471
- ],
7472
- lossCurrent: [
7473
- TaxReturnCategoryListEnum.DEFERRED_BUSINESS_LOSSES,
7474
- ],
7475
- taxOffsets: [
7476
- TaxReturnCategoryListEnum.TAX_OFFSETS_SOLE
7477
- ],
7478
- },
7479
- summary: {
7480
- income: [
7481
- TaxReturnCategoryListEnum.GROSS_TAX_PAYABLE, TaxReturnCategoryListEnum.TAX_PAYABLE
7482
- ],
7483
- taxCredits: [
7484
- TaxReturnCategoryListEnum.TAX_CREDITS
7485
- ],
7486
- taxOffsets: [
7487
- TaxReturnCategoryListEnum.TAX_OFFSETS,
7488
- ]
7489
- }
7490
- };
7491
-
7492
7344
  var TaxSummarySectionEnum;
7493
7345
  (function (TaxSummarySectionEnum) {
7494
7346
  TaxSummarySectionEnum[TaxSummarySectionEnum["WORK_TANK"] = 1] = "WORK_TANK";
@@ -7503,7 +7355,7 @@ var TaxSummarySectionEnum;
7503
7355
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form (section "Business income or losses")
7504
7356
  */
7505
7357
  class MyTaxBusinessLosses {
7506
- constructor(transactions, depreciations, allocations, businessLosses, currentLoss, taxSummary) {
7358
+ constructor(transactions, depreciations, businessLosses, currentLoss, taxSummary) {
7507
7359
  this.currentLoss = currentLoss;
7508
7360
  this.purchasesAndOtherCostsAmount = Math.abs(transactions.getExpenseTransactions()
7509
7361
  .filterBy('chartAccounts.id', ChartAccountsListEnum.PURCHASES_STOCK_INVENTORY)
@@ -7557,7 +7409,7 @@ class MyTaxBusinessLosses {
7557
7409
  .getSBPDepreciations()
7558
7410
  .sumBy('claimAmount');
7559
7411
  this.currentYearNetNonPrimaryIncomeOrLossesAmount = new TransactionCollection(transactions.toArray(), depreciations.toArray())
7560
- .getBusinessClaimAmount(allocations);
7412
+ .getBusinessClaimAmount();
7561
7413
  this.priorYearsNonPrimaryLossesAmount = businessLosses.sumBy('openBalance');
7562
7414
  this.netNonPrimaryIncomeOrLossesAmount = this.currentYearNetNonPrimaryIncomeOrLossesAmount -
7563
7415
  this.priorYearsNonPrimaryLossesAmount;
@@ -7927,12 +7779,9 @@ class MyTaxInterest {
7927
7779
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4644110466/Tax+Return+MyTax+-+Online+Form ("Losses" section)
7928
7780
  */
7929
7781
  class MyTaxLosses {
7930
- constructor(businessLosses, transactions, allocations) {
7931
- this.businessLosses = businessLosses;
7932
- this.transactions = transactions;
7933
- this.allocations = allocations;
7782
+ constructor(businessLosses, transactions) {
7934
7783
  this.businessLossDeferred = businessLosses.sumBy('openBalance');
7935
- this.businessLossApplied = businessLosses.calculateBusinessLossApplied(transactions, allocations);
7784
+ this.businessLossApplied = businessLosses.calculateBusinessLossApplied(transactions);
7936
7785
  }
7937
7786
  }
7938
7787
 
@@ -8084,11 +7933,11 @@ const atoLinks = {
8084
7933
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4641357930/Rules+when+a+business+makes+a+loss+Tax+Summary
8085
7934
  */
8086
7935
  class SoleBusinessLossReport extends AbstractModel {
8087
- constructor(loss, transactions, depreciations, allocations) {
7936
+ constructor(loss, transactions, depreciations) {
8088
7937
  super();
8089
7938
  this.openBalance = loss.openBalance;
8090
7939
  const claimAmount = new TransactionCollection(transactions.toArray(), depreciations.toArray())
8091
- .getBusinessClaimAmount(new TransactionAllocationCollection(allocations), loss.business.id);
7940
+ .getBusinessClaimAmount(loss.business.id);
8092
7941
  this.netIncome = claimAmount;
8093
7942
  this.closeBalance = loss.offsetRule ? 0 : Math.min(0, claimAmount - this.openBalance);
8094
7943
  }
@@ -8124,60 +7973,13 @@ class VehicleExpenseCollection extends Collection {
8124
7973
  }
8125
7974
  }
8126
7975
 
8127
- /**
8128
- * @TODO refactor with Map
8129
- * List of objects grouped by passed property
8130
- */
8131
- class Dictionary {
8132
- constructor(items, path = 'id') {
8133
- this.items = {};
8134
- if (!items.length) {
8135
- return;
8136
- }
8137
- this.groupItems(items, path);
8138
- }
8139
- add(key, value) {
8140
- this.items[key] = value;
8141
- }
8142
- get(key) {
8143
- return this.items[key] !== undefined ? this.items[key] : null;
8144
- }
8145
- merge(dictionary) {
8146
- Object.assign(this.items, dictionary.items);
8147
- return this;
8148
- }
8149
- toArray() {
8150
- return Object.values(this.items);
8151
- }
8152
- groupItems(items, path) {
8153
- // Do nothing if provided path was not found in the 1st item
8154
- if (!hasIn(items[0], path.split('.')[0])) {
8155
- return;
8156
- }
8157
- items.forEach((item) => {
8158
- let key = get(item, path);
8159
- // if object does not have property for grouping it will be grouped as 'other'
8160
- if (key === undefined) {
8161
- key = 'other';
8162
- }
8163
- this.items[key] = item;
8164
- });
8165
- }
8166
- get keys() {
8167
- return Object.keys(this.items);
8168
- }
8169
- get length() {
8170
- return this.keys.length;
8171
- }
8172
- }
8173
-
8174
7976
  class SoleBusinessLossesCollection extends Collection {
8175
7977
  /**
8176
7978
  * Business loss applied in current year, includes previous year losses and current year losses for businesses matching offset rule
8177
7979
  */
8178
- calculateBusinessLossApplied(transactions, allocations) {
7980
+ calculateBusinessLossApplied(transactions) {
8179
7981
  // claim amounts for businesses that can be applied to be reduced by prior year business losses
8180
- const claimAmountsByBusinessId = this.getClaimAmountsByBusinessId(transactions, allocations);
7982
+ const claimAmountsByBusinessId = this.getClaimAmountsByBusinessId(transactions);
8181
7983
  return Object.keys(claimAmountsByBusinessId.items).reduce((sum, businessId) => {
8182
7984
  const loss = this.findBy('business.id', +businessId);
8183
7985
  const lossOpenBalance = loss?.openBalance || 0;
@@ -8190,7 +7992,7 @@ class SoleBusinessLossesCollection extends Collection {
8190
7992
  * businesses with income or businesses with a loss, but which met the non-commercial loss rules
8191
7993
  * https://www.ato.gov.au/Business/Non-commercial-losses/
8192
7994
  */
8193
- getClaimAmountsByBusinessId(transactions, allocations) {
7995
+ getClaimAmountsByBusinessId(transactions) {
8194
7996
  const claimAmountsByBusinessId = new Dictionary([]);
8195
7997
  const transactionsByBusinessId = transactions.groupBy('business.id');
8196
7998
  transactionsByBusinessId.keys.forEach((businessId) => {
@@ -8198,7 +8000,7 @@ class SoleBusinessLossesCollection extends Collection {
8198
8000
  const lossOffsetRule = this.findBy('business.id', +businessId)?.offsetRule;
8199
8001
  const businessClaimAmount = transactionsByBusinessId
8200
8002
  .get(businessId)
8201
- .getBusinessClaimAmount(allocations, +businessId);
8003
+ .getBusinessClaimAmount(+businessId);
8202
8004
  // @TODO vik it has nothing to do with getClaimAmountsByBusinessId
8203
8005
  // no way to apply loss for business without profit if offset rules not met
8204
8006
  if (businessClaimAmount < 0 && !lossOffsetRule) {
@@ -8214,46 +8016,35 @@ class SoleInvoiceItemCollection extends Collection {
8214
8016
  get gstItems() {
8215
8017
  return this.filterBy('isGST', true);
8216
8018
  }
8019
+ getTotalPrice(taxType, includeGST = false) {
8020
+ return this.reduce((sum, item) => sum + item.getTotalPrice(taxType, includeGST));
8021
+ }
8217
8022
  }
8218
8023
 
8219
8024
  class SoleInvoiceCollection extends Collection {
8220
8025
  getOverdue() {
8221
8026
  return this.filter((invoice) => invoice.isOverdue());
8222
8027
  }
8223
- getUnpaid() {
8224
- return this.filter((invoice) => invoice.isUnpaid());
8225
- }
8226
- getPaid() {
8227
- return this.filter((invoice) => invoice.isAllocated());
8228
- }
8229
- getPaidCash() {
8230
- return this.filter((invoice) => invoice.isPaidCash());
8231
- }
8232
8028
  getPending() {
8233
8029
  return this.filter((invoice) => invoice.isPending());
8234
8030
  }
8235
- getTransactionsIds() {
8236
- return flatten(this.items.map((invoice) => invoice.getTransactionsIds()));
8031
+ getPaid(transactions) {
8032
+ return this.filter(invoice => transactions.getAmountPerInvoice().get(invoice.id) >= invoice.grossPrice);
8237
8033
  }
8238
- getUnallocated(allocations) {
8239
- return this.filter((invoice) => {
8240
- const invoiceAllocatedAmount = allocations.filterBy('transaction.id', invoice.getTransactionsIds()).sumBy('amount');
8241
- return invoice.grossPrice > invoiceAllocatedAmount;
8242
- });
8034
+ getUnpaid(transactions) {
8035
+ return this.getOpen().filter(invoice => transactions.getAmountPerInvoice().get(invoice.id) < invoice.grossPrice);
8243
8036
  }
8244
- getUnallocatedAmount(allocations) {
8245
- return this.sumBy('grossPrice') - allocations.filterBy('transaction.id', this.getTransactionsIds()).sumBy('amount');
8037
+ getOpen() {
8038
+ return this.filter((invoice) => invoice.isOpen());
8246
8039
  }
8247
- getPaidAmountById(allocations) {
8248
- const allocationsByTransactionId = allocations.groupBy('transaction.id');
8249
- const dictionary = new Dictionary([]);
8250
- this.toArray().forEach((invoice) => {
8251
- // fully paid if user marked invoice as paid with cash
8252
- const amount = invoice.isPaidCash() ? invoice.grossPrice
8253
- : allocationsByTransactionId.merge(invoice.itemsCollection.mapBy('transaction.id')).amount || 0;
8254
- dictionary.add(invoice.id, amount);
8255
- });
8256
- return dictionary;
8040
+ getInvoiceItemsIds() {
8041
+ return flatten(this.map(invoice => invoice.items.map(item => item.id)));
8042
+ }
8043
+ getUnpaidAmount(transactions) {
8044
+ return this.sumBy('grossPrice') - transactions.getByInvoices(this).sumBy('grossAmount');
8045
+ }
8046
+ allocate(bankTransaction, amount) {
8047
+ return flatten(this.map(invoice => invoice.allocate(bankTransaction, amount)));
8257
8048
  }
8258
8049
  }
8259
8050
 
@@ -8477,6 +8268,118 @@ class ReportItemCollection extends Collection {
8477
8268
  }
8478
8269
  }
8479
8270
 
8271
+ const TAX_RETURN_CATEGORIES = {
8272
+ work: {
8273
+ income: [
8274
+ TaxReturnCategoryListEnum.SALARY,
8275
+ TaxReturnCategoryListEnum.ALLOWANCES_EARNINGS_TIPS_DIRECTOR_FEES,
8276
+ TaxReturnCategoryListEnum.EMPLOYER_LUMP_SUM_PAYMENTS,
8277
+ TaxReturnCategoryListEnum.ETP,
8278
+ TaxReturnCategoryListEnum.GOVERNMENT_ALLOWANCES,
8279
+ TaxReturnCategoryListEnum.GOVERNMENT_PENSIONS,
8280
+ TaxReturnCategoryListEnum.ANNUITIES_SUPER_INCOME_STREAMS,
8281
+ TaxReturnCategoryListEnum.SUPERANNUATION_LUMP_SUM_PAYMENTS,
8282
+ TaxReturnCategoryListEnum.ATTRIBUTED_PSI_INCOME,
8283
+ TaxReturnCategoryListEnum.DIVIDENDS,
8284
+ TaxReturnCategoryListEnum.GROSS_INTEREST
8285
+ ],
8286
+ expenses: [
8287
+ TaxReturnCategoryListEnum.WORK_EXPENSES
8288
+ ],
8289
+ interest: [],
8290
+ taxWithheld: [
8291
+ TaxReturnCategoryListEnum.TAX_WITHHELD
8292
+ ]
8293
+ },
8294
+ property: {
8295
+ income: [
8296
+ TaxReturnCategoryListEnum.GROSS_RENT
8297
+ ],
8298
+ expenses: [
8299
+ TaxReturnCategoryListEnum.OTHER_RENTAL_DEDUCTIONS
8300
+ ],
8301
+ interest: [
8302
+ TaxReturnCategoryListEnum.INTEREST_DEDUCTIONS
8303
+ ],
8304
+ depreciation: [
8305
+ TaxReturnCategoryListEnum.CAPITAL_WORKS,
8306
+ // @TODO Nik/Alex (it was TaxReturnCategoryListEnum.DEPRECIATION which doesn't exist)
8307
+ TaxReturnCategoryListEnum.PLANT_AND_EQUIPMENT
8308
+ ]
8309
+ },
8310
+ other: {
8311
+ income: [
8312
+ TaxReturnCategoryListEnum.GROSS_INTEREST,
8313
+ TaxReturnCategoryListEnum.SHARE_SCHEMES,
8314
+ TaxReturnCategoryListEnum.PARTNERSHIPS,
8315
+ TaxReturnCategoryListEnum.PARTNERSHIPS_TRUSTS,
8316
+ TaxReturnCategoryListEnum.TRUSTS,
8317
+ TaxReturnCategoryListEnum.PSI_SBE_INCOME,
8318
+ TaxReturnCategoryListEnum.SOLE_TRADER_BUSINESS_INCOME,
8319
+ TaxReturnCategoryListEnum.CAPITAL_GAINS,
8320
+ TaxReturnCategoryListEnum.FOREIGN_SOURCE_INCOME,
8321
+ TaxReturnCategoryListEnum.BONUSES_FROM_LIFE_INSURANCE,
8322
+ TaxReturnCategoryListEnum.FORESTRY_MANAGED_INVESTMENT_SCHEMES,
8323
+ TaxReturnCategoryListEnum.OTHER_INCOME
8324
+ ],
8325
+ expenses: [
8326
+ TaxReturnCategoryListEnum.OTHER_DEDUCTIONS
8327
+ ],
8328
+ taxCredits: [
8329
+ TaxReturnCategoryListEnum.TAX_CREDITS
8330
+ ],
8331
+ taxOffsets: [
8332
+ TaxReturnCategoryListEnum.TAX_OFFSETS,
8333
+ TaxReturnCategoryListEnum.TAX_OFFSETS_LOW,
8334
+ TaxReturnCategoryListEnum.TAX_OFFSETS_MIDDLE,
8335
+ ]
8336
+ },
8337
+ sole: {
8338
+ income: [
8339
+ TaxReturnCategoryListEnum.GROSS_PAYMENTS_NO_ABN_GIVEN,
8340
+ TaxReturnCategoryListEnum.GROSS_PAYMENTS_VOLUNTARY_AGREEMENT,
8341
+ TaxReturnCategoryListEnum.GROSS_PAYMENTS_LABOUR_HIRE_OR_OTHER,
8342
+ TaxReturnCategoryListEnum.ASSESSABLE_GOVERNMENT_PAYMENTS,
8343
+ TaxReturnCategoryListEnum.OTHER_BUSINESS_INCOME
8344
+ ],
8345
+ expenses: [
8346
+ TaxReturnCategoryListEnum.PURCHASES_AND_OTHER_COSTS,
8347
+ TaxReturnCategoryListEnum.CONTRACTORS_SUBCONTRACTORS_COMMISSION_EXPENSES,
8348
+ TaxReturnCategoryListEnum.SUPERANNUATION_EXPENSES,
8349
+ TaxReturnCategoryListEnum.BAD_DEBTS,
8350
+ TaxReturnCategoryListEnum.LEASE_EXPENSES,
8351
+ TaxReturnCategoryListEnum.RENT_EXPENSES,
8352
+ TaxReturnCategoryListEnum.INTEREST_EXPENSES_WITHIN_AUSTRALIA,
8353
+ TaxReturnCategoryListEnum.INTEREST_EXPENSES_OVERSEAS,
8354
+ TaxReturnCategoryListEnum.MOTOR_VEHICLE_EXPENSES,
8355
+ TaxReturnCategoryListEnum.ALL_OTHER_EXPENSES
8356
+ ],
8357
+ depreciation: [
8358
+ TaxReturnCategoryListEnum.DEPRECIATION_EXPENSES,
8359
+ ],
8360
+ loss: [
8361
+ TaxReturnCategoryListEnum.DEFERRED_BUSINESS_LOSSES_FROM_PRIOR_YEAR,
8362
+ ],
8363
+ lossCurrent: [
8364
+ TaxReturnCategoryListEnum.DEFERRED_BUSINESS_LOSSES,
8365
+ ],
8366
+ taxOffsets: [
8367
+ TaxReturnCategoryListEnum.TAX_OFFSETS_SOLE
8368
+ ],
8369
+ },
8370
+ summary: {
8371
+ income: [
8372
+ TaxReturnCategoryListEnum.GROSS_TAX_PAYABLE, TaxReturnCategoryListEnum.TAX_PAYABLE
8373
+ ],
8374
+ taxCredits: [
8375
+ TaxReturnCategoryListEnum.TAX_CREDITS
8376
+ ],
8377
+ taxOffsets: [
8378
+ TaxReturnCategoryListEnum.TAX_OFFSETS,
8379
+ ]
8380
+ }
8381
+ };
8382
+
8480
8383
  class VehicleLogbookCollection extends Collection {
8481
8384
  /**
8482
8385
  * Calculate total kilometers traveled
@@ -10005,6 +9908,53 @@ __decorate([
10005
9908
  Expose()
10006
9909
  ], Message.prototype, "documents", void 0);
10007
9910
 
9911
+ /**
9912
+ * @TODO refactor with Map
9913
+ * List of objects grouped by passed property
9914
+ */
9915
+ class Dictionary {
9916
+ constructor(items, path = 'id') {
9917
+ this.items = {};
9918
+ if (!items.length) {
9919
+ return;
9920
+ }
9921
+ this.groupItems(items, path);
9922
+ }
9923
+ add(key, value) {
9924
+ this.items[key] = value;
9925
+ }
9926
+ get(key) {
9927
+ return this.items[key] !== undefined ? this.items[key] : null;
9928
+ }
9929
+ merge(dictionary) {
9930
+ Object.assign(this.items, dictionary.items);
9931
+ return this;
9932
+ }
9933
+ toArray() {
9934
+ return Object.values(this.items);
9935
+ }
9936
+ groupItems(items, path) {
9937
+ // Do nothing if provided path was not found in the 1st item
9938
+ if (!hasIn(items[0], path.split('.')[0])) {
9939
+ return;
9940
+ }
9941
+ items.forEach((item) => {
9942
+ let key = get(item, path);
9943
+ // if object does not have property for grouping it will be grouped as 'other'
9944
+ if (key === undefined) {
9945
+ key = 'other';
9946
+ }
9947
+ this.items[key] = item;
9948
+ });
9949
+ }
9950
+ get keys() {
9951
+ return Object.keys(this.items);
9952
+ }
9953
+ get length() {
9954
+ return this.keys.length;
9955
+ }
9956
+ }
9957
+
10008
9958
  /**
10009
9959
  * @TODO Alex remove
10010
9960
  */
@@ -13976,37 +13926,10 @@ class SoleInvoiceService extends RestService {
13976
13926
  this.modelClass = SoleInvoice;
13977
13927
  this.url = 'sole-invoices';
13978
13928
  this.roles = [UserRolesEnum.SOLE_TANK];
13979
- this.listenEvents();
13980
- }
13981
- listenEvents() {
13982
- this.listenAllocations();
13983
- }
13984
- add(invoice) {
13985
- return super.add(invoice).pipe(map((newInvoice) => {
13986
- // invoice published right away skipping draft status
13987
- if (newInvoice.isPending()) {
13988
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.SOLE_INVOICE_PUBLISHED, newInvoice));
13989
- }
13990
- return newInvoice;
13991
- }));
13992
- }
13993
- update(invoice) {
13994
- return super.update(invoice).pipe(map((updatedInvoice) => {
13995
- if (!updatedInvoice.isDraft()) {
13996
- // @TODO vik use different event to reload transactions
13997
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.SOLE_INVOICE_PUBLISHED, updatedInvoice));
13998
- }
13999
- return updatedInvoice;
14000
- }));
14001
13929
  }
14002
13930
  updateStatus(invoice, status) {
14003
13931
  // @TODO use id only to avoid unexpected changes
14004
- return this.update(Object.assign({}, invoice, { status })).pipe(map((updatedInvoice) => {
14005
- if (updatedInvoice.isPending()) {
14006
- this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.SOLE_INVOICE_PUBLISHED, updatedInvoice));
14007
- }
14008
- return updatedInvoice;
14009
- }));
13932
+ return this.update(Object.assign({}, invoice, { status }));
14010
13933
  }
14011
13934
  send(invoice, file) {
14012
13935
  const formData = new FormData();
@@ -14025,14 +13948,6 @@ class SoleInvoiceService extends RestService {
14025
13948
  const number = last(this.cache)?.number ?? 0;
14026
13949
  return number + 1;
14027
13950
  }
14028
- listenAllocations() {
14029
- this.eventDispatcherService.on([
14030
- AppEventTypeEnum.TRANSACTION_ALLOCATION_CREATED,
14031
- AppEventTypeEnum.TRANSACTION_ALLOCATION_DELETED
14032
- ]).subscribe(() => {
14033
- this.refreshCache();
14034
- });
14035
- }
14036
13951
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleInvoiceService, deps: [{ token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
14037
13952
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SoleInvoiceService, providedIn: 'root' }); }
14038
13953
  }
@@ -14926,7 +14841,6 @@ class TransactionService extends RestService {
14926
14841
  this.listenPropertyShareUpdate();
14927
14842
  this.listenVehicleClaimChanges();
14928
14843
  this.listenPropertyForecastUpdate();
14929
- this.listenInvoicesPublish();
14930
14844
  }
14931
14845
  /**
14932
14846
  * get list of all user's TaxTank transactions
@@ -15060,6 +14974,11 @@ class TransactionService extends RestService {
15060
14974
  return updatedTransactions;
15061
14975
  }));
15062
14976
  }
14977
+ deleteBatch(models) {
14978
+ return super.deleteBatch(models).pipe(map(() => {
14979
+ this.eventDispatcherService.dispatch(new AppEvent(AppEventTypeEnum.TRANSACTION_DELETED, models[0]));
14980
+ }));
14981
+ }
15063
14982
  /**
15064
14983
  * delete transaction and related transactions
15065
14984
  * @param model
@@ -15143,11 +15062,6 @@ class TransactionService extends RestService {
15143
15062
  replace(this.cache, transactionToReplace);
15144
15063
  this.updateCache();
15145
15064
  }
15146
- listenInvoicesPublish() {
15147
- this.eventDispatcherService.on(AppEventTypeEnum.SOLE_INVOICE_PUBLISHED).subscribe(() => {
15148
- this.refreshCache();
15149
- });
15150
- }
15151
15065
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionService, deps: [{ token: i1.HttpClient }, { token: EventDispatcherService }, { token: 'environment' }], target: i0.ɵɵFactoryTarget.Injectable }); }
15152
15066
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionService, providedIn: 'root' }); }
15153
15067
  }
@@ -18995,27 +18909,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
18995
18909
  }]
18996
18910
  }], ctorParameters: function () { return [{ type: PropertyService }, { type: TransactionService }, { type: DepreciationService }, { type: ChartAccountsService }]; } });
18997
18911
 
18998
- /**
18999
- * @TODO Alex: refactor, move methods to collections and models, remove this service
19000
- */
19001
- class TransactionCalculationService {
19002
- getAllocationsByInvoices(invoices, allocations) {
19003
- const allocationsByInvoices = new TransactionAllocationCollection([]).groupBy();
19004
- invoices.toArray().forEach((invoice) => {
19005
- allocationsByInvoices.add(invoice.id, allocations.filterBy('transaction.id', invoice.getTransactionsIds()));
19006
- });
19007
- return allocationsByInvoices;
19008
- }
19009
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionCalculationService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
19010
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionCalculationService, providedIn: 'root' }); }
19011
- }
19012
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TransactionCalculationService, decorators: [{
19013
- type: Injectable,
19014
- args: [{
19015
- providedIn: 'root'
19016
- }]
19017
- }] });
19018
-
19019
18912
  const EXCEL_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=UTF-8';
19020
18913
  /**
19021
18914
  * Service to work with XLSX (generate, download, e.t.c.)
@@ -20838,7 +20731,7 @@ class UniqueEmailValidator {
20838
20731
  this.userService = userService;
20839
20732
  }
20840
20733
  validate(control) {
20841
- return control.valueChanges.pipe(debounceTime(500), distinctUntilChanged(), first$1(), switchMap((value) => this.userService.search(value)), map((user) => user ? { emailIsUsed: true } : null), catchError(() => of(null)));
20734
+ return control.valueChanges.pipe(debounceTime(500), distinctUntilChanged(), switchMap((value) => this.userService.search(value)), map((user) => (user ? { emailIsUsed: true } : null)), catchError(() => of(null)));
20842
20735
  }
20843
20736
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UniqueEmailValidator, deps: [{ token: UserService }], target: i0.ɵɵFactoryTarget.Injectable }); }
20844
20737
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UniqueEmailValidator, providedIn: 'root' }); }
@@ -21293,7 +21186,7 @@ class SoleInvoiceTemplateForm extends AbstractForm {
21293
21186
  * https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/268533936/BAS+Report
21294
21187
  */
21295
21188
  class BasReportForm extends AbstractForm {
21296
- constructor(report, transactions, allocations, depreciations) {
21189
+ constructor(report, transactions, depreciations) {
21297
21190
  super({
21298
21191
  dateFrom: new UntypedFormControl(report.dateFrom, Validators.required),
21299
21192
  dateTo: new UntypedFormControl(report.dateTo, Validators.required),
@@ -21308,7 +21201,6 @@ class BasReportForm extends AbstractForm {
21308
21201
  fuelTaxCredit: new UntypedFormControl(report.fuelTaxCredit, Validators.required),
21309
21202
  gst: new UntypedFormControl({ value: report.gst, disabled: true }),
21310
21203
  }, report);
21311
- this.report = report;
21312
21204
  // prefill income/expense data based on transactions/depreciations filtered by specified date
21313
21205
  combineLatest([this.get('dateFrom').valueChanges, this.get('dateTo').valueChanges])
21314
21206
  .subscribe(([dateFrom, dateTo]) => {
@@ -21318,8 +21210,8 @@ class BasReportForm extends AbstractForm {
21318
21210
  const expenseTransactions = new TransactionCollection(filteredTransactions.getExpenseTransactions().toArray(), filteredDepreciations.toArray());
21319
21211
  // all sole income claimed as 100%
21320
21212
  // @TODO temp fix, waiting for TT-3503/TT-3495 breaking changes
21321
- this.patchField('income', incomeTransactions.getAllocatedAmount(allocations));
21322
- this.patchField('incomeGST', incomeTransactions.calculateAllocatedGST(allocations));
21213
+ this.patchField('income', incomeTransactions.sumBy('amount'));
21214
+ this.patchField('incomeGST', incomeTransactions.sumBy('gstAmount'));
21323
21215
  this.patchField('expenseGST', expenseTransactions.filterBy('isGST', true).sumBy('gstClaimAmount'));
21324
21216
  });
21325
21217
  // calculate taxWithheldTotal
@@ -23683,5 +23575,5 @@ var MessagesEnum;
23683
23575
  * Generated bundle index. Do not edit.
23684
23576
  */
23685
23577
 
23686
- export { AbstractForm, AbstractModel, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressForm, AddressService, AddressTypeEnum, AllocationGroup, AllocationGroupCollection, AllocationRule, AllocationRuleCollection, AllocationRuleConditionComparisonOperatorEnum, AllocationRuleConditionFieldEnum, AllocationRuleConditionOperatorEnum, AllocationRuleForm, AllocationRuleService, AllocationRuleTransaction, AllocationRuleTransactionMetaField, AllocationRuleTypeEnum, AlphabetColorsEnum, AnnualClientDetails, AnnualClientDetailsForm, AnnualClientDetailsService, AnnualFrequencyEnum, AppCurrencyPipe, AppEvent, AppEvent2, AppEventTypeEnum, AppFile, AssetEntityTypeEnum, AssetSale, AssetSaleCollection, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Badge, BadgeColorEnum, Bank, BankAccount, BankAccountAddManualForm, BankAccountAllocationForm, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountImportForm, BankAccountPropertiesForm, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankAccountsImportForm, BankConnection, BankConnectionMessagesEnum, BankConnectionService, BankConnectionStatusEnum, BankExternalStats, BankPopularEnum, BankProviderEnum, BankService, BankTransaction, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasReport, BasReportForm, BasReportService, BasiqConfig, BasiqJob, BasiqJobResponse, BasiqJobStep, BasiqMessagesEnum, BasiqService, BasiqToken, BasiqTokenService, BestVehicleLogbookCollection, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, BorrowingReport, BorrowingReportForm, BorrowingReportMessagesEnum, BorrowingReportService, Budget, BudgetForm, BudgetMessagesEnum, BudgetRule, BudgetService, BusinessTypeEnum, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CgtExemptionAndRolloverCodeEnum, ChartAccounts, ChartAccountsCategoryECollection, ChartAccountsCategoryEnum, ChartAccountsCollection, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingListEnum, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsHoldingUntaxedIncomeListEnum, ChartAccountsInvoiceExpenseEnum, ChartAccountsKeepSign, ChartAccountsListEnum, ChartAccountsMetaField, ChartAccountsMetaFieldListEnum, ChartAccountsMetaFieldTypeEnum, ChartAccountsSalaryAdjustmentsListEnum, ChartAccountsSalaryIncludedListEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsUnallocatableListEnum, ChartAccountsValue, ChartAccountsValueService, ChartData, ChartSerie, Chat, ChatCollection, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsForm, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteCollection, ClientInviteMessages, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEDUCTION_CATEGORIES, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, DeductionClothingTypeEnum, DeductionSelfEducationTypeEnum, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationForm, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpRateEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Dictionary, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderForm, DocumentFolderMessagesEnum, DocumentFolderService, DocumentForm, DocumentMessagesEnum, DocumentService, DocumentTypeEnum, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeMessagesEnum, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, ExportFormatterService, ExportableCollection, FacebookService, FileService, FileValidator, FinancialYear, FinancialYearService, Firm, FirmForm, FirmMessagesEnum, FirmService, FirmTypeEnum, FormValidationsEnum, GoogleService, HeaderTitleService, Holding, HoldingCollection, HoldingForm, HoldingImport, HoldingImportForm, HoldingImportMessagesEnum, HoldingImportService, HoldingIncomeForm, HoldingMessagesEnum, HoldingReinvest, HoldingReinvestForm, HoldingSale, HoldingSaleCollection, HoldingSaleForm, HoldingSaleMessagesEnum, HoldingSaleService, HoldingService, HoldingType, HoldingTypeCategoryEnum, HoldingTypeCollection, HoldingTypeExchange, HoldingTypeExchangeListEnum, HoldingTypeExchangeService, HoldingTypeForm, HoldingTypeMessagesEnum, HoldingTypeService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastCollection, IncomeSourceForecastService, IncomeSourceForecastTrustTypeEnum, IncomeSourceMessagesEnum, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListHoldingEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSoleEnum, IncomeSourceTypeListWorkEnum, IncomeSourceTypeService, InterceptorsModule, IntercomService, InviteStatusEnum, JsPdf, JwtService, Loan, LoanBankTypeEnum, LoanCollection, LoanForm, LoanFrequencyEnum, LoanInterestTypeEnum, LoanInterestTypeLabelEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPaymentCollection, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanRepaymentTypeLabelEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LoginForm, LossTypeEnum, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MessagesEnum, MixpanelService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, MyTaxBusinessDetails, MyTaxBusinessDetailsForm, MyTaxBusinessIncome, MyTaxBusinessIncomeForm, MyTaxBusinessIncomeOrLossesForm, MyTaxBusinessLosses, MyTaxBusinessLossesForm, MyTaxCgt, MyTaxCgtForm, MyTaxDeductions, MyTaxDeductionsForm, MyTaxDividends, MyTaxDividendsForm, MyTaxEstimate, MyTaxIncomeStatements, MyTaxIncomeStatementsForm, MyTaxIncomeTests, MyTaxIncomeTestsForm, MyTaxInterest, MyTaxInterestForm, MyTaxLosses, MyTaxLossesForm, MyTaxMedicareForm, MyTaxOffsets, MyTaxOffsetsForm, MyTaxOtherIncome, MyTaxOtherIncomeForm, MyTaxPartnershipsAndTrusts, MyTaxPartnershipsAndTrustsForm, MyTaxRent, MyTaxRentForm, Notification, Occupation, OccupationService, PASSWORD_REGEXPS, PasswordForm, PdfFromDataTableService, PdfFromDomElementService, PdfFromHtmlTableService, PdfFromTableService, PdfOrientationEnum, PdfService, PdfSettings, Phone, PhoneForm, PhoneTypeEnum, PreloaderService, Property, PropertyAddForm, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementCollection, PropertyCategoryMovementForm, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentForm, PropertyDocumentMessagesEnum, PropertyDocumentService, PropertyEditForm, PropertyEquityChartData, PropertyEquityChartItem, PropertyEquityChartTypeEnum, PropertyForecast, PropertyForecastForm, PropertyMessagesEnum, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciation, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleCollection, PropertySaleCostBase, PropertySaleCostBaseForm, PropertySaleCostSaleForm, PropertySaleExemptionsForm, PropertySaleService, PropertySaleTaxExemptionMetaField, PropertySaleTaxExemptionMetaFieldCollection, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareCollection, PropertyShareForm, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, PropertyValuationCollection, PropertyValuationForm, PropertyValuationMessages, PropertyValuationService, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, RestService$1 as RestService, RewardfulService, SERVICE_PRODUCT_ROLES, SafeUrlPipe, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentMethod, ServicePaymentMethodService, ServicePaymentService, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceService, ServicePriceTypeEnum, ServiceProduct, ServiceProductCollection, ServiceProductIconsEnum, ServiceProductIdEnum, ServiceProductService, ServiceProductStatusEnum, ServicePromoCode, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, SetupItemTypeEnum, SoleBusiness, SoleBusinessActivity, SoleBusinessActivityService, SoleBusinessAllocation, SoleBusinessAllocationsForm, SoleBusinessForm, SoleBusinessLoss, SoleBusinessLossForm, SoleBusinessLossOffsetRule, SoleBusinessLossOffsetRuleService, SoleBusinessLossReport, SoleBusinessLossService, SoleBusinessLossesCollection, SoleBusinessMessagesEnum, SoleBusinessService, SoleContact, SoleContactForm, SoleContactService, SoleDepreciationMethod, SoleDepreciationMethodEnum, SoleDepreciationMethodForm, SoleDepreciationMethodService, SoleDetails, SoleDetailsForm, SoleDetailsService, SoleForecast, SoleForecastService, SoleIncomeForm, SoleInvoice, SoleInvoiceCollection, SoleInvoiceForm, SoleInvoiceItem, SoleInvoiceItemCollection, SoleInvoiceItemForm, SoleInvoiceService, SoleInvoiceStatusesEnum, SoleInvoiceTaxTypeEnum, SoleInvoiceTemplate, SoleInvoiceTemplateForm, SoleInvoiceTemplateService, SoleInvoiceTemplateTaxTypeEnum, SpareDocumentSpareTypeEnum, SseService, StatesEnum, SubscriptionItemCollection, SubscriptionMessagesEnum, SubscriptionService, TAX_RETURN_CATEGORIES, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetaField, TaxExemptionMetaFieldEnum, TaxExemptionService, TaxReturn, TaxReturnCategory, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReturnItem, TaxReturnItemEnum, TaxReturnItemService, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewMessagesEnum, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionBaseForm, TransactionCalculationService, TransactionCategoryEnum, TransactionCollection, TransactionForm, TransactionMetaField, TransactionOperationEnum, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, UniqueEmailValidator, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeCollection, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserForm, UserInviteForm, UserMedicareExemptionEnum, UserMessagesEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, UsersInviteService, Vehicle, VehicleClaim, VehicleClaimCollection, VehicleClaimDetails, VehicleClaimDetailsForm, VehicleClaimDetailsMethodEnum, VehicleClaimDetailsService, VehicleClaimForm, VehicleClaimService, VehicleExpense, VehicleExpenseCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookForm, VehicleLogbookMessages, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleMessagesEnum, VehicleService, WorkExpenseForm, WorkIncomeForm, XlsxService, YoutubeService, atLeastOneCheckedValidator, atoLinks, autocompleteValidator, cloneDeep, compare, compareMatOptions, conditionalValidator, createDate, currentFinYearValidator, displayMatOptions, enumToList, fieldsSumValidator, getDocIcon, greaterThanValidator, minDateValidator, passwordMatchValidator, passwordValidator, replace, sort, sortDeep, taxReviewFilterPredicate, toArray };
23578
+ export { AbstractForm, AbstractModel, AccountSetupItem, AccountSetupItemCollection, AccountSetupService, Address, AddressForm, AddressService, AddressTypeEnum, AllocationGroup, AllocationGroupCollection, AllocationRule, AllocationRuleCollection, AllocationRuleConditionComparisonOperatorEnum, AllocationRuleConditionFieldEnum, AllocationRuleConditionOperatorEnum, AllocationRuleForm, AllocationRuleService, AllocationRuleTransaction, AllocationRuleTransactionMetaField, AllocationRuleTypeEnum, AlphabetColorsEnum, AnnualClientDetails, AnnualClientDetailsForm, AnnualClientDetailsService, AnnualFrequencyEnum, AppCurrencyPipe, AppEvent, AppEvent2, AppEventTypeEnum, AppFile, AssetEntityTypeEnum, AssetSale, AssetSaleCollection, AssetTypeEnum, AssetsService, AuthService, BANK_ACCOUNT_TYPES, Badge, BadgeColorEnum, Bank, BankAccount, BankAccountAddManualForm, BankAccountAllocationForm, BankAccountCalculationService, BankAccountChartData, BankAccountCollection, BankAccountImportForm, BankAccountPropertiesForm, BankAccountProperty, BankAccountService, BankAccountStatusEnum, BankAccountTypeEnum, BankAccountsImportForm, BankConnection, BankConnectionMessagesEnum, BankConnectionService, BankConnectionStatusEnum, BankExternalStats, BankPopularEnum, BankProviderEnum, BankService, BankTransaction, BankTransactionChartData, BankTransactionCollection, BankTransactionService, BankTransactionSummaryFieldsEnum, BankTransactionTypeEnum, BasReport, BasReportForm, BasReportService, BasiqConfig, BasiqJob, BasiqJobResponse, BasiqJobStep, BasiqMessagesEnum, BasiqService, BasiqToken, BasiqTokenService, BestVehicleLogbookCollection, BorrowingExpense, BorrowingExpenseLoan, BorrowingExpenseService, BorrowingReport, BorrowingReportForm, BorrowingReportMessagesEnum, BorrowingReportService, Budget, BudgetForm, BudgetMessagesEnum, BudgetRule, BudgetService, BusinessTypeEnum, CAPITAL_COSTS_ITEMS, CHART_ACCOUNTS_CATEGORIES, CalculationFormItem, CalculationFormTypeEnum, CgtExemptionAndRolloverCodeEnum, ChartAccounts, ChartAccountsCategoryECollection, ChartAccountsCategoryEnum, ChartAccountsCollection, ChartAccountsDepreciation, ChartAccountsDepreciationService, ChartAccountsEtpEnum, ChartAccountsHeading, ChartAccountsHeadingListEnum, ChartAccountsHeadingTaxDeductibleEnum, ChartAccountsHeadingTaxableEnum, ChartAccountsHeadingVehicleListEnum, ChartAccountsHoldingUntaxedIncomeListEnum, ChartAccountsInvoiceExpenseEnum, ChartAccountsKeepSign, ChartAccountsListEnum, ChartAccountsMetaField, ChartAccountsMetaFieldListEnum, ChartAccountsMetaFieldTypeEnum, ChartAccountsSalaryAdjustmentsListEnum, ChartAccountsSalaryIncludedListEnum, ChartAccountsService, ChartAccountsTaxLabelsEnum, ChartAccountsTypeEnum, ChartAccountsUnallocatableListEnum, ChartAccountsValue, ChartAccountsValueService, ChartData, ChartSerie, Chat, ChatCollection, ChatService, ChatStatusEnum, ChatViewTypeEnum, ClientCollection, ClientDetails, ClientDetailsForm, ClientDetailsMedicareExemptionEnum, ClientDetailsWorkDepreciationCalculationEnum, ClientDetailsWorkingHolidayMakerEnum, ClientIncomeTypes, ClientIncomeTypesForm, ClientIncomeTypesService, ClientInvite, ClientInviteCollection, ClientInviteMessages, ClientInviteService, ClientInviteStatusEnum, ClientInviteTypeEnum, ClientMovement, ClientMovementCollection, ClientMovementService, ClientPortfolioChartData, ClientPortfolioReport, ClientPortfolioReportCollection, ClientPortfolioReportService, Collection, CollectionDictionary, CorelogicService, CorelogicSuggestion, Country, DEDUCTION_CATEGORIES, DEPRECIATION_GROUPS, DOCUMENT_FILE_TYPES, DeductionClothingTypeEnum, DeductionSelfEducationTypeEnum, Depreciation, DepreciationCalculationEnum, DepreciationCalculationPercentEnum, DepreciationCapitalProject, DepreciationCapitalProjectService, DepreciationCollection, DepreciationForecast, DepreciationForecastCollection, DepreciationForm, DepreciationGroup, DepreciationGroupEnum, DepreciationGroupItem, DepreciationLvpAssetTypeEnum, DepreciationLvpRateEnum, DepreciationLvpReportItem, DepreciationLvpReportItemCollection, DepreciationReportItem, DepreciationReportItemCollection, DepreciationService, DepreciationTypeEnum, DepreciationWriteOffAmountEnum, Dictionary, Document, DocumentApiUrlPrefixEnum, DocumentFolder, DocumentFolderForm, DocumentFolderMessagesEnum, DocumentFolderService, DocumentForm, DocumentMessagesEnum, DocumentService, DocumentTypeEnum, ENDPOINTS, EmployeeCollection, EmployeeDetails, EmployeeInvite, EmployeeInviteService, EmployeeMessagesEnum, EmployeeService, Endpoint, EquityPositionChartService, EventDispatcherService, ExportDataTable, ExportFormatEnum, ExportFormatterService, ExportableCollection, FacebookService, FileService, FileValidator, FinancialYear, FinancialYearService, Firm, FirmForm, FirmMessagesEnum, FirmService, FirmTypeEnum, FormValidationsEnum, GoogleService, HeaderTitleService, Holding, HoldingCollection, HoldingForm, HoldingImport, HoldingImportForm, HoldingImportMessagesEnum, HoldingImportService, HoldingIncomeForm, HoldingMessagesEnum, HoldingReinvest, HoldingReinvestForm, HoldingSale, HoldingSaleCollection, HoldingSaleForm, HoldingSaleMessagesEnum, HoldingSaleService, HoldingService, HoldingType, HoldingTypeCategoryEnum, HoldingTypeCollection, HoldingTypeExchange, HoldingTypeExchangeListEnum, HoldingTypeExchangeService, HoldingTypeForm, HoldingTypeMessagesEnum, HoldingTypeService, IconsFileEnum, IncomeAmountTypeEnum, IncomePosition, IncomeSource, IncomeSourceChartData, IncomeSourceCollection, IncomeSourceForecast, IncomeSourceForecastCollection, IncomeSourceForecastService, IncomeSourceForecastTrustTypeEnum, IncomeSourceMessagesEnum, IncomeSourceService, IncomeSourceType, IncomeSourceTypeEnum, IncomeSourceTypeListHoldingEnum, IncomeSourceTypeListOtherEnum, IncomeSourceTypeListSoleEnum, IncomeSourceTypeListWorkEnum, IncomeSourceTypeService, InterceptorsModule, IntercomService, InviteStatusEnum, JsPdf, JwtService, Loan, LoanBankTypeEnum, LoanCollection, LoanForm, LoanFrequencyEnum, LoanInterestTypeEnum, LoanInterestTypeLabelEnum, LoanMaxNumberOfPaymentsEnum, LoanPayment, LoanPaymentCollection, LoanPayout, LoanPayoutTypeEnum, LoanRepaymentFrequencyEnum, LoanRepaymentTypeEnum, LoanRepaymentTypeLabelEnum, LoanService, LoanTypeEnum, LoanVehicleTypeEnum, LoginForm, LossTypeEnum, MODULE_URL_LIST, MONTHS, Message, MessageCollection, MessageDocument, MessageDocumentCollection, MessageDocumentService, MessageService, MessagesEnum, MixpanelService, MonthNameShortEnum, MonthNumberEnum, MyAccountHistory, MyAccountHistoryInitiatedByEnum, MyAccountHistoryStatusEnum, MyAccountHistoryTypeEnum, MyTaxBusinessDetails, MyTaxBusinessDetailsForm, MyTaxBusinessIncome, MyTaxBusinessIncomeForm, MyTaxBusinessIncomeOrLossesForm, MyTaxBusinessLosses, MyTaxBusinessLossesForm, MyTaxCgt, MyTaxCgtForm, MyTaxDeductions, MyTaxDeductionsForm, MyTaxDividends, MyTaxDividendsForm, MyTaxEstimate, MyTaxIncomeStatements, MyTaxIncomeStatementsForm, MyTaxIncomeTests, MyTaxIncomeTestsForm, MyTaxInterest, MyTaxInterestForm, MyTaxLosses, MyTaxLossesForm, MyTaxMedicareForm, MyTaxOffsets, MyTaxOffsetsForm, MyTaxOtherIncome, MyTaxOtherIncomeForm, MyTaxPartnershipsAndTrusts, MyTaxPartnershipsAndTrustsForm, MyTaxRent, MyTaxRentForm, Notification, Occupation, OccupationService, PASSWORD_REGEXPS, PasswordForm, PdfFromDataTableService, PdfFromDomElementService, PdfFromHtmlTableService, PdfFromTableService, PdfOrientationEnum, PdfService, PdfSettings, Phone, PhoneForm, PhoneTypeEnum, PreloaderService, Property, PropertyAddForm, PropertyCalculationService, PropertyCategory, PropertyCategoryListEnum, PropertyCategoryMovement, PropertyCategoryMovementCollection, PropertyCategoryMovementForm, PropertyCategoryMovementService, PropertyCategoryService, PropertyCollection, PropertyDepreciationCalculationEnum, PropertyDocument, PropertyDocumentForm, PropertyDocumentMessagesEnum, PropertyDocumentService, PropertyEditForm, PropertyEquityChartData, PropertyEquityChartItem, PropertyEquityChartTypeEnum, PropertyForecast, PropertyForecastForm, PropertyMessagesEnum, PropertyReportItem, PropertyReportItemCollection, PropertyReportItemDepreciation, PropertyReportItemDepreciationCollection, PropertyReportItemTransaction, PropertyReportItemTransactionCollection, PropertySale, PropertySaleCollection, PropertySaleCostBase, PropertySaleCostBaseForm, PropertySaleCostSaleForm, PropertySaleExemptionsForm, PropertySaleService, PropertySaleTaxExemptionMetaField, PropertySaleTaxExemptionMetaFieldCollection, PropertyService, PropertyShare, PropertyShareAccessEnum, PropertyShareCollection, PropertyShareForm, PropertyShareService, PropertyShareStatusEnum, PropertySubscription, PropertyTransactionReportService, PropertyValuation, PropertyValuationCollection, PropertyValuationForm, PropertyValuationMessages, PropertyValuationService, RegisterClientForm, RegisterFirmForm, RegistrationInvite, RegistrationInviteStatusEnum, ReportItem, ReportItemCollection, ReportItemDetails, ResetPasswordForm, RestService$1 as RestService, RewardfulService, SERVICE_PRODUCT_ROLES, SafeUrlPipe, SalaryForecast, SalaryForecastFrequencyEnum, SalaryForecastService, ServiceNotificationService, ServiceNotificationStatusEnum, ServiceNotificationTypeEnum, ServicePayment, ServicePaymentMethod, ServicePaymentMethodService, ServicePaymentService, ServicePaymentStatusEnum, ServicePrice, ServicePriceCollection, ServicePriceRecurringIntervalEnum, ServicePriceService, ServicePriceTypeEnum, ServiceProduct, ServiceProductCollection, ServiceProductIconsEnum, ServiceProductIdEnum, ServiceProductService, ServiceProductStatusEnum, ServicePromoCode, ServiceSubscription, ServiceSubscriptionCollection, ServiceSubscriptionItem, ServiceSubscriptionStatusEnum, SetupItemTypeEnum, SoleBusiness, SoleBusinessActivity, SoleBusinessActivityService, SoleBusinessAllocation, SoleBusinessAllocationsForm, SoleBusinessForm, SoleBusinessLoss, SoleBusinessLossForm, SoleBusinessLossOffsetRule, SoleBusinessLossOffsetRuleService, SoleBusinessLossReport, SoleBusinessLossService, SoleBusinessLossesCollection, SoleBusinessMessagesEnum, SoleBusinessService, SoleContact, SoleContactForm, SoleContactService, SoleDepreciationMethod, SoleDepreciationMethodEnum, SoleDepreciationMethodForm, SoleDepreciationMethodService, SoleDetails, SoleDetailsForm, SoleDetailsService, SoleForecast, SoleForecastService, SoleIncomeForm, SoleInvoice, SoleInvoiceCollection, SoleInvoiceForm, SoleInvoiceItem, SoleInvoiceItemCollection, SoleInvoiceItemForm, SoleInvoiceService, SoleInvoiceStatusesEnum, SoleInvoiceTaxTypeEnum, SoleInvoiceTemplate, SoleInvoiceTemplateForm, SoleInvoiceTemplateService, SoleInvoiceTemplateTaxTypeEnum, SpareDocumentSpareTypeEnum, SseService, StatesEnum, SubscriptionItemCollection, SubscriptionMessagesEnum, SubscriptionService, TAX_RETURN_CATEGORIES, TYPE_LOAN, TankTypeEnum, TaxCalculationMedicareExemptionEnum, TaxCalculationTypeEnum, TaxExemption, TaxExemptionEnum, TaxExemptionMetaField, TaxExemptionMetaFieldEnum, TaxExemptionService, TaxReturn, TaxReturnCategory, TaxReturnCategoryListEnum, TaxReturnCategorySectionEnum, TaxReturnItem, TaxReturnItemEnum, TaxReturnItemService, TaxReview, TaxReviewCollection, TaxReviewHistoryService, TaxReviewMessagesEnum, TaxReviewService, TaxReviewStatusEnum, TaxSummary, TaxSummaryListEnum, TaxSummarySection, TaxSummarySectionEnum, TaxSummaryService, TaxSummaryTaxSummaryEnum, TaxSummaryTypeEnum, TicketFeedbackEnum, TicketStatusEnum, TicketTypesEnum, Toast, ToastService, ToastTypeEnum, Transaction, TransactionAllocation, TransactionAllocationCollection, TransactionAllocationService, TransactionBase, TransactionBaseForm, TransactionCategoryEnum, TransactionCollection, TransactionForm, TransactionMetaField, TransactionOperationEnum, TransactionService, TransactionSourceEnum, TransactionTypeEnum, TtCoreModule, USER_ROLES, USER_WORK_POSITION, UniqueEmailValidator, User, UserEventSetting, UserEventSettingCollection, UserEventSettingFieldEnum, UserEventSettingService, UserEventStatusEnum, UserEventType, UserEventTypeCategory, UserEventTypeClientTypeEnum, UserEventTypeCollection, UserEventTypeEmployeeTypeEnum, UserEventTypeFrequencyEnum, UserEventTypeService, UserEventTypeUserTypeEnum, UserForm, UserInviteForm, UserMedicareExemptionEnum, UserMessagesEnum, UserRolesEnum, UserService, UserStatusEnum, UserSwitcherService, UserTitleEnum, UserToRegister, UserWorkDepreciationCalculationEnum, UserWorkingHolidayMakerEnum, UsersInviteService, Vehicle, VehicleClaim, VehicleClaimCollection, VehicleClaimDetails, VehicleClaimDetailsForm, VehicleClaimDetailsMethodEnum, VehicleClaimDetailsService, VehicleClaimForm, VehicleClaimService, VehicleExpense, VehicleExpenseCollection, VehicleForm, VehicleLogbook, VehicleLogbookCollection, VehicleLogbookForm, VehicleLogbookMessages, VehicleLogbookPurposeEnum, VehicleLogbookService, VehicleMessagesEnum, VehicleService, WorkExpenseForm, WorkIncomeForm, XlsxService, YoutubeService, atLeastOneCheckedValidator, atoLinks, autocompleteValidator, cloneDeep, compare, compareMatOptions, conditionalValidator, createDate, currentFinYearValidator, displayMatOptions, enumToList, fieldsSumValidator, getDocIcon, greaterThanValidator, minDateValidator, passwordMatchValidator, passwordValidator, replace, sort, sortDeep, taxReviewFilterPredicate, toArray };
23687
23579
  //# sourceMappingURL=taxtank-core.mjs.map