Nonpresentation currency should now be correctly imported, but needs additional validation
This commit is contained in:
@@ -95,7 +95,7 @@ Beta-6 features progress
|
||||
Beta-6 will be released on June 5 with string freeze on June 2. Its focus is to increase multicurrency functionality for payouts and bank imports.
|
||||
|
||||
- [x] Parameterize the bank file import procedure (big feature!)
|
||||
- [ ] Make it possible to import bank files in non-presentation currency
|
||||
- [x] Make it possible to import bank files in non-presentation currency
|
||||
- [ ] Rewrite payment addresses (a new name for this? Account vs. designator?)
|
||||
- [ ] Enable payment destinations, with currency
|
||||
|
||||
|
||||
@@ -615,6 +615,14 @@ namespace Swarmops.Site.Pages.Ledgers
|
||||
progressUpdateInterval = 100;
|
||||
}
|
||||
|
||||
Currency organizationCurrency = assetAccount.Organization.Currency;
|
||||
Currency accountCurrency = assetAccount.ForeignCurrency;
|
||||
|
||||
if (accountCurrency == null)
|
||||
{
|
||||
accountCurrency = organizationCurrency;
|
||||
}
|
||||
|
||||
foreach (ExternalBankDataRecord row in import.Records)
|
||||
{
|
||||
// Update progress.
|
||||
@@ -650,6 +658,14 @@ namespace Swarmops.Site.Pages.Ledgers
|
||||
amountCents = row.TransactionGrossCents;
|
||||
}
|
||||
|
||||
Int64 foreignCents = amountCents;
|
||||
|
||||
if (accountCurrency.Identity != organizationCurrency.Identity)
|
||||
{
|
||||
amountCents =
|
||||
new Money(amountCents, accountCurrency, row.DateTime).ToCurrency(organizationCurrency).Cents;
|
||||
}
|
||||
|
||||
FinancialTransaction transaction = FinancialTransaction.ImportWithStub (args.Organization.Identity,
|
||||
row.DateTime,
|
||||
assetAccount.Identity, amountCents,
|
||||
@@ -658,10 +674,17 @@ namespace Swarmops.Site.Pages.Ledgers
|
||||
|
||||
if (transaction != null)
|
||||
{
|
||||
// The transaction was created. Examine if the autobook criteria are true.
|
||||
// The transaction was created.
|
||||
|
||||
result.TransactionsImported++;
|
||||
|
||||
// If non-presentation currency, log the account currency amount as well.
|
||||
|
||||
if (accountCurrency.Identity != organizationCurrency.Identity)
|
||||
{
|
||||
transaction.Rows[0].AmountForeignCents = new Money(foreignCents, accountCurrency);
|
||||
}
|
||||
|
||||
FinancialAccounts accounts = FinancialAccounts.FromBankTransactionTag (row.Description);
|
||||
|
||||
if (accounts.Count == 1)
|
||||
|
||||
Reference in New Issue
Block a user