@tomei/finance 0.6.26 → 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.d.ts +1 -1
- package/dist/finance-company/finance-company.js +7 -8
- 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 +22 -23
- package/src/journal-entry/journal-entry.ts +0 -1
package/package.json
CHANGED
|
@@ -1784,7 +1784,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
1784
1784
|
dbTransaction: any,
|
|
1785
1785
|
loginUser: LoginUserBase,
|
|
1786
1786
|
payment: Payment,
|
|
1787
|
-
|
|
1787
|
+
creditTransaction: {
|
|
1788
1788
|
AccountNo: string;
|
|
1789
1789
|
Currency: string;
|
|
1790
1790
|
Amount: number;
|
|
@@ -1824,7 +1824,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
1824
1824
|
}
|
|
1825
1825
|
|
|
1826
1826
|
//Make sure the payment items length is equal to creditTransactions length records.
|
|
1827
|
-
if (paymentItems.length !==
|
|
1827
|
+
if (paymentItems.length !== creditTransaction.length) {
|
|
1828
1828
|
throw new Error(
|
|
1829
1829
|
'Payment items length is not equal to creditTransaction length',
|
|
1830
1830
|
);
|
|
@@ -1836,7 +1836,7 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
1836
1836
|
totalAmount += paymentItem.Amount;
|
|
1837
1837
|
});
|
|
1838
1838
|
|
|
1839
|
-
const totalCreditTransactionAmount =
|
|
1839
|
+
const totalCreditTransactionAmount = creditTransaction.reduce(
|
|
1840
1840
|
(accumulator, currentValue) => {
|
|
1841
1841
|
return accumulator + currentValue.Amount;
|
|
1842
1842
|
},
|
|
@@ -1933,36 +1933,35 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
1933
1933
|
|
|
1934
1934
|
// For each Payment.PaymentPaidWith:
|
|
1935
1935
|
for (const paymentPaidWithItem of paymentPaidWithItems) {
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
);
|
|
1936
|
+
const paymentMethodType = await PaymentMethodType.initMethodType(
|
|
1937
|
+
dbTransaction,
|
|
1938
|
+
paymentPaidWithItem.MethodTypeId,
|
|
1939
|
+
);
|
|
1941
1940
|
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
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;
|
|
1952
1951
|
}
|
|
1953
1952
|
|
|
1954
1953
|
//For each creditTransactions, Initialise new Credit LedgerTransaction by calling JournalEntry.newLedgerTransaction() method
|
|
1955
|
-
for (const
|
|
1954
|
+
for (const ct of creditTransaction) {
|
|
1956
1955
|
const creditLT = await journalEntry.newLedgerTransaction(
|
|
1957
1956
|
TransactionTypeOptions.CREDIT,
|
|
1958
1957
|
);
|
|
1959
|
-
creditLT.AccountNo =
|
|
1960
|
-
creditLT.Currency =
|
|
1961
|
-
creditLT.CreditAmount =
|
|
1958
|
+
creditLT.AccountNo = ct.AccountNo;
|
|
1959
|
+
creditLT.Currency = ct.Currency;
|
|
1960
|
+
creditLT.CreditAmount = ct.Amount;
|
|
1962
1961
|
creditLT.Date = transactionDate;
|
|
1963
1962
|
creditLT.Description = 'Payment Received';
|
|
1964
1963
|
creditLT.RelatedPaymentId = payment.PaymentId;
|
|
1965
|
-
}
|
|
1964
|
+
}
|
|
1966
1965
|
|
|
1967
1966
|
// Call this.postJournal()
|
|
1968
1967
|
await this.postJournal(dbTransaction, journalEntry, loginUser);
|
|
@@ -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
|
*
|