@tomei/finance 0.6.25 → 0.6.27
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 +18 -28
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/journal-entry/journal-entry.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/finance-company/finance-company.ts +24 -33
- package/src/journal-entry/journal-entry.ts +0 -1
package/package.json
CHANGED
|
@@ -307,7 +307,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
307
307
|
// const customerId = await this.AccountingSystem.createCustomer({
|
|
308
308
|
// customer,
|
|
309
309
|
// });
|
|
310
|
-
const customerId =
|
|
310
|
+
const customerId = 'REF';
|
|
311
311
|
|
|
312
312
|
customer.CompanyId = this._CompanyId;
|
|
313
313
|
|
|
@@ -450,7 +450,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
450
450
|
// createAccountPayload,
|
|
451
451
|
// );
|
|
452
452
|
|
|
453
|
-
const accSystemAccountId =
|
|
453
|
+
const accSystemAccountId = 'REF';
|
|
454
454
|
|
|
455
455
|
console.log(
|
|
456
456
|
'Finance Company Create Account: After accSystemAccountId Create',
|
|
@@ -1932,48 +1932,39 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
1932
1932
|
const journalEntry = new JournalEntry(dbTransaction);
|
|
1933
1933
|
|
|
1934
1934
|
// For each Payment.PaymentPaidWith:
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
paymentPaidWithItem.MethodTypeId,
|
|
1941
|
-
);
|
|
1935
|
+
for (const paymentPaidWithItem of paymentPaidWithItems) {
|
|
1936
|
+
const paymentMethodType = await PaymentMethodType.initMethodType(
|
|
1937
|
+
dbTransaction,
|
|
1938
|
+
paymentPaidWithItem.MethodTypeId,
|
|
1939
|
+
);
|
|
1942
1940
|
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
if (error instanceof RecordNotFoundError) {
|
|
1955
|
-
throw new Error('Invalid Payment Method Type Id');
|
|
1956
|
-
} else {
|
|
1957
|
-
throw error;
|
|
1958
|
-
}
|
|
1959
|
-
}
|
|
1960
|
-
});
|
|
1941
|
+
//Initialise new Debit LedgerTransaction by calling JournalEntry.newLedgerTransaction() method and set below attributes:
|
|
1942
|
+
const debitLT = await journalEntry.newLedgerTransaction(
|
|
1943
|
+
TransactionTypeOptions.DEBIT,
|
|
1944
|
+
);
|
|
1945
|
+
debitLT.AccountNo = paymentMethodType.AccountNo;
|
|
1946
|
+
debitLT.Currency = paymentPaidWithItem.Currency;
|
|
1947
|
+
debitLT.DebitAmount = paymentPaidWithItem.Amount;
|
|
1948
|
+
debitLT.Date = transactionDate;
|
|
1949
|
+
debitLT.Description = 'Payment Received';
|
|
1950
|
+
debitLT.RelatedPaymentId = payment.PaymentId;
|
|
1951
|
+
}
|
|
1961
1952
|
|
|
1962
1953
|
//For each creditTransactions, Initialise new Credit LedgerTransaction by calling JournalEntry.newLedgerTransaction() method
|
|
1963
|
-
|
|
1954
|
+
for (const ct of creditTransaction) {
|
|
1964
1955
|
const creditLT = await journalEntry.newLedgerTransaction(
|
|
1965
1956
|
TransactionTypeOptions.CREDIT,
|
|
1966
1957
|
);
|
|
1967
|
-
creditLT.AccountNo =
|
|
1968
|
-
creditLT.Currency =
|
|
1969
|
-
creditLT.CreditAmount =
|
|
1958
|
+
creditLT.AccountNo = ct.AccountNo;
|
|
1959
|
+
creditLT.Currency = ct.Currency;
|
|
1960
|
+
creditLT.CreditAmount = ct.Amount;
|
|
1970
1961
|
creditLT.Date = transactionDate;
|
|
1971
1962
|
creditLT.Description = 'Payment Received';
|
|
1972
1963
|
creditLT.RelatedPaymentId = payment.PaymentId;
|
|
1973
|
-
}
|
|
1964
|
+
}
|
|
1974
1965
|
|
|
1975
1966
|
// Call this.postJournal()
|
|
1976
|
-
this.postJournal(dbTransaction, journalEntry, loginUser);
|
|
1967
|
+
await this.postJournal(dbTransaction, journalEntry, loginUser);
|
|
1977
1968
|
|
|
1978
1969
|
return payment;
|
|
1979
1970
|
} catch (error) {
|
|
@@ -213,7 +213,6 @@ export default class JournalEntry extends AccountSystemEntity {
|
|
|
213
213
|
/**
|
|
214
214
|
* Create a new LedgerTransaction
|
|
215
215
|
*
|
|
216
|
-
* @see {@link FinanceCompany.issueInvoice} - for implementation
|
|
217
216
|
*
|
|
218
217
|
* @param transactionType - Indicating the type of ledger transaction to create
|
|
219
218
|
*
|