taxtank-core 0.30.110 → 0.30.112
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/esm2020/lib/db/Enums/chart-accounts/chart-accounts-list.enum.mjs +3 -1
- package/esm2020/lib/db/Models/sole/sole-business.mjs +1 -1
- package/esm2020/lib/forms/sole/sole-business.form.mjs +6 -6
- package/esm2020/lib/forms/transaction/transaction-base.form.mjs +4 -1
- package/esm2020/lib/models/chart-accounts/chart-accounts.mjs +12 -4
- package/esm2020/lib/models/sole/sole-business.mjs +10 -7
- package/fesm2015/taxtank-core.mjs +62 -45
- package/fesm2015/taxtank-core.mjs.map +1 -1
- package/fesm2020/taxtank-core.mjs +62 -45
- package/fesm2020/taxtank-core.mjs.map +1 -1
- package/lib/db/Enums/chart-accounts/chart-accounts-list.enum.d.ts +2 -0
- package/lib/db/Models/sole/sole-business.d.ts +1 -0
- package/lib/forms/sole/sole-business.form.d.ts +1 -1
- package/lib/models/chart-accounts/chart-accounts.d.ts +4 -1
- package/lib/models/sole/sole-business.d.ts +7 -6
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ import moment from 'moment';
|
|
|
21
21
|
import { DateRange } from 'moment-range';
|
|
22
22
|
import intersection from 'lodash/intersection';
|
|
23
23
|
import range from 'lodash/range';
|
|
24
|
-
import { Validators, UntypedFormGroup, UntypedFormControl, UntypedFormArray, FormArray, FormGroup
|
|
24
|
+
import { Validators, UntypedFormGroup, UntypedFormControl, UntypedFormArray, FormControl, FormArray, FormGroup } from '@angular/forms';
|
|
25
25
|
import compact from 'lodash/compact';
|
|
26
26
|
import concat from 'lodash/concat';
|
|
27
27
|
import cloneDeep$1 from 'lodash/cloneDeep';
|
|
@@ -1122,12 +1122,14 @@ var ChartAccountsListEnum;
|
|
|
1122
1122
|
ChartAccountsListEnum[ChartAccountsListEnum["REGISTRATION"] = 686] = "REGISTRATION";
|
|
1123
1123
|
ChartAccountsListEnum[ChartAccountsListEnum["LEASE_INTEREST_PAYMENTS"] = 687] = "LEASE_INTEREST_PAYMENTS";
|
|
1124
1124
|
ChartAccountsListEnum[ChartAccountsListEnum["SOLE_VEHICLE_LOAN_INTEREST"] = 688] = "SOLE_VEHICLE_LOAN_INTEREST";
|
|
1125
|
+
ChartAccountsListEnum[ChartAccountsListEnum["SOLE_VEHICLE_LOAN_PRINCIPAL"] = 855] = "SOLE_VEHICLE_LOAN_PRINCIPAL";
|
|
1125
1126
|
ChartAccountsListEnum[ChartAccountsListEnum["INSURANCE"] = 689] = "INSURANCE";
|
|
1126
1127
|
ChartAccountsListEnum[ChartAccountsListEnum["TYRES"] = 690] = "TYRES";
|
|
1127
1128
|
ChartAccountsListEnum[ChartAccountsListEnum["BATTERIES"] = 691] = "BATTERIES";
|
|
1128
1129
|
ChartAccountsListEnum[ChartAccountsListEnum["CAR_WASH"] = 692] = "CAR_WASH";
|
|
1129
1130
|
ChartAccountsListEnum[ChartAccountsListEnum["PARKING_TOLLS"] = 693] = "PARKING_TOLLS";
|
|
1130
1131
|
ChartAccountsListEnum[ChartAccountsListEnum["OTHER_SOLE_EXPENSES"] = 694] = "OTHER_SOLE_EXPENSES";
|
|
1132
|
+
ChartAccountsListEnum[ChartAccountsListEnum["SOLE_ENTERTAINMENT"] = 698] = "SOLE_ENTERTAINMENT";
|
|
1131
1133
|
ChartAccountsListEnum[ChartAccountsListEnum["PERSONAL_EXPENSES"] = 628] = "PERSONAL_EXPENSES";
|
|
1132
1134
|
ChartAccountsListEnum[ChartAccountsListEnum["PERSONAL_INCOME"] = 630] = "PERSONAL_INCOME";
|
|
1133
1135
|
ChartAccountsListEnum[ChartAccountsListEnum["PLATFORM_FEES"] = 857] = "PLATFORM_FEES";
|
|
@@ -3288,7 +3290,13 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
|
3288
3290
|
* Check if transaction chart account is work related car expenses
|
|
3289
3291
|
*/
|
|
3290
3292
|
isVehicleLoanExpense() {
|
|
3291
|
-
return this.
|
|
3293
|
+
return this.isVehicleLoanInterest() || this.isVehicleLoanPrinciple();
|
|
3294
|
+
}
|
|
3295
|
+
isVehicleLoanPrinciple() {
|
|
3296
|
+
return [ChartAccountsListEnum.VEHICLE_LOAN_PRINCIPAL, ChartAccountsListEnum.SOLE_VEHICLE_LOAN_PRINCIPAL].includes(this.id);
|
|
3297
|
+
}
|
|
3298
|
+
isVehicleLoanInterest() {
|
|
3299
|
+
return [ChartAccountsListEnum.VEHICLE_LOAN_INTEREST, ChartAccountsListEnum.SOLE_VEHICLE_LOAN_INTEREST].includes(this.id);
|
|
3292
3300
|
}
|
|
3293
3301
|
/**
|
|
3294
3302
|
* Get chart accounts value for current financial year
|
|
@@ -3304,10 +3312,12 @@ class ChartAccounts extends ChartAccounts$1 {
|
|
|
3304
3312
|
}
|
|
3305
3313
|
/**
|
|
3306
3314
|
* no way to check how much used for work/sole, so we let user adjust it
|
|
3307
|
-
* except vehicle expense, which is equal to vehicleClaim.workUsage
|
|
3315
|
+
* except vehicle expense, which is equal to vehicleClaim.workUsage
|
|
3316
|
+
* except when taxablePercent=0, but not SOLE_ENTERTAINMENT
|
|
3308
3317
|
*/
|
|
3309
3318
|
isClaimPercentEditable() {
|
|
3310
|
-
return (this.isWorkExpense() || this.isSoleExpense()) &&
|
|
3319
|
+
return ((this.isWorkExpense() || this.isSoleExpense()) && !this.isVehicleExpense() && this.taxablePercent > 0)
|
|
3320
|
+
|| this.id === ChartAccountsListEnum.SOLE_ENTERTAINMENT;
|
|
3311
3321
|
}
|
|
3312
3322
|
/**
|
|
3313
3323
|
* get label for transaction tax field depended on selected chart account.
|
|
@@ -4646,46 +4656,6 @@ class DepreciationReceipt extends DepreciationReceipt$1 {
|
|
|
4646
4656
|
}
|
|
4647
4657
|
}
|
|
4648
4658
|
|
|
4649
|
-
class SoleBusinessAllocation extends SoleBusinessAllocation$1 {
|
|
4650
|
-
}
|
|
4651
|
-
__decorate([
|
|
4652
|
-
Type(() => BankAccount)
|
|
4653
|
-
], SoleBusinessAllocation.prototype, "bankAccount", void 0);
|
|
4654
|
-
__decorate([
|
|
4655
|
-
Type(() => SoleBusiness)
|
|
4656
|
-
], SoleBusinessAllocation.prototype, "business", void 0);
|
|
4657
|
-
__decorate([
|
|
4658
|
-
Transform(({ value }) => value || 100),
|
|
4659
|
-
Expose()
|
|
4660
|
-
], SoleBusinessAllocation.prototype, "percent", void 0);
|
|
4661
|
-
|
|
4662
|
-
class SoleBusinessLossOffsetRule extends SoleBusinessLossOffsetRule$1 {
|
|
4663
|
-
}
|
|
4664
|
-
__decorate([
|
|
4665
|
-
Type(() => SoleBusinessLossOffsetRule)
|
|
4666
|
-
], SoleBusinessLossOffsetRule.prototype, "parent", void 0);
|
|
4667
|
-
|
|
4668
|
-
/**
|
|
4669
|
-
* If a sole trader business makes a tax loss in a current year, you can generally carry forward that loss and offset profit in future years.
|
|
4670
|
-
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4641357930/Rules+when+a+business+makes+a+loss+Tax+Summary#Offsetting-current-year-business-losses
|
|
4671
|
-
*/
|
|
4672
|
-
class SoleBusinessLoss extends SoleBusinessLoss$1 {
|
|
4673
|
-
constructor() {
|
|
4674
|
-
super(...arguments);
|
|
4675
|
-
this.openBalance = 0;
|
|
4676
|
-
this.financialYear = new FinancialYear().year;
|
|
4677
|
-
}
|
|
4678
|
-
get hasOffset() {
|
|
4679
|
-
return !!this.offsetRule;
|
|
4680
|
-
}
|
|
4681
|
-
}
|
|
4682
|
-
__decorate([
|
|
4683
|
-
Type(() => SoleBusiness)
|
|
4684
|
-
], SoleBusinessLoss.prototype, "business", void 0);
|
|
4685
|
-
__decorate([
|
|
4686
|
-
Type(() => SoleBusinessLossOffsetRule)
|
|
4687
|
-
], SoleBusinessLoss.prototype, "offsetRule", void 0);
|
|
4688
|
-
|
|
4689
4659
|
var MyAccountHistoryInitiatedByEnum;
|
|
4690
4660
|
(function (MyAccountHistoryInitiatedByEnum) {
|
|
4691
4661
|
MyAccountHistoryInitiatedByEnum[MyAccountHistoryInitiatedByEnum["OWNER"] = 0] = "OWNER";
|
|
@@ -4735,6 +4705,46 @@ const USER_ROLES = {
|
|
|
4735
4705
|
class UserToRegister {
|
|
4736
4706
|
}
|
|
4737
4707
|
|
|
4708
|
+
class SoleBusinessAllocation extends SoleBusinessAllocation$1 {
|
|
4709
|
+
}
|
|
4710
|
+
__decorate([
|
|
4711
|
+
Type(() => BankAccount)
|
|
4712
|
+
], SoleBusinessAllocation.prototype, "bankAccount", void 0);
|
|
4713
|
+
__decorate([
|
|
4714
|
+
Type(() => SoleBusiness)
|
|
4715
|
+
], SoleBusinessAllocation.prototype, "business", void 0);
|
|
4716
|
+
__decorate([
|
|
4717
|
+
Transform(({ value }) => value || 100),
|
|
4718
|
+
Expose()
|
|
4719
|
+
], SoleBusinessAllocation.prototype, "percent", void 0);
|
|
4720
|
+
|
|
4721
|
+
class SoleBusinessLossOffsetRule extends SoleBusinessLossOffsetRule$1 {
|
|
4722
|
+
}
|
|
4723
|
+
__decorate([
|
|
4724
|
+
Type(() => SoleBusinessLossOffsetRule)
|
|
4725
|
+
], SoleBusinessLossOffsetRule.prototype, "parent", void 0);
|
|
4726
|
+
|
|
4727
|
+
/**
|
|
4728
|
+
* If a sole trader business makes a tax loss in a current year, you can generally carry forward that loss and offset profit in future years.
|
|
4729
|
+
* https://taxtank.atlassian.net/wiki/spaces/TAXTANK/pages/4641357930/Rules+when+a+business+makes+a+loss+Tax+Summary#Offsetting-current-year-business-losses
|
|
4730
|
+
*/
|
|
4731
|
+
class SoleBusinessLoss extends SoleBusinessLoss$1 {
|
|
4732
|
+
constructor() {
|
|
4733
|
+
super(...arguments);
|
|
4734
|
+
this.openBalance = 0;
|
|
4735
|
+
this.financialYear = new FinancialYear().year;
|
|
4736
|
+
}
|
|
4737
|
+
get hasOffset() {
|
|
4738
|
+
return !!this.offsetRule;
|
|
4739
|
+
}
|
|
4740
|
+
}
|
|
4741
|
+
__decorate([
|
|
4742
|
+
Type(() => SoleBusiness)
|
|
4743
|
+
], SoleBusinessLoss.prototype, "business", void 0);
|
|
4744
|
+
__decorate([
|
|
4745
|
+
Type(() => SoleBusinessLossOffsetRule)
|
|
4746
|
+
], SoleBusinessLoss.prototype, "offsetRule", void 0);
|
|
4747
|
+
|
|
4738
4748
|
class SoleInvoiceItem extends SoleInvoiceItem$1 {
|
|
4739
4749
|
constructor() {
|
|
4740
4750
|
super(...arguments);
|
|
@@ -5145,6 +5155,9 @@ __decorate([
|
|
|
5145
5155
|
__decorate([
|
|
5146
5156
|
Type(() => IncomeSource)
|
|
5147
5157
|
], SoleBusiness.prototype, "incomeSource", void 0);
|
|
5158
|
+
__decorate([
|
|
5159
|
+
Transform(({ value }) => value || false)
|
|
5160
|
+
], SoleBusiness.prototype, "isPrimaryProduction", void 0);
|
|
5148
5161
|
|
|
5149
5162
|
class SoleBusinessActivity extends SoleBusinessActivity$1 {
|
|
5150
5163
|
}
|
|
@@ -18456,7 +18469,8 @@ class SoleBusinessForm extends AbstractForm {
|
|
|
18456
18469
|
name: new UntypedFormControl(business.name, Validators.required),
|
|
18457
18470
|
activity: new UntypedFormControl(business.activity, Validators.required),
|
|
18458
18471
|
description: new UntypedFormControl(business.description),
|
|
18459
|
-
website: new UntypedFormControl(business.website)
|
|
18472
|
+
website: new UntypedFormControl(business.website),
|
|
18473
|
+
isPrimaryProduction: new FormControl(business.isPrimaryProduction),
|
|
18460
18474
|
}, business);
|
|
18461
18475
|
this.business = business;
|
|
18462
18476
|
// User have to create income source with new business.
|
|
@@ -20439,6 +20453,9 @@ class TransactionBaseForm extends AbstractForm {
|
|
|
20439
20453
|
if (chartAccounts.isClaimPercentEditable()) {
|
|
20440
20454
|
this.get('claimPercent').enable();
|
|
20441
20455
|
}
|
|
20456
|
+
else {
|
|
20457
|
+
this.get('claimPercent').disable();
|
|
20458
|
+
}
|
|
20442
20459
|
// property claim (ownership% x shared%) for property expenses, taxable percent for others
|
|
20443
20460
|
let claimPercent = chartAccounts.taxablePercent;
|
|
20444
20461
|
if (chartAccounts.isPropertyExpense() && chartAccounts.id !== ChartAccountsListEnum.PLATFORM_FEES) {
|