@tomei/finance 0.3.82 → 0.3.83
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/dist/finance-company/finance-company.js +6 -4
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/ledger-transaction/ledger-transaction.d.ts +6 -4
- package/dist/ledger-transaction/ledger-transaction.js +26 -0
- package/dist/ledger-transaction/ledger-transaction.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/finance-company/finance-company.ts +18 -10
- package/src/ledger-transaction/ledger-transaction.ts +29 -1
package/package.json
CHANGED
|
@@ -361,19 +361,27 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
361
361
|
const newJournalEntry = await journalEntry.save('test', dbTransaction);
|
|
362
362
|
|
|
363
363
|
for (const ledgerTransaction of debitTransactions) {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
);
|
|
368
|
-
await
|
|
364
|
+
ledgerTransaction.TransactionId = cuid();
|
|
365
|
+
ledgerTransaction.JournalEntryId = newJournalEntry.JournalEntryId;
|
|
366
|
+
|
|
367
|
+
await ledgerTransaction.save(dbTransaction);
|
|
368
|
+
// const dt = await ledgerTransaction.newLedgerTransaction(
|
|
369
|
+
// TransactionTypeOptions.DEBIT,
|
|
370
|
+
// newJournalEntry.JournalEntryId,
|
|
371
|
+
// );
|
|
372
|
+
// await dt.save();
|
|
369
373
|
}
|
|
370
374
|
|
|
371
375
|
for (const ledgerTransaction of creditTransactions) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
);
|
|
376
|
-
await
|
|
376
|
+
ledgerTransaction.TransactionId = cuid();
|
|
377
|
+
ledgerTransaction.JournalEntryId = newJournalEntry.JournalEntryId;
|
|
378
|
+
|
|
379
|
+
await ledgerTransaction.save(dbTransaction);
|
|
380
|
+
// const ct = await ledgerTransaction.newLedgerTransaction(
|
|
381
|
+
// TransactionTypeOptions.CREDIT,
|
|
382
|
+
// newJournalEntry.JournalEntryId,
|
|
383
|
+
// );
|
|
384
|
+
// await ct.save();
|
|
377
385
|
}
|
|
378
386
|
|
|
379
387
|
await this.AccountingSystem.postJournalEntry(newJournalEntry);
|
|
@@ -2,7 +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
|
|
5
|
+
import LedgerTransactionModel from '../models/ledger-transaction.entity';
|
|
6
6
|
|
|
7
7
|
export default class LedgerTransaction {
|
|
8
8
|
TransactionId = 'New';
|
|
@@ -69,6 +69,34 @@ export default class LedgerTransaction {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
async save(dbTransaction?: any): Promise<LedgerTransactionModel> {
|
|
73
|
+
try {
|
|
74
|
+
this.TransactionId = cuid();
|
|
75
|
+
|
|
76
|
+
return await LedgerTransaction._LedgerTransactionRepository.create(
|
|
77
|
+
{
|
|
78
|
+
TransactionId: this.TransactionId,
|
|
79
|
+
TransactionType: this.TransactionType,
|
|
80
|
+
JournalEntryId: this.JournalEntryId,
|
|
81
|
+
AccountNo: this.AccountNo,
|
|
82
|
+
Date: this.Date,
|
|
83
|
+
Name: this.Name,
|
|
84
|
+
Description: this.Description,
|
|
85
|
+
Currency: this.Currency,
|
|
86
|
+
DebitAmount: this.DebitAmount,
|
|
87
|
+
CreditAmount: this.CreditAmount,
|
|
88
|
+
RelatedObjectId: this.RelatedObjectId,
|
|
89
|
+
RelatedObjectType: this.RelatedObjectType,
|
|
90
|
+
RelatedDocNo: this.RelatedDocNo,
|
|
91
|
+
RelatedPaymentId: this.RelatedPaymentId,
|
|
92
|
+
},
|
|
93
|
+
{ transaction: dbTransaction },
|
|
94
|
+
);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
72
100
|
async create() {
|
|
73
101
|
return await LedgerTransaction._LedgerTransactionRepository.create(
|
|
74
102
|
this.getData,
|