Merge remote-tracking branch 'musoni/MIFOSX-790' into develop
This commit is contained in:
+18
-2
@@ -19517,7 +19517,15 @@ GET https://DomainName/api/v1/journalentries?transactionId=PB37X8Y21EQUY4S
|
|||||||
"reversed": false,
|
"reversed": false,
|
||||||
"officeRunningBalance":0,
|
"officeRunningBalance":0,
|
||||||
"organizationRunningBalance":0
|
"organizationRunningBalance":0
|
||||||
"runningBalanceComputed":false
|
"runningBalanceComputed":false ,
|
||||||
|
"paymentDetails": {
|
||||||
|
"accountNumber": "",
|
||||||
|
"checkNumber": "",
|
||||||
|
"receiptNumber": "ddddd",
|
||||||
|
"bankNumber": "",
|
||||||
|
"routineCode": "",
|
||||||
|
"paymentType": "Cash"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
@@ -19560,7 +19568,15 @@ GET https://DomainName/api/v1/journalentries?transactionId=PB37X8Y21EQUY4S
|
|||||||
"reversed": false,
|
"reversed": false,
|
||||||
"officeRunningBalance":0,
|
"officeRunningBalance":0,
|
||||||
"organizationRunningBalance":0
|
"organizationRunningBalance":0
|
||||||
"runningBalanceComputed":false
|
"runningBalanceComputed":false,
|
||||||
|
"paymentDetails": {
|
||||||
|
"accountNumber": "",
|
||||||
|
"checkNumber": "",
|
||||||
|
"receiptNumber": "ddddd",
|
||||||
|
"bankNumber": "",
|
||||||
|
"routineCode": "",
|
||||||
|
"paymentType": "Cash"
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+4
-1
@@ -59,13 +59,15 @@ public class JournalEntryData {
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final Boolean runningBalanceComputed;
|
private final Boolean runningBalanceComputed;
|
||||||
|
|
||||||
|
private final PaymentDetails paymentDetails;
|
||||||
|
|
||||||
public JournalEntryData(final Long id, final Long officeId, final String officeName, final String glAccountName,
|
public JournalEntryData(final Long id, final Long officeId, final String officeName, final String glAccountName,
|
||||||
final Long glAccountId, final String glAccountCode, final EnumOptionData glAccountClassification,
|
final Long glAccountId, final String glAccountCode, final EnumOptionData glAccountClassification,
|
||||||
final LocalDate transactionDate, final EnumOptionData entryType, final BigDecimal amount, final String transactionId,
|
final LocalDate transactionDate, final EnumOptionData entryType, final BigDecimal amount, final String transactionId,
|
||||||
final Boolean manualEntry, final EnumOptionData entityType, final Long entityId, final Long createdByUserId,
|
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 LocalDate createdDate, final String createdByUserName, final String comments, final Boolean reversed,
|
||||||
final String referenceNumber, final BigDecimal officeRunningBalance, final BigDecimal organizationRunningBalance,
|
final String referenceNumber, final BigDecimal officeRunningBalance, final BigDecimal organizationRunningBalance,
|
||||||
final Boolean runningBalanceComputed) {
|
final Boolean runningBalanceComputed,final PaymentDetails paymentDetails) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.officeId = officeId;
|
this.officeId = officeId;
|
||||||
this.officeName = officeName;
|
this.officeName = officeName;
|
||||||
@@ -89,6 +91,7 @@ public class JournalEntryData {
|
|||||||
this.officeRunningBalance = officeRunningBalance;
|
this.officeRunningBalance = officeRunningBalance;
|
||||||
this.organizationRunningBalance = organizationRunningBalance;
|
this.organizationRunningBalance = organizationRunningBalance;
|
||||||
this.runningBalanceComputed = runningBalanceComputed;
|
this.runningBalanceComputed = runningBalanceComputed;
|
||||||
|
this.paymentDetails = paymentDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
|
|||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
package org.mifosplatform.accounting.journalentry.data;
|
||||||
|
|
||||||
|
public class PaymentDetails {
|
||||||
|
|
||||||
|
private final String accountNumber;
|
||||||
|
private final String checkNumber;
|
||||||
|
private final String receiptNumber;
|
||||||
|
private final String bankNumber;
|
||||||
|
private final String routineCode;
|
||||||
|
private final String paymentType;
|
||||||
|
|
||||||
|
public PaymentDetails(final String accountNumber,
|
||||||
|
final String checkNumber,
|
||||||
|
final String receiptNumber,
|
||||||
|
final String bankNumber,
|
||||||
|
final String routineCode,
|
||||||
|
final String paymentType)
|
||||||
|
{
|
||||||
|
this.accountNumber = accountNumber;
|
||||||
|
this.checkNumber = checkNumber;
|
||||||
|
this.receiptNumber = receiptNumber;
|
||||||
|
this.bankNumber = bankNumber;
|
||||||
|
this.routineCode = routineCode ;
|
||||||
|
this.paymentType = paymentType;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+60
-15
@@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.mifosplatform.accounting.journalentry.service;
|
package org.mifosplatform.accounting.journalentry.service;
|
||||||
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -17,6 +18,7 @@ import org.apache.commons.lang.StringUtils;
|
|||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.mifosplatform.accounting.common.AccountingEnumerations;
|
import org.mifosplatform.accounting.common.AccountingEnumerations;
|
||||||
import org.mifosplatform.accounting.journalentry.data.JournalEntryData;
|
import org.mifosplatform.accounting.journalentry.data.JournalEntryData;
|
||||||
|
import org.mifosplatform.accounting.journalentry.data.PaymentDetails;
|
||||||
import org.mifosplatform.accounting.journalentry.exception.JournalEntriesNotFoundException;
|
import org.mifosplatform.accounting.journalentry.exception.JournalEntriesNotFoundException;
|
||||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||||
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
||||||
@@ -47,7 +49,8 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
|
|
||||||
public String schema() {
|
public String schema() {
|
||||||
return " journalEntry.id as id, glAccount.classification_enum as classification ,"
|
return " journalEntry.id as id, glAccount.classification_enum as classification ,"
|
||||||
+ " glAccount.name as glAccountName, glAccount.gl_code as glAccountCode, journalEntry.account_id as glAccountId,"
|
+ "journalEntry.transaction_id,"
|
||||||
|
+ " glAccount.name as glAccountName, glAccount.gl_code as glAccountCode,glAccount.id as glAccountId, "
|
||||||
+ " journalEntry.office_id as officeId, office.name as officeName, journalEntry.ref_num as referenceNumber, "
|
+ " journalEntry.office_id as officeId, office.name as officeName, journalEntry.ref_num as referenceNumber, "
|
||||||
+ " journalEntry.manual_entry as manualEntry,journalEntry.entry_date as transactionDate, "
|
+ " journalEntry.manual_entry as manualEntry,journalEntry.entry_date as transactionDate, "
|
||||||
+ " journalEntry.type_enum as entryType,journalEntry.amount as amount, journalEntry.transaction_id as transactionId,"
|
+ " journalEntry.type_enum as entryType,journalEntry.amount as amount, journalEntry.transaction_id as transactionId,"
|
||||||
@@ -56,10 +59,23 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
+ " journalEntry.created_date as createdDate, journalEntry.reversed as reversed, "
|
+ " journalEntry.created_date as createdDate, journalEntry.reversed as reversed, "
|
||||||
+ " journalEntry.is_running_balance_caculated as runningBalanceComputed, "
|
+ " journalEntry.is_running_balance_caculated as runningBalanceComputed, "
|
||||||
+ " journalEntry.office_running_balance as officeRunningBalance, "
|
+ " journalEntry.office_running_balance as officeRunningBalance, "
|
||||||
+ " journalEntry.organization_running_balance as organizationRunningBalance "
|
+ " journalEntry.organization_running_balance as organizationRunningBalance, "
|
||||||
+ " from acc_gl_journal_entry journalEntry, acc_gl_account glAccount, m_office office, m_appuser creatingUser "
|
+ " pd.receipt_number as receiptNumber, "
|
||||||
+ " where journalEntry.account_id = glAccount.id "
|
+ " pd.check_number as checkNumber, "
|
||||||
+ " and journalEntry.office_id = office.id and journalEntry.createdby_id = creatingUser.id ";
|
+ " pd.account_number as accountNumber, "
|
||||||
|
+ " cdv.code_value as paymentType, "
|
||||||
|
+ " pd.bank_number as bankNumber, "
|
||||||
|
+ " pd.routing_code as routingCode, "
|
||||||
|
+ " pd.check_number as checkNumber "
|
||||||
|
+ " from acc_gl_journal_entry as journalEntry "
|
||||||
|
+ " left join acc_gl_account as glAccount on glAccount.id = journalEntry.account_id"
|
||||||
|
+ " left join m_office as office on office.id = journalEntry.office_id"
|
||||||
|
+ " left join m_appuser as creatingUser on creatingUser.id = journalEntry.createdby_id "
|
||||||
|
+ " left join m_loan_transaction as lt on journalEntry.transaction_id = lt.id "
|
||||||
|
+ " left join m_payment_detail as pd on lt.payment_detail_id = pd.id "
|
||||||
|
+ " left join m_code_value as cdv on cdv.id = pd.payment_type_cv_id " ;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -96,9 +112,18 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
final BigDecimal organizationRunningBalance = rs.getBigDecimal("organizationRunningBalance");
|
final BigDecimal organizationRunningBalance = rs.getBigDecimal("organizationRunningBalance");
|
||||||
final Boolean runningBalanceComputed = rs.getBoolean("runningBalanceComputed");
|
final Boolean runningBalanceComputed = rs.getBoolean("runningBalanceComputed");
|
||||||
|
|
||||||
|
final PaymentDetails paymentDetail = new PaymentDetails(
|
||||||
|
rs.getString("accountNumber"),
|
||||||
|
rs.getString("checkNumber"),
|
||||||
|
rs.getString("receiptNumber"),
|
||||||
|
rs.getString("bankNumber"),
|
||||||
|
rs.getString("routingCode"),
|
||||||
|
rs.getString("paymentType")
|
||||||
|
);
|
||||||
|
|
||||||
return new JournalEntryData(id, officeId, officeName, glAccountName, glAccountId, glCode, accountType, transactionDate,
|
return new JournalEntryData(id, officeId, officeName, glAccountName, glAccountId, glCode, accountType, transactionDate,
|
||||||
entryType, amount, transactionId, manualEntry, entityType, entityId, createdByUserId, createdDate, createdByUserName,
|
entryType, amount, transactionId, manualEntry, entityType, entityId, createdByUserId, createdDate, createdByUserName,
|
||||||
comments, reversed, referenceNumber,officeRunningBalance,organizationRunningBalance,runningBalanceComputed);
|
comments, reversed, referenceNumber,officeRunningBalance,organizationRunningBalance,runningBalanceComputed,paymentDetail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,29 +137,40 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
|
|
||||||
final Object[] objectArray = new Object[5];
|
final Object[] objectArray = new Object[5];
|
||||||
int arrayPos = 0;
|
int arrayPos = 0;
|
||||||
|
String whereClose = " where ";
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(transactionId)) {
|
if (StringUtils.isNotBlank(transactionId)) {
|
||||||
sqlBuilder.append(" and journalEntry.transaction_id = ?");
|
sqlBuilder.append(whereClose+" journalEntry.transaction_id = ?");
|
||||||
objectArray[arrayPos] = transactionId;
|
objectArray[arrayPos] = transactionId;
|
||||||
arrayPos = arrayPos + 1;
|
arrayPos = arrayPos + 1;
|
||||||
|
|
||||||
|
whereClose =" and ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entityType != null && entityType != 0 && (onlyManualEntries == null)) {
|
if (entityType != null && entityType != 0 && (onlyManualEntries == null)) {
|
||||||
sqlBuilder.append(" and journalEntry.entity_type_enum = ?");
|
|
||||||
|
sqlBuilder.append(whereClose+" journalEntry.entity_type_enum = ?");
|
||||||
|
|
||||||
objectArray[arrayPos] = entityType;
|
objectArray[arrayPos] = entityType;
|
||||||
arrayPos = arrayPos + 1;
|
arrayPos = arrayPos + 1;
|
||||||
|
|
||||||
|
whereClose =" and ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchParameters.isOfficeIdPassed()) {
|
if (searchParameters.isOfficeIdPassed()) {
|
||||||
sqlBuilder.append(" and journalEntry.office_id = ?");
|
sqlBuilder.append(whereClose+" journalEntry.office_id = ?");
|
||||||
objectArray[arrayPos] = searchParameters.getOfficeId();
|
objectArray[arrayPos] = searchParameters.getOfficeId();
|
||||||
arrayPos = arrayPos + 1;
|
arrayPos = arrayPos + 1;
|
||||||
|
|
||||||
|
whereClose =" and ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glAccountId != null && glAccountId != 0) {
|
if (glAccountId != null && glAccountId != 0) {
|
||||||
sqlBuilder.append(" and journalEntry.account_id = ?");
|
sqlBuilder.append(whereClose+" journalEntry.account_id = ?");
|
||||||
objectArray[arrayPos] = glAccountId;
|
objectArray[arrayPos] = glAccountId;
|
||||||
arrayPos = arrayPos + 1;
|
arrayPos = arrayPos + 1;
|
||||||
|
|
||||||
|
whereClose =" and ";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromDate != null || toDate != null) {
|
if (fromDate != null || toDate != null) {
|
||||||
@@ -142,7 +178,10 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
String fromDateString = null;
|
String fromDateString = null;
|
||||||
String toDateString = null;
|
String toDateString = null;
|
||||||
if (fromDate != null && toDate != null) {
|
if (fromDate != null && toDate != null) {
|
||||||
sqlBuilder.append(" and journalEntry.entry_date between ? and ? ");
|
sqlBuilder.append(whereClose+" journalEntry.entry_date between ? and ? ");
|
||||||
|
|
||||||
|
whereClose =" and ";
|
||||||
|
|
||||||
fromDateString = df.format(fromDate);
|
fromDateString = df.format(fromDate);
|
||||||
toDateString = df.format(toDate);
|
toDateString = df.format(toDate);
|
||||||
objectArray[arrayPos] = fromDateString;
|
objectArray[arrayPos] = fromDateString;
|
||||||
@@ -150,21 +189,27 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
objectArray[arrayPos] = toDateString;
|
objectArray[arrayPos] = toDateString;
|
||||||
arrayPos = arrayPos + 1;
|
arrayPos = arrayPos + 1;
|
||||||
} else if (fromDate != null) {
|
} else if (fromDate != null) {
|
||||||
sqlBuilder.append(" and journalEntry.entry_date >= ? ");
|
sqlBuilder.append(whereClose+" journalEntry.entry_date >= ? ");
|
||||||
fromDateString = df.format(fromDate);
|
fromDateString = df.format(fromDate);
|
||||||
objectArray[arrayPos] = fromDateString;
|
objectArray[arrayPos] = fromDateString;
|
||||||
arrayPos = arrayPos + 1;
|
arrayPos = arrayPos + 1;
|
||||||
|
whereClose =" and ";
|
||||||
|
|
||||||
} else if (toDate != null) {
|
} else if (toDate != null) {
|
||||||
sqlBuilder.append(" and journalEntry.entry_date <= ? ");
|
sqlBuilder.append(whereClose+" journalEntry.entry_date <= ? ");
|
||||||
toDateString = df.format(toDate);
|
toDateString = df.format(toDate);
|
||||||
objectArray[arrayPos] = toDateString;
|
objectArray[arrayPos] = toDateString;
|
||||||
arrayPos = arrayPos + 1;
|
arrayPos = arrayPos + 1;
|
||||||
|
|
||||||
|
whereClose =" and ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onlyManualEntries != null) {
|
if (onlyManualEntries != null) {
|
||||||
if (onlyManualEntries) {
|
if (onlyManualEntries) {
|
||||||
sqlBuilder.append(" and journalEntry.manual_entry = 1");
|
sqlBuilder.append(whereClose+" journalEntry.manual_entry = 1");
|
||||||
|
|
||||||
|
whereClose =" and ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +243,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
final GLJournalEntryMapper rm = new GLJournalEntryMapper();
|
final GLJournalEntryMapper rm = new GLJournalEntryMapper();
|
||||||
final String sql = "select " + rm.schema() + " and journalEntry.id = ?";
|
final String sql = "select " + rm.schema() + " where journalEntry.id = ?";
|
||||||
|
|
||||||
final JournalEntryData glJournalEntryData = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { glJournalEntryId });
|
final JournalEntryData glJournalEntryData = this.jdbcTemplate.queryForObject(sql, rm, new Object[] { glJournalEntryId });
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -266,7 +266,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
|||||||
final EnumOptionData entryType = AccountingEnumerations.journalEntryType(entryTypeId);
|
final EnumOptionData entryType = AccountingEnumerations.journalEntryType(entryTypeId);
|
||||||
|
|
||||||
return new JournalEntryData(id, officeId, null, null, glAccountId, null, accountType, null, entryType, amount, null, null,
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user