diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntriesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntriesApiResource.java index 884ca1b9e..8edcd640a 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntriesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntriesApiResource.java @@ -48,7 +48,7 @@ public class JournalEntriesApiResource { private static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "officeId", "officeName", "glAccountName", "glAccountId", "glAccountCode", "glAccountType", "transactionDate", "entryType", "amount", "transactionId", "manualEntry", "entityType", "entityId", "createdByUserId", "createdDate", "createdByUserName", "comments", "reversed", - "referenceNumber")); + "referenceNumber", "currency")); private final String resourceNameForPermission = "JOURNALENTRY"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/JournalEntryData.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/JournalEntryData.java index 8d7bfd11b..0e9327cdd 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/JournalEntryData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/JournalEntryData.java @@ -9,6 +9,7 @@ import java.math.BigDecimal; import org.joda.time.LocalDate; import org.mifosplatform.infrastructure.core.data.EnumOptionData; +import org.mifosplatform.organisation.monetary.data.CurrencyData; /** * Immutable object representing a General Ledger Account @@ -33,6 +34,8 @@ public class JournalEntryData { private final EnumOptionData entryType; private final BigDecimal amount; @SuppressWarnings("unused") + private final CurrencyData currency; + @SuppressWarnings("unused") private final String transactionId; @SuppressWarnings("unused") private final Boolean manualEntry; @@ -68,7 +71,7 @@ public class JournalEntryData { final Boolean manualEntry, final EnumOptionData entityType, final Long entityId, final Long createdByUserId, final LocalDate createdDate, final String createdByUserName, final String comments, final Boolean reversed, final String referenceNumber, final BigDecimal officeRunningBalance, final BigDecimal organizationRunningBalance, - final Boolean runningBalanceComputed,final TransactionDetailData transactionDetailData) { + final Boolean runningBalanceComputed,final TransactionDetailData transactionDetailData, final CurrencyData currency) { this.id = id; this.officeId = officeId; this.officeName = officeName; @@ -93,6 +96,7 @@ public class JournalEntryData { this.organizationRunningBalance = organizationRunningBalance; this.runningBalanceComputed = runningBalanceComputed; this.transactionDetails = transactionDetailData; + this.currency = currency; } public Long getId() { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java index 789c46f3a..7ef8c2367 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java @@ -27,6 +27,7 @@ import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.service.Page; import org.mifosplatform.infrastructure.core.service.PaginationHelper; import org.mifosplatform.infrastructure.core.service.RoutingDataSource; +import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.portfolio.group.service.SearchParameters; import org.mifosplatform.portfolio.note.data.NoteData; import org.mifosplatform.portfolio.paymentdetail.data.PaymentDetailData; @@ -71,7 +72,9 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat .append(" journalEntry.type_enum as entryType,journalEntry.amount as amount, journalEntry.transaction_id as transactionId,") .append(" journalEntry.entity_type_enum as entityType, journalEntry.entity_id as entityId, creatingUser.id as createdByUserId, ") .append(" creatingUser.username as createdByUserName, journalEntry.description as comments, ") - .append(" journalEntry.created_date as createdDate, journalEntry.reversed as reversed "); + .append(" journalEntry.created_date as createdDate, journalEntry.reversed as reversed, ") + .append(" journalEntry.currency_code as currencyCode, curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ") + .append(" curr.display_symbol as currencyDisplaySymbol, curr.decimal_places as currencyDigits, curr.currency_multiplesof as inMultiplesOf "); if(associationParametersData.isRunningBalanceRequired()){ sb.append(" ,journalEntry.is_running_balance_caculated as runningBalanceComputed, ") .append(" journalEntry.office_running_balance as officeRunningBalance, ") @@ -91,7 +94,8 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat sb.append(" from acc_gl_journal_entry as journalEntry ") .append(" left join acc_gl_account as glAccount on glAccount.id = journalEntry.account_id") .append(" left join m_office as office on office.id = journalEntry.office_id") - .append(" left join m_appuser as creatingUser on creatingUser.id = journalEntry.createdby_id "); + .append(" left join m_appuser as creatingUser on creatingUser.id = journalEntry.createdby_id ") + .append(" join m_currency curr on curr.code = journalEntry.currency_code "); if(associationParametersData.isTransactionDetailsRequired()){ sb.append(" left join m_loan_transaction as lt on journalEntry.loan_transaction_id = lt.id ") .append(" left join m_savings_account_transaction as st on journalEntry.savings_transaction_id = st.id ") @@ -136,6 +140,16 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat BigDecimal officeRunningBalance = null; BigDecimal organizationRunningBalance =null; Boolean runningBalanceComputed =null; + + final String currencyCode = rs.getString("currencyCode"); + final String currencyName = rs.getString("currencyName"); + final String currencyNameCode = rs.getString("currencyNameCode"); + final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol"); + final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits"); + final Integer inMultiplesOf = JdbcSupport.getInteger(rs, "inMultiplesOf"); + final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, inMultiplesOf, + currencyDisplaySymbol, currencyNameCode); + if(associationParametersData.isRunningBalanceRequired()){ officeRunningBalance = rs.getBigDecimal("officeRunningBalance"); organizationRunningBalance = rs.getBigDecimal("organizationRunningBalance"); @@ -171,7 +185,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat } return new JournalEntryData(id, officeId, officeName, glAccountName, glAccountId, glCode, accountType, transactionDate, entryType, amount, transactionId, manualEntry, entityType, entityId, createdByUserId, createdDate, createdByUserName, - comments, reversed, referenceNumber,officeRunningBalance,organizationRunningBalance,runningBalanceComputed,transactionDetailData); + comments, reversed, referenceNumber,officeRunningBalance,organizationRunningBalance,runningBalanceComputed,transactionDetailData, currency); } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java index 7d7fa3a21..bf4623935 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java @@ -268,7 +268,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry final EnumOptionData entryType = AccountingEnumerations.journalEntryType(entryTypeId); return new JournalEntryData(id, officeId, null, null, glAccountId, null, accountType, null, entryType, amount, null, null, - null, null, null, null, null, null, null, null, null, null, null,null); + null, null, null, null, null, null, null, null, null, null, null,null, null); } }