@tomei/finance 0.4.21 → 0.4.22

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.
@@ -61,6 +61,16 @@ module.exports = {
61
61
  type: Sequelize.STRING(200),
62
62
  allowNull: true,
63
63
  },
64
+ ReceiptDocNo: {
65
+ type: Sequelize.STRING(30),
66
+ allowNull: true,
67
+ references: {
68
+ model: 'finance_Document',
69
+ key: 'DocNo',
70
+ },
71
+ onUpdate: 'CASCADE',
72
+ onDelete: 'CASCADE',
73
+ },
64
74
  AccSystemRefId: {
65
75
  type: Sequelize.STRING(30),
66
76
  allowNull: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/finance",
3
- "version": "0.4.21",
3
+ "version": "0.4.22",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -13,6 +13,8 @@ import {
13
13
  import { DocType, DocumentStatus } from '../enum';
14
14
  import FinanceCompanyModel from './finance-company.entity';
15
15
  import DocumentItemModel from './document-item.entity';
16
+ import LedgerTransactionModel from './ledger-transaction.entity';
17
+ import PaymentModel from './payment.entity';
16
18
 
17
19
  @Table({
18
20
  tableName: 'finance_Document',
@@ -198,6 +200,12 @@ export default class DocumentModel extends Model {
198
200
  @HasMany(() => DocumentItemModel)
199
201
  DocumentItems: DocumentItemModel[];
200
202
 
203
+ @HasMany(() => LedgerTransactionModel)
204
+ LedgerTransactions: LedgerTransactionModel[];
205
+
206
+ @HasMany(() => PaymentModel)
207
+ Payments: PaymentModel[];
208
+
201
209
  @BelongsTo(() => FinanceCompanyModel)
202
210
  FinanceCompany: FinanceCompanyModel;
203
211
  }
@@ -6,8 +6,11 @@ import {
6
6
  Model,
7
7
  Table,
8
8
  UpdatedAt,
9
+ BelongsTo,
9
10
  } from 'sequelize-typescript';
11
+ import { ForeignKey } from 'sequelize-typescript/dist/associations/foreign-key/foreign-key';
10
12
  import { PaymentType, PaymentStatus } from '../enum';
13
+ import DocumentModel from './document.entity';
11
14
  import PaymentItemModel from './payment-item.entity';
12
15
 
13
16
  @Table({
@@ -102,6 +105,14 @@ export default class PaymentModel extends Model {
102
105
  })
103
106
  RelatedObjectType: string;
104
107
 
108
+ @ApiProperty({ type: String, description: 'DocNo' })
109
+ @ForeignKey(() => DocumentModel)
110
+ @Column({
111
+ allowNull: true,
112
+ type: DataType.STRING(30),
113
+ })
114
+ ReceiptDocNo: string;
115
+
105
116
  @ApiProperty({
106
117
  type: String,
107
118
  description: 'Account Customer Id in API',
@@ -144,4 +155,7 @@ export default class PaymentModel extends Model {
144
155
 
145
156
  @HasMany(() => PaymentItemModel)
146
157
  PaymentItems: PaymentItemModel[];
158
+
159
+ @BelongsTo(() => DocumentModel)
160
+ Document: DocumentModel;
147
161
  }
@@ -12,6 +12,7 @@ export class IPaymentAttr {
12
12
  IssuedBy?: string;
13
13
  RelatedObjectId?: string;
14
14
  RelatedObjectType?: string;
15
+ ReceiptDocNo?: string;
15
16
  Remarks?: string;
16
17
  UpdatedAt: Date;
17
18
  UpdatedBy: string;
@@ -30,6 +30,7 @@ export default class Payment extends AccountSystemEntity {
30
30
  Remarks = '';
31
31
  RelatedObjectId = '';
32
32
  RelatedObjectType = '';
33
+ ReceiptDocNo = '';
33
34
 
34
35
  private static _RepositoryBase = new PaymentRepository();
35
36
  private static _PaymentItemRepository = new PaymentItemRepository();
@@ -103,6 +104,7 @@ export default class Payment extends AccountSystemEntity {
103
104
  payment.Remarks = paymentData.Remarks;
104
105
  payment.RelatedObjectId = paymentData.RelatedObjectId;
105
106
  payment.RelatedObjectType = paymentData.RelatedObjectType;
107
+ payment.ReceiptDocNo = paymentData.ReceiptDocNo;
106
108
  payment.AccSystemRefId = paymentData.AccSystemRefId;
107
109
  payment.PostedToAccSystemYN = paymentData.PostedToAccSystemYN;
108
110
  payment.PostedById = paymentData.PostedById;