taxtank-core 0.32.71 → 0.32.73
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/esm2022/lib/db/Models/transaction/transaction-base.mjs +4 -1
- package/esm2022/lib/db/Models/transaction/transaction.mjs +1 -1
- package/esm2022/lib/forms/transaction/allocation-rule.form.mjs +28 -1
- package/esm2022/lib/forms/transaction/transaction.form.mjs +1 -3
- package/esm2022/lib/models/transaction/allocation-rule-transaction.mjs +20 -15
- package/esm2022/lib/models/transaction/allocation-rule.mjs +5 -2
- package/esm2022/lib/models/transaction/transaction.mjs +13 -2
- package/esm2022/lib/services/http/bank/bank-connection/bank-connection.service.mjs +2 -2
- package/esm2022/lib/services/http/chat/message.service.mjs +2 -2
- package/esm2022/lib/services/http/firm/client-invite/client-invite.service.mjs +2 -2
- package/esm2022/lib/services/http/firm/client-movement/client-movement.service.mjs +2 -2
- package/esm2022/lib/services/http/subscription/service-payment-method/service-payment-method.service.mjs +2 -2
- package/esm2022/lib/services/http/subscription/service-subscription/subscription.service.mjs +2 -2
- package/fesm2022/taxtank-core.mjs +216 -169
- package/fesm2022/taxtank-core.mjs.map +1 -1
- package/lib/db/Models/transaction/transaction-base.d.ts +1 -0
- package/lib/db/Models/transaction/transaction.d.ts +3 -0
- package/lib/forms/transaction/allocation-rule.form.d.ts +9 -0
- package/lib/models/transaction/allocation-rule-transaction.d.ts +1 -1
- package/lib/models/transaction/transaction.d.ts +4 -0
- package/lib/services/http/bank/bank-connection/bank-connection.service.d.ts +1 -0
- package/lib/services/http/chat/message.service.d.ts +1 -0
- package/lib/services/http/firm/client-invite/client-invite.service.d.ts +1 -0
- package/lib/services/http/firm/client-movement/client-movement.service.d.ts +1 -0
- package/lib/services/http/subscription/service-payment-method/service-payment-method.service.d.ts +1 -0
- package/lib/services/http/subscription/service-subscription/subscription.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -21,7 +21,6 @@ import differenceBy from 'lodash/differenceBy';
|
|
|
21
21
|
import uniq from 'lodash/uniq';
|
|
22
22
|
import moment from 'moment';
|
|
23
23
|
import { DateRange } from 'moment-range';
|
|
24
|
-
import merge from 'lodash/merge';
|
|
25
24
|
import ceil from 'lodash/ceil';
|
|
26
25
|
import range from 'lodash/range';
|
|
27
26
|
import { Validators, UntypedFormGroup, UntypedFormControl, UntypedFormArray, FormControl, FormArray, FormGroup } from '@angular/forms';
|
|
@@ -32,6 +31,7 @@ import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource.min.j
|
|
|
32
31
|
import { JwtHelperService } from '@auth0/angular-jwt';
|
|
33
32
|
import * as mixpanel from 'mixpanel-browser';
|
|
34
33
|
import clone from 'lodash/clone';
|
|
34
|
+
import merge from 'lodash/merge';
|
|
35
35
|
import { isArray } from 'rxjs/internal-compatibility';
|
|
36
36
|
import * as i4 from '@angular/router';
|
|
37
37
|
import { NavigationEnd } from '@angular/router';
|
|
@@ -443,6 +443,9 @@ var TankTypeEnum;
|
|
|
443
443
|
})(TankTypeEnum || (TankTypeEnum = {}));
|
|
444
444
|
|
|
445
445
|
class TransactionBase extends ObservableModel {
|
|
446
|
+
get gstCoefficient() {
|
|
447
|
+
return this.isGST ? ChartAccounts.GSTCoefficient : 1;
|
|
448
|
+
}
|
|
446
449
|
get claimRatio() {
|
|
447
450
|
return this.sharedClaimPercent / 100;
|
|
448
451
|
}
|
|
@@ -3750,6 +3753,12 @@ class IncomeSourceChartData {
|
|
|
3750
3753
|
}
|
|
3751
3754
|
}
|
|
3752
3755
|
|
|
3756
|
+
var TransactionSourceEnum;
|
|
3757
|
+
(function (TransactionSourceEnum) {
|
|
3758
|
+
TransactionSourceEnum[TransactionSourceEnum["CASH"] = 1] = "CASH";
|
|
3759
|
+
TransactionSourceEnum[TransactionSourceEnum["BANK_TRANSACTION"] = 2] = "BANK_TRANSACTION";
|
|
3760
|
+
})(TransactionSourceEnum || (TransactionSourceEnum = {}));
|
|
3761
|
+
|
|
3753
3762
|
class AllocationRuleTransaction extends AllocationRuleTransaction$1 {
|
|
3754
3763
|
constructor() {
|
|
3755
3764
|
super(...arguments);
|
|
@@ -3782,8 +3791,10 @@ class AllocationRuleTransaction extends AllocationRuleTransaction$1 {
|
|
|
3782
3791
|
/**
|
|
3783
3792
|
* Create Transaction instance based on passed bank transaction and rule transaction
|
|
3784
3793
|
*/
|
|
3785
|
-
toTransaction(bankTransaction) {
|
|
3786
|
-
const transaction =
|
|
3794
|
+
toTransaction(bankTransaction = null) {
|
|
3795
|
+
const transaction = bankTransaction ? bankTransaction.toTransaction(this.isGST) : plainToClass(Transaction, {});
|
|
3796
|
+
Object.assign(transaction, {
|
|
3797
|
+
isGST: this.isGST,
|
|
3787
3798
|
tax: this.tax,
|
|
3788
3799
|
claimPercent: this.claimPercent,
|
|
3789
3800
|
chartAccounts: this.chartAccounts,
|
|
@@ -3791,19 +3802,22 @@ class AllocationRuleTransaction extends AllocationRuleTransaction$1 {
|
|
|
3791
3802
|
loan: this.loan,
|
|
3792
3803
|
incomeSource: this.incomeSource,
|
|
3793
3804
|
metaFields: this.metaFields,
|
|
3794
|
-
parentTransaction: this.parentTransaction,
|
|
3795
|
-
childTransactions: this.childTransactions,
|
|
3796
3805
|
business: this.business,
|
|
3806
|
+
source: TransactionSourceEnum.BANK_TRANSACTION,
|
|
3797
3807
|
operation: TransactionOperationEnum.ALLOCATE,
|
|
3808
|
+
transactions: [],
|
|
3798
3809
|
});
|
|
3799
|
-
//
|
|
3800
|
-
if (this.
|
|
3801
|
-
transaction.amount = this.
|
|
3810
|
+
// split allocation
|
|
3811
|
+
if (this.amountPercent) {
|
|
3812
|
+
transaction.amount = bankTransaction.amount * this.amountPercentCoefficient / this.gstCoefficient;
|
|
3802
3813
|
}
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3814
|
+
// child transactions inherit most of the fields from parent transaction
|
|
3815
|
+
this.childTransactions.forEach((childRuleTransaction) => {
|
|
3816
|
+
const childTransaction = childRuleTransaction.toTransaction();
|
|
3817
|
+
childTransaction.amount = childRuleTransaction.amount;
|
|
3818
|
+
childTransaction.setParent(transaction);
|
|
3819
|
+
transaction.transactions.push(childTransaction);
|
|
3820
|
+
});
|
|
3807
3821
|
return transaction;
|
|
3808
3822
|
}
|
|
3809
3823
|
}
|
|
@@ -3845,145 +3859,12 @@ __decorate([
|
|
|
3845
3859
|
Type(() => Number)
|
|
3846
3860
|
], AllocationRuleTransaction.prototype, "tax", void 0);
|
|
3847
3861
|
|
|
3848
|
-
class AllocationRule extends AllocationRule$1 {
|
|
3849
|
-
constructor() {
|
|
3850
|
-
super(...arguments);
|
|
3851
|
-
this.type = AllocationRuleTypeEnum.EXPENSE;
|
|
3852
|
-
this.conditionOperator = AllocationRuleConditionOperatorEnum.OR;
|
|
3853
|
-
this.autoAllocate = false;
|
|
3854
|
-
}
|
|
3855
|
-
get typeLabel() {
|
|
3856
|
-
switch (this.type) {
|
|
3857
|
-
case AllocationRuleTypeEnum.EXPENSE:
|
|
3858
|
-
return 'expense';
|
|
3859
|
-
case AllocationRuleTypeEnum.INCOME:
|
|
3860
|
-
return 'income';
|
|
3861
|
-
default:
|
|
3862
|
-
return 'transfer';
|
|
3863
|
-
}
|
|
3864
|
-
}
|
|
3865
|
-
isIncome() {
|
|
3866
|
-
return this.type === AllocationRuleTypeEnum.INCOME;
|
|
3867
|
-
}
|
|
3868
|
-
isExpense() {
|
|
3869
|
-
return this.type === AllocationRuleTypeEnum.EXPENSE;
|
|
3870
|
-
}
|
|
3871
|
-
isTransfer() {
|
|
3872
|
-
return this.type === AllocationRuleTypeEnum.TRANSFER;
|
|
3873
|
-
}
|
|
3874
|
-
isPropertyTank() {
|
|
3875
|
-
return this.transaction.tankType === TankTypeEnum.PROPERTY;
|
|
3876
|
-
}
|
|
3877
|
-
isWorkTank() {
|
|
3878
|
-
return this.transaction.tankType === TankTypeEnum.WORK;
|
|
3879
|
-
}
|
|
3880
|
-
isSoleTank() {
|
|
3881
|
-
return this.transaction.tankType === TankTypeEnum.SOLE;
|
|
3882
|
-
}
|
|
3883
|
-
isPropertyIncome() {
|
|
3884
|
-
return this.isIncome() && this.isPropertyTank();
|
|
3885
|
-
}
|
|
3886
|
-
isWorkIncome() {
|
|
3887
|
-
return this.isIncome() && this.isWorkTank();
|
|
3888
|
-
}
|
|
3889
|
-
isSoleIncome() {
|
|
3890
|
-
return this.isIncome() && this.isSoleTank();
|
|
3891
|
-
}
|
|
3892
|
-
/**
|
|
3893
|
-
* @TODO Alex: move to collection
|
|
3894
|
-
*/
|
|
3895
|
-
matchBankTransaction(bankTransaction) {
|
|
3896
|
-
return this.conditionOperator === AllocationRuleConditionOperatorEnum.AND ? this.checkAnd(bankTransaction) : this.checkOr(bankTransaction);
|
|
3897
|
-
}
|
|
3898
|
-
createTransaction(bankTransaction) {
|
|
3899
|
-
if (this.isTransfer()) {
|
|
3900
|
-
const transaction = bankTransaction.toTransaction();
|
|
3901
|
-
transaction.operation = TransactionOperationEnum.TRANSFER;
|
|
3902
|
-
transaction.chartAccounts = plainToClass(ChartAccounts, { id: ChartAccountsListEnum.TRANSFER });
|
|
3903
|
-
return transaction;
|
|
3904
|
-
}
|
|
3905
|
-
return this.transaction.toTransaction(bankTransaction);
|
|
3906
|
-
}
|
|
3907
|
-
/**
|
|
3908
|
-
* Rule is matched when all conditions matched
|
|
3909
|
-
*/
|
|
3910
|
-
checkAnd(bankTransaction) {
|
|
3911
|
-
for (const condition of this.conditions) {
|
|
3912
|
-
if (!condition.matchBankTransaction(bankTransaction)) {
|
|
3913
|
-
return false;
|
|
3914
|
-
}
|
|
3915
|
-
}
|
|
3916
|
-
return true;
|
|
3917
|
-
}
|
|
3918
|
-
/**
|
|
3919
|
-
* Rule is matched when at least one condition matched
|
|
3920
|
-
*/
|
|
3921
|
-
checkOr(bankTransaction) {
|
|
3922
|
-
for (const condition of this.conditions) {
|
|
3923
|
-
if (condition.matchBankTransaction(bankTransaction)) {
|
|
3924
|
-
return true;
|
|
3925
|
-
}
|
|
3926
|
-
}
|
|
3927
|
-
return false;
|
|
3928
|
-
}
|
|
3929
|
-
/**
|
|
3930
|
-
* Create allocation rule based on bank transaction (just prefill rule fields with bank transaction values)
|
|
3931
|
-
*/
|
|
3932
|
-
static fromBankTransaction(bankTransaction) {
|
|
3933
|
-
return plainToClass(AllocationRule, {
|
|
3934
|
-
type: bankTransaction.isDebit() ? AllocationRuleTypeEnum.EXPENSE : AllocationRuleTypeEnum.INCOME,
|
|
3935
|
-
bankAccount: bankTransaction.bankAccount,
|
|
3936
|
-
conditionOperator: AllocationRuleConditionOperatorEnum.AND,
|
|
3937
|
-
conditions: [
|
|
3938
|
-
plainToClass(AllocationRuleCondition, {
|
|
3939
|
-
field: AllocationRuleConditionFieldEnum.AMOUNT,
|
|
3940
|
-
comparisonOperator: AllocationRuleConditionComparisonOperatorEnum.EQUALS,
|
|
3941
|
-
value: bankTransaction.amount
|
|
3942
|
-
}),
|
|
3943
|
-
plainToClass(AllocationRuleCondition, {
|
|
3944
|
-
field: AllocationRuleConditionFieldEnum.DESCRIPTION,
|
|
3945
|
-
comparisonOperator: AllocationRuleConditionComparisonOperatorEnum.EQUALS,
|
|
3946
|
-
value: bankTransaction.description
|
|
3947
|
-
})
|
|
3948
|
-
]
|
|
3949
|
-
});
|
|
3950
|
-
}
|
|
3951
|
-
}
|
|
3952
|
-
__decorate([
|
|
3953
|
-
Type(() => BankAccount),
|
|
3954
|
-
Transform(({ value }) => ({ id: value.id }), { toPlainOnly: true })
|
|
3955
|
-
], AllocationRule.prototype, "bankAccount", void 0);
|
|
3956
|
-
__decorate([
|
|
3957
|
-
Type(() => AllocationRuleCondition)
|
|
3958
|
-
], AllocationRule.prototype, "conditions", void 0);
|
|
3959
|
-
__decorate([
|
|
3960
|
-
Type(() => AllocationRuleTransaction)
|
|
3961
|
-
], AllocationRule.prototype, "transaction", void 0);
|
|
3962
|
-
__decorate([
|
|
3963
|
-
Type(() => BankAccount)
|
|
3964
|
-
], AllocationRule.prototype, "transferBankAccount", void 0);
|
|
3965
|
-
|
|
3966
|
-
/**
|
|
3967
|
-
* Enum with income amount types (Net or Gross)
|
|
3968
|
-
*/
|
|
3969
|
-
var IncomeAmountTypeEnum;
|
|
3970
|
-
(function (IncomeAmountTypeEnum) {
|
|
3971
|
-
IncomeAmountTypeEnum[IncomeAmountTypeEnum["NET"] = 0] = "NET";
|
|
3972
|
-
IncomeAmountTypeEnum[IncomeAmountTypeEnum["GROSS"] = 1] = "GROSS";
|
|
3973
|
-
})(IncomeAmountTypeEnum || (IncomeAmountTypeEnum = {}));
|
|
3974
|
-
|
|
3975
3862
|
var TransactionTypeEnum;
|
|
3976
3863
|
(function (TransactionTypeEnum) {
|
|
3977
3864
|
TransactionTypeEnum[TransactionTypeEnum["DEBIT"] = 1] = "DEBIT";
|
|
3978
3865
|
TransactionTypeEnum[TransactionTypeEnum["CREDIT"] = 2] = "CREDIT";
|
|
3979
3866
|
})(TransactionTypeEnum || (TransactionTypeEnum = {}));
|
|
3980
3867
|
|
|
3981
|
-
var TransactionSourceEnum;
|
|
3982
|
-
(function (TransactionSourceEnum) {
|
|
3983
|
-
TransactionSourceEnum[TransactionSourceEnum["CASH"] = 1] = "CASH";
|
|
3984
|
-
TransactionSourceEnum[TransactionSourceEnum["BANK_TRANSACTION"] = 2] = "BANK_TRANSACTION";
|
|
3985
|
-
})(TransactionSourceEnum || (TransactionSourceEnum = {}));
|
|
3986
|
-
|
|
3987
3868
|
var TaxExemptionEnum;
|
|
3988
3869
|
(function (TaxExemptionEnum) {
|
|
3989
3870
|
TaxExemptionEnum[TaxExemptionEnum["ONE_YEAR_RULE"] = 1] = "ONE_YEAR_RULE";
|
|
@@ -6261,27 +6142,13 @@ __decorate([
|
|
|
6261
6142
|
Type(() => ChartAccountsMetaField)
|
|
6262
6143
|
], TransactionMetaField.prototype, "chartAccountsMetaField", void 0);
|
|
6263
6144
|
|
|
6264
|
-
class TransactionAllocation extends TransactionAllocation$1 {
|
|
6265
|
-
/**
|
|
6266
|
-
* Create a new instance of transaction allocation
|
|
6267
|
-
* transaction could be empty since we can POST allocation inside a new transaction
|
|
6268
|
-
*/
|
|
6269
|
-
static create(amount, bankTransaction, transaction) {
|
|
6270
|
-
return plainToClass(TransactionAllocation, { amount, transaction, bankTransaction });
|
|
6271
|
-
}
|
|
6272
|
-
}
|
|
6273
|
-
__decorate([
|
|
6274
|
-
Type(() => BankTransaction)
|
|
6275
|
-
], TransactionAllocation.prototype, "bankTransaction", void 0);
|
|
6276
|
-
__decorate([
|
|
6277
|
-
Type(() => Transaction)
|
|
6278
|
-
], TransactionAllocation.prototype, "transaction", void 0);
|
|
6279
|
-
|
|
6280
6145
|
// @TODO Alex: refactor: move here allocations methods, netAmount = amount, grossAmount calculation, remove unused methods, etc.
|
|
6281
6146
|
class Transaction extends Transaction$1 {
|
|
6282
6147
|
constructor() {
|
|
6283
6148
|
super(...arguments);
|
|
6284
|
-
|
|
6149
|
+
/**
|
|
6150
|
+
* @TODO rename to childTransactions
|
|
6151
|
+
*/
|
|
6285
6152
|
this.transactions = [];
|
|
6286
6153
|
this.metaFields = [];
|
|
6287
6154
|
this.allocations = [];
|
|
@@ -6459,6 +6326,15 @@ class Transaction extends Transaction$1 {
|
|
|
6459
6326
|
ignoreSign() {
|
|
6460
6327
|
return !(this.chartAccounts?.id in ChartAccountsKeepSign);
|
|
6461
6328
|
}
|
|
6329
|
+
setParent(transaction) {
|
|
6330
|
+
this.description = this.chartAccounts.name;
|
|
6331
|
+
this.date = transaction.date;
|
|
6332
|
+
this.claimPercent = transaction.claimPercent;
|
|
6333
|
+
this.property = transaction.property;
|
|
6334
|
+
this.loan = transaction.loan;
|
|
6335
|
+
this.incomeSource = transaction.incomeSource;
|
|
6336
|
+
this.business = transaction.business;
|
|
6337
|
+
}
|
|
6462
6338
|
}
|
|
6463
6339
|
__decorate([
|
|
6464
6340
|
Type(() => Transaction)
|
|
@@ -6494,6 +6370,151 @@ __decorate([
|
|
|
6494
6370
|
Transform(({ value }) => +value)
|
|
6495
6371
|
], Transaction.prototype, "tax", void 0);
|
|
6496
6372
|
|
|
6373
|
+
class TransactionAllocation extends TransactionAllocation$1 {
|
|
6374
|
+
/**
|
|
6375
|
+
* Create a new instance of transaction allocation
|
|
6376
|
+
* transaction could be empty since we can POST allocation inside a new transaction
|
|
6377
|
+
*/
|
|
6378
|
+
static create(amount, bankTransaction, transaction) {
|
|
6379
|
+
return plainToClass(TransactionAllocation, { amount, transaction, bankTransaction });
|
|
6380
|
+
}
|
|
6381
|
+
}
|
|
6382
|
+
__decorate([
|
|
6383
|
+
Type(() => BankTransaction)
|
|
6384
|
+
], TransactionAllocation.prototype, "bankTransaction", void 0);
|
|
6385
|
+
__decorate([
|
|
6386
|
+
Type(() => Transaction)
|
|
6387
|
+
], TransactionAllocation.prototype, "transaction", void 0);
|
|
6388
|
+
|
|
6389
|
+
class AllocationRule extends AllocationRule$1 {
|
|
6390
|
+
constructor() {
|
|
6391
|
+
super(...arguments);
|
|
6392
|
+
this.type = AllocationRuleTypeEnum.EXPENSE;
|
|
6393
|
+
this.conditionOperator = AllocationRuleConditionOperatorEnum.OR;
|
|
6394
|
+
this.autoAllocate = false;
|
|
6395
|
+
}
|
|
6396
|
+
get typeLabel() {
|
|
6397
|
+
switch (this.type) {
|
|
6398
|
+
case AllocationRuleTypeEnum.EXPENSE:
|
|
6399
|
+
return 'expense';
|
|
6400
|
+
case AllocationRuleTypeEnum.INCOME:
|
|
6401
|
+
return 'income';
|
|
6402
|
+
default:
|
|
6403
|
+
return 'transfer';
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
isIncome() {
|
|
6407
|
+
return this.type === AllocationRuleTypeEnum.INCOME;
|
|
6408
|
+
}
|
|
6409
|
+
isExpense() {
|
|
6410
|
+
return this.type === AllocationRuleTypeEnum.EXPENSE;
|
|
6411
|
+
}
|
|
6412
|
+
isTransfer() {
|
|
6413
|
+
return this.type === AllocationRuleTypeEnum.TRANSFER;
|
|
6414
|
+
}
|
|
6415
|
+
isPropertyTank() {
|
|
6416
|
+
return this.transaction.tankType === TankTypeEnum.PROPERTY;
|
|
6417
|
+
}
|
|
6418
|
+
isWorkTank() {
|
|
6419
|
+
return this.transaction.tankType === TankTypeEnum.WORK;
|
|
6420
|
+
}
|
|
6421
|
+
isSoleTank() {
|
|
6422
|
+
return this.transaction.tankType === TankTypeEnum.SOLE;
|
|
6423
|
+
}
|
|
6424
|
+
isPropertyIncome() {
|
|
6425
|
+
return this.isIncome() && this.isPropertyTank();
|
|
6426
|
+
}
|
|
6427
|
+
isWorkIncome() {
|
|
6428
|
+
return this.isIncome() && this.isWorkTank();
|
|
6429
|
+
}
|
|
6430
|
+
isSoleIncome() {
|
|
6431
|
+
return this.isIncome() && this.isSoleTank();
|
|
6432
|
+
}
|
|
6433
|
+
/**
|
|
6434
|
+
* @TODO Alex: move to collection
|
|
6435
|
+
*/
|
|
6436
|
+
matchBankTransaction(bankTransaction) {
|
|
6437
|
+
return this.conditionOperator === AllocationRuleConditionOperatorEnum.AND ? this.checkAnd(bankTransaction) : this.checkOr(bankTransaction);
|
|
6438
|
+
}
|
|
6439
|
+
createTransaction(bankTransaction) {
|
|
6440
|
+
if (this.isTransfer()) {
|
|
6441
|
+
const transaction = bankTransaction.toTransaction();
|
|
6442
|
+
transaction.operation = TransactionOperationEnum.TRANSFER;
|
|
6443
|
+
transaction.chartAccounts = plainToClass(ChartAccounts, { id: ChartAccountsListEnum.TRANSFER });
|
|
6444
|
+
return transaction;
|
|
6445
|
+
}
|
|
6446
|
+
const transaction = this.transaction.toTransaction(bankTransaction);
|
|
6447
|
+
transaction.allocations = [TransactionAllocation.create(transaction.amountWithGst, bankTransaction)];
|
|
6448
|
+
return transaction;
|
|
6449
|
+
}
|
|
6450
|
+
/**
|
|
6451
|
+
* Rule is matched when all conditions matched
|
|
6452
|
+
*/
|
|
6453
|
+
checkAnd(bankTransaction) {
|
|
6454
|
+
for (const condition of this.conditions) {
|
|
6455
|
+
if (!condition.matchBankTransaction(bankTransaction)) {
|
|
6456
|
+
return false;
|
|
6457
|
+
}
|
|
6458
|
+
}
|
|
6459
|
+
return true;
|
|
6460
|
+
}
|
|
6461
|
+
/**
|
|
6462
|
+
* Rule is matched when at least one condition matched
|
|
6463
|
+
*/
|
|
6464
|
+
checkOr(bankTransaction) {
|
|
6465
|
+
for (const condition of this.conditions) {
|
|
6466
|
+
if (condition.matchBankTransaction(bankTransaction)) {
|
|
6467
|
+
return true;
|
|
6468
|
+
}
|
|
6469
|
+
}
|
|
6470
|
+
return false;
|
|
6471
|
+
}
|
|
6472
|
+
/**
|
|
6473
|
+
* Create allocation rule based on bank transaction (just prefill rule fields with bank transaction values)
|
|
6474
|
+
*/
|
|
6475
|
+
static fromBankTransaction(bankTransaction) {
|
|
6476
|
+
return plainToClass(AllocationRule, {
|
|
6477
|
+
type: bankTransaction.isDebit() ? AllocationRuleTypeEnum.EXPENSE : AllocationRuleTypeEnum.INCOME,
|
|
6478
|
+
bankAccount: bankTransaction.bankAccount,
|
|
6479
|
+
conditionOperator: AllocationRuleConditionOperatorEnum.AND,
|
|
6480
|
+
conditions: [
|
|
6481
|
+
plainToClass(AllocationRuleCondition, {
|
|
6482
|
+
field: AllocationRuleConditionFieldEnum.AMOUNT,
|
|
6483
|
+
comparisonOperator: AllocationRuleConditionComparisonOperatorEnum.EQUALS,
|
|
6484
|
+
value: bankTransaction.amount
|
|
6485
|
+
}),
|
|
6486
|
+
plainToClass(AllocationRuleCondition, {
|
|
6487
|
+
field: AllocationRuleConditionFieldEnum.DESCRIPTION,
|
|
6488
|
+
comparisonOperator: AllocationRuleConditionComparisonOperatorEnum.EQUALS,
|
|
6489
|
+
value: bankTransaction.description
|
|
6490
|
+
})
|
|
6491
|
+
]
|
|
6492
|
+
});
|
|
6493
|
+
}
|
|
6494
|
+
}
|
|
6495
|
+
__decorate([
|
|
6496
|
+
Type(() => BankAccount),
|
|
6497
|
+
Transform(({ value }) => ({ id: value.id }), { toPlainOnly: true })
|
|
6498
|
+
], AllocationRule.prototype, "bankAccount", void 0);
|
|
6499
|
+
__decorate([
|
|
6500
|
+
Type(() => AllocationRuleCondition)
|
|
6501
|
+
], AllocationRule.prototype, "conditions", void 0);
|
|
6502
|
+
__decorate([
|
|
6503
|
+
Type(() => AllocationRuleTransaction)
|
|
6504
|
+
], AllocationRule.prototype, "transaction", void 0);
|
|
6505
|
+
__decorate([
|
|
6506
|
+
Type(() => BankAccount)
|
|
6507
|
+
], AllocationRule.prototype, "transferBankAccount", void 0);
|
|
6508
|
+
|
|
6509
|
+
/**
|
|
6510
|
+
* Enum with income amount types (Net or Gross)
|
|
6511
|
+
*/
|
|
6512
|
+
var IncomeAmountTypeEnum;
|
|
6513
|
+
(function (IncomeAmountTypeEnum) {
|
|
6514
|
+
IncomeAmountTypeEnum[IncomeAmountTypeEnum["NET"] = 0] = "NET";
|
|
6515
|
+
IncomeAmountTypeEnum[IncomeAmountTypeEnum["GROSS"] = 1] = "GROSS";
|
|
6516
|
+
})(IncomeAmountTypeEnum || (IncomeAmountTypeEnum = {}));
|
|
6517
|
+
|
|
6497
6518
|
var TransactionCategoryEnum;
|
|
6498
6519
|
(function (TransactionCategoryEnum) {
|
|
6499
6520
|
TransactionCategoryEnum[TransactionCategoryEnum["PROPERTY"] = 0] = "PROPERTY";
|
|
@@ -11170,7 +11191,6 @@ var BankConnectionMessagesEnum;
|
|
|
11170
11191
|
* service handles BankConnection management
|
|
11171
11192
|
*/
|
|
11172
11193
|
class BankConnectionService extends RestService$1 {
|
|
11173
|
-
// mercureTopic = 'bankConnections';
|
|
11174
11194
|
constructor(environment) {
|
|
11175
11195
|
super(environment);
|
|
11176
11196
|
this.environment = environment;
|
|
@@ -11178,6 +11198,7 @@ class BankConnectionService extends RestService$1 {
|
|
|
11178
11198
|
this.collectionClass = Collection;
|
|
11179
11199
|
this.endpointUri = 'bank-connections';
|
|
11180
11200
|
this.disabledMethods = ['postBatch', 'putBatch', 'delete', 'deleteBatch'];
|
|
11201
|
+
this.mercureTopic = 'bankConnections';
|
|
11181
11202
|
this.listenEvents();
|
|
11182
11203
|
}
|
|
11183
11204
|
listenEvents() {
|
|
@@ -11735,7 +11756,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
11735
11756
|
* Service for work with messages
|
|
11736
11757
|
*/
|
|
11737
11758
|
class MessageService extends RestService$1 {
|
|
11738
|
-
// mercureTopic = 'messages';
|
|
11739
11759
|
constructor(environment) {
|
|
11740
11760
|
super(environment);
|
|
11741
11761
|
this.environment = environment;
|
|
@@ -11743,6 +11763,7 @@ class MessageService extends RestService$1 {
|
|
|
11743
11763
|
this.collectionClass = MessageCollection;
|
|
11744
11764
|
this.endpointUri = 'messages';
|
|
11745
11765
|
this.disabledMethods = ['postBatch', 'putBatch'];
|
|
11766
|
+
this.mercureTopic = 'messages';
|
|
11746
11767
|
this.listenEvents();
|
|
11747
11768
|
}
|
|
11748
11769
|
listenEvents() {
|
|
@@ -12191,13 +12212,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
12191
12212
|
}] });
|
|
12192
12213
|
|
|
12193
12214
|
class ClientInviteService extends RestService$1 {
|
|
12194
|
-
// mercureTopic = 'clientInvites';
|
|
12195
12215
|
constructor(environment) {
|
|
12196
12216
|
super(environment);
|
|
12197
12217
|
this.environment = environment;
|
|
12198
12218
|
this.endpointUri = 'clients/invites';
|
|
12199
12219
|
this.collectionClass = ClientInviteCollection;
|
|
12200
12220
|
this.modelClass = ClientInvite;
|
|
12221
|
+
this.mercureTopic = 'clientInvites';
|
|
12201
12222
|
this.listenEvents();
|
|
12202
12223
|
}
|
|
12203
12224
|
listenEvents() {
|
|
@@ -12298,7 +12319,6 @@ var ClientInviteMessages;
|
|
|
12298
12319
|
})(ClientInviteMessages || (ClientInviteMessages = {}));
|
|
12299
12320
|
|
|
12300
12321
|
class ClientMovementService extends RestService$1 {
|
|
12301
|
-
// mercureTopic = 'clientMovements';
|
|
12302
12322
|
constructor(environment) {
|
|
12303
12323
|
super(environment);
|
|
12304
12324
|
this.environment = environment;
|
|
@@ -12306,6 +12326,7 @@ class ClientMovementService extends RestService$1 {
|
|
|
12306
12326
|
this.collectionClass = ClientMovementCollection;
|
|
12307
12327
|
this.modelClass = ClientMovement;
|
|
12308
12328
|
this.disabledMethods = ['postBatch', 'delete', 'deleteBatch'];
|
|
12329
|
+
this.mercureTopic = 'clientMovements';
|
|
12309
12330
|
this.listenEvents();
|
|
12310
12331
|
}
|
|
12311
12332
|
listenEvents() {
|
|
@@ -14034,13 +14055,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
|
|
|
14034
14055
|
}] });
|
|
14035
14056
|
|
|
14036
14057
|
class ServicePaymentMethodService extends RestService$1 {
|
|
14037
|
-
// mercureTopic = 'servicePaymentMethods';
|
|
14038
14058
|
constructor(environment) {
|
|
14039
14059
|
super(environment);
|
|
14040
14060
|
this.environment = environment;
|
|
14041
14061
|
this.endpointUri = 'service-payment-methods';
|
|
14042
14062
|
this.collectionClass = Collection;
|
|
14043
14063
|
this.modelClass = ServicePaymentMethod;
|
|
14064
|
+
this.mercureTopic = 'servicePaymentMethods';
|
|
14044
14065
|
this.listenEvents();
|
|
14045
14066
|
}
|
|
14046
14067
|
listenEvents() {
|
|
@@ -14106,7 +14127,6 @@ var SubscriptionMessagesEnum;
|
|
|
14106
14127
|
* @TODO Alex refactor
|
|
14107
14128
|
*/
|
|
14108
14129
|
class SubscriptionService extends RestService$1 {
|
|
14109
|
-
// mercureTopic = 'serviceSubscriptions';
|
|
14110
14130
|
constructor(http, environment) {
|
|
14111
14131
|
super(environment);
|
|
14112
14132
|
this.http = http;
|
|
@@ -14115,6 +14135,7 @@ class SubscriptionService extends RestService$1 {
|
|
|
14115
14135
|
this.modelClass = ServiceSubscription;
|
|
14116
14136
|
this.collectionClass = ServiceSubscriptionCollection;
|
|
14117
14137
|
this.disabledMethods = ['putBatch', 'delete', 'deleteBatch'];
|
|
14138
|
+
this.mercureTopic = 'serviceSubscriptions';
|
|
14118
14139
|
this.listenEvents();
|
|
14119
14140
|
}
|
|
14120
14141
|
listenEvents() {
|
|
@@ -23016,6 +23037,33 @@ class AllocationRuleForm extends AbstractForm {
|
|
|
23016
23037
|
break;
|
|
23017
23038
|
}
|
|
23018
23039
|
}
|
|
23040
|
+
isIncome() {
|
|
23041
|
+
return this.get('type').value === AllocationRuleTypeEnum.INCOME;
|
|
23042
|
+
}
|
|
23043
|
+
isExpense() {
|
|
23044
|
+
return this.get('type').value === AllocationRuleTypeEnum.EXPENSE;
|
|
23045
|
+
}
|
|
23046
|
+
isTransfer() {
|
|
23047
|
+
return this.get('type').value === AllocationRuleTypeEnum.TRANSFER;
|
|
23048
|
+
}
|
|
23049
|
+
isPropertyTank() {
|
|
23050
|
+
return this.get('transaction').get('tankType').value === TankTypeEnum.PROPERTY;
|
|
23051
|
+
}
|
|
23052
|
+
isWorkTank() {
|
|
23053
|
+
return this.get('transaction').get('tankType').value === TankTypeEnum.WORK;
|
|
23054
|
+
}
|
|
23055
|
+
isSoleTank() {
|
|
23056
|
+
return this.get('transaction').get('tankType').value === TankTypeEnum.SOLE;
|
|
23057
|
+
}
|
|
23058
|
+
isPropertyIncome() {
|
|
23059
|
+
return this.isIncome() && this.isPropertyTank();
|
|
23060
|
+
}
|
|
23061
|
+
isWorkIncome() {
|
|
23062
|
+
return this.isIncome() && this.isWorkTank();
|
|
23063
|
+
}
|
|
23064
|
+
isSoleIncome() {
|
|
23065
|
+
return this.isIncome() && this.isSoleTank();
|
|
23066
|
+
}
|
|
23019
23067
|
}
|
|
23020
23068
|
|
|
23021
23069
|
/**
|
|
@@ -23161,7 +23209,6 @@ class TransactionForm extends TransactionBaseForm {
|
|
|
23161
23209
|
date: transaction.date,
|
|
23162
23210
|
claimPercent: (transaction.claimPercent * childTransaction.chartAccounts?.taxablePercent) / 100,
|
|
23163
23211
|
source: TransactionSourceEnum.BANK_TRANSACTION,
|
|
23164
|
-
type: childTransaction.chartAccounts?.isExpense() ? TransactionTypeEnum.DEBIT : TransactionTypeEnum.CREDIT,
|
|
23165
23212
|
incomeSource: transaction.incomeSource,
|
|
23166
23213
|
property: transaction.property
|
|
23167
23214
|
}, this.model.transactions.find((transaction) => transaction.id === childTransaction['id']) || {}, childTransaction));
|