@tomei/finance 0.6.99 → 0.6.102
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/.husky/commit-msg +12 -3
- package/.husky/pre-commit +4 -4
- package/configs/config.js +1 -1
- package/dist/account/account.d.ts +37 -37
- package/dist/account/account.js +251 -263
- package/dist/account/account.js.map +1 -1
- package/dist/account/account.repository.d.ts +5 -5
- package/dist/account/account.repository.js +11 -11
- package/dist/account/interfaces/account-attr.interface.d.ts +29 -29
- package/dist/account/interfaces/account-attr.interface.js +2 -2
- package/dist/account-system-entity/account-system-entity.d.ts +12 -12
- package/dist/account-system-entity/account-system-entity.js +55 -66
- package/dist/account-system-entity/account-system-entity.js.map +1 -1
- package/dist/account-system-entity/post-history.repository.d.ts +5 -5
- package/dist/account-system-entity/post-history.repository.js +11 -11
- package/dist/config.d.ts +1888 -1888
- package/dist/config.js +331 -331
- package/dist/config.js.map +1 -1
- package/dist/customer/customer.d.ts +44 -44
- package/dist/customer/customer.js +212 -234
- package/dist/customer/customer.js.map +1 -1
- package/dist/customer/finance-customer.repository.d.ts +5 -5
- package/dist/customer/finance-customer.repository.js +25 -25
- package/dist/customer/finance-customer.repository.js.map +1 -1
- package/dist/customer/interfaces/customer.repository.interface.d.ts +3 -3
- package/dist/customer/interfaces/customer.repository.interface.js +2 -2
- package/dist/customer/interfaces/finance-customer-attr.interface.d.ts +10 -10
- package/dist/customer/interfaces/finance-customer-attr.interface.js +2 -2
- package/dist/customer/interfaces/finance-customer.repository.interface.d.ts +3 -3
- package/dist/customer/interfaces/finance-customer.repository.interface.js +2 -2
- package/dist/database.d.ts +4 -4
- package/dist/database.js +46 -47
- package/dist/database.js.map +1 -1
- package/dist/document/document-item.d.ts +46 -46
- package/dist/document/document-item.js +122 -132
- package/dist/document/document-item.js.map +1 -1
- package/dist/document/document-item.repository.d.ts +5 -5
- package/dist/document/document-item.repository.js +11 -11
- package/dist/document/document.d.ts +87 -88
- package/dist/document/document.js +735 -766
- package/dist/document/document.js.map +1 -1
- package/dist/document/document.repository.d.ts +5 -5
- package/dist/document/document.repository.js +11 -11
- package/dist/document/interfaces/document-attr.interface.d.ts +27 -27
- package/dist/document/interfaces/document-attr.interface.js +6 -6
- package/dist/document/interfaces/document-find-all.interface.d.ts +13 -13
- package/dist/document/interfaces/document-find-all.interface.js +2 -2
- package/dist/document/interfaces/document-item-attr.interface.d.ts +26 -26
- package/dist/document/interfaces/document-item-attr.interface.js +6 -6
- package/dist/document/interfaces/document-item.repository.interface.d.ts +3 -3
- package/dist/document/interfaces/document-item.repository.interface.js +2 -2
- package/dist/enum/collect-payment-type.d.ts +4 -4
- package/dist/enum/collect-payment-type.js +8 -8
- package/dist/enum/collect-payment-type.js.map +1 -1
- package/dist/enum/doc-type.enum.d.ts +8 -8
- package/dist/enum/doc-type.enum.js +12 -12
- package/dist/enum/doc-type.enum.js.map +1 -1
- package/dist/enum/document-status.enum.d.ts +6 -6
- package/dist/enum/document-status.enum.js +10 -10
- package/dist/enum/document-status.enum.js.map +1 -1
- package/dist/enum/index.d.ts +9 -9
- package/dist/enum/index.js +19 -19
- package/dist/enum/payment-method.enum.d.ts +3 -3
- package/dist/enum/payment-method.enum.js +7 -7
- package/dist/enum/payment-method.enum.js.map +1 -1
- package/dist/enum/payment-status.enum.d.ts +10 -10
- package/dist/enum/payment-status.enum.js +15 -16
- package/dist/enum/payment-status.enum.js.map +1 -1
- package/dist/enum/payment-type.enum.d.ts +4 -4
- package/dist/enum/payment-type.enum.js +8 -8
- package/dist/enum/payment-type.enum.js.map +1 -1
- package/dist/enum/quick-book-client-scopes.enum.d.ts +13 -13
- package/dist/enum/quick-book-client-scopes.enum.js +18 -18
- package/dist/enum/quick-book-client-scopes.enum.js.map +1 -1
- package/dist/enum/transaction-type.enum.d.ts +4 -4
- package/dist/enum/transaction-type.enum.js +8 -8
- package/dist/enum/transaction-type.enum.js.map +1 -1
- package/dist/finance-company/finance-company.d.ts +88 -88
- package/dist/finance-company/finance-company.js +1533 -1576
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/finance-company/finance-company.repository.d.ts +5 -5
- package/dist/finance-company/finance-company.repository.js +11 -11
- package/dist/helpers/login-user.d.ts +13 -13
- package/dist/helpers/login-user.js +28 -28
- package/dist/helpers/login-user.js.map +1 -1
- package/dist/helpers/typeof.d.ts +1 -1
- package/dist/helpers/typeof.js +28 -29
- package/dist/helpers/typeof.js.map +1 -1
- package/dist/index.d.ts +17 -17
- package/dist/index.js +32 -32
- package/dist/interfaces/account-system.interface.d.ts +30 -30
- package/dist/interfaces/account-system.interface.js +2 -2
- package/dist/interfaces/index.d.ts +2 -2
- package/dist/interfaces/index.js +2 -2
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts +12 -12
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.js +2 -2
- package/dist/journal-entry/journal-entry.d.ts +42 -42
- package/dist/journal-entry/journal-entry.js +216 -233
- package/dist/journal-entry/journal-entry.js.map +1 -1
- package/dist/journal-entry/journal-entry.repository.d.ts +6 -6
- package/dist/journal-entry/journal-entry.repository.js +16 -27
- package/dist/journal-entry/journal-entry.repository.js.map +1 -1
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +17 -17
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.js +2 -2
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts +5 -5
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.js +2 -2
- package/dist/ledger-transaction/ledger-transaction.d.ts +54 -54
- package/dist/ledger-transaction/ledger-transaction.js +143 -164
- package/dist/ledger-transaction/ledger-transaction.js.map +1 -1
- package/dist/ledger-transaction/ledger-transaction.repository.d.ts +6 -6
- package/dist/ledger-transaction/ledger-transaction.repository.js +16 -27
- package/dist/ledger-transaction/ledger-transaction.repository.js.map +1 -1
- package/dist/models/account.entity.d.ts +30 -30
- package/dist/models/account.entity.js +232 -232
- package/dist/models/account.entity.js.map +1 -1
- package/dist/models/customer.entity.d.ts +13 -13
- package/dist/models/customer.entity.js +109 -109
- package/dist/models/customer.entity.js.map +1 -1
- package/dist/models/document-item.entity.d.ts +31 -31
- package/dist/models/document-item.entity.js +200 -200
- package/dist/models/document-item.entity.js.map +1 -1
- package/dist/models/document.entity.d.ts +36 -36
- package/dist/models/document.entity.js +242 -242
- package/dist/models/document.entity.js.map +1 -1
- package/dist/models/finance-company.entity.d.ts +15 -15
- package/dist/models/finance-company.entity.js +93 -93
- package/dist/models/finance-company.entity.js.map +1 -1
- package/dist/models/journal-entry.entity.d.ts +16 -16
- package/dist/models/journal-entry.entity.js +127 -127
- package/dist/models/journal-entry.entity.js.map +1 -1
- package/dist/models/ledger-transaction.entity.d.ts +24 -24
- package/dist/models/ledger-transaction.entity.js +172 -172
- package/dist/models/ledger-transaction.entity.js.map +1 -1
- package/dist/models/payment-item.entity.d.ts +12 -12
- package/dist/models/payment-item.entity.js +75 -75
- package/dist/models/payment-item.entity.js.map +1 -1
- package/dist/models/payment-method-type.entity.d.ts +13 -13
- package/dist/models/payment-method-type.entity.js +85 -85
- package/dist/models/payment-method-type.entity.js.map +1 -1
- package/dist/models/payment-method.entity.d.ts +10 -10
- package/dist/models/payment-method.entity.js +62 -62
- package/dist/models/payment-method.entity.js.map +1 -1
- package/dist/models/payment-paid-with.entity.d.ts +24 -24
- package/dist/models/payment-paid-with.entity.js +158 -158
- package/dist/models/payment-paid-with.entity.js.map +1 -1
- package/dist/models/payment.entity.d.ts +29 -29
- package/dist/models/payment.entity.js +193 -193
- package/dist/models/payment.entity.js.map +1 -1
- package/dist/models/post-history.entity.d.ts +11 -11
- package/dist/models/post-history.entity.js +63 -63
- package/dist/models/post-history.entity.js.map +1 -1
- package/dist/models/tax.entity.d.ts +13 -13
- package/dist/models/tax.entity.js +89 -89
- package/dist/models/tax.entity.js.map +1 -1
- package/dist/payment/interfaces/payment-attr.interface.d.ts +22 -22
- package/dist/payment/interfaces/payment-attr.interface.js +6 -6
- package/dist/payment/interfaces/payment-params.interface.d.ts +7 -7
- package/dist/payment/interfaces/payment-params.interface.js +2 -2
- package/dist/payment/payment.d.ts +53 -53
- package/dist/payment/payment.js +186 -201
- package/dist/payment/payment.js.map +1 -1
- package/dist/payment/payment.repository.d.ts +5 -5
- package/dist/payment/payment.repository.js +11 -11
- package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts +10 -10
- package/dist/payment-item/interfaces/payment-item-attr.interface.js +6 -6
- package/dist/payment-item/payment-item.d.ts +25 -25
- package/dist/payment-item/payment-item.js +111 -122
- package/dist/payment-item/payment-item.js.map +1 -1
- package/dist/payment-item/payment-item.repository.d.ts +5 -5
- package/dist/payment-item/payment-item.repository.js +11 -11
- package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts +5 -5
- package/dist/payment-method/interfaces/payment-method-attr.interface.js +2 -2
- package/dist/payment-method/payment-method.d.ts +21 -21
- package/dist/payment-method/payment-method.js +104 -117
- package/dist/payment-method/payment-method.js.map +1 -1
- package/dist/payment-method/payment-method.repository.d.ts +5 -5
- package/dist/payment-method/payment-method.repository.js +11 -11
- package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts +8 -8
- package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.js +2 -2
- package/dist/payment-method-type/payment-method-type.d.ts +18 -18
- package/dist/payment-method-type/payment-method-type.js +65 -76
- package/dist/payment-method-type/payment-method-type.js.map +1 -1
- package/dist/payment-method-type/payment-method-type.repository.d.ts +5 -5
- package/dist/payment-method-type/payment-method-type.repository.js +11 -11
- package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts +19 -19
- package/dist/payment-paid-with/interfaces/payment-paid-with.interface.js +6 -6
- package/dist/payment-paid-with/payment-paid-with.d.ts +33 -33
- package/dist/payment-paid-with/payment-paid-with.js +56 -56
- package/dist/payment-paid-with/payment-paid-with.js.map +1 -1
- package/dist/payment-paid-with/payment-paid-with.repository.d.ts +5 -5
- package/dist/payment-paid-with/payment-paid-with.repository.js +11 -11
- package/dist/tax/interfaces/tax-attr.interface.d.ts +10 -10
- package/dist/tax/interfaces/tax-attr.interface.js +2 -2
- package/dist/tax/tax.d.ts +26 -26
- package/dist/tax/tax.js +51 -51
- package/dist/tax/tax.js.map +1 -1
- package/dist/tax/tax.repository.d.ts +5 -5
- package/dist/tax/tax.repository.js +11 -11
- package/dist/test-document.d.ts +3 -3
- package/dist/test-document.js +18 -18
- package/dist/test.d.ts +1 -1
- package/dist/test.js +6 -7
- package/dist/test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/eslint.config.mjs +58 -0
- package/invoice-template/assets/js/html2canvas.min.js +16 -16
- package/package.json +35 -41
- package/src/account/account.ts +2 -1
- package/src/customer/customer.ts +8 -7
- package/src/document/document-item.ts +3 -2
- package/src/document/document.ts +20 -13
- package/src/enum/collect-payment-type.ts +3 -3
- package/src/enum/payment-status.enum.ts +1 -1
- package/src/finance-company/finance-company.ts +5 -7
- package/src/journal-entry/journal-entry.ts +0 -1
- package/src/ledger-transaction/ledger-transaction.ts +4 -4
- package/src/payment-method-type/payment-method-type.ts +1 -1
- package/src/tax/tax.ts +0 -1
- package/tsconfig.json +4 -3
- package/.eslintrc.js +0 -72
- package/img.png +0 -0
- package/img_1.png +0 -0
- package/tslint.json +0 -18
package/.husky/commit-msg
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
. "$(dirname "$0")/_/husky.sh"
|
|
3
|
-
|
|
4
1
|
npx commitlint --edit $1
|
|
2
|
+
message="$(cat $1)"
|
|
3
|
+
echo "$message"
|
|
4
|
+
a=($(echo "$message" | tr ':' '\n'))
|
|
5
|
+
echo "${a[0]}"
|
|
6
|
+
if [ "${a[0]}" = "feat" ];
|
|
7
|
+
then
|
|
8
|
+
npm version --commit-hooks false --no-git-tag-version minor
|
|
9
|
+
else
|
|
10
|
+
npm version --commit-hooks false --no-git-tag-version patch
|
|
11
|
+
fi
|
|
12
|
+
git add .
|
|
13
|
+
git commit -m "$message" --no-verify
|
package/.husky/pre-commit
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
npm run lint
|
|
2
|
+
npm run format
|
|
3
|
+
npm run build
|
|
4
|
+
git add .
|
package/configs/config.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
|
|
2
|
-
import AccountModel from '../models/account.entity';
|
|
3
|
-
import { AccountRepository } from './account.repository';
|
|
4
|
-
export default class Account extends AccountSystemEntity {
|
|
5
|
-
AccountNo: string;
|
|
6
|
-
ParentAccountNo?: string;
|
|
7
|
-
Name: string;
|
|
8
|
-
Description: string;
|
|
9
|
-
AccountType: string;
|
|
10
|
-
AccountSubtype: string;
|
|
11
|
-
OwnerId: string;
|
|
12
|
-
OwnerType: string;
|
|
13
|
-
RelatedObjectId: string;
|
|
14
|
-
RelatedObjectType: string;
|
|
15
|
-
CreatedById: string;
|
|
16
|
-
CreatedAt: Date;
|
|
17
|
-
UpdatedById: string;
|
|
18
|
-
UpdatedAt: Date;
|
|
19
|
-
protected _ObjectType: string;
|
|
20
|
-
private static _RepositoryBase;
|
|
21
|
-
private _DbTransaction;
|
|
22
|
-
private _IsNewRecord;
|
|
23
|
-
private get IsNewRecord();
|
|
24
|
-
private set IsNewRecord(value);
|
|
25
|
-
get ObjectType(): string;
|
|
26
|
-
get RepositoryBase(): AccountRepository;
|
|
27
|
-
get ObjectId(): string;
|
|
28
|
-
get ObjectName(): string;
|
|
29
|
-
get TableName(): string;
|
|
30
|
-
constructor(dbTransaction?: any, accountNo?: string);
|
|
31
|
-
init(accountData: any): void;
|
|
32
|
-
static initAccount(dbTransaction: any, accountNo: string): Promise<Account>;
|
|
33
|
-
static initialize(): void;
|
|
34
|
-
validateAccountValue(): void;
|
|
35
|
-
isParentAccountExists(): boolean;
|
|
36
|
-
save(CompanyId: string, AccSystemRefId: string, userId: string, dbTransaction?: any): Promise<AccountModel>;
|
|
37
|
-
}
|
|
1
|
+
import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
|
|
2
|
+
import AccountModel from '../models/account.entity';
|
|
3
|
+
import { AccountRepository } from './account.repository';
|
|
4
|
+
export default class Account extends AccountSystemEntity {
|
|
5
|
+
AccountNo: string;
|
|
6
|
+
ParentAccountNo?: string;
|
|
7
|
+
Name: string;
|
|
8
|
+
Description: string;
|
|
9
|
+
AccountType: string;
|
|
10
|
+
AccountSubtype: string;
|
|
11
|
+
OwnerId: string;
|
|
12
|
+
OwnerType: string;
|
|
13
|
+
RelatedObjectId: string;
|
|
14
|
+
RelatedObjectType: string;
|
|
15
|
+
CreatedById: string;
|
|
16
|
+
CreatedAt: Date;
|
|
17
|
+
UpdatedById: string;
|
|
18
|
+
UpdatedAt: Date;
|
|
19
|
+
protected _ObjectType: string;
|
|
20
|
+
private static _RepositoryBase;
|
|
21
|
+
private _DbTransaction;
|
|
22
|
+
private _IsNewRecord;
|
|
23
|
+
private get IsNewRecord();
|
|
24
|
+
private set IsNewRecord(value);
|
|
25
|
+
get ObjectType(): string;
|
|
26
|
+
get RepositoryBase(): AccountRepository;
|
|
27
|
+
get ObjectId(): string;
|
|
28
|
+
get ObjectName(): string;
|
|
29
|
+
get TableName(): string;
|
|
30
|
+
constructor(dbTransaction?: any, accountNo?: string);
|
|
31
|
+
init(accountData: any): void;
|
|
32
|
+
static initAccount(dbTransaction: any, accountNo: string): Promise<Account>;
|
|
33
|
+
static initialize(): void;
|
|
34
|
+
validateAccountValue(): void;
|
|
35
|
+
isParentAccountExists(): boolean;
|
|
36
|
+
save(CompanyId: string, AccSystemRefId: string, userId: string, dbTransaction?: any): Promise<AccountModel>;
|
|
37
|
+
}
|
package/dist/account/account.js
CHANGED
|
@@ -1,264 +1,252 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
get
|
|
17
|
-
return
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
-
}
|
|
22
|
-
get
|
|
23
|
-
return this.
|
|
24
|
-
}
|
|
25
|
-
get
|
|
26
|
-
return
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this.
|
|
40
|
-
this.
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.
|
|
66
|
-
this.
|
|
67
|
-
this.
|
|
68
|
-
this.
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
71
|
-
this.
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
this.
|
|
97
|
-
this.
|
|
98
|
-
this.
|
|
99
|
-
this.
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
103
|
-
this.
|
|
104
|
-
this.
|
|
105
|
-
this.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
this.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
this.
|
|
207
|
-
this.
|
|
208
|
-
this.
|
|
209
|
-
this.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}, {
|
|
253
|
-
transaction: dbTransaction,
|
|
254
|
-
});
|
|
255
|
-
console.log(data, '<><><><><><><> DATA THAT GETS CREATED <><><><><><><>');
|
|
256
|
-
}
|
|
257
|
-
console.log(data, 'Account Save: Account details returned');
|
|
258
|
-
return data;
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
exports.default = Account;
|
|
263
|
-
Account._RepositoryBase = new account_repository_1.AccountRepository();
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const record_not_found_error_1 = require("@tomei/general/dist/class/exceptions/record-not-found.error");
|
|
4
|
+
const account_system_entity_1 = require("../account-system-entity/account-system-entity");
|
|
5
|
+
const account_repository_1 = require("./account.repository");
|
|
6
|
+
class Account extends account_system_entity_1.AccountSystemEntity {
|
|
7
|
+
get IsNewRecord() {
|
|
8
|
+
return this._IsNewRecord;
|
|
9
|
+
}
|
|
10
|
+
set IsNewRecord(record) {
|
|
11
|
+
this._IsNewRecord = record;
|
|
12
|
+
}
|
|
13
|
+
get ObjectType() {
|
|
14
|
+
return this._ObjectType;
|
|
15
|
+
}
|
|
16
|
+
get RepositoryBase() {
|
|
17
|
+
return Account._RepositoryBase;
|
|
18
|
+
}
|
|
19
|
+
get ObjectId() {
|
|
20
|
+
return this.AccountNo;
|
|
21
|
+
}
|
|
22
|
+
get ObjectName() {
|
|
23
|
+
return this.Name;
|
|
24
|
+
}
|
|
25
|
+
get TableName() {
|
|
26
|
+
return 'finance_Account';
|
|
27
|
+
}
|
|
28
|
+
constructor(dbTransaction, accountNo) {
|
|
29
|
+
super();
|
|
30
|
+
this.AccountNo = 'New';
|
|
31
|
+
this.ParentAccountNo = '';
|
|
32
|
+
this.Name = '';
|
|
33
|
+
this.Description = '';
|
|
34
|
+
this.AccountType = '';
|
|
35
|
+
this.AccountSubtype = '';
|
|
36
|
+
this.OwnerId = '';
|
|
37
|
+
this.OwnerType = '';
|
|
38
|
+
this.RelatedObjectId = '';
|
|
39
|
+
this.RelatedObjectType = '';
|
|
40
|
+
this.CreatedById = '';
|
|
41
|
+
this.UpdatedById = '';
|
|
42
|
+
this._ObjectType = 'Account';
|
|
43
|
+
this._IsNewRecord = true;
|
|
44
|
+
if (dbTransaction) {
|
|
45
|
+
this._DbTransaction = dbTransaction;
|
|
46
|
+
}
|
|
47
|
+
if (accountNo) {
|
|
48
|
+
this.RepositoryBase.findOne({
|
|
49
|
+
where: {
|
|
50
|
+
AccountNo: accountNo,
|
|
51
|
+
},
|
|
52
|
+
transaction: dbTransaction,
|
|
53
|
+
})
|
|
54
|
+
.then((accountData) => {
|
|
55
|
+
if (accountData) {
|
|
56
|
+
this.IsNewRecord = false;
|
|
57
|
+
this.CompanyId = accountData.CompanyId;
|
|
58
|
+
this.ParentAccountNo = accountData.ParentAccountNo;
|
|
59
|
+
this.Name = accountData.Name;
|
|
60
|
+
this.Description = accountData.Description;
|
|
61
|
+
this.AccountType = accountData.AccountType;
|
|
62
|
+
this.AccountSubtype = accountData.AccountSubType;
|
|
63
|
+
this.OwnerId = accountData.OwnerId;
|
|
64
|
+
this.OwnerType = accountData.OwnerType;
|
|
65
|
+
this.RelatedObjectId = accountData.RelatedObjectId;
|
|
66
|
+
this.RelatedObjectType = accountData.RelatedObjectType;
|
|
67
|
+
this.CreatedById = accountData.CreatedById;
|
|
68
|
+
this.CreatedAt = accountData.CreatedAt;
|
|
69
|
+
this.UpdatedById = accountData.UpdatedById;
|
|
70
|
+
this.UpdatedAt = accountData.UpdatedAt;
|
|
71
|
+
this.AccSystemRefId = accountData.AccSystemRefId;
|
|
72
|
+
this.PostedToAccSystemYN = accountData.PostedToAccSystemYN;
|
|
73
|
+
this.PostedById = accountData.PostedById;
|
|
74
|
+
this.PostedDateTime = accountData.PostedDateTime;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
const notFoundError = new record_not_found_error_1.RecordNotFoundError('AccountErrMsg', 'No Record Found.');
|
|
78
|
+
throw notFoundError;
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
.catch((err) => {
|
|
82
|
+
console.log('Account Class constructor err: ', err);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
init(accountData) {
|
|
87
|
+
this.IsNewRecord = false;
|
|
88
|
+
this.CompanyId = accountData.CompanyId;
|
|
89
|
+
this.ParentAccountNo = accountData.ParentAccountNo;
|
|
90
|
+
this.Name = accountData.Name;
|
|
91
|
+
this.Description = accountData.Description;
|
|
92
|
+
this.AccountType = accountData.AccountType;
|
|
93
|
+
this.AccountSubtype = accountData.AccountSubType;
|
|
94
|
+
this.OwnerId = accountData.OwnerId;
|
|
95
|
+
this.OwnerType = accountData.OwnerType;
|
|
96
|
+
this.RelatedObjectId = accountData.RelatedObjectId;
|
|
97
|
+
this.RelatedObjectType = accountData.RelatedObjectType;
|
|
98
|
+
this.CreatedById = accountData.CreatedById;
|
|
99
|
+
this.CreatedAt = accountData.CreatedAt;
|
|
100
|
+
this.UpdatedById = accountData.UpdatedById;
|
|
101
|
+
this.UpdatedAt = accountData.UpdatedAt;
|
|
102
|
+
this.AccSystemRefId = accountData.AccSystemRefId;
|
|
103
|
+
this.PostedToAccSystemYN = accountData.PostedToAccSystemYN;
|
|
104
|
+
this.PostedById = accountData.PostedById;
|
|
105
|
+
this.PostedDateTime = accountData.PostedDateTime;
|
|
106
|
+
}
|
|
107
|
+
static async initAccount(dbTransaction, accountNo) {
|
|
108
|
+
try {
|
|
109
|
+
const accountData = await Account._RepositoryBase.findOne({
|
|
110
|
+
where: {
|
|
111
|
+
AccountNo: accountNo,
|
|
112
|
+
},
|
|
113
|
+
transaction: dbTransaction,
|
|
114
|
+
});
|
|
115
|
+
if (accountData) {
|
|
116
|
+
const account = new Account(dbTransaction);
|
|
117
|
+
account.init(accountData.get({ plain: true }));
|
|
118
|
+
return account;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
const notFoundError = new record_not_found_error_1.RecordNotFoundError('AccountErrMsg', 'No Record Found.');
|
|
122
|
+
throw notFoundError;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.log('Account Class constructor err: ', error);
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
static initialize() {
|
|
131
|
+
const dbTransaction = null;
|
|
132
|
+
let defaultAccountReceivable;
|
|
133
|
+
let defaultAccountPayable;
|
|
134
|
+
try {
|
|
135
|
+
defaultAccountReceivable = new Account(dbTransaction, 'EZC-AR');
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
defaultAccountReceivable = new Account(dbTransaction);
|
|
139
|
+
defaultAccountReceivable.AccountNo = null;
|
|
140
|
+
defaultAccountReceivable.AccountType = 'Account Receivable';
|
|
141
|
+
defaultAccountReceivable.OwnerId = 'System';
|
|
142
|
+
defaultAccountReceivable.OwnerType = '';
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
defaultAccountPayable = new Account(dbTransaction, 'EZC-AP');
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
defaultAccountPayable = new Account(dbTransaction);
|
|
149
|
+
defaultAccountPayable.AccountNo = null;
|
|
150
|
+
defaultAccountPayable.AccountType = 'Account Payable';
|
|
151
|
+
defaultAccountPayable.OwnerId = 'System';
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
validateAccountValue() {
|
|
155
|
+
if (!this.AccSystemRefId) {
|
|
156
|
+
throw new Error('AccSystemAccountId is required.');
|
|
157
|
+
}
|
|
158
|
+
if (!this.AccountType) {
|
|
159
|
+
throw new Error('AccountType is required.');
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
isParentAccountExists() {
|
|
163
|
+
if (this.ParentAccountNo)
|
|
164
|
+
return true;
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
async save(CompanyId, AccSystemRefId, userId, dbTransaction) {
|
|
168
|
+
this.AccSystemRefId = AccSystemRefId;
|
|
169
|
+
console.log('Account Save: Before AccountNo FindOne');
|
|
170
|
+
let data = await this.RepositoryBase.findOne({
|
|
171
|
+
where: {
|
|
172
|
+
AccountNo: this.AccountNo,
|
|
173
|
+
},
|
|
174
|
+
transaction: dbTransaction,
|
|
175
|
+
});
|
|
176
|
+
console.log('Account Save: After AccountNo FindOne');
|
|
177
|
+
console.log(data, '<><><><><> Account Data Result <><><><><><>');
|
|
178
|
+
if (data) {
|
|
179
|
+
console.log('Account Save: THERE IS DATA FOUND');
|
|
180
|
+
const oldAccountNo = data.AccountNo;
|
|
181
|
+
this.AccountNo = this.AccountNo || data.AccountNo;
|
|
182
|
+
this.AccSystemRefId = this.AccSystemRefId || data.AccSystemRefId;
|
|
183
|
+
this.Name = this.Name || data.Name;
|
|
184
|
+
this.Description = this.Description || data.Description;
|
|
185
|
+
this.AccountType = this.AccountType || data.AccountType;
|
|
186
|
+
this.AccountSubtype = this.AccountSubtype || data.AccountSubType;
|
|
187
|
+
this.CompanyId = this.CompanyId || data.CompanyId;
|
|
188
|
+
this.OwnerId = this.OwnerId || data.OwnerId;
|
|
189
|
+
this.OwnerType = this.OwnerType || data.OwnerType;
|
|
190
|
+
this.RelatedObjectId = this.RelatedObjectId || data.RelatedObjectId;
|
|
191
|
+
this.RelatedObjectType = this.RelatedObjectType || data.RelatedObjectType;
|
|
192
|
+
this.PostedToAccSystemYN =
|
|
193
|
+
this.PostedToAccSystemYN || data.PostedToAccSystemYN;
|
|
194
|
+
this.ParentAccountNo = this.ParentAccountNo || data.ParentAccountNo;
|
|
195
|
+
this.CreatedAt = data.CreatedAt;
|
|
196
|
+
this.CreatedById = data.CreatedById;
|
|
197
|
+
this.UpdatedAt = new Date();
|
|
198
|
+
this.UpdatedById = userId;
|
|
199
|
+
await this.RepositoryBase.update({
|
|
200
|
+
AccountNo: this.AccountNo,
|
|
201
|
+
AccSystemRefId: this.AccSystemRefId,
|
|
202
|
+
Name: this.Name,
|
|
203
|
+
Description: this.Description,
|
|
204
|
+
AccountType: this.AccountType,
|
|
205
|
+
AccountSubtype: this.AccountSubtype,
|
|
206
|
+
CompanyId: this.CompanyId,
|
|
207
|
+
OwnerId: this.OwnerId,
|
|
208
|
+
OwnerType: this.OwnerType,
|
|
209
|
+
RelatedObjectId: this.RelatedObjectId,
|
|
210
|
+
RelatedObjectType: this.RelatedObjectType,
|
|
211
|
+
PostedToAccSystemYN: this.PostedToAccSystemYN,
|
|
212
|
+
ParentAccountNo: this.ParentAccountNo,
|
|
213
|
+
UpdatedAt: this.UpdatedAt,
|
|
214
|
+
UpdatedById: this.UpdatedById,
|
|
215
|
+
}, {
|
|
216
|
+
where: {
|
|
217
|
+
AccountNo: oldAccountNo,
|
|
218
|
+
},
|
|
219
|
+
transaction: dbTransaction,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
console.log('Account Save: THERE IS NO DATA FOUND');
|
|
224
|
+
data = await this.RepositoryBase.create({
|
|
225
|
+
AccountNo: this.AccountNo,
|
|
226
|
+
AccSystemRefId: this.AccSystemRefId,
|
|
227
|
+
Name: this.Name,
|
|
228
|
+
Description: this.Description,
|
|
229
|
+
AccountType: this.AccountType,
|
|
230
|
+
AccountSubtype: this.AccountSubtype,
|
|
231
|
+
CompanyId: CompanyId,
|
|
232
|
+
OwnerId: this.OwnerId,
|
|
233
|
+
OwnerType: this.OwnerType,
|
|
234
|
+
RelatedObjectId: this.RelatedObjectId,
|
|
235
|
+
RelatedObjectType: this.RelatedObjectType,
|
|
236
|
+
PostedToAccSystemYN: this.PostedToAccSystemYN,
|
|
237
|
+
ParentAccountNo: this.ParentAccountNo,
|
|
238
|
+
CreatedAt: new Date(),
|
|
239
|
+
UpdatedAt: new Date(),
|
|
240
|
+
CreatedById: userId,
|
|
241
|
+
}, {
|
|
242
|
+
transaction: dbTransaction,
|
|
243
|
+
});
|
|
244
|
+
console.log(data, '<><><><><><><> DATA THAT GETS CREATED <><><><><><><>');
|
|
245
|
+
}
|
|
246
|
+
console.log(data, 'Account Save: Account details returned');
|
|
247
|
+
return data;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
Account._RepositoryBase = new account_repository_1.AccountRepository();
|
|
251
|
+
exports.default = Account;
|
|
264
252
|
//# sourceMappingURL=account.js.map
|