@tomei/finance 0.3.22 → 0.3.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/finance",
3
- "version": "0.3.22",
3
+ "version": "0.3.24",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -1034,6 +1034,11 @@ export default class FinanceCompany extends ObjectBase {
1034
1034
  });
1035
1035
 
1036
1036
  const journalEntry = new JournalEntry(dbTransaction);
1037
+ //Temporary fix to successfully save journal entry in PostJournal
1038
+ journalEntry.init({
1039
+ CompanyId: this.CompanyId,
1040
+ Name: 'Collect-payments for ' + payment.PaymentId,
1041
+ });
1037
1042
  const transactionDate = new Date();
1038
1043
 
1039
1044
  const debitLT = await journalEntry.newLedgerTransaction(
@@ -1,11 +1,11 @@
1
1
  export interface IJournalEntryAttr {
2
- CompanyId: string;
3
- JournalEntryId: string;
2
+ CompanyId?: string;
3
+ JournalEntryId?: string;
4
4
  Date?: Date;
5
- Name: string;
5
+ Name?: string;
6
6
  Description?: string;
7
7
  AccSystemRefId?: string;
8
- PostedToAccSystemYN: string;
8
+ PostedToAccSystemYN?: string;
9
9
  PostedById?: string;
10
10
  PostedDateTime?: Date;
11
11
  }
@@ -80,7 +80,7 @@ export default class JournalEntry extends AccountSystemEntity {
80
80
  } else {
81
81
  this.init({
82
82
  JournalEntryId: cuid(),
83
- CompanyId: this.CompanyId,
83
+ CompanyId: '',
84
84
  Date: new Date(),
85
85
  Name: '',
86
86
  Description: '',
@@ -107,11 +107,11 @@ export default class JournalEntry extends AccountSystemEntity {
107
107
  })
108
108
  .then((debitTransactions) => {
109
109
  const debitTransactionObjects = debitTransactions.map(
110
- (debitTransactionData) => new LedgerTransaction(
110
+ (debitTransactionData) =>
111
+ new LedgerTransaction(
111
112
  this._DbTransaction,
112
113
  debitTransactionData.TransactionId,
113
- )
114
-
114
+ ),
115
115
  );
116
116
  return Promise.all(debitTransactionObjects);
117
117
  })
@@ -142,12 +142,11 @@ export default class JournalEntry extends AccountSystemEntity {
142
142
  })
143
143
  .then((creditTransaction) => {
144
144
  const creditTransactionObjects = creditTransaction.map(
145
- (creditTransactionData) =>
145
+ (creditTransactionData) =>
146
146
  new LedgerTransaction(
147
147
  this._DbTransaction,
148
148
  creditTransactionData.TransactionId,
149
- )
150
-
149
+ ),
151
150
  );
152
151
  return Promise.all(creditTransactionObjects);
153
152
  })
@@ -214,13 +213,15 @@ export default class JournalEntry extends AccountSystemEntity {
214
213
  // }
215
214
 
216
215
  init(params: IJournalEntryAttr) {
217
- this.JournalEntryId = params.JournalEntryId;
218
- this.Date = params.Date;
219
- this.Name = params.Name;
220
- this.Description = params.Description;
221
- this.PostedById = params.PostedById;
222
- this.PostedToAccSystemYN = params.PostedToAccSystemYN;
223
- this.PostedDateTime = params.PostedDateTime;
216
+ if (params.JournalEntryId) this.JournalEntryId = params.JournalEntryId;
217
+ if (params.CompanyId) this.CompanyId = params.CompanyId;
218
+ if (params.Date) this.Date = params.Date;
219
+ if (params.Name) this.Name = params.Name;
220
+ if (params.Description) this.Description = params.Description;
221
+ if (params.PostedById) this.PostedById = params.PostedById;
222
+ if (params.PostedToAccSystemYN)
223
+ this.PostedToAccSystemYN = params.PostedToAccSystemYN;
224
+ if (params.PostedDateTime) this.PostedDateTime = params.PostedDateTime;
224
225
  }
225
226
 
226
227
  getData() {
@@ -267,10 +268,7 @@ export default class JournalEntry extends AccountSystemEntity {
267
268
  async newLedgerTransaction(
268
269
  transactionType: TransactionTypeOptions,
269
270
  ): Promise<LedgerTransaction> {
270
-
271
- const ledgerTransaction = new LedgerTransaction(
272
- this._DbTransaction,
273
- );
271
+ const ledgerTransaction = new LedgerTransaction(this._DbTransaction);
274
272
  ledgerTransaction.JournalEntryId = this.JournalEntryId;
275
273
 
276
274
  if (transactionType === TransactionTypeOptions.DEBIT) {