branch feature/1241-account-report updated (d720088 -> 4d8c038)
This is an automated email from the git hooks/post-receive script. New change to branch feature/1241-account-report in repository lima. See http://git.chorem.org/lima.git from d720088 refs #1241 Ajout de traductions new 4d8c038 refs #1298 corrige la génération de rapport pour les comptes si aucun compte n'existe The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 4d8c038bbc2c3f0ab0971df75a1a24e9314d75df Author: dcosse <cosse@codelutin.com> Date: Thu Sep 24 15:00:36 2015 +0200 refs #1298 corrige la génération de rapport pour les comptes si aucun compte n'existe Summary of changes: .../lima/business/ejb/AccountServiceImpl.java | 7 +- .../ejb/report/AccountReportServiceImpl.java | 98 +++++++++++----------- 2 files changed, 56 insertions(+), 49 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1241-account-report in repository lima. See http://git.chorem.org/lima.git commit 4d8c038bbc2c3f0ab0971df75a1a24e9314d75df Author: dcosse <cosse@codelutin.com> Date: Thu Sep 24 15:00:36 2015 +0200 refs #1298 corrige la génération de rapport pour les comptes si aucun compte n'existe --- .../lima/business/ejb/AccountServiceImpl.java | 7 +- .../ejb/report/AccountReportServiceImpl.java | 98 +++++++++++----------- 2 files changed, 56 insertions(+), 49 deletions(-) diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java index 96a075b..3505633 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java @@ -299,8 +299,11 @@ public class AccountServiceImpl extends AbstractLimaService implements AccountSe @Override public Account findAccountById(String accountId) { - AccountTopiaDao accountDao = getDaoHelper().getAccountDao(); - Account account = accountDao.forTopiaIdEquals(accountId).findUniqueOrNull(); + Account account = null; + if (StringUtils.isNotBlank(accountId)) { + AccountTopiaDao accountDao = getDaoHelper().getAccountDao(); + account = accountDao.forTopiaIdEquals(accountId).findUniqueOrNull(); + } return account; } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/AccountReportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/AccountReportServiceImpl.java index 94c74ff..14fced0 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/AccountReportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/AccountReportServiceImpl.java @@ -2,6 +2,7 @@ package org.chorem.lima.business.ejb.report; import net.sf.jasperreports.engine.JasperReport; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.chorem.lima.beans.AccountEntry; import org.chorem.lima.beans.AccountEntryImpl; import org.chorem.lima.beans.DocumentReport; @@ -48,61 +49,64 @@ public class AccountReportServiceImpl extends AbstractLimaService implements Acc setHeaderColumnTitles(documentReport); - AccountTopiaDao accountTopiaDao = getDaoHelper().getAccountDao(); - Account account = accountTopiaDao.forTopiaIdEquals(accountId).findUniqueOrNull(); - - if (from != null && to != null && account != null) { - String selectedAccounts = account.getAccountNumber(); - - Collection<AccountEntry> accountEntries = new ArrayList<>(); - - ReportsDatas results = reportService.generateAccountsReports(account, true, from, to); - List<Entry> entries = results.getListEntry(); - - if (CollectionUtils.isNotEmpty(entries)) { - for (Entry entry : entries) { - if (entry.getAmount() == null || BigDecimal.ZERO.compareTo(entry.getAmount()) == 0) { - continue; + if (StringUtils.isNotBlank(accountId)) { + AccountTopiaDao accountTopiaDao = getDaoHelper().getAccountDao(); + Account account = accountTopiaDao.forTopiaIdEquals(accountId).findUniqueOrNull(); + + if (from != null && to != null && account != null) { + String selectedAccounts = account.getAccountNumber(); + + Collection<AccountEntry> accountEntries = new ArrayList<>(); + + ReportsDatas results = reportService.generateAccountsReports(account, true, from, to); + List<Entry> entries = results.getListEntry(); + + if (CollectionUtils.isNotEmpty(entries)) { + for (Entry entry : entries) { + if (entry.getAmount() == null || BigDecimal.ZERO.compareTo(entry.getAmount()) == 0) { + continue; + } + + String entryAccountNumber = entry.getAccount().getAccountNumber(); + String code = ""; + if (entry.getFinancialTransaction().getEntryBook() != null) { + code = entry.getFinancialTransaction().getEntryBook().getCode(); + } + + AccountEntry accountEntry = new AccountEntryImpl(); + accountEntry.setAccountNumber(entryAccountNumber); + accountEntry.setTransactionDate(entry.getFinancialTransaction().getTransactionDate()); + accountEntry.setCode(code); + accountEntry.setVoucher(entry.getVoucher()); + accountEntry.setDescription(entry.getDescription()); + accountEntry.setLettering(entry.getLettering()); + accountEntry.setDebit(entry.isDebit() ? entry.getAmount() : BigDecimal.ZERO); + accountEntry.setCredit(entry.isDebit() ? BigDecimal.ZERO : entry.getAmount()); + accountEntry.setFormatter(bigDecimalFormat); + accountEntry.setDateFormat(LimaBusinessConfig.getInstance().getDateFormat()); + accountEntry.setSubTotalForLabel(t("lima-business.document.subTotal")); + accountEntries.add(accountEntry); } + } - String entryAccountNumber = entry.getAccount().getAccountNumber(); - String code = ""; - if (entry.getFinancialTransaction().getEntryBook() != null) { - code = entry.getFinancialTransaction().getEntryBook().getCode(); - } + documentReport.addAllAccounts(accountEntries); - AccountEntry accountEntry = new AccountEntryImpl(); - accountEntry.setAccountNumber(entryAccountNumber); - accountEntry.setTransactionDate(entry.getFinancialTransaction().getTransactionDate()); - accountEntry.setCode(code); - accountEntry.setVoucher(entry.getVoucher()); - accountEntry.setDescription(entry.getDescription()); - accountEntry.setLettering(entry.getLettering()); - accountEntry.setDebit(entry.isDebit() ? entry.getAmount() : BigDecimal.ZERO); - accountEntry.setCredit(entry.isDebit() ? BigDecimal.ZERO : entry.getAmount()); - accountEntry.setFormatter(bigDecimalFormat); - accountEntry.setDateFormat(LimaBusinessConfig.getInstance().getDateFormat()); - accountEntry.setSubTotalForLabel(t("lima-business.document.subTotal")); - accountEntries.add(accountEntry); + if (CollectionUtils.isEmpty(accountEntries)) { + selectedAccounts += t("lima-business.document.selectedAccountNoEntryFound"); + } else if (accountEntries.size() == 1){ + selectedAccounts += t("lima-business.document.selectedAccountAndSubAccount"); + } else { + selectedAccounts += t("lima-business.document.selectedAccountAndSubAccounts"); } - } - documentReport.addAllAccounts(accountEntries); + documentReport.setHeaderSelectedAccounts(selectedAccounts); - if (CollectionUtils.isEmpty(accountEntries)) { - selectedAccounts += t("lima-business.document.selectedAccountNoEntryFound"); - } else if (accountEntries.size() == 1){ - selectedAccounts += t("lima-business.document.selectedAccountAndSubAccount"); - } else { - selectedAccounts += t("lima-business.document.selectedAccountAndSubAccounts"); + } else if (log.isWarnEnabled()) { + log.warn("No account present"); } - documentReport.setHeaderSelectedAccounts(selectedAccounts); - - } else { - if (log.isWarnEnabled()) { - log.warn("No account present"); - } + } else if (log.isWarnEnabled()) { + log.warn("No account present"); } return documentReport; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm