@tomei/finance 0.2.13 → 0.2.14

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.
Files changed (53) hide show
  1. package/dist/account/account.js.map +1 -1
  2. package/dist/account-system-entity/account-system-entity.js +1 -1
  3. package/dist/account-system-entity/account-system-entity.js.map +1 -1
  4. package/dist/customer/entities/customer.entity.d.ts +1 -1
  5. package/dist/customer/entities/customer.entity.js +4 -4
  6. package/dist/customer/entities/customer.entity.js.map +1 -1
  7. package/dist/document/document-item.d.ts +4 -1
  8. package/dist/document/document-item.js.map +1 -1
  9. package/dist/document/entities/document-item.entity.d.ts +3 -0
  10. package/dist/document/entities/document-item.entity.js +22 -1
  11. package/dist/document/entities/document-item.entity.js.map +1 -1
  12. package/dist/document/interfaces/document-item-attr.interface.d.ts +4 -1
  13. package/dist/document/interfaces/document-item-attr.interface.js.map +1 -1
  14. package/dist/finance-company/finance-company.d.ts +7 -6
  15. package/dist/finance-company/finance-company.entity.d.ts +13 -0
  16. package/dist/finance-company/finance-company.entity.js +66 -0
  17. package/dist/finance-company/finance-company.entity.js.map +1 -0
  18. package/dist/finance-company/finance-company.js +43 -22
  19. package/dist/finance-company/finance-company.js.map +1 -1
  20. package/dist/finance-company/finance-company.repository.d.ts +4 -9
  21. package/dist/finance-company/finance-company.repository.js +5 -30
  22. package/dist/finance-company/finance-company.repository.js.map +1 -1
  23. package/dist/finance-company/index.d.ts +2 -5
  24. package/dist/finance-company/index.js +2 -4
  25. package/dist/finance-company/index.js.map +1 -1
  26. package/dist/journal-entry/entities/journal-entry.entity.d.ts +5 -1
  27. package/dist/journal-entry/entities/journal-entry.entity.js +37 -6
  28. package/dist/journal-entry/entities/journal-entry.entity.js.map +1 -1
  29. package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts +4 -2
  30. package/dist/journal-entry/journal-entry.d.ts +16 -9
  31. package/dist/journal-entry/journal-entry.js +34 -7
  32. package/dist/journal-entry/journal-entry.js.map +1 -1
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/migrations/finance-company-migration.js +1 -3
  35. package/migrations/finance-document-item-migration.js +18 -6
  36. package/migrations/finance-journal-entry-migration.js +17 -3
  37. package/package.json +1 -1
  38. package/src/account/account.ts +0 -3
  39. package/src/account-system-entity/account-system-entity.ts +1 -1
  40. package/src/customer/entities/customer.entity.ts +1 -1
  41. package/src/document/document-item.ts +4 -1
  42. package/src/document/entities/document-item.entity.ts +19 -1
  43. package/src/document/interfaces/document-item-attr.interface.ts +4 -1
  44. package/src/finance-company/finance-company.entity.ts +41 -0
  45. package/src/finance-company/finance-company.repository.ts +5 -23
  46. package/src/finance-company/finance-company.ts +58 -34
  47. package/src/finance-company/index.ts +2 -11
  48. package/src/journal-entry/entities/journal-entry.entity.ts +43 -7
  49. package/src/journal-entry/interfaces/journal-entry-attr.interface.ts +4 -2
  50. package/src/journal-entry/journal-entry.ts +51 -17
  51. package/src/finance-company/entities/finance-company.entity.ts +0 -88
  52. package/src/finance-company/interfaces/finance-company-attr.interface.ts +0 -10
  53. package/src/finance-company/interfaces/finance-company.repository.interface.ts +0 -4
@@ -1,36 +1,68 @@
1
+ import * as cuid from 'cuid';
2
+ import { Op } from 'sequelize';
1
3
  import { LedgerTransactionRepository } from '../ledger-transaction/ledger-transaction.repository';
2
4
  import { LedgerTransaction } from '../ledger-transaction';
3
5
  import { ILedgerTransactionTypeOptionsAttr } from '../ledger-transaction/interfaces/ledger-transaction-attr.interface';
4
6
  import { JournalEntryRepository } from './journal-entry.repository';
5
7
  import { IJournalEntryAttr } from './interfaces/journal-entry-attr.interface';
6
8
  import { TransactionTypeOptions } from '../enum';
7
- import { Op } from 'sequelize';
8
9
  import { JournalEntryModel } from './entities/journal-entry.entity';
9
10
  import { AccountSystemEntity } from '../account-system-entity';
11
+ import { IBaseRepository } from '@tomei/general';
10
12
 
11
13
  export class JournalEntry extends AccountSystemEntity {
12
- TableName: string;
13
- protected BaseRepository;
14
- ObjectId: string;
15
- ObjectName: string;
16
- JournalEntryId: string;
14
+ private _JournalEntryId: string;
17
15
  Date: Date;
18
16
  Name: string;
19
17
  Description: string;
20
- DatePosted?: string;
21
- AccSystemCode: string;
18
+
19
+ private _JournalEntryModel: IBaseRepository<JournalEntryModel> =
20
+ new JournalEntryModel();
21
+ protected _BaseRepository: IBaseRepository;
22
+
23
+ _TableName: string;
24
+ _ObjectId: string;
25
+ _ObjectName: string;
26
+
22
27
  journalEntryRepository: JournalEntryRepository;
23
28
  ledgerTransactionRepository: LedgerTransactionRepository;
24
29
  private _DebitTransactions: any = null;
25
30
  private _CreditTransactions: any = null;
26
31
 
27
- constructor(
28
- journalEntryRepository?: JournalEntryRepository,
29
- ledgerTransactionRepository?: LedgerTransactionRepository,
30
- ) {
32
+ get JournalEntryId() {
33
+ return this._JournalEntryId;
34
+ }
35
+
36
+ private set JournalEntryId(id: string) {
37
+ this._JournalEntryId = id;
38
+ }
39
+
40
+ override get BaseRepository() {
41
+ return this._JournalEntryModel;
42
+ }
43
+
44
+ override get TableName() {
45
+ return 'finance_JournalEntry';
46
+ }
47
+
48
+ override get ObjectName() {
49
+ return this.Name;
50
+ }
51
+
52
+ override get ObjectId() {
53
+ return this._JournalEntryId;
54
+ }
55
+
56
+ constructor(dbTransaction: any);
57
+ constructor(dbTransaction: any, journalEntryId: string);
58
+ constructor(dbTransaction: any, journalEntryId?: string) {
31
59
  super();
32
- this.ledgerTransactionRepository = ledgerTransactionRepository;
33
- this.journalEntryRepository = journalEntryRepository;
60
+ this.journalEntryRepository = this.ledgerTransactionRepository.findOne({
61
+ where: {
62
+ JournalEntryId: journalEntryId,
63
+ },
64
+ transaction: dbTransaction,
65
+ });
34
66
  }
35
67
 
36
68
  public get DebitTransactions() {
@@ -99,7 +131,7 @@ export class JournalEntry extends AccountSystemEntity {
99
131
  Description: this.Description,
100
132
  PostedById: this.PostedById,
101
133
  PostedToAccSystemYN: this.PostedToAccSystemYN,
102
- DatePosted: this.DatePosted,
134
+ PostedDateTime: this.PostedDateTime,
103
135
  };
104
136
  }
105
137
 
@@ -116,7 +148,7 @@ export class JournalEntry extends AccountSystemEntity {
116
148
  Description: this.Description,
117
149
  PostedById: userId,
118
150
  PostedToAccSystemYN: this.PostedToAccSystemYN,
119
- DatePosted: this.DatePosted,
151
+ PostedDateTime: this.PostedDateTime,
120
152
  },
121
153
  dbTransaction,
122
154
  );
@@ -127,12 +159,14 @@ export class JournalEntry extends AccountSystemEntity {
127
159
  transactionType,
128
160
  }: ILedgerTransactionTypeOptionsAttr): Promise<any> {
129
161
  this.init({
162
+ CompanyId: cuid(),
130
163
  JournalEntryId: 'New',
131
164
  Date: new Date(),
132
165
  Name: '',
133
166
  Description: '',
134
- PostedById: '',
167
+ AccSystemRefId: '',
135
168
  PostedToAccSystemYN: 'N',
169
+ PostedById: '',
136
170
  PostedDateTime: null,
137
171
  });
138
172
 
@@ -1,88 +0,0 @@
1
- import { ApiProperty } from '@nestjs/swagger';
2
- import { Column, DataType, Model, Table, HasMany } from 'sequelize-typescript';
3
- import { FinanceCustomerModel } from '../../customer/entities/customer.entity';
4
-
5
- @Table({ tableName: 'finance_Company', createdAt: false, updatedAt: false })
6
- export class FinanceCompanyModel extends Model {
7
- @ApiProperty({ type: String, description: 'CompanyId' })
8
- @Column({
9
- primaryKey: true,
10
- allowNull: false,
11
- type: DataType.STRING(30),
12
- })
13
- CompanyId: string;
14
-
15
- @ApiProperty({
16
- type: String,
17
- description: 'CompanySystemCode',
18
- })
19
- @Column({
20
- allowNull: false,
21
- type: DataType.STRING(10),
22
- })
23
- CompSystemCode: string;
24
-
25
- @ApiProperty({
26
- type: String,
27
- description: 'CompanySystemRefId',
28
- })
29
- @Column({
30
- allowNull: false,
31
- type: DataType.STRING(30),
32
- })
33
- CompSystemRefId: string;
34
-
35
- @ApiProperty({
36
- type: String,
37
- description: 'Account System Code eg. "EZC", "CRM"',
38
- })
39
- @Column({
40
- allowNull: false,
41
- type: DataType.STRING(10),
42
- })
43
- AccSystemCode: string;
44
-
45
- @ApiProperty({
46
- type: String,
47
- description: 'Account Company Id in API',
48
- })
49
- @Column({
50
- allowNull: false,
51
- type: DataType.STRING(30),
52
- })
53
- AccSystemRefId: string;
54
-
55
- @ApiProperty({
56
- type: String,
57
- description: 'PostedToAccSystemYN',
58
- example: 'Y',
59
- })
60
- @Column({
61
- allowNull: false,
62
- type: DataType.CHAR(1),
63
- })
64
- PostedToAccSystemYN: string;
65
-
66
- @ApiProperty({
67
- example: '138140891dd211b288d34bc7b4312a49',
68
- description: 'PostedById',
69
- })
70
- @Column({
71
- allowNull: true,
72
- type: DataType.STRING(30),
73
- })
74
- PostedById: string;
75
-
76
- @ApiProperty({
77
- example: new Date(),
78
- description: 'PostedToAccSystem Date',
79
- })
80
- @Column({
81
- allowNull: true,
82
- type: DataType.DATE,
83
- })
84
- PostedDateTime: Date;
85
-
86
- @HasMany(() => FinanceCustomerModel)
87
- FinanceCustomers: FinanceCustomerModel[];
88
- }
@@ -1,10 +0,0 @@
1
- export interface IFinanceCompanyAttr {
2
- CompanyId: string;
3
- CompSystemCode: string;
4
- CompSystemRefId: string;
5
- AccSystemCode: string;
6
- AccSystemRefId: string;
7
- PostedToAccSystemYN: string;
8
- PostedById: string;
9
- PostedDateTime?: Date;
10
- }
@@ -1,4 +0,0 @@
1
- import { IBaseRepository } from '@tomei/general';
2
- import { FinanceCompanyModel } from '../entities/finance-company.entity';
3
-
4
- export type IFinanceCompanyRepository = IBaseRepository<FinanceCompanyModel>;