@tomei/finance 0.3.80 → 0.3.82

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.80",
3
+ "version": "0.3.82",
4
4
  "description": "NestJS package for finance module",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -360,12 +360,20 @@ export default class FinanceCompany extends ObjectBase {
360
360
 
361
361
  const newJournalEntry = await journalEntry.save('test', dbTransaction);
362
362
 
363
- const allLedgerTransactions =
364
- await FinanceCompany._LedgerTransactionRepository.findAll({});
363
+ for (const ledgerTransaction of debitTransactions) {
364
+ const dt = await ledgerTransaction.newLedgerTransaction(
365
+ TransactionTypeOptions.DEBIT,
366
+ newJournalEntry.JournalEntryId,
367
+ );
368
+ await dt.save();
369
+ }
365
370
 
366
- for (const ledgerTransaction of allLedgerTransactions) {
367
- ledgerTransaction.JournalEntryId = newJournalEntry.JournalEntryId;
368
- await ledgerTransaction.save();
371
+ for (const ledgerTransaction of creditTransactions) {
372
+ const ct = await ledgerTransaction.newLedgerTransaction(
373
+ TransactionTypeOptions.CREDIT,
374
+ newJournalEntry.JournalEntryId,
375
+ );
376
+ await ct.save();
369
377
  }
370
378
 
371
379
  await this.AccountingSystem.postJournalEntry(newJournalEntry);
@@ -1142,12 +1150,16 @@ export default class FinanceCompany extends ObjectBase {
1142
1150
  Amount: paymentPaidWithItem.Amount,
1143
1151
  Status: paymentPaidWithItem.Status,
1144
1152
  TransactionId: paymentPaidWithItem.TransactionId,
1145
- // TransactionApprovalCode:
1146
- // paymentPaidWithItem.TransactionApprovalCode,
1147
- // TransactionApprovalName:
1148
- // paymentPaidWithItem.TransactionApprovalName,
1149
- // TransactionAccountNo: paymentPaidWithItem.TransactionAccountNo,
1153
+ RefBank: paymentPaidWithItem.RefBank,
1154
+ RefName: paymentPaidWithItem.RefName,
1155
+ RefNo: paymentPaidWithItem.RefNo,
1156
+ RefOther1: paymentPaidWithItem.RefOther1,
1157
+ RefOther2: paymentPaidWithItem.RefOther2,
1158
+ RefOther3: paymentPaidWithItem.RefOther3,
1159
+ RefOther4: paymentPaidWithItem.RefOther4,
1160
+ RefOther5: paymentPaidWithItem.RefOther5,
1150
1161
  Remarks: paymentPaidWithItem.Remarks,
1162
+ PaymentMediaId: paymentPaidWithItem.PaymentMediaId,
1151
1163
  },
1152
1164
  { transaction: dbTransaction },
1153
1165
  );
@@ -2,6 +2,7 @@ import * as cuid from 'cuid';
2
2
  import { ILedgerTransactionAttr } from './interfaces/ledger-transaction-attr.interface';
3
3
  import { TransactionTypeOptions } from '../enum/transaction-type.enum';
4
4
  import { LedgerTransactionRepository } from './ledger-transaction.repository';
5
+ import JournalEntryModel from '../models/journal-entry.entity';
5
6
 
6
7
  export default class LedgerTransaction {
7
8
  TransactionId = 'New';
@@ -104,18 +105,17 @@ export default class LedgerTransaction {
104
105
  TransactionId: cuid(),
105
106
  TransactionType: transactionType,
106
107
  JournalEntryId: journalEntryId,
107
- //TODO: AccountNo should be Filled In. Not sure with What
108
- Name: '',
109
- AccountNo: '',
110
- Date: new Date(),
111
- Description: '',
112
- Currency: 'MYR',
113
- DebitAmount: 0,
114
- CreditAmount: 0,
115
- RelatedObjectId: '',
116
- RelatedObjectType: '',
117
- RelatedDocNo: '',
118
- RelatedPaymentId: '',
108
+ // Name: journalEntry.Name,
109
+ // AccountNo: '',
110
+ // Date: new Date(),
111
+ // Description: journalEntry.Description,
112
+ // Currency: 'MYR',
113
+ // DebitAmount: 0,
114
+ // CreditAmount: 0,
115
+ // RelatedObjectId: '',
116
+ // RelatedObjectType: '',
117
+ // RelatedDocNo: '',
118
+ // RelatedPaymentId: '',
119
119
  });
120
120
 
121
121
  if (transactionType === TransactionTypeOptions.DEBIT) {