@tomei/finance 0.6.59 → 0.6.60
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/dist/customer/customer.js +1 -2
- package/dist/customer/customer.js.map +1 -1
- package/dist/finance-company/finance-company.js +8 -9
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/ledger-transaction/ledger-transaction.d.ts +8 -4
- package/dist/ledger-transaction/ledger-transaction.js +11 -6
- package/dist/ledger-transaction/ledger-transaction.js.map +1 -1
- package/dist/payment/payment.js.map +1 -1
- package/dist/tax/tax.d.ts +8 -5
- package/dist/tax/tax.js +11 -9
- package/dist/tax/tax.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/customer/customer.ts +1 -2
- package/src/finance-company/finance-company.ts +9 -10
- package/src/journal-entry/journal-entry.ts +1 -1
- package/src/ledger-transaction/ledger-transaction.ts +17 -9
- package/src/payment/payment.ts +3 -3
- package/src/tax/tax.ts +16 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomei/finance",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.60",
|
|
4
4
|
"description": "NestJS package for finance module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"@nestjs/platform-express": ">=9.0.8",
|
|
36
36
|
"@nestjs/sequelize": ">=9.0.0",
|
|
37
37
|
"@nestjs/swagger": ">=6.1.4",
|
|
38
|
-
"@tomei/activity-history": "^0.2.
|
|
38
|
+
"@tomei/activity-history": "^0.2.11",
|
|
39
39
|
"@tomei/config": "^0.3.6",
|
|
40
|
-
"@tomei/general": "^0.6
|
|
41
|
-
"@tomei/media": "
|
|
42
|
-
"@tomei/sso": "^0.
|
|
40
|
+
"@tomei/general": "^0.10.6",
|
|
41
|
+
"@tomei/media": "^0.6.19",
|
|
42
|
+
"@tomei/sso": "^0.16.1",
|
|
43
43
|
"axios": "^1.6.0",
|
|
44
44
|
"class-transformer": "^0.5.1",
|
|
45
45
|
"class-validator": "^0.14.0",
|
package/src/customer/customer.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { RecordNotFoundError } from '@tomei/general/dist/class/exceptions/record
|
|
|
8
8
|
import FinanceCustomerModel from '../models/customer.entity';
|
|
9
9
|
import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
|
|
10
10
|
import { FinanceCustomerRepository } from './finance-customer.repository';
|
|
11
|
-
import * as cuid from 'cuid';
|
|
12
11
|
import Account from '../account/account';
|
|
13
12
|
import { AccountRepository } from '../account/account.repository';
|
|
14
13
|
import { type } from '../helpers/typeof';
|
|
@@ -227,7 +226,7 @@ export default abstract class FinanceCustomerBase
|
|
|
227
226
|
const data = await FinanceCustomerBase._FinanceCustomerRepository.create(
|
|
228
227
|
{
|
|
229
228
|
CompanyId: this.CompanyId,
|
|
230
|
-
CustomerId:
|
|
229
|
+
CustomerId: this.createId(),
|
|
231
230
|
CustSystemCode: this.CustSystemCode,
|
|
232
231
|
CustSystemRefId: this.CustSystemRefId,
|
|
233
232
|
AccSystemRefId: this.AccSystemRefId,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import * as cuid from 'cuid';
|
|
3
2
|
import {
|
|
4
3
|
ClassError,
|
|
5
4
|
HashTable,
|
|
@@ -325,7 +324,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
325
324
|
);
|
|
326
325
|
|
|
327
326
|
const activity = new Activity();
|
|
328
|
-
activity.ActivityId =
|
|
327
|
+
activity.ActivityId = this.createId();
|
|
329
328
|
activity.Action = ActionEnum.ADD;
|
|
330
329
|
activity.Description = 'Add Finance Customer';
|
|
331
330
|
activity.EntityType = 'FinanceCustomer';
|
|
@@ -612,7 +611,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
612
611
|
for (const documentItem of documentItems) {
|
|
613
612
|
await FinanceCompany._DocumentItemRepository.create(
|
|
614
613
|
{
|
|
615
|
-
DocumentItemId:
|
|
614
|
+
DocumentItemId: this.createId(),
|
|
616
615
|
DocNo: invoice.DocNo,
|
|
617
616
|
Name: documentItem.Name,
|
|
618
617
|
NameBM: documentItem.NameBM,
|
|
@@ -783,7 +782,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
783
782
|
|
|
784
783
|
/*Set up the document type*/
|
|
785
784
|
invoice.DocType = DocType.DEBIT_NOTE;
|
|
786
|
-
// invoice.DocNo =
|
|
785
|
+
// invoice.DocNo = this.createId();
|
|
787
786
|
|
|
788
787
|
/*Saving the document and document items to the database*/
|
|
789
788
|
await FinanceCompany._DocumentRepository.create(
|
|
@@ -822,7 +821,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
822
821
|
documentItems.forEach(async (documentItem) => {
|
|
823
822
|
await FinanceCompany._DocumentItemRepository.create(
|
|
824
823
|
{
|
|
825
|
-
DocumentItemId:
|
|
824
|
+
DocumentItemId: this.createId(),
|
|
826
825
|
DocNo: documentItem.DocNo,
|
|
827
826
|
Name: documentItem.Name,
|
|
828
827
|
NameBM: documentItem.NameBM,
|
|
@@ -1039,7 +1038,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
1039
1038
|
for (const docItem of documentItems) {
|
|
1040
1039
|
await FinanceCompany._DocumentItemRepository.create(
|
|
1041
1040
|
{
|
|
1042
|
-
DocumentItemId:
|
|
1041
|
+
DocumentItemId: this.createId(),
|
|
1043
1042
|
DocNo: docItem.DocNo,
|
|
1044
1043
|
Name: docItem.Name,
|
|
1045
1044
|
NameBM: docItem.NameBM,
|
|
@@ -1204,7 +1203,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
1204
1203
|
}
|
|
1205
1204
|
|
|
1206
1205
|
/*Saving payment, payment items, and payment paid with details to the database*/
|
|
1207
|
-
payment.PaymentId =
|
|
1206
|
+
payment.PaymentId = this.createId();
|
|
1208
1207
|
payment.PaymentType = PaymentType.PAYMENT_RECEIVED;
|
|
1209
1208
|
payment.ReceivedBy = loginUser.ObjectId;
|
|
1210
1209
|
payment.IssuedBy = loginUser.ObjectId;
|
|
@@ -1329,7 +1328,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
1329
1328
|
);
|
|
1330
1329
|
}
|
|
1331
1330
|
|
|
1332
|
-
payment.PaymentId =
|
|
1331
|
+
payment.PaymentId = this.createId();
|
|
1333
1332
|
payment.PaymentType = PaymentType.PAYOUT;
|
|
1334
1333
|
payment.ReceivedBy = loginUser.ObjectId;
|
|
1335
1334
|
payment.IssuedBy = loginUser.ObjectId;
|
|
@@ -1798,7 +1797,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
1798
1797
|
//Part 4: Saving Payment, Payment Items and Payment Paid with Details to the Database
|
|
1799
1798
|
|
|
1800
1799
|
//Set below Payment attributes:
|
|
1801
|
-
payment.PaymentId =
|
|
1800
|
+
payment.PaymentId = this.createId();
|
|
1802
1801
|
payment.PaymentType = PaymentType.PAYMENT_RECEIVED;
|
|
1803
1802
|
payment.ReceivedBy = loginUser.ObjectId;
|
|
1804
1803
|
payment.IssuedBy = loginUser.ObjectId;
|
|
@@ -2078,7 +2077,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
2078
2077
|
for (const receiptItem of receiptItems) {
|
|
2079
2078
|
await FinanceCompany._DocumentItemRepository.create(
|
|
2080
2079
|
{
|
|
2081
|
-
DocumentItemId:
|
|
2080
|
+
DocumentItemId: this.createId(),
|
|
2082
2081
|
DocNo: receipt.DocNo,
|
|
2083
2082
|
Name: receiptItem.Name,
|
|
2084
2083
|
NameBM: receiptItem.NameBM,
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import { ILedgerTransactionAttr } from './interfaces/ledger-transaction-attr.interface';
|
|
3
3
|
import { TransactionTypeOptions } from '../enum/transaction-type.enum';
|
|
4
4
|
import { LedgerTransactionRepository } from './ledger-transaction.repository';
|
|
5
5
|
import LedgerTransactionModel from '../models/ledger-transaction.entity';
|
|
6
|
+
import { ObjectBase } from '@tomei/general';
|
|
6
7
|
|
|
7
|
-
export default class LedgerTransaction {
|
|
8
|
-
|
|
8
|
+
export default class LedgerTransaction extends ObjectBase {
|
|
9
|
+
ObjectName: string;
|
|
10
|
+
TableName: string;
|
|
11
|
+
ObjectType = 'LedgerTransaction';
|
|
12
|
+
ObjectId = 'New';
|
|
9
13
|
TransactionType = TransactionTypeOptions.DEBIT;
|
|
10
14
|
JournalEntryId = '';
|
|
11
15
|
AccountNo = '';
|
|
@@ -19,22 +23,26 @@ export default class LedgerTransaction {
|
|
|
19
23
|
RelatedObjectType = '';
|
|
20
24
|
RelatedDocNo = '';
|
|
21
25
|
RelatedPaymentId = '';
|
|
22
|
-
|
|
26
|
+
|
|
27
|
+
get LedgerNo() {
|
|
28
|
+
return this.ObjectId;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
set LedgerNo(id: string) {
|
|
32
|
+
this.ObjectId = id;
|
|
33
|
+
}
|
|
23
34
|
|
|
24
35
|
private _DbTransaction: any;
|
|
25
36
|
|
|
26
37
|
private static _LedgerTransactionRepository =
|
|
27
38
|
new LedgerTransactionRepository();
|
|
28
39
|
|
|
29
|
-
get ObjectType() {
|
|
30
|
-
return this._ObjectType;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
40
|
constructor(
|
|
34
41
|
transactionType: TransactionTypeOptions,
|
|
35
42
|
dbTransaction?: any,
|
|
36
43
|
LedgerNo?: string,
|
|
37
44
|
) {
|
|
45
|
+
super();
|
|
38
46
|
this.TransactionType = transactionType;
|
|
39
47
|
if (dbTransaction) {
|
|
40
48
|
this._DbTransaction = dbTransaction;
|
|
@@ -143,7 +151,7 @@ export default class LedgerTransaction {
|
|
|
143
151
|
journalEntryId?: string,
|
|
144
152
|
): Promise<any> {
|
|
145
153
|
this.init({
|
|
146
|
-
LedgerNo:
|
|
154
|
+
LedgerNo: this.createId(),
|
|
147
155
|
TransactionType: transactionType,
|
|
148
156
|
JournalEntryId: journalEntryId,
|
|
149
157
|
// Name: journalEntry.Name,
|
package/src/payment/payment.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ObjectBase } from '@tomei/general';
|
|
2
2
|
import { RecordNotFoundError } from '@tomei/general/dist/class/exceptions/record-not-found.error';
|
|
3
|
-
import { PaymentType
|
|
3
|
+
import { PaymentType } from '../enum';
|
|
4
4
|
import { IPaymentParams } from './interfaces/payment-params.interface';
|
|
5
5
|
import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
|
|
6
6
|
import { PaymentStatus } from '../enum/payment-status.enum';
|
|
@@ -145,7 +145,7 @@ export default class Payment extends AccountSystemEntity {
|
|
|
145
145
|
ObjectName: this.ObjectName,
|
|
146
146
|
TableName: this.TableName,
|
|
147
147
|
ObjectType: this.ObjectType,
|
|
148
|
-
},
|
|
148
|
+
} as ObjectBase,
|
|
149
149
|
);
|
|
150
150
|
pi.PayForObjectType = paymentItem.PayForObjectType;
|
|
151
151
|
pi.PayForObjectId = paymentItem.PayForObjectId;
|
package/src/tax/tax.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { ObjectBase } from '@tomei/general';
|
|
1
2
|
import { ITaxAttr } from './interfaces/tax-attr.interface';
|
|
2
3
|
|
|
3
|
-
export class Tax {
|
|
4
|
-
|
|
4
|
+
export class Tax extends ObjectBase {
|
|
5
|
+
ObjectName: string;
|
|
6
|
+
TableName: string;
|
|
7
|
+
ObjectId = 'New';
|
|
5
8
|
private _Description: string;
|
|
6
9
|
private _CompanyId: string;
|
|
7
10
|
private _TaxRate = 0;
|
|
@@ -9,14 +12,21 @@ export class Tax {
|
|
|
9
12
|
private _CreatedAt: Date;
|
|
10
13
|
private _UpdatedById: string;
|
|
11
14
|
private _UpdatedAt: Date;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
ObjectType = 'Tax';
|
|
16
|
+
|
|
17
|
+
get TaxCode(): string {
|
|
18
|
+
return this.ObjectId;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
set TaxCode(code: string) {
|
|
22
|
+
this.ObjectId = code;
|
|
15
23
|
}
|
|
16
24
|
|
|
25
|
+
|
|
17
26
|
constructor(taxAttr?: ITaxAttr) {
|
|
27
|
+
super();
|
|
18
28
|
if (taxAttr) {
|
|
19
|
-
this.
|
|
29
|
+
this.TaxCode = taxAttr.TaxCode;
|
|
20
30
|
this._Description = taxAttr.Description;
|
|
21
31
|
this._CompanyId = taxAttr.CompanyId;
|
|
22
32
|
this._TaxRate = taxAttr.TaxRate;
|
|
@@ -27,10 +37,6 @@ export class Tax {
|
|
|
27
37
|
}
|
|
28
38
|
}
|
|
29
39
|
|
|
30
|
-
get TaxCode(): string {
|
|
31
|
-
return this._TaxCode;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
40
|
get Description(): string {
|
|
35
41
|
return this._Description;
|
|
36
42
|
}
|