taxtank-core 1.0.55 → 1.0.57
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/fesm2022/taxtank-core.mjs +38 -36
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/collections/transaction/transaction.collection.d.ts +0 -2
- package/src/lib/db/Enums/tax-return/tax-return-category-list.enum.d.ts +4 -1
- package/src/lib/models/chart-accounts/chart-accounts.d.ts +1 -0
- package/src/lib/models/tax-summary/tax-summary.d.ts +3 -0
@@ -1326,11 +1326,11 @@ var TaxReturnCategoryListEnum;
|
|
1326
1326
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["WORK_DONATION"] = 73] = "WORK_DONATION";
|
1327
1327
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["WORK_TAX_AFFAIRS"] = 74] = "WORK_TAX_AFFAIRS";
|
1328
1328
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["WORK_OTHER_DEDUCTIONS"] = 76] = "WORK_OTHER_DEDUCTIONS";
|
1329
|
+
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["WORK_SUPER_CONTRIBUTION"] = 81] = "WORK_SUPER_CONTRIBUTION";
|
1329
1330
|
// holding expenses
|
1330
1331
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["HOLDING_INTEREST_DEDUCTIONS"] = 71] = "HOLDING_INTEREST_DEDUCTIONS";
|
1331
1332
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["HOLDING_DIVIDEND_DEDUCTION"] = 72] = "HOLDING_DIVIDEND_DEDUCTION";
|
1332
1333
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["HOLDING_UPP"] = 75] = "HOLDING_UPP";
|
1333
|
-
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["HOLDING_SUPER_CONTRIBUTION"] = 81] = "HOLDING_SUPER_CONTRIBUTION";
|
1334
1334
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["HOLDING_INVESTMENT_SCHEME"] = 82] = "HOLDING_INVESTMENT_SCHEME";
|
1335
1335
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["HOLDING_INVESTMENT_SCHEME_DEDUCTION"] = 83] = "HOLDING_INVESTMENT_SCHEME_DEDUCTION";
|
1336
1336
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["HOLDING_OTHER_DEDUCTION"] = 84] = "HOLDING_OTHER_DEDUCTION";
|
@@ -1378,6 +1378,9 @@ var TaxReturnCategoryListEnum;
|
|
1378
1378
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_CREDITS"] = 23] = "TAX_CREDITS";
|
1379
1379
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_WITHHELD"] = 24] = "TAX_WITHHELD";
|
1380
1380
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_INSTALMENTS"] = 25] = "TAX_INSTALMENTS";
|
1381
|
+
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["WORK_TAX_INSTALMENTS"] = 85] = "WORK_TAX_INSTALMENTS";
|
1382
|
+
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["HOLDINGS_TAX_INSTALMENTS"] = 86] = "HOLDINGS_TAX_INSTALMENTS";
|
1383
|
+
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["SOLE_TAX_INSTALMENTS"] = 87] = "SOLE_TAX_INSTALMENTS";
|
1381
1384
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["FRANKING_CREDITS"] = 26] = "FRANKING_CREDITS";
|
1382
1385
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSETS"] = 27] = "TAX_OFFSETS";
|
1383
1386
|
TaxReturnCategoryListEnum[TaxReturnCategoryListEnum["TAX_OFFSETS_LOW"] = 61] = "TAX_OFFSETS_LOW";
|
@@ -3481,8 +3484,10 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
3481
3484
|
.includes(this.category);
|
3482
3485
|
}
|
3483
3486
|
isSoleExpense() {
|
3484
|
-
return [ChartAccountsCategoryEnum.SOLE_EXPENSE, ChartAccountsCategoryEnum.SOLE_DEPRECIATION]
|
3485
|
-
|
3487
|
+
return [ChartAccountsCategoryEnum.SOLE_EXPENSE, ChartAccountsCategoryEnum.SOLE_DEPRECIATION].includes(this.category);
|
3488
|
+
}
|
3489
|
+
isHoldingExpense() {
|
3490
|
+
return [ChartAccountsCategoryEnum.HOLDING_EXPENSE].includes(this.category);
|
3486
3491
|
}
|
3487
3492
|
/**
|
3488
3493
|
* Check if chart accounts is property expense
|
@@ -3538,7 +3543,7 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
3538
3543
|
* except when taxablePercent=0, but not ENTERTAINMENT
|
3539
3544
|
*/
|
3540
3545
|
isClaimPercentEditable() {
|
3541
|
-
return ((this.isWorkExpense() || this.isSoleExpense()) && !this.isVehicleExpense() && this.taxablePercent > 0)
|
3546
|
+
return ((this.isWorkExpense() || this.isSoleExpense() || this.isHoldingExpense()) && !this.isVehicleExpense() && this.taxablePercent > 0)
|
3542
3547
|
|| this.id === BusinessChartAccountsEnum.ENTERTAINMENT;
|
3543
3548
|
}
|
3544
3549
|
/**
|
@@ -6880,6 +6885,7 @@ class Depreciation extends Depreciation$1 {
|
|
6880
6885
|
amount: -this.currentYearForecast?.amount || 0,
|
6881
6886
|
claimAmount: -this.currentYearForecast?.claimAmount || 0,
|
6882
6887
|
claimPercent: claimPercent,
|
6888
|
+
date: this.currentYearForecast?.fromDate ?? this.date,
|
6883
6889
|
sharedClaimPercent: claimPercent,
|
6884
6890
|
}));
|
6885
6891
|
}
|
@@ -7200,25 +7206,6 @@ class TransactionCollection extends TransactionBaseCollection {
|
|
7200
7206
|
getTaxable() {
|
7201
7207
|
return this.filter(transaction => transaction.claimPercent > 0);
|
7202
7208
|
}
|
7203
|
-
getWorkTaxCredits() {
|
7204
|
-
const transactions = this.filter(transaction => transaction.isWorkTank() && !transaction.depreciation && transaction.claimAmount !== 0 && transaction.chartAccounts.id !== 571);
|
7205
|
-
const metaFields = new Collection(transactions
|
7206
|
-
.map(transaction => transaction.metaFields)
|
7207
|
-
.flat()
|
7208
|
-
.filter(metaField => [4].includes(metaField.chartAccountsMetaField.id)));
|
7209
|
-
const instalments = this.filterBy('chartAccounts.id', 911).amount;
|
7210
|
-
console.log(transactions.sumBy('claimableTax'), instalments);
|
7211
|
-
return -transactions.sumBy('claimableTax') - metaFields.sumBy('value') + instalments;
|
7212
|
-
}
|
7213
|
-
getHoldingTaxCredits() {
|
7214
|
-
const transactions = this.filter(transaction => transaction.isHoldingTank() && !transaction.depreciation && transaction.claimAmount !== 0 && transaction.chartAccounts.id !== 571);
|
7215
|
-
const metaFields = new Collection(transactions
|
7216
|
-
.map(transaction => transaction.metaFields)
|
7217
|
-
.flat()
|
7218
|
-
.filter(metaField => [4, 5].includes(metaField.chartAccountsMetaField.id)));
|
7219
|
-
const instalments = this.filterBy('chartAccounts.id', 662).amount;
|
7220
|
-
return -metaFields.sumBy('value') + instalments;
|
7221
|
-
}
|
7222
7209
|
}
|
7223
7210
|
|
7224
7211
|
class TransactionAllocationCollection extends Collection {
|
@@ -8809,6 +8796,7 @@ const TAX_RETURN_CATEGORIES = {
|
|
8809
8796
|
TaxReturnCategoryListEnum.WORK_DONATION,
|
8810
8797
|
TaxReturnCategoryListEnum.WORK_TAX_AFFAIRS,
|
8811
8798
|
TaxReturnCategoryListEnum.WORK_OTHER_DEDUCTIONS,
|
8799
|
+
TaxReturnCategoryListEnum.WORK_SUPER_CONTRIBUTION,
|
8812
8800
|
],
|
8813
8801
|
depreciation: [
|
8814
8802
|
TaxReturnCategoryListEnum.WORK_RELATED_DEPRECIATION
|
@@ -8848,7 +8836,6 @@ const TAX_RETURN_CATEGORIES = {
|
|
8848
8836
|
TaxReturnCategoryListEnum.HOLDING_INTEREST_DEDUCTIONS,
|
8849
8837
|
TaxReturnCategoryListEnum.HOLDING_DIVIDEND_DEDUCTION,
|
8850
8838
|
TaxReturnCategoryListEnum.HOLDING_UPP,
|
8851
|
-
TaxReturnCategoryListEnum.HOLDING_SUPER_CONTRIBUTION,
|
8852
8839
|
TaxReturnCategoryListEnum.HOLDING_INVESTMENT_SCHEME,
|
8853
8840
|
TaxReturnCategoryListEnum.HOLDING_INVESTMENT_SCHEME_DEDUCTION,
|
8854
8841
|
TaxReturnCategoryListEnum.HOLDING_OTHER_DEDUCTION,
|
@@ -8892,9 +8879,6 @@ const TAX_RETURN_CATEGORIES = {
|
|
8892
8879
|
lossCurrent: [
|
8893
8880
|
TaxReturnCategoryListEnum.DEFERRED_BUSINESS_LOSSES,
|
8894
8881
|
],
|
8895
|
-
taxOffsets: [
|
8896
|
-
TaxReturnCategoryListEnum.TAX_OFFSETS_SOLE
|
8897
|
-
],
|
8898
8882
|
},
|
8899
8883
|
summary: {
|
8900
8884
|
income: [
|
@@ -9155,7 +9139,8 @@ class BankAccountCollection extends Collection {
|
|
9155
9139
|
return this.filterBy('type', TYPE_LOAN);
|
9156
9140
|
}
|
9157
9141
|
getLoanAndOffsetAccounts() {
|
9158
|
-
|
9142
|
+
// @TODO we have to add TRANSACTION/SAVINGS because basiq doesn't provide offset type
|
9143
|
+
return this.filterBy('type', [...TYPE_LOAN, BankAccountTypeEnum.OFFSET, BankAccountTypeEnum.TRANSACTION, BankAccountTypeEnum.SAVINGS]);
|
9159
9144
|
}
|
9160
9145
|
getDebitAccounts() {
|
9161
9146
|
return this.filter(bankAccount => ![...TYPE_LOAN, BankAccountTypeEnum.CREDIT_CARD].includes(bankAccount.type));
|
@@ -15650,14 +15635,17 @@ class TaxSummary {
|
|
15650
15635
|
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/217677990/Dashboard+Main
|
15651
15636
|
*/
|
15652
15637
|
get workNetCash() {
|
15653
|
-
|
15654
|
-
return this.workNetTotal - Math.abs(taxWithheld);
|
15638
|
+
return this.workNetTotal + this.workTaxCredits;
|
15655
15639
|
}
|
15656
15640
|
get workTaxCredits() {
|
15657
15641
|
const taxWithheld = this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.work.taxWithheld, TaxSummarySectionEnum.WORK_TANK);
|
15658
|
-
const taxInstallments = this.summary.items.sumByCategoriesAndSection([TaxReturnCategoryListEnum.
|
15659
|
-
|
15660
|
-
|
15642
|
+
const taxInstallments = this.summary.items.sumByCategoriesAndSection([TaxReturnCategoryListEnum.WORK_TAX_INSTALMENTS], TaxSummarySectionEnum.SUMMARY);
|
15643
|
+
return taxWithheld + taxInstallments;
|
15644
|
+
}
|
15645
|
+
get soleTaxCredits() {
|
15646
|
+
const taxOffsets = this.summary.items.sumByCategoriesAndSection([TaxReturnCategoryListEnum.TAX_OFFSETS_SOLE], TaxSummarySectionEnum.SOLE_TANK);
|
15647
|
+
const taxInstallments = this.summary.items.sumByCategoriesAndSection([TaxReturnCategoryListEnum.SOLE_TAX_INSTALMENTS], TaxSummarySectionEnum.SUMMARY);
|
15648
|
+
return taxOffsets + taxInstallments;
|
15661
15649
|
}
|
15662
15650
|
get income() {
|
15663
15651
|
return this.getReportItems([this.work, this.property, this.sole, this.holdings]).sumByCategories([
|
@@ -15671,12 +15659,25 @@ class TaxSummary {
|
|
15671
15659
|
return this.getReportItems([this.work, this.property, this.sole, this.holdings]).sumByCategories([
|
15672
15660
|
...TAX_RETURN_CATEGORIES.work.expenses,
|
15673
15661
|
...TAX_RETURN_CATEGORIES.property.expenses,
|
15662
|
+
TaxReturnCategoryListEnum.BORROWING_EXPENSES,
|
15663
|
+
...TAX_RETURN_CATEGORIES.property.interest,
|
15664
|
+
...TAX_RETURN_CATEGORIES.property.depreciation,
|
15674
15665
|
...TAX_RETURN_CATEGORIES.sole.expenses,
|
15666
|
+
...TAX_RETURN_CATEGORIES.sole.depreciation,
|
15667
|
+
...TAX_RETURN_CATEGORIES.sole.loss,
|
15675
15668
|
...TAX_RETURN_CATEGORIES.holdings.expenses,
|
15676
15669
|
]);
|
15677
15670
|
}
|
15671
|
+
get taxCredits() {
|
15672
|
+
return this.summary.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.summary.taxCredits, TaxSummarySectionEnum.SUMMARY);
|
15673
|
+
}
|
15674
|
+
get depreciation() {
|
15675
|
+
return this.sole.items.sumByCategories(TAX_RETURN_CATEGORIES.sole.depreciation)
|
15676
|
+
+ this.property.items.sumByCategoriesAndSection(TAX_RETURN_CATEGORIES.property.depreciation, TaxSummarySectionEnum.PROPERTY_TANK)
|
15677
|
+
+ this.workDepreciations;
|
15678
|
+
}
|
15678
15679
|
get netCash() {
|
15679
|
-
return this.
|
15680
|
+
return this.income + this.expense + this.taxCredits - this.depreciation;
|
15680
15681
|
}
|
15681
15682
|
get netTotal() {
|
15682
15683
|
return this.workNetTotal + this.propertyNetTotal + this.soleNetTotal + this.holdingsNetTotal;
|
@@ -15732,9 +15733,10 @@ class TaxSummary {
|
|
15732
15733
|
return this.holdingsNetTotal + this.holdingsTaxCredits;
|
15733
15734
|
}
|
15734
15735
|
get holdingsTaxCredits() {
|
15735
|
-
const taxInstallments = this.summary.items.sumByCategoriesAndSection([TaxReturnCategoryListEnum.TAX_INSTALMENTS], TaxSummarySectionEnum.HOLDINGS_TANK);
|
15736
15736
|
const frankingCredits = this.summary.items.sumByCategoriesAndSection([TaxReturnCategoryListEnum.FRANKING_CREDITS], TaxSummarySectionEnum.HOLDINGS_TANK);
|
15737
|
-
|
15737
|
+
const taxWithheld = this.summary.items.sumByCategoriesAndSection([TaxReturnCategoryListEnum.TAX_WITHHELD], TaxSummarySectionEnum.HOLDINGS_TANK);
|
15738
|
+
const taxInstallments = this.summary.items.sumByCategoriesAndSection([TaxReturnCategoryListEnum.HOLDINGS_TAX_INSTALMENTS], TaxSummarySectionEnum.SUMMARY);
|
15739
|
+
return taxInstallments + frankingCredits + taxWithheld;
|
15738
15740
|
}
|
15739
15741
|
/**
|
15740
15742
|
* Sole Net Cash = gross income – expenses
|