@tomei/finance 0.3.33 → 0.3.35

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 (66) hide show
  1. package/dist/document/document.d.ts +1 -1
  2. package/dist/document/document.js +9 -6
  3. package/dist/document/document.js.map +1 -1
  4. package/dist/finance-company/finance-company.d.ts +1 -0
  5. package/dist/finance-company/finance-company.js +176 -102
  6. package/dist/finance-company/finance-company.js.map +1 -1
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.js +3 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +2 -1
  11. package/dist/ledger-transaction/ledger-transaction.d.ts +4 -2
  12. package/dist/ledger-transaction/ledger-transaction.js +6 -5
  13. package/dist/ledger-transaction/ledger-transaction.js.map +1 -1
  14. package/dist/models/ledger-transaction.entity.d.ts +6 -1
  15. package/dist/models/ledger-transaction.entity.js +31 -14
  16. package/dist/models/ledger-transaction.entity.js.map +1 -1
  17. package/dist/models/payment-item.entity.d.ts +2 -1
  18. package/dist/models/payment-item.entity.js +9 -2
  19. package/dist/models/payment-item.entity.js.map +1 -1
  20. package/dist/models/payment-paid-with.entity.d.ts +18 -0
  21. package/dist/models/payment-paid-with.entity.js +117 -0
  22. package/dist/models/payment-paid-with.entity.js.map +1 -0
  23. package/dist/models/payment.entity.d.ts +1 -6
  24. package/dist/models/payment.entity.js +2 -29
  25. package/dist/models/payment.entity.js.map +1 -1
  26. package/dist/payment/interfaces/payment-attr.interface.d.ts +1 -6
  27. package/dist/payment/interfaces/payment-attr.interface.js.map +1 -1
  28. package/dist/payment/payment.d.ts +10 -17
  29. package/dist/payment/payment.js +43 -30
  30. package/dist/payment/payment.js.map +1 -1
  31. package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts +3 -1
  32. package/dist/payment-item/interfaces/payment-item-attr.interface.js.map +1 -1
  33. package/dist/payment-item/payment-item.d.ts +3 -0
  34. package/dist/payment-item/payment-item.js +6 -0
  35. package/dist/payment-item/payment-item.js.map +1 -1
  36. package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts +13 -0
  37. package/dist/payment-paid-with/interfaces/payment-paid-with.interface.js +7 -0
  38. package/dist/payment-paid-with/interfaces/payment-paid-with.interface.js.map +1 -0
  39. package/dist/payment-paid-with/payment-paid-with.d.ts +24 -0
  40. package/dist/payment-paid-with/payment-paid-with.js +44 -0
  41. package/dist/payment-paid-with/payment-paid-with.js.map +1 -0
  42. package/dist/payment-paid-with/payment-paid-with.repository.d.ts +5 -0
  43. package/dist/payment-paid-with/payment-paid-with.repository.js +12 -0
  44. package/dist/payment-paid-with/payment-paid-with.repository.js.map +1 -0
  45. package/dist/tsconfig.tsbuildinfo +1 -1
  46. package/migrations/finance-ledger-transaction-migration.js +23 -7
  47. package/migrations/finance-payment-item-migration.js +10 -2
  48. package/migrations/finance-payment-migration.js +2 -34
  49. package/migrations/finance-paymentpaidwith-migration.js +66 -0
  50. package/package.json +1 -1
  51. package/src/document/document.ts +20 -10
  52. package/src/finance-company/finance-company.ts +233 -175
  53. package/src/index.ts +2 -0
  54. package/src/ledger-transaction/interfaces/ledger-transaction-attr.interface.ts +2 -1
  55. package/src/ledger-transaction/ledger-transaction.ts +6 -4
  56. package/src/models/ledger-transaction.entity.ts +27 -13
  57. package/src/models/payment-item.entity.ts +8 -2
  58. package/src/models/payment-paid-with.entity.ts +97 -0
  59. package/src/models/payment.entity.ts +2 -28
  60. package/src/payment/interfaces/payment-attr.interface.ts +1 -6
  61. package/src/payment/payment.ts +55 -50
  62. package/src/payment-item/interfaces/payment-item-attr.interface.ts +3 -1
  63. package/src/payment-item/payment-item.ts +6 -3
  64. package/src/payment-paid-with/interfaces/payment-paid-with.interface.ts +14 -0
  65. package/src/payment-paid-with/payment-paid-with.repository.ts +11 -0
  66. package/src/payment-paid-with/payment-paid-with.ts +54 -0
@@ -36,13 +36,9 @@ module.exports = {
36
36
  type: Sequelize.DATE,
37
37
  allowNull: false,
38
38
  },
39
- Name: {
40
- type: Sequelize.STRING(200),
41
- allowNull: false,
42
- },
43
39
  Description: {
44
40
  type: Sequelize.STRING(1000),
45
- allowNull: true,
41
+ allowNull: false,
46
42
  },
47
43
  Currency: {
48
44
  type: Sequelize.CHAR(3),
@@ -58,11 +54,31 @@ module.exports = {
58
54
  },
59
55
  RelatedObjectId: {
60
56
  type: Sequelize.STRING(30),
61
- allowNull: false,
57
+ allowNull: true,
62
58
  },
63
59
  RelatedObjectType: {
64
60
  type: Sequelize.STRING(200),
65
- allowNull: false,
61
+ allowNull: true,
62
+ },
63
+ RelatedDocNo: {
64
+ type: Sequelize.STRING(30),
65
+ allowNull: true,
66
+ references: {
67
+ model: 'finance_Document',
68
+ key: 'DocNo',
69
+ },
70
+ onUpdate: 'CASCADE',
71
+ onDelete: 'CASCADE',
72
+ },
73
+ RelatedPaymentId: {
74
+ type: Sequelize.STRING(30),
75
+ allowNull: true,
76
+ references: {
77
+ model: 'finance_Payment',
78
+ key: 'PaymentId',
79
+ },
80
+ onUpdate: 'CASCADE',
81
+ onDelete: 'CASCADE',
66
82
  },
67
83
  });
68
84
  },
@@ -30,8 +30,16 @@ module.exports = {
30
30
  type: Sequelize.DECIMAL(10, 2),
31
31
  allowNull: false,
32
32
  },
33
- TaxCode: {
34
- type: Sequelize.STRING(10),
33
+ Name: {
34
+ type: Sequelize.STRING(200),
35
+ allowNull: true,
36
+ },
37
+ Description: {
38
+ type: Sequelize.STRING(1000),
39
+ allowNull: false,
40
+ },
41
+ Remarks: {
42
+ type: Sequelize.STRING(5000),
35
43
  allowNull: true,
36
44
  },
37
45
  });
@@ -17,25 +17,9 @@ module.exports = {
17
17
  type: Sequelize.DATE,
18
18
  allowNull: false,
19
19
  },
20
- CompanyId: {
21
- type: Sequelize.STRING(30),
22
- allowNull: false,
23
- references: {
24
- model: 'finance_Company',
25
- key: 'CompanyId',
26
- },
27
- onUpdate: 'CASCADE',
28
- onDelete: 'CASCADE',
29
- },
30
- MethodTypeId: {
31
- type: Sequelize.STRING(30),
20
+ Description: {
21
+ type: Sequelize.STRING(1000),
32
22
  allowNull: false,
33
- references: {
34
- model: 'finance_PaymentMethodType',
35
- key: 'MethodTypeId',
36
- },
37
- onUpdate: 'CASCADE',
38
- onDelete: 'CASCADE',
39
23
  },
40
24
  Currency: {
41
25
  type: Sequelize.CHAR(3),
@@ -49,22 +33,6 @@ module.exports = {
49
33
  type: Sequelize.STRING(20),
50
34
  allowNull: false,
51
35
  },
52
- TransactionId: {
53
- type: Sequelize.STRING(100),
54
- allowNull: true,
55
- },
56
- TransactionApprovalCode: {
57
- type: Sequelize.STRING(100),
58
- allowNull: true,
59
- },
60
- TransactionAccountName: {
61
- type: Sequelize.STRING(100),
62
- allowNull: true,
63
- },
64
- TransactionAccountNo: {
65
- type: Sequelize.STRING(100),
66
- allowNull: true,
67
- },
68
36
  ReceivedBy: {
69
37
  type: Sequelize.STRING(30),
70
38
  allowNull: false,
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ async up(queryInterface, Sequelize) {
5
+ await queryInterface.createTable('finance_PaymentPaidWith', {
6
+ PaymentId: {
7
+ type: Sequelize.STRING(30),
8
+ primaryKey: true,
9
+ allowNull: false,
10
+ references: {
11
+ model: 'finance_Payment',
12
+ key: 'PaymentId',
13
+ },
14
+ onUpdate: 'CASCADE',
15
+ onDelete: 'CASCADE',
16
+ },
17
+ MethodTypeId: {
18
+ type: Sequelize.STRING(30),
19
+ allowNull: false,
20
+ primaryKey: true,
21
+ references: {
22
+ model: 'finance_PaymentMethodType',
23
+ key: 'MethodTypeId',
24
+ },
25
+ onUpdate: 'CASCADE',
26
+ onDelete: 'CASCADE',
27
+ },
28
+ Currency: {
29
+ type: Sequelize.CHAR(3),
30
+ allowNull: false,
31
+ },
32
+ Amount: {
33
+ type: Sequelize.DECIMAL(10, 2),
34
+ allowNull: false,
35
+ },
36
+ Status: {
37
+ type: Sequelize.STRING(20),
38
+ allowNull: false,
39
+ },
40
+ TransactionId: {
41
+ type: Sequelize.STRING(100),
42
+ allowNull: true,
43
+ },
44
+ TransactionApprovalCode: {
45
+ type: Sequelize.STRING(100),
46
+ allowNull: true,
47
+ },
48
+ TransactionApprovalName: {
49
+ type: Sequelize.STRING(100),
50
+ allowNull: true,
51
+ },
52
+ TransactionAccountNo: {
53
+ type: Sequelize.STRING(100),
54
+ allowNull: true,
55
+ },
56
+ Remarks: {
57
+ type: Sequelize.TEXT,
58
+ allowNull: true,
59
+ },
60
+ });
61
+ },
62
+
63
+ async down(queryInterface) {
64
+ await queryInterface.dropTable('finance_PaymentPaidWith');
65
+ },
66
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/finance",
3
- "version": "0.3.33",
3
+ "version": "0.3.35",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -20,6 +20,7 @@ import { DocumentRepository } from './document.repository';
20
20
  import FinanceCompany from '../finance-company/finance-company';
21
21
  import FinanceCustomerBase from '../customer/customer';
22
22
  import DocumentModel from '../models/document.entity';
23
+ import { threadId } from 'worker_threads';
23
24
 
24
25
  // eslint-disable-next-line @typescript-eslint/no-var-requires
25
26
  const getConfig = require('../config');
@@ -132,7 +133,6 @@ export default class Document extends AccountSystemEntity {
132
133
 
133
134
  constructor(dbTransaction?: any, docNo?: string) {
134
135
  super();
135
- console.log(config, '<<< test config from finance');
136
136
  if (dbTransaction) {
137
137
  this._DbTransaction = dbTransaction;
138
138
  }
@@ -167,6 +167,7 @@ export default class Document extends AccountSystemEntity {
167
167
  this.PostedById = documentData.PostedById;
168
168
  this.PostedDateTime = documentData.PostedDateTime;
169
169
  this.UseAccSystemDocYN = documentData.UseAccSystemDocYN;
170
+ this.IsNewRecord = false;
170
171
  } else {
171
172
  const notFoundError = new RecordNotFoundError('No Record Found.');
172
173
  throw notFoundError;
@@ -205,8 +206,9 @@ export default class Document extends AccountSystemEntity {
205
206
  .catch((err) => {
206
207
  reject(err);
207
208
  });
209
+ } else {
210
+ resolve(this._DocumentItems);
208
211
  }
209
- resolve(this._DocumentItems);
210
212
  });
211
213
  }
212
214
 
@@ -467,14 +469,22 @@ export default class Document extends AccountSystemEntity {
467
469
  *
468
470
  * @returns {DocumentItem}
469
471
  */
470
- async newDocumentItem(documentItem): Promise<DocumentItem[]> {
471
- await Document._DocumentItemRepository.create({
472
- ...documentItem,
473
- DocumentItemId: cuid(),
474
- DocNo: this.DocNo,
475
- });
476
-
477
- return await this.DocumentItems;
472
+ async newDocumentItem(
473
+ dbTransaction?: any,
474
+ documentItem?: any,
475
+ ): Promise<DocumentItem> {
476
+ // await Document._DocumentItemRepository.create({
477
+ // ...documentItem,
478
+ // DocumentItemId: cuid(),
479
+ // DocNo: this.DocNo,
480
+ // });
481
+
482
+ // return await this.DocumentItems;
483
+
484
+ const di = new DocumentItem();
485
+ di.DocNo = this.DocNo;
486
+ this._DocumentItems.push(documentItem);
487
+ return documentItem;
478
488
  }
479
489
 
480
490
  /**