taxtank-core 0.33.50 → 0.33.52
Sign up to get free protection for your applications and to get access to all the features.
- package/esm2022/src/lib/collections/depreciation.collection.mjs +2 -2
- package/esm2022/src/lib/collections/income-source/income-source.collection.mjs +2 -2
- package/esm2022/src/lib/collections/sole/sole-invoice.collection.mjs +4 -2
- package/esm2022/src/lib/collections/transaction/transaction.collection.mjs +3 -3
- package/esm2022/src/lib/collections/vehicle/vehicle-logbook.collection.mjs +2 -2
- package/esm2022/src/lib/db/Enums/chart-accounts/business-chart-accounts.enum.mjs +2 -2
- package/esm2022/src/lib/db/Enums/chart-accounts/chart-accounts-adjustment-included-list.enum.mjs +4 -1
- package/esm2022/src/lib/db/Enums/chart-accounts/chart-accounts-list.enum.mjs +2 -2
- package/esm2022/src/lib/db/Enums/tank-type.enum.mjs +6 -6
- package/esm2022/src/lib/db/Models/bank/bank-account.mjs +1 -1
- package/esm2022/src/lib/db/Models/transaction/transaction-base.mjs +6 -6
- package/esm2022/src/lib/forms/bank/bank-account/bank-account-allocation.form.mjs +3 -3
- package/esm2022/src/lib/forms/bank/bank-account/bank-account-properties.form.mjs +2 -2
- package/esm2022/src/lib/forms/sole/sole-business-allocations.form.mjs +2 -2
- package/esm2022/src/lib/forms/transaction/allocation-rule.form.mjs +11 -11
- package/esm2022/src/lib/forms/transaction/transaction-base-filter.form.mjs +3 -3
- package/esm2022/src/lib/forms/transaction/work/work-income.form.mjs +6 -4
- package/esm2022/src/lib/models/bank/allocation-group.mjs +2 -2
- package/esm2022/src/lib/models/bank/bank-account.mjs +1 -12
- package/esm2022/src/lib/models/bank/bank-transaction.mjs +3 -2
- package/esm2022/src/lib/models/report/my-tax/my-tax-deductions/my-tax-deductions.mjs +2 -2
- package/esm2022/src/lib/models/report/vehicle-expense/vehicle-expense.mjs +1 -1
- package/esm2022/src/lib/models/transaction/allocation-rule.mjs +4 -4
- package/esm2022/src/lib/models/transaction/transaction.mjs +3 -4
- package/esm2022/src/lib/models/user/user.mjs +5 -5
- package/esm2022/src/lib/models/vehicle/vehicle-claim.mjs +2 -2
- package/esm2022/src/lib/models/vehicle/vehicle-logbook.mjs +3 -3
- package/fesm2022/taxtank-core.mjs +57 -62
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/package.json +1 -1
- package/src/lib/db/Enums/chart-accounts/business-chart-accounts.enum.d.ts +1 -1
- package/src/lib/db/Enums/chart-accounts/chart-accounts-adjustment-included-list.enum.d.ts +3 -0
- package/src/lib/db/Enums/chart-accounts/chart-accounts-list.enum.d.ts +1 -1
- package/src/lib/db/Enums/tank-type.enum.d.ts +5 -5
- package/src/lib/db/Models/bank/bank-account.d.ts +2 -0
- package/src/lib/models/bank/bank-account.d.ts +0 -2
@@ -258,11 +258,11 @@ let DepreciationForecast$1 = class DepreciationForecast extends AbstractModel {
|
|
258
258
|
|
259
259
|
var TankTypeEnum;
|
260
260
|
(function (TankTypeEnum) {
|
261
|
-
TankTypeEnum[TankTypeEnum["
|
262
|
-
TankTypeEnum[TankTypeEnum["
|
263
|
-
TankTypeEnum[TankTypeEnum["
|
264
|
-
TankTypeEnum[TankTypeEnum["
|
265
|
-
TankTypeEnum[TankTypeEnum["
|
261
|
+
TankTypeEnum[TankTypeEnum["PROPERTY_TANK"] = 1] = "PROPERTY_TANK";
|
262
|
+
TankTypeEnum[TankTypeEnum["WORK_TANK"] = 2] = "WORK_TANK";
|
263
|
+
TankTypeEnum[TankTypeEnum["OTHER_TANK"] = 3] = "OTHER_TANK";
|
264
|
+
TankTypeEnum[TankTypeEnum["SOLE_TANK"] = 4] = "SOLE_TANK";
|
265
|
+
TankTypeEnum[TankTypeEnum["HOLDING_TANK"] = 5] = "HOLDING_TANK";
|
266
266
|
TankTypeEnum[TankTypeEnum["PERSONAL"] = 6] = "PERSONAL";
|
267
267
|
})(TankTypeEnum || (TankTypeEnum = {}));
|
268
268
|
|
@@ -276,15 +276,15 @@ class TransactionBase extends ObservableModel {
|
|
276
276
|
get tankType() {
|
277
277
|
switch (true) {
|
278
278
|
case this.isPropertyTank():
|
279
|
-
return TankTypeEnum.
|
279
|
+
return TankTypeEnum.PROPERTY_TANK;
|
280
280
|
case this.isWorkTank():
|
281
|
-
return TankTypeEnum.
|
281
|
+
return TankTypeEnum.WORK_TANK;
|
282
282
|
case this.isSoleTank():
|
283
|
-
return TankTypeEnum.
|
283
|
+
return TankTypeEnum.SOLE_TANK;
|
284
284
|
case this.isHoldingTank():
|
285
|
-
return TankTypeEnum.
|
285
|
+
return TankTypeEnum.HOLDING_TANK;
|
286
286
|
case this.isOtherTank():
|
287
|
-
return TankTypeEnum.
|
287
|
+
return TankTypeEnum.OTHER_TANK;
|
288
288
|
default:
|
289
289
|
return TankTypeEnum.PERSONAL;
|
290
290
|
}
|
@@ -689,7 +689,7 @@ class AllocationGroup extends AbstractModel {
|
|
689
689
|
operation: TransactionOperationEnum.ALLOCATE_INVOICE,
|
690
690
|
description: invoice.reference,
|
691
691
|
invoiceNumber: invoice.getNumber(),
|
692
|
-
tankType: TankTypeEnum.
|
692
|
+
tankType: TankTypeEnum.SOLE_TANK,
|
693
693
|
amount: invoice.grossPrice,
|
694
694
|
allocations,
|
695
695
|
bankTransactions
|
@@ -1036,7 +1036,7 @@ var ChartAccountsListEnum;
|
|
1036
1036
|
ChartAccountsListEnum[ChartAccountsListEnum["INTERNET"] = 94] = "INTERNET";
|
1037
1037
|
ChartAccountsListEnum[ChartAccountsListEnum["ELECTRICITY_AND_GAS"] = 234] = "ELECTRICITY_AND_GAS";
|
1038
1038
|
ChartAccountsListEnum[ChartAccountsListEnum["TELEPHONE"] = 255] = "TELEPHONE";
|
1039
|
-
ChartAccountsListEnum[ChartAccountsListEnum["HOME_OFFICE_CLEANING"] =
|
1039
|
+
ChartAccountsListEnum[ChartAccountsListEnum["HOME_OFFICE_CLEANING"] = 11871] = "HOME_OFFICE_CLEANING";
|
1040
1040
|
})(ChartAccountsListEnum || (ChartAccountsListEnum = {}));
|
1041
1041
|
|
1042
1042
|
var BusinessChartAccountsEnum;
|
@@ -1079,7 +1079,7 @@ var BusinessChartAccountsEnum;
|
|
1079
1079
|
BusinessChartAccountsEnum[BusinessChartAccountsEnum["ELECTRICITY_AND_GAS"] = 892] = "ELECTRICITY_AND_GAS";
|
1080
1080
|
BusinessChartAccountsEnum[BusinessChartAccountsEnum["HOME_OFFICE_CLEANING"] = 893] = "HOME_OFFICE_CLEANING";
|
1081
1081
|
BusinessChartAccountsEnum[BusinessChartAccountsEnum["INTERNET"] = 705] = "INTERNET";
|
1082
|
-
BusinessChartAccountsEnum[BusinessChartAccountsEnum["TELEPHONE"] =
|
1082
|
+
BusinessChartAccountsEnum[BusinessChartAccountsEnum["TELEPHONE"] = 11862] = "TELEPHONE";
|
1083
1083
|
BusinessChartAccountsEnum[BusinessChartAccountsEnum["MOBILE_PHONE"] = 719] = "MOBILE_PHONE";
|
1084
1084
|
BusinessChartAccountsEnum[BusinessChartAccountsEnum["HOME_OFFICE_RENT"] = 889] = "HOME_OFFICE_RENT";
|
1085
1085
|
BusinessChartAccountsEnum[BusinessChartAccountsEnum["HOME_OFFICE_LOAN"] = 890] = "HOME_OFFICE_LOAN";
|
@@ -1129,6 +1129,9 @@ var ChartAccountsSalaryAdjustmentsListEnum;
|
|
1129
1129
|
ChartAccountsSalaryAdjustmentsListEnum[ChartAccountsSalaryAdjustmentsListEnum["WORK_PLACE_GIVING"] = 653] = "WORK_PLACE_GIVING";
|
1130
1130
|
})(ChartAccountsSalaryAdjustmentsListEnum || (ChartAccountsSalaryAdjustmentsListEnum = {}));
|
1131
1131
|
|
1132
|
+
/**
|
1133
|
+
* list of child transactions included in parent amount
|
1134
|
+
*/
|
1132
1135
|
var ChartAccountsAdjustmentIncludedListEnum;
|
1133
1136
|
(function (ChartAccountsAdjustmentIncludedListEnum) {
|
1134
1137
|
ChartAccountsAdjustmentIncludedListEnum[ChartAccountsAdjustmentIncludedListEnum["ALLOWANCE"] = 4] = "ALLOWANCE";
|
@@ -5023,11 +5026,11 @@ class VehicleLogbook extends VehicleLogbook$1 {
|
|
5023
5026
|
get tankType() {
|
5024
5027
|
switch (true) {
|
5025
5028
|
case !!this.business:
|
5026
|
-
return TankTypeEnum.
|
5029
|
+
return TankTypeEnum.SOLE_TANK;
|
5027
5030
|
case this.isPersonal:
|
5028
5031
|
return TankTypeEnum.PERSONAL;
|
5029
5032
|
default:
|
5030
|
-
return TankTypeEnum.
|
5033
|
+
return TankTypeEnum.WORK_TANK;
|
5031
5034
|
}
|
5032
5035
|
}
|
5033
5036
|
}
|
@@ -5091,7 +5094,7 @@ class VehicleClaim extends VehicleClaim$1 {
|
|
5091
5094
|
return !!this.business;
|
5092
5095
|
}
|
5093
5096
|
get tankType() {
|
5094
|
-
return this.isSoleTank() ? TankTypeEnum.
|
5097
|
+
return this.isSoleTank() ? TankTypeEnum.SOLE_TANK : TankTypeEnum.WORK_TANK;
|
5095
5098
|
}
|
5096
5099
|
/**
|
5097
5100
|
* Claim amount for KMs method. Exists only for KMs method.
|
@@ -5413,16 +5416,16 @@ class User extends User$1 {
|
|
5413
5416
|
getTankTypes() {
|
5414
5417
|
const tankTypes = [];
|
5415
5418
|
if (this.roles.includes(UserRolesEnum.WORK_TANK)) {
|
5416
|
-
tankTypes.push(TankTypeEnum.
|
5419
|
+
tankTypes.push(TankTypeEnum.WORK_TANK);
|
5417
5420
|
}
|
5418
5421
|
if (this.roles.includes(UserRolesEnum.PROPERTY_TANK)) {
|
5419
|
-
tankTypes.push(TankTypeEnum.
|
5422
|
+
tankTypes.push(TankTypeEnum.PROPERTY_TANK);
|
5420
5423
|
}
|
5421
5424
|
if (this.roles.includes(UserRolesEnum.SOLE_TANK)) {
|
5422
|
-
tankTypes.push(TankTypeEnum.
|
5425
|
+
tankTypes.push(TankTypeEnum.SOLE_TANK);
|
5423
5426
|
}
|
5424
5427
|
if (this.roles.includes(UserRolesEnum.HOLDING_TANK)) {
|
5425
|
-
tankTypes.push(TankTypeEnum.
|
5428
|
+
tankTypes.push(TankTypeEnum.HOLDING_TANK);
|
5426
5429
|
}
|
5427
5430
|
tankTypes.push(TankTypeEnum.PERSONAL);
|
5428
5431
|
return tankTypes;
|
@@ -6412,8 +6415,7 @@ class Transaction extends Transaction$1 {
|
|
6412
6415
|
return grossAmount;
|
6413
6416
|
}
|
6414
6417
|
// included transactions affect parent transaction amount and as a result grossAmount, skip to avoid double sum
|
6415
|
-
const adjustments = new Collection(this.transactions)
|
6416
|
-
.filter(transaction => !transaction.chartAccounts?.isAdjustmentIncluded());
|
6418
|
+
const adjustments = new Collection(this.transactions).filter(transaction => ![ChartAccountsAdjustmentIncludedListEnum.FUNDS_OVER_ADJUSTMENT, ChartAccountsAdjustmentIncludedListEnum.LANDLORD_REIMBURSEMENT].includes(transaction.chartAccounts?.id));
|
6417
6419
|
const income = adjustments.filter(transaction => transaction.isIncome()).sumBy('amount');
|
6418
6420
|
const expense = adjustments.filter(transaction => transaction.isExpense()).sumBy('amount', true);
|
6419
6421
|
// all adjustments except property income increase grossIncome
|
@@ -6536,13 +6538,13 @@ class AllocationRule extends AllocationRule$1 {
|
|
6536
6538
|
return this.type === AllocationRuleTypeEnum.TRANSFER;
|
6537
6539
|
}
|
6538
6540
|
isPropertyTank() {
|
6539
|
-
return this.transaction.tankType === TankTypeEnum.
|
6541
|
+
return this.transaction.tankType === TankTypeEnum.PROPERTY_TANK;
|
6540
6542
|
}
|
6541
6543
|
isWorkTank() {
|
6542
|
-
return this.transaction.tankType === TankTypeEnum.
|
6544
|
+
return this.transaction.tankType === TankTypeEnum.WORK_TANK;
|
6543
6545
|
}
|
6544
6546
|
isSoleTank() {
|
6545
|
-
return this.transaction.tankType === TankTypeEnum.
|
6547
|
+
return this.transaction.tankType === TankTypeEnum.SOLE_TANK;
|
6546
6548
|
}
|
6547
6549
|
isPropertyIncome() {
|
6548
6550
|
return this.isIncome() && this.isPropertyTank();
|
@@ -6935,7 +6937,7 @@ class TransactionCollection extends TransactionBaseCollection {
|
|
6935
6937
|
* Get new collection of property transactions
|
6936
6938
|
*/
|
6937
6939
|
getPropertyTransactions() {
|
6938
|
-
return this.filterBy('tankType', TankTypeEnum.
|
6940
|
+
return this.filterBy('tankType', TankTypeEnum.PROPERTY_TANK);
|
6939
6941
|
}
|
6940
6942
|
getDebitTransactions() {
|
6941
6943
|
return new TransactionCollection(this.items.filter((transaction) => transaction.isDebit()));
|
@@ -7004,7 +7006,7 @@ class TransactionCollection extends TransactionBaseCollection {
|
|
7004
7006
|
// sole tank may have multiple vehicle claims, so we need to filter by business.id
|
7005
7007
|
? this.getVehicleTransactions().filterBy('business.id', vehicleClaim.business.id)
|
7006
7008
|
// work tank may have only one vehicle claim, so we need to filter by tank type
|
7007
|
-
: this.getVehicleTransactions().filterBy('tankType', TankTypeEnum.
|
7009
|
+
: this.getVehicleTransactions().filterBy('tankType', TankTypeEnum.WORK_TANK);
|
7008
7010
|
}
|
7009
7011
|
/**
|
7010
7012
|
* Get list of vehicle transactions except KMS transactions
|
@@ -7185,7 +7187,7 @@ class DepreciationCollection extends TransactionBaseCollection {
|
|
7185
7187
|
// sole tank may have multiple vehicle claims, so we need to filter by business.id
|
7186
7188
|
? this.getVehicleDepreciations().filterBy('business.id', vehicleClaim.business.id)
|
7187
7189
|
// work tank may have only one vehicle claim, so we need to filter by tank type
|
7188
|
-
: this.getVehicleDepreciations().filterBy('tankType', TankTypeEnum.
|
7190
|
+
: this.getVehicleDepreciations().filterBy('tankType', TankTypeEnum.WORK_TANK);
|
7189
7191
|
}
|
7190
7192
|
getExportBody(params) {
|
7191
7193
|
return [];
|
@@ -7602,7 +7604,7 @@ class MyTaxDeductions {
|
|
7602
7604
|
this.workRelatedSelfEducationType = this.workRelatedSelfEducationExpenses.length ?
|
7603
7605
|
DeductionSelfEducationTypeEnum.IMPROVE_SKILLS_FOR_CURRENT_EARNINGS_K : null;
|
7604
7606
|
this.workRelatedSelfEducationTotalAmount = this.calculateWorkRelatedSelfEducationTotalAmount();
|
7605
|
-
this.lowValuePoolDeductionTotalAmount = this.depreciations.getByTankType(TankTypeEnum.
|
7607
|
+
this.lowValuePoolDeductionTotalAmount = this.depreciations.getByTankType(TankTypeEnum.WORK_TANK)
|
7606
7608
|
.getLVPDepreciations().sumBy('claimAmount');
|
7607
7609
|
this.interestExpensesTotalAmount = this.transactions
|
7608
7610
|
.filterBy('chartAccounts.heading.id', DEDUCTION_CATEGORIES.interestExpenses)
|
@@ -8308,8 +8310,9 @@ class SoleInvoiceCollection extends Collection {
|
|
8308
8310
|
return this.filter((invoice) => invoice.isOverdue());
|
8309
8311
|
}
|
8310
8312
|
getPaid(transactions) {
|
8313
|
+
const amountPerInvoice = transactions.getAmountPerInvoice();
|
8311
8314
|
return this.filter(invoice => invoice.grossPrice > 0
|
8312
|
-
&&
|
8315
|
+
&& round(amountPerInvoice.get(invoice.id), 2) >= invoice.grossPrice);
|
8313
8316
|
}
|
8314
8317
|
getUnpaid(transactions) {
|
8315
8318
|
return this.getOpen().filter(invoice => transactions.getAmountPerInvoice().get(invoice.id) < invoice.grossPrice);
|
@@ -8693,7 +8696,7 @@ class VehicleLogbookCollection extends Collection {
|
|
8693
8696
|
// sole tank may have multiple vehicle claims, so we need to filter by business.id
|
8694
8697
|
? this.filterBy('business.id', vehicleClaim.business.id)
|
8695
8698
|
// work tank may have only one vehicle claim, so we need to filter by tank type
|
8696
|
-
: this.filterBy('tankType', TankTypeEnum.
|
8699
|
+
: this.filterBy('tankType', TankTypeEnum.WORK_TANK);
|
8697
8700
|
}
|
8698
8701
|
/**
|
8699
8702
|
* get collection of logbooks with the biggest work usage for {@link BestVehicleLogbookCollection.periodDuration}
|
@@ -9272,7 +9275,7 @@ class IncomeSourceCollection extends Collection {
|
|
9272
9275
|
filterByTank(tank) {
|
9273
9276
|
return this.items.filter((incomeSource) => {
|
9274
9277
|
switch (tank) {
|
9275
|
-
case TankTypeEnum.
|
9278
|
+
case TankTypeEnum.OTHER_TANK:
|
9276
9279
|
return incomeSource.isOtherIncome();
|
9277
9280
|
default:
|
9278
9281
|
return incomeSource.isWorkIncome();
|
@@ -9810,16 +9813,6 @@ class BankAccount extends BankAccount$1 {
|
|
9810
9813
|
isSoleTank() {
|
9811
9814
|
return !!this.businessAllocations.length;
|
9812
9815
|
}
|
9813
|
-
get tankType() {
|
9814
|
-
switch (true) {
|
9815
|
-
case this.isPropertyTank():
|
9816
|
-
return TankTypeEnum.PROPERTY;
|
9817
|
-
case this.isSoleTank():
|
9818
|
-
return TankTypeEnum.SOLE;
|
9819
|
-
default:
|
9820
|
-
return TankTypeEnum.WORK;
|
9821
|
-
}
|
9822
|
-
}
|
9823
9816
|
/**
|
9824
9817
|
* Get Bank account property by id
|
9825
9818
|
* @param id Id of property
|
@@ -10005,7 +9998,7 @@ class BankTransaction extends BankTransaction$1 {
|
|
10005
9998
|
* Get bank transaction allocated amount
|
10006
9999
|
*/
|
10007
10000
|
getAllocatedAmount(allocations) {
|
10008
|
-
return allocations.getByBankTransactionsIds([this.id]).amount;
|
10001
|
+
return round(allocations.getByBankTransactionsIds([this.id]).amount, 2);
|
10009
10002
|
}
|
10010
10003
|
/**
|
10011
10004
|
* Get bank transaction unallocated amount
|
@@ -21583,7 +21576,7 @@ class BankAccountPropertiesForm extends UntypedFormArray {
|
|
21583
21576
|
property: new UntypedFormControl(bankAccountProperty?.property, Validators.required),
|
21584
21577
|
percent: new UntypedFormControl(bankAccountProperty.percent, Validators.required)
|
21585
21578
|
})), [
|
21586
|
-
conditionalValidator((control) => control.get('tankType').value === TankTypeEnum.
|
21579
|
+
conditionalValidator((control) => control.get('tankType').value === TankTypeEnum.PROPERTY_TANK, Validators.required),
|
21587
21580
|
fieldsSumValidator('percent', 100)
|
21588
21581
|
]);
|
21589
21582
|
}
|
@@ -21707,7 +21700,7 @@ class SoleBusinessAllocationsForm extends UntypedFormArray {
|
|
21707
21700
|
business: new UntypedFormControl(businessAllocation?.business, Validators.required),
|
21708
21701
|
percent: new UntypedFormControl(businessAllocation.percent, Validators.required)
|
21709
21702
|
})), [
|
21710
|
-
conditionalValidator((control) => control.get('tankType').value === TankTypeEnum.
|
21703
|
+
conditionalValidator((control) => control.get('tankType').value === TankTypeEnum.SOLE_TANK, Validators.required),
|
21711
21704
|
fieldsSumValidator('percent', 100)
|
21712
21705
|
]);
|
21713
21706
|
}
|
@@ -22110,10 +22103,10 @@ class BankAccountAllocationForm extends AbstractForm {
|
|
22110
22103
|
this.removeControl('bankAccountProperties');
|
22111
22104
|
this.removeControl('businessAllocations');
|
22112
22105
|
switch (tankType) {
|
22113
|
-
case TankTypeEnum.
|
22106
|
+
case TankTypeEnum.PROPERTY_TANK:
|
22114
22107
|
this.addControl('bankAccountProperties', new BankAccountPropertiesForm(this.bankAccount?.bankAccountProperties));
|
22115
22108
|
break;
|
22116
|
-
case TankTypeEnum.
|
22109
|
+
case TankTypeEnum.SOLE_TANK:
|
22117
22110
|
this.addControl('businessAllocations', new SoleBusinessAllocationsForm(this.bankAccount?.businessAllocations));
|
22118
22111
|
break;
|
22119
22112
|
}
|
@@ -23771,13 +23764,13 @@ class AllocationRuleForm extends AbstractForm {
|
|
23771
23764
|
}
|
23772
23765
|
get tankTypeLabel() {
|
23773
23766
|
switch (this.transactionFormGroup.get('tankType').value) {
|
23774
|
-
case TankTypeEnum.
|
23767
|
+
case TankTypeEnum.WORK_TANK:
|
23775
23768
|
return 'work';
|
23776
|
-
case TankTypeEnum.
|
23769
|
+
case TankTypeEnum.PROPERTY_TANK:
|
23777
23770
|
return 'property';
|
23778
|
-
case TankTypeEnum.
|
23771
|
+
case TankTypeEnum.SOLE_TANK:
|
23779
23772
|
return 'sole';
|
23780
|
-
case TankTypeEnum.
|
23773
|
+
case TankTypeEnum.HOLDING_TANK:
|
23781
23774
|
return 'holding';
|
23782
23775
|
default:
|
23783
23776
|
return 'personal';
|
@@ -23807,13 +23800,13 @@ class AllocationRuleForm extends AbstractForm {
|
|
23807
23800
|
this.transactionFormGroup.get('business').disable({ emitEvent: false });
|
23808
23801
|
this.transactionFormGroup.get('incomeSource').disable({ emitEvent: false });
|
23809
23802
|
switch (tankType) {
|
23810
|
-
case TankTypeEnum.
|
23803
|
+
case TankTypeEnum.WORK_TANK:
|
23811
23804
|
this.transactionFormGroup.get('incomeSource').enable({ emitEvent: false });
|
23812
23805
|
break;
|
23813
|
-
case TankTypeEnum.
|
23806
|
+
case TankTypeEnum.PROPERTY_TANK:
|
23814
23807
|
this.transactionFormGroup.get('property').enable({ emitEvent: false });
|
23815
23808
|
break;
|
23816
|
-
case TankTypeEnum.
|
23809
|
+
case TankTypeEnum.SOLE_TANK:
|
23817
23810
|
this.transactionFormGroup.get('business').enable({ emitEvent: false });
|
23818
23811
|
break;
|
23819
23812
|
}
|
@@ -23828,13 +23821,13 @@ class AllocationRuleForm extends AbstractForm {
|
|
23828
23821
|
return this.get('type').value === AllocationRuleTypeEnum.TRANSFER;
|
23829
23822
|
}
|
23830
23823
|
isPropertyTank() {
|
23831
|
-
return this.get('transaction').get('tankType').value === TankTypeEnum.
|
23824
|
+
return this.get('transaction').get('tankType').value === TankTypeEnum.PROPERTY_TANK;
|
23832
23825
|
}
|
23833
23826
|
isWorkTank() {
|
23834
|
-
return this.get('transaction').get('tankType').value === TankTypeEnum.
|
23827
|
+
return this.get('transaction').get('tankType').value === TankTypeEnum.WORK_TANK;
|
23835
23828
|
}
|
23836
23829
|
isSoleTank() {
|
23837
|
-
return this.get('transaction').get('tankType').value === TankTypeEnum.
|
23830
|
+
return this.get('transaction').get('tankType').value === TankTypeEnum.SOLE_TANK;
|
23838
23831
|
}
|
23839
23832
|
isPropertyIncome() {
|
23840
23833
|
return this.isIncome() && this.isPropertyTank();
|
@@ -24058,15 +24051,17 @@ class WorkTransactionForm extends TransactionForm {
|
|
24058
24051
|
|
24059
24052
|
class WorkIncomeForm extends WorkTransactionForm {
|
24060
24053
|
constructor(transaction, registeredForGst, allocations) {
|
24061
|
-
// for work income we need to show netAmount instead of amount (because some adjustments are included in amount)
|
24062
|
-
transaction.amount = transaction.netAmount;
|
24063
24054
|
super(transaction, registeredForGst, allocations, {
|
24055
|
+
netAmount: new UntypedFormControl(transaction.netAmount, Validators.required),
|
24064
24056
|
tax: new UntypedFormControl({
|
24065
24057
|
value: transaction.tax,
|
24066
24058
|
disabled: !transaction.chartAccounts || transaction.chartAccounts.isNRAS(),
|
24067
24059
|
}, Validators.required),
|
24068
24060
|
incomeSource: new UntypedFormControl(transaction.incomeSource, [Validators.required, autocompleteValidator()]),
|
24069
24061
|
});
|
24062
|
+
if (allocations.length) {
|
24063
|
+
this.get('netAmount').disable();
|
24064
|
+
}
|
24070
24065
|
// forbid to edit some fields for allocated transaction
|
24071
24066
|
if (allocations.length) {
|
24072
24067
|
this.get('chartAccounts').disable();
|
@@ -24129,7 +24124,7 @@ class WorkIncomeForm extends WorkTransactionForm {
|
|
24129
24124
|
* ie bankTransaction=1000$ with 900$ salary and 100$ tips will create 2 transactions with 900$ and 100$
|
24130
24125
|
*/
|
24131
24126
|
getAmount() {
|
24132
|
-
return this.get('
|
24127
|
+
return this.get('netAmount').value - new Collection(this.currentValue.transactions)
|
24133
24128
|
.filter((t) => t.chartAccounts?.isAdjustmentIncluded())
|
24134
24129
|
.sumBy('amount');
|
24135
24130
|
}
|
@@ -24249,8 +24244,8 @@ class TransactionBaseFilterForm extends FormGroup {
|
|
24249
24244
|
}
|
24250
24245
|
listenEvents() {
|
24251
24246
|
this.get('tankType').valueChanges.subscribe(tankType => {
|
24252
|
-
tankType === TankTypeEnum.
|
24253
|
-
tankType === TankTypeEnum.
|
24247
|
+
tankType === TankTypeEnum.SOLE_TANK ? this.get('business').enable() : this.get('business').disable();
|
24248
|
+
tankType === TankTypeEnum.PROPERTY_TANK ? this.get('properties').enable() : this.get('properties').disable();
|
24254
24249
|
});
|
24255
24250
|
}
|
24256
24251
|
filter(collection) {
|