@tomei/finance 0.2.11 → 0.2.13

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 (79) hide show
  1. package/dist/account/account.d.ts +1 -7
  2. package/dist/account/account.js +1 -7
  3. package/dist/account/account.js.map +1 -1
  4. package/dist/account-system-entity/account-system-entity.d.ts +18 -7
  5. package/dist/account-system-entity/account-system-entity.js +59 -8
  6. package/dist/account-system-entity/account-system-entity.js.map +1 -1
  7. package/dist/account-system-entity/index.d.ts +2 -0
  8. package/dist/account-system-entity/index.js +6 -0
  9. package/dist/account-system-entity/index.js.map +1 -0
  10. package/dist/account-system-entity/post-history.entity.d.ts +11 -0
  11. package/dist/account-system-entity/post-history.entity.js +65 -0
  12. package/dist/account-system-entity/post-history.entity.js.map +1 -0
  13. package/dist/account-system-entity/post-history.repository.d.ts +5 -0
  14. package/dist/account-system-entity/post-history.repository.js +13 -0
  15. package/dist/account-system-entity/post-history.repository.js.map +1 -0
  16. package/dist/customer/customer.d.ts +18 -13
  17. package/dist/customer/customer.js +18 -13
  18. package/dist/customer/customer.js.map +1 -1
  19. package/dist/customer/entities/customer.entity.d.ts +9 -4
  20. package/dist/customer/entities/customer.entity.js +46 -9
  21. package/dist/customer/entities/customer.entity.js.map +1 -1
  22. package/dist/customer/index.d.ts +2 -2
  23. package/dist/customer/index.js +3 -3
  24. package/dist/customer/index.js.map +1 -1
  25. package/dist/customer/interfaces/finance-customer-attr.interface.d.ts +7 -1
  26. package/dist/document/document.d.ts +2 -6
  27. package/dist/document/document.js +1 -2
  28. package/dist/document/document.js.map +1 -1
  29. package/dist/finance-company/entities/finance-company.entity.d.ts +13 -0
  30. package/dist/finance-company/entities/finance-company.entity.js +113 -0
  31. package/dist/finance-company/entities/finance-company.entity.js.map +1 -0
  32. package/dist/finance-company/finance-company.d.ts +23 -8
  33. package/dist/finance-company/finance-company.js +75 -16
  34. package/dist/finance-company/finance-company.js.map +1 -1
  35. package/dist/finance-company/finance-company.repository.d.ts +10 -0
  36. package/dist/finance-company/finance-company.repository.js +38 -0
  37. package/dist/finance-company/finance-company.repository.js.map +1 -0
  38. package/dist/finance-company/index.d.ts +5 -1
  39. package/dist/finance-company/index.js +5 -1
  40. package/dist/finance-company/index.js.map +1 -1
  41. package/dist/finance-company/interfaces/finance-company-attr.interface.d.ts +10 -0
  42. package/dist/finance-company/interfaces/finance-company-attr.interface.js +3 -0
  43. package/dist/finance-company/interfaces/finance-company-attr.interface.js.map +1 -0
  44. package/dist/finance-company/interfaces/finance-company.repository.interface.d.ts +3 -0
  45. package/dist/finance-company/interfaces/finance-company.repository.interface.js +3 -0
  46. package/dist/finance-company/interfaces/finance-company.repository.interface.js.map +1 -0
  47. package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts +2 -2
  48. package/dist/journal-entry/journal-entry.d.ts +1 -7
  49. package/dist/journal-entry/journal-entry.js +3 -10
  50. package/dist/journal-entry/journal-entry.js.map +1 -1
  51. package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +1 -1
  52. package/dist/payment/payment.d.ts +1 -7
  53. package/dist/payment/payment.js +1 -8
  54. package/dist/payment/payment.js.map +1 -1
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/migrations/finance-company-migration.js +45 -0
  57. package/migrations/finance-customer-migration.js +23 -5
  58. package/migrations/finance-post-history-migration.js +45 -0
  59. package/package.json +2 -2
  60. package/src/account/account.ts +4 -15
  61. package/src/account-system-entity/account-system-entity.ts +82 -12
  62. package/src/account-system-entity/index.ts +3 -0
  63. package/src/account-system-entity/post-history.entity.ts +41 -0
  64. package/src/account-system-entity/post-history.repository.ts +12 -0
  65. package/src/customer/customer.ts +38 -26
  66. package/src/customer/entities/customer.entity.ts +50 -10
  67. package/src/customer/index.ts +2 -2
  68. package/src/customer/interfaces/finance-customer-attr.interface.ts +7 -1
  69. package/src/document/document.ts +2 -6
  70. package/src/finance-company/entities/finance-company.entity.ts +88 -0
  71. package/src/finance-company/finance-company.repository.ts +30 -0
  72. package/src/finance-company/finance-company.ts +152 -24
  73. package/src/finance-company/index.ts +11 -1
  74. package/src/finance-company/interfaces/finance-company-attr.interface.ts +10 -0
  75. package/src/finance-company/interfaces/finance-company.repository.interface.ts +4 -0
  76. package/src/journal-entry/interfaces/journal-entry-attr.interface.ts +2 -2
  77. package/src/journal-entry/journal-entry.ts +3 -19
  78. package/src/ledger-transaction/interfaces/ledger-transaction-attr.interface.ts +1 -2
  79. package/src/payment/payment.ts +1 -18
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ async up(queryInterface, Sequelize) {
5
+ await queryInterface.createTable('finance_Company', {
6
+ CompanyId: {
7
+ type: Sequelize.STRING(30),
8
+ primaryKey: true,
9
+ allowNull: false,
10
+ },
11
+ CompSystemCode: {
12
+ type: Sequelize.STRING(10),
13
+ allowNull: false,
14
+ },
15
+ CompSystemRefId: {
16
+ type: Sequelize.STRING(30),
17
+ allowNull: false,
18
+ },
19
+ AccSystemCode: {
20
+ type: Sequelize.STRING(10),
21
+ allowNull: false,
22
+ },
23
+ AccSystemRefId: {
24
+ type: Sequelize.STRING(30),
25
+ allowNull: false,
26
+ },
27
+ PostedToAccSystemYN: {
28
+ type: Sequelize.CHAR(1),
29
+ allowNull: false,
30
+ },
31
+ PostedById: {
32
+ type: Sequelize.STRING(30),
33
+ allowNull: true,
34
+ },
35
+ PostedDateTime: {
36
+ type: Sequelize.DATE,
37
+ allowNull: true,
38
+ },
39
+ });
40
+ },
41
+
42
+ async down(queryInterface) {
43
+ await queryInterface.dropTable('finance_Company');
44
+ },
45
+ };
@@ -8,22 +8,40 @@ module.exports = {
8
8
  primaryKey: true,
9
9
  allowNull: false,
10
10
  },
11
- SystemCode: {
11
+ CompanyId: {
12
12
  type: Sequelize.STRING(30),
13
13
  allowNull: false,
14
+ references: {
15
+ model: 'finance_Company',
16
+ key: 'CompanyId',
17
+ },
18
+ onUpdate: 'CASCADE',
19
+ onDelete: 'CASCADE',
14
20
  },
15
- AccSystemCode: {
16
- type: Sequelize.STRING(30),
21
+ CustSystemCode: {
22
+ type: Sequelize.STRING(10),
17
23
  allowNull: false,
18
24
  },
19
- AccSystemCustomerId: {
25
+ CustSystemRefId: {
20
26
  type: Sequelize.STRING(30),
21
27
  allowNull: false,
22
28
  },
23
- CustomerRefId: {
29
+ AccSystemRefId: {
24
30
  type: Sequelize.STRING(30),
25
31
  allowNull: false,
26
32
  },
33
+ PostedToAccSystemYN: {
34
+ type: Sequelize.CHAR(1),
35
+ allowNull: false,
36
+ },
37
+ PostedById: {
38
+ type: Sequelize.STRING(30),
39
+ allowNull: true,
40
+ },
41
+ PostedDateTime: {
42
+ type: Sequelize.DATE,
43
+ allowNull: true,
44
+ },
27
45
  });
28
46
  },
29
47
 
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ async up(queryInterface, Sequelize) {
5
+ await queryInterface.createTable('finance_PostHistory', {
6
+ PostId: {
7
+ type: Sequelize.STRING(30),
8
+ primaryKey: true,
9
+ allowNull: false,
10
+ },
11
+ DateTime: {
12
+ type: Sequelize.Date,
13
+ allowNull: false,
14
+ },
15
+ ItemId: {
16
+ type: Sequelize.STRING(30),
17
+ allowNull: false,
18
+ },
19
+ ItemType: {
20
+ type: Sequelize.STRING(200),
21
+ allowNull: false,
22
+ },
23
+ ItemValue: {
24
+ type: Sequelize.JSON(),
25
+ allowNull: false,
26
+ },
27
+ PostedById: {
28
+ type: Sequelize.STRING(30),
29
+ allowNull: false,
30
+ },
31
+ AccSystemCode: {
32
+ type: Sequelize.STRING(10),
33
+ allowNull: false,
34
+ },
35
+ AccSystemRefId: {
36
+ type: Sequelize.STRING(30),
37
+ allowNull: false,
38
+ },
39
+ });
40
+ },
41
+
42
+ async down(queryInterface) {
43
+ await queryInterface.dropTable('finance_PostHistory');
44
+ },
45
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/finance",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -34,7 +34,7 @@
34
34
  "@nestjs/core": "^9.0.8",
35
35
  "@nestjs/platform-express": "^9.0.8",
36
36
  "@nestjs/sequelize": "^9.0.0",
37
- "@tomei/general": "^0.0.14",
37
+ "@tomei/general": "^0.0.24",
38
38
  "@tomei/media": "^0.4.0",
39
39
  "axios": "^1.1.3",
40
40
  "class-transformer": "^0.5.1",
@@ -2,34 +2,24 @@ import { IAccountRepository } from './interfaces/account.repository.interface';
2
2
  import { AccountModel } from './entities/account.entity';
3
3
  import { ObjectBase, LoginUserBase, RecordNotFoundError } from '@tomei/general';
4
4
  import { IBaseRepository } from '@tomei/general/dist/interfaces/repository.base.interface';
5
- import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
5
+ import { AccountSystemEntity } from '../account-system-entity';
6
6
  export class Account extends AccountSystemEntity {
7
7
  protected BaseRepository;
8
8
  ObjectId: string;
9
9
  ObjectName: string;
10
10
 
11
- /*todo:remove when ObjectBase updated.*/
12
- get objectId(): string {
13
- return '';
14
- }
15
-
16
- /*todo:remove when ObjectBase updated.*/
17
- get objectName(): string {
18
- return '';
19
- }
20
11
  accountRepository: IAccountRepository;
21
12
  AccountNo: string;
22
13
  Owner: LoginUserBase;
23
14
  RelatedObject: ObjectBase;
24
15
  TableName: string;
25
-
26
16
  private isNewRecord = true;
27
17
  private OwnerId: string;
28
18
  private OwnerType: string;
29
19
  private RelatedObjectId: string;
30
20
  private RelatedObjectType: string;
31
21
  private ParentAccountNo: string;
32
- AccSystemRefId: string;
22
+
33
23
 
34
24
  SystemCode: string;
35
25
  AccSystemCode: string;
@@ -37,9 +27,8 @@ export class Account extends AccountSystemEntity {
37
27
  Description: string;
38
28
  AccountType: string;
39
29
  AccountSubtype: string;
40
- PostedToAccSystemYN: 'N';
41
- PostedById: string;
42
- PostedDateTime: Date;
30
+
31
+
43
32
 
44
33
  CreatedAt: Date;
45
34
  CreatedById: string;
@@ -1,30 +1,100 @@
1
1
  import { IBaseRepository, LoginUserBase, ObjectBase } from '@tomei/general';
2
- // import { FinanceCompany } from '../finance-company';
2
+ import { FinanceCompany } from '../finance-company';
3
+ import { PostHistoryRepository } from './post-history.repository';
4
+ import cuid from 'cuid';
3
5
 
4
6
  export abstract class AccountSystemEntity extends ObjectBase {
5
- CompanyId = '';
6
- PostedToAccSystemYN = 'N';
7
- AccSystemRefId = '';
8
- PostedById = '';
9
- PostedDateTime: Date;
7
+ private _CompanyId = 'New';
8
+ private _PostedToAccSystemYN = 'N';
9
+ private _AccSystemRefId = '';
10
+ private _PostedById = '';
11
+ private _PostedDateTime: Date;
12
+ protected abstract BaseRepository: IBaseRepository<any>;
13
+ private static PostHistoryRepository = new PostHistoryRepository();
10
14
 
11
- protected abstract BaseRepository: IBaseRepository;
15
+ get CompanyId(): string {
16
+ return this._CompanyId;
17
+ }
18
+
19
+ /*todo:verify if protected is correct instead of private*/
20
+ protected set CompanyId(value: string) {
21
+ this._CompanyId = value;
22
+ }
23
+
24
+ get PostedToAccSystemYN(): string {
25
+ return this._PostedToAccSystemYN;
26
+ }
27
+
28
+ set PostedToAccSystemYN(value: string) {
29
+ this._PostedToAccSystemYN = value;
30
+ }
31
+
32
+ get AccSystemRefId(): string {
33
+ return this._AccSystemRefId;
34
+ }
35
+
36
+ set AccSystemRefId(value: string) {
37
+ this._AccSystemRefId = value;
38
+ }
39
+
40
+ get PostedById(): string {
41
+ return this._PostedById;
42
+ }
43
+
44
+ set PostedById(value: string) {
45
+ this._PostedById = value;
46
+ }
12
47
 
13
- postToAccSystem(dbTransaction: any, loginUser: LoginUserBase) {
48
+ get PostedDateTime(): Date {
49
+ return this._PostedDateTime;
50
+ }
51
+
52
+ set PostedDateTime(value: Date) {
53
+ this._PostedDateTime = value;
54
+ }
55
+
56
+ async postToAccSystem(dbTransaction: any, loginUser: LoginUserBase) {
14
57
  try {
15
58
  /*retrieve the finance company details from finance_Company to
16
59
  * get details of the accounting system*/
60
+ const company = FinanceCompany.getFinanceCompany(this.CompanyId);
17
61
 
18
- /*instantiating the appropriate accounting system to perform the post*/
62
+ /*todo:instantiating the appropriate accounting system to perform the post*/
63
+ // if (this.TableName === 'finance_Customer') {
64
+ // await this.AccountingSystem.createCustomer();
65
+ // }
19
66
 
20
67
  /*setting the posted fields*/
21
- this.PostedToAccSystemYN = 'Y';
22
- this.PostedById = loginUser.ObjectId;
23
- this.PostedDateTime = new Date();
68
+ this._PostedToAccSystemYN = 'Y';
69
+ this._PostedById = loginUser.ObjectId;
70
+ this._PostedDateTime = new Date();
71
+
24
72
  /*updating the posted fields to the table either using direct
25
73
  * SQL or BaseRepository*/
74
+ const entity = await this.BaseRepository.findByPk(this.ObjectId);
75
+ const updated = await entity.update(
76
+ {
77
+ PostedToAccSystemYN: this._PostedToAccSystemYN,
78
+ PostedById: this._PostedById,
79
+ PostedDateTime: this._PostedDateTime,
80
+ },
81
+ { transaction: dbTransaction },
82
+ );
26
83
 
27
84
  /*writing to accounting transaction log table finance_PostHistory*/
85
+ await AccountSystemEntity.PostHistoryRepository.create(
86
+ {
87
+ PostId: cuid(),
88
+ DateTime: this._PostedDateTime,
89
+ ItemId: this.ObjectId,
90
+ ItemType: this.TableName,
91
+ ItemValue: JSON.stringify(updated),
92
+ PostedById: this._PostedById,
93
+ AccSystemCode: company.AccSystemCode,
94
+ AccSystemRefId: this._AccSystemRefId,
95
+ },
96
+ { transaction: dbTransaction },
97
+ );
28
98
  } catch (err) {
29
99
  throw err;
30
100
  }
@@ -0,0 +1,3 @@
1
+ import { AccountSystemEntity } from './account-system-entity';
2
+
3
+ export { AccountSystemEntity };
@@ -0,0 +1,41 @@
1
+ import { ApiProperty } from '@nestjs/swagger';
2
+ import { Column, DataType, Model, Table } from 'sequelize-typescript';
3
+
4
+ @Table({ tableName: 'finance_PostHistory', createdAt: false, updatedAt: false })
5
+ export class FinancePostHistoryModel extends Model {
6
+ @ApiProperty({ type: String, description: 'PostId' })
7
+ @Column({
8
+ primaryKey: true,
9
+ allowNull: false,
10
+ type: DataType.STRING(30),
11
+ })
12
+ PostId: string;
13
+
14
+ @ApiProperty({ type: Date })
15
+ @Column({ allowNull: false, type: DataType.DATE })
16
+ DateTime: Date;
17
+
18
+ @ApiProperty({ type: String, description: 'ItemId' })
19
+ @Column({ allowNull: false, type: DataType.STRING(30) })
20
+ ItemId: string;
21
+
22
+ @ApiProperty({ type: String, description: 'ItemType' })
23
+ @Column({ allowNull: false, type: DataType.STRING(200) })
24
+ ItemType: string;
25
+
26
+ @ApiProperty({ type: String, description: 'ItemValue' })
27
+ @Column({ allowNull: false, type: DataType.JSON })
28
+ ItemValue: string;
29
+
30
+ @ApiProperty()
31
+ @Column({ allowNull: false, type: DataType.STRING(30) })
32
+ PostedById: string;
33
+
34
+ @ApiProperty()
35
+ @Column({ allowNull: false, type: DataType.STRING(10) })
36
+ AccSystemCode: string;
37
+
38
+ @ApiProperty()
39
+ @Column({ allowNull: false, type: DataType.STRING(30) })
40
+ AccSystemRefId: string;
41
+ }
@@ -0,0 +1,12 @@
1
+ import { BaseRepository, IBaseRepository } from '@tomei/general';
2
+ import { FinancePostHistoryModel } from './post-history.entity';
3
+
4
+ export class PostHistoryRepository
5
+ extends BaseRepository<FinancePostHistoryModel>
6
+ implements IBaseRepository<FinancePostHistoryModel>
7
+ {
8
+ constructor() {
9
+ const postHistoryModel = new FinancePostHistoryModel();
10
+ super(postHistoryModel);
11
+ }
12
+ }
@@ -1,44 +1,58 @@
1
- import { IAddress, LoginUserBase, RecordNotFoundError } from '@tomei/general';
1
+ import {
2
+ IAddress,
3
+ IPerson,
4
+ LoginUserBase,
5
+ RecordNotFoundError,
6
+ } from '@tomei/general';
7
+ import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
2
8
  import { FinanceCustomerModel } from './entities/customer.entity';
3
9
  import { IFinanceCustomerRepository } from './interfaces/finance-customer.repository.interface';
10
+ export abstract class Customer extends AccountSystemEntity implements IPerson {
11
+ abstract FullName: string;
12
+ abstract IDNo: string;
13
+ abstract IDType: string;
14
+ abstract ContactNo: string;
15
+ abstract Email: string;
16
+ abstract DefaultAddress: IAddress;
4
17
 
5
- export abstract class Customer extends LoginUserBase {
6
- FullName: string;
7
- IDNo: string;
8
- IDType: string;
9
- ContactNo: string;
10
- Email: string;
11
- DefaultAddress: IAddress;
18
+ // note: getDetails from spec is void type. Meaning that this probably needed a fix soon
19
+ async getDetails(): Promise<{
20
+ FullName: string;
21
+ IDNo: string;
22
+ IDType: string;
23
+ Email: string;
24
+ ContactNo: string;
25
+ }> {
26
+ return {
27
+ FullName: this.FullName,
28
+ IDNo: this.IDNo,
29
+ IDType: this.IDType,
30
+ Email: this.Email,
31
+ ContactNo: this.ContactNo,
32
+ };
33
+ }
12
34
 
13
35
  financeCustomerRepository: IFinanceCustomerRepository;
14
36
 
15
37
  CustomerId: string;
16
-
17
- SystemCode: string;
18
- AccSystemCode: string;
19
- AccSystemCustomerId: string; // customer id return from accounting system
20
38
  CustSystemCode: string;
21
39
  CustSystemRefId: string;
22
40
 
23
41
  constructor(
24
- systemCode: string,
25
- accSystemCode: string,
42
+ sFinanceCompanyId: string,
26
43
  custSystemCode: string,
27
44
  custSystemRefId: string,
28
45
  ) {
29
46
  super();
30
47
  const financeCustomerData = this.financeCustomerRepository.findOne({
31
48
  where: {
32
- SystemCode: systemCode,
33
- AccSystemCode: accSystemCode,
34
- AccSystemCustomerId: custSystemCode,
35
- CustomerRefId: custSystemRefId,
49
+ CompanyId: sFinanceCompanyId,
50
+ CustSystemCode: custSystemCode,
51
+ CustSystemRefId: custSystemRefId,
36
52
  },
37
53
  });
38
54
  if (financeCustomerData) {
39
- this.CustomerId = financeCustomerData.CustomerId;
40
- this.AccSystemCode = accSystemCode;
41
- this.AccSystemCustomerId = financeCustomerData.AccSystemCustomerId;
55
+ this.CompanyId = sFinanceCompanyId;
42
56
  this.CustSystemCode = custSystemCode;
43
57
  this.CustSystemRefId = custSystemRefId;
44
58
  } else {
@@ -50,7 +64,7 @@ export abstract class Customer extends LoginUserBase {
50
64
  /*
51
65
  * Get the billing address for a person.
52
66
  **/
53
- abstract getBilligAddress(): Promise<IAddress>;
67
+ abstract getBillingAddress(): Promise<IAddress>;
54
68
 
55
69
  init(person: LoginUserBase) {
56
70
  this.FullName = person.FullName;
@@ -68,10 +82,8 @@ export abstract class Customer extends LoginUserBase {
68
82
  const data = await this.financeCustomerRepository.create(
69
83
  {
70
84
  CustomerId: customerId,
71
- SystemCode: this.SystemCode,
72
- AccSystemCode: this.SystemCode,
73
- AccSystemCustomerId: this.AccSystemCustomerId,
74
- CustomerRefId: this.CustSystemRefId,
85
+ CustSystemCode: this.CustSystemCode,
86
+ CustSystemRefId: this.CustSystemRefId,
75
87
  },
76
88
  dbTransaction,
77
89
  );
@@ -1,5 +1,13 @@
1
1
  import { ApiProperty } from '@nestjs/swagger';
2
- import { Column, DataType, Model, Table } from 'sequelize-typescript';
2
+ import {
3
+ ForeignKey,
4
+ BelongsTo,
5
+ Column,
6
+ DataType,
7
+ Model,
8
+ Table,
9
+ } from 'sequelize-typescript';
10
+ import { FinanceCompanyModel } from '../../finance-company/entities/finance-company.entity';
3
11
 
4
12
  @Table({ tableName: 'finance_Customer', createdAt: false, updatedAt: false })
5
13
  export class FinanceCustomerModel extends Model {
@@ -11,43 +19,75 @@ export class FinanceCustomerModel extends Model {
11
19
  })
12
20
  CustomerId: string;
13
21
 
22
+ @ApiProperty({ type: String, description: 'CompanyId' })
23
+ @ForeignKey(() => FinanceCompanyModel)
24
+ @Column({
25
+ allowNull: false,
26
+ type: DataType.STRING(30),
27
+ })
28
+ CompanyId: string;
29
+
14
30
  @ApiProperty({
15
31
  type: String,
16
- description: 'System Code eg. "EZC", "CRM"',
32
+ description: 'Cust System Code eg. "EZC", "CRM"',
17
33
  })
18
34
  @Column({
19
35
  allowNull: false,
20
- type: DataType.STRING(30),
36
+ type: DataType.STRING(10),
21
37
  })
22
- SystemCode: string;
38
+ CustSystemCode: string;
23
39
 
24
40
  @ApiProperty({
25
41
  type: String,
26
- description: 'Account System Code eg. "EZC", "CRM"',
42
+ description: 'CustSystemRefId',
27
43
  })
28
44
  @Column({
29
45
  allowNull: false,
30
46
  type: DataType.STRING(30),
31
47
  })
32
- AccSystemCode: string;
48
+ CustSystemRefId: string;
33
49
 
34
50
  @ApiProperty({
35
51
  type: String,
36
- description: 'Account Customer Id in Api',
52
+ description: 'Account Customer Id in API',
37
53
  })
38
54
  @Column({
39
55
  allowNull: false,
40
56
  type: DataType.STRING(30),
41
57
  })
42
- AccSystemCustomerId: string;
58
+ AccSystemRefId: string;
43
59
 
44
60
  @ApiProperty({
45
61
  type: String,
46
- description: 'Custoemr Ref Id',
62
+ description: 'PostedToAccSystemYN',
63
+ example: 'Y',
47
64
  })
48
65
  @Column({
49
66
  allowNull: false,
67
+ type: DataType.CHAR(1),
68
+ })
69
+ PostedToAccSystemYN: string;
70
+
71
+ @ApiProperty({
72
+ example: '138140891dd211b288d34bc7b4312a49',
73
+ description: 'PostedById',
74
+ })
75
+ @Column({
76
+ allowNull: true,
50
77
  type: DataType.STRING(30),
51
78
  })
52
- CustomerRefId: string;
79
+ PostedById: string;
80
+
81
+ @ApiProperty({
82
+ example: new Date(),
83
+ description: 'PostedToAccSystem Date',
84
+ })
85
+ @Column({
86
+ allowNull: true,
87
+ type: DataType.DATE,
88
+ })
89
+ PostedDateTime: Date;
90
+
91
+ @BelongsTo(() => FinanceCompanyModel)
92
+ FinanceCompany: FinanceCompanyModel;
53
93
  }
@@ -1,15 +1,15 @@
1
+ import { Customer } from './customer';
1
2
  import { IFinanceCustomerRepository } from './interfaces/finance-customer.repository.interface';
2
3
  import { IFinanceCustomerAttr } from './interfaces/finance-customer-attr.interface';
3
4
  import { FinanceCustomerModel } from './entities/customer.entity';
4
5
  import { ICustomerRepository } from './interfaces/customer.repository.interface';
5
6
  import { FinanceCustomerRepository } from './finance-customer.repository';
6
- import { Customer } from './customer';
7
7
 
8
8
  export {
9
+ Customer,
9
10
  IFinanceCustomerRepository,
10
11
  IFinanceCustomerAttr,
11
12
  FinanceCustomerModel,
12
13
  ICustomerRepository,
13
14
  FinanceCustomerRepository,
14
- Customer,
15
15
  };
@@ -1,4 +1,10 @@
1
1
  export interface IFinanceCustomerAttr {
2
2
  CustomerId: string;
3
- AccSystemId: string;
3
+ CompanyId: string;
4
+ CustSystemCode: string;
5
+ CustSystemRefId: string;
6
+ AccSystemRefId: string;
7
+ PostedToAccSystemYN: string;
8
+ PostedById: string;
9
+ PostedDateTime?: Date;
4
10
  }
@@ -8,12 +8,12 @@ import {
8
8
  CommonService as MediaCommonService,
9
9
  MediaType,
10
10
  } from '@tomei/media';
11
- import { DocumentStatus, DocType } from 'src/enum';
11
+ import { DocumentStatus, DocType } from '../enum';
12
12
  import { DocumentRepository } from './document.repository';
13
13
  import { IDocumentAttr } from './interfaces/document-attr.interface';
14
14
  import { DocumentItemRepository } from './document-item.repository';
15
15
  import { DocumentItem } from './document-item';
16
- import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
16
+ import { AccountSystemEntity } from '../account-system-entity';
17
17
 
18
18
  export class Document extends AccountSystemEntity {
19
19
  protected BaseRepository: IBaseRepository;
@@ -31,10 +31,6 @@ export class Document extends AccountSystemEntity {
31
31
  IssuedToId: string;
32
32
  IssuedToType: string;
33
33
  AccSystemCode: string;
34
- PostedToAccSystemYN = 'N';
35
- PostedById: string;
36
- PostedDateTime: Date;
37
- AccSystemRefId: string;
38
34
  UseAccSystemDocYN: string;
39
35
  private DocHTMLFilePath: string;
40
36
  private DocPDFFilePath: string;