This is an automated email from the git hooks/post-receive script. New commit to branch feature/newReportBuilder in repository lima. See http://git.chorem.org/lima.git commit ecf8a6c675b17df2e79034a69229c442cfc24681 Author: dcosse <japbiw74> Date: Fri Jan 30 15:45:48 2015 +0100 refs #769 amélioration sur la récupération et la mise à jour des paramètres --- .../chorem/lima/business/api/OptionsService.java | 6 +++ .../business/api/report/BalanceReportService.java | 2 +- .../api/report/GeneralEntryBookReportService.java | 3 +- .../business/api/report/LedgerReportService.java | 3 +- .../report/ProvisionalEntryBookReportService.java | 3 +- .../chorem/lima/business/LimaServiceConfig.java | 1 - .../lima/business/ejb/OptionsServiceImpl.java | 43 ++++++++++++++-------- .../ejb/report/BalanceReportServiceImpl.java | 4 +- .../report/GeneralEntryBookReportServiceImpl.java | 4 +- .../ejb/report/LedgerReportServiceImpl.java | 4 +- .../ProvisionalEntryBookReportServiceImpl.java | 4 +- .../lima/business/utils/BigDecimalToString.java | 26 ++++++------- .../chorem/lima/business/utils/DocumentsEnum.java | 2 +- .../main/java/org/chorem/lima/LimaSwingConfig.java | 15 ++------ .../chorem/lima/web/action/DocumentService.java | 16 ++++---- .../chorem/lima/web/service/HttpServerService.java | 36 +++--------------- .../org/chorem/lima/web/action/ReportTest.java | 2 +- 17 files changed, 78 insertions(+), 96 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java index 80a14c9..c0217fb 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/OptionsService.java @@ -41,6 +41,12 @@ public interface OptionsService { */ void setScale(String scale); + void setThousandSeparator(String thousandSeparator); + + void setCurrency(boolean currency); + + void setDecimalSeparator(String decimalSeparator); + /** * Gets the business scale * diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/report/BalanceReportService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/BalanceReportService.java index 0a86213..9426ea8 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/report/BalanceReportService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/BalanceReportService.java @@ -40,5 +40,5 @@ public interface BalanceReportService { * @param selectedAccounts if null all accounts will be selected * @return the balance beans */ - DocumentReport getBalanceDocumentReport(Date from, Date to, String selectedAccounts, String Currency, DecimalFormat bigDecimalFormat); + DocumentReport getBalanceDocumentReport(Date from, Date to, String selectedAccounts, DecimalFormat bigDecimalFormat); } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/report/GeneralEntryBookReportService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/GeneralEntryBookReportService.java index 134eaf0..b1af150 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/report/GeneralEntryBookReportService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/GeneralEntryBookReportService.java @@ -15,8 +15,7 @@ public interface GeneralEntryBookReportService { * * @param from from date * @param to to date - * @param currency the currency used * @return the entryBook beans */ - DocumentReport getGeneralEntryBookDocumentReport(Date from, Date to, String currency, DecimalFormat bigDecimalFormat); + DocumentReport getGeneralEntryBookDocumentReport(Date from, Date to, DecimalFormat bigDecimalFormat); } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/report/LedgerReportService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/LedgerReportService.java index c63c203..2e31073 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/report/LedgerReportService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/LedgerReportService.java @@ -14,8 +14,7 @@ public interface LedgerReportService { * * @param beginDate period from * @param endDate period to - * @param currency current currency * @return */ - DocumentReport getLedgerDocumentReport(Date beginDate, Date endDate, String currency, DecimalFormat decimalFormat); + DocumentReport getLedgerDocumentReport(Date beginDate, Date endDate, DecimalFormat decimalFormat); } diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/report/ProvisionalEntryBookReportService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/ProvisionalEntryBookReportService.java index b1930ba..5c10655 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/report/ProvisionalEntryBookReportService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/ProvisionalEntryBookReportService.java @@ -16,8 +16,7 @@ public interface ProvisionalEntryBookReportService { * @param beginDate period from * @param endDate period to * @param entryBookCodes selected entry books if null all are selected - * @param currency current currency * @return */ - DocumentReport getEntryBookDocumentReport(Date beginDate, Date endDate, List<String> entryBookCodes, String currency, DecimalFormat bigDecimalFormat); + DocumentReport getEntryBookDocumentReport(Date beginDate, Date endDate, List<String> entryBookCodes, DecimalFormat bigDecimalFormat); } diff --git a/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java b/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java index b1caf54..66a079b 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java +++ b/lima-business/src/main/java/org/chorem/lima/business/LimaServiceConfig.java @@ -255,7 +255,6 @@ public class LimaServiceConfig { public char getDecimalSeparator() { char decimalSeparator = config.getOption(ServiceConfigOption.DECIMAL_SEPARATOR.key).charAt(0); - LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); return decimalSeparator; } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java index caf775e..f29706a 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java @@ -23,6 +23,7 @@ package org.chorem.lima.business.ejb; import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.OptionsService; +import org.chorem.lima.business.utils.BigDecimalToString; import javax.ejb.Remote; import javax.ejb.Stateless; @@ -38,13 +39,39 @@ public class OptionsServiceImpl extends AbstractLimaService implements OptionsSe public OptionsServiceImpl() { scale = LimaServiceConfig.getInstance().getScale(); vatPDFUrl = LimaServiceConfig.getInstance().getVatPDFUrl(); + BigDecimalToString.generateDecimalFormat(); } + @Override public int getScale() { return scale; } @Override + public void setScale(String scale) { + LimaServiceConfig.getInstance().setScale(scale); + BigDecimalToString.generateDecimalFormat(); + } + + @Override + public void setThousandSeparator(String thousandSeparator) { + LimaServiceConfig.getInstance().setThousandSeparator(thousandSeparator); + BigDecimalToString.generateDecimalFormat(); + } + + @Override + public void setCurrency(boolean currency) { + LimaServiceConfig.getInstance().setCurrency(Boolean.toString(currency)); + BigDecimalToString.generateDecimalFormat(); + } + + @Override + public void setDecimalSeparator(String decimalSeparator) { + LimaServiceConfig.getInstance().setDecimalSeparator(decimalSeparator); + BigDecimalToString.generateDecimalFormat(); + } + + @Override public void setReportsDir(String path) { LimaServiceConfig.getInstance().setReportsModelDir(path); } @@ -104,22 +131,6 @@ public class OptionsServiceImpl extends AbstractLimaService implements OptionsSe LimaServiceConfig.getInstance().setEntryBookTransactionReportModelPath(path); } -// @Override -// public void setBigDecimalFormat(String format) { -// LimaServiceConfig.getInstance().setBigDecimalFormat(format); -// } -// -// @Override -// public String getBigDecimalFormat() { -// String format = LimaServiceConfig.getInstance().getBigDecimalFormat(); -// return format; -// } - - @Override - public void setScale(String scale) { - LimaServiceConfig.getInstance().setScale(scale); - } - public String getVatPDFUrl() { return vatPDFUrl; } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceReportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceReportServiceImpl.java index c02a85a..46606f2 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceReportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/BalanceReportServiceImpl.java @@ -91,7 +91,7 @@ public class BalanceReportServiceImpl extends AbstractLimaService implements Bal }; @Override - public DocumentReport getBalanceDocumentReport(Date from, Date to, String selectedAccounts, String currency, DecimalFormat bigDecimalFormat) { + public DocumentReport getBalanceDocumentReport(Date from, Date to, String selectedAccounts, DecimalFormat bigDecimalFormat) { String balanceAccountReportModelPath = LimaServiceConfig.getInstance().getBalanceAccountReportModelPath(); String balanceSubAccountReportModelPath = LimaServiceConfig.getInstance().getBalanceSubAccountReportModelPath(); @@ -103,7 +103,7 @@ public class BalanceReportServiceImpl extends AbstractLimaService implements Bal // general info about balance report documentReport.setTitle(TITLE); - documentReport.setCurrency(currency); + documentReport.setCurrency(bigDecimalFormat.getDecimalFormatSymbols().getCurrencySymbol()); documentReport.setFromDate(from); documentReport.setToDate(to); documentReport.setSubReportPath(balanceAccountReportModelPath); diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/GeneralEntryBookReportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/GeneralEntryBookReportServiceImpl.java index 442aaac..ff77565 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/GeneralEntryBookReportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/GeneralEntryBookReportServiceImpl.java @@ -72,7 +72,7 @@ public class GeneralEntryBookReportServiceImpl extends AbstractLimaService imple protected static final String TITLE = "Journal Général Provisoire"; @Override - public DocumentReport getGeneralEntryBookDocumentReport(Date beginDate, Date endDate, String currency, DecimalFormat bigDecimalFormat) { + public DocumentReport getGeneralEntryBookDocumentReport(Date beginDate, Date endDate, DecimalFormat bigDecimalFormat) { String generalEntryBookReportPath = LimaServiceConfig.getInstance().getGeneralEntryBookReportModelPath(); String generalEntryBookEntryReportPath = LimaServiceConfig.getInstance().getGeneralEntryBookEntryReportModelPath(); @@ -85,7 +85,7 @@ public class GeneralEntryBookReportServiceImpl extends AbstractLimaService imple // general infos about balance report documentReport.setTitle(TITLE); - documentReport.setCurrency(currency); + documentReport.setCurrency(bigDecimalFormat.getDecimalFormatSymbols().getCurrencySymbol()); documentReport.setFromDate(beginDate); documentReport.setToDate(endDate); documentReport.setSubReportPath(generalEntryBookReportPath); diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/LedgerReportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/LedgerReportServiceImpl.java index 9c6506e..b973893 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/LedgerReportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/LedgerReportServiceImpl.java @@ -52,7 +52,7 @@ public class LedgerReportServiceImpl extends AbstractLimaService implements Ledg protected static final String TITLE = t("lima-business.document.ledger"); @Override - public DocumentReport getLedgerDocumentReport(Date beginDate, Date endDate, String currency, DecimalFormat decimalFormat) { + public DocumentReport getLedgerDocumentReport(Date beginDate, Date endDate, DecimalFormat decimalFormat) { String generalLedgerReportModelPath = LimaServiceConfig.getInstance().getGeneralLedgerModelPath(); String generalLedgerEntryModelPath = LimaServiceConfig.getInstance().getGeneralLedgerEntryModelPath(); @@ -61,7 +61,7 @@ public class LedgerReportServiceImpl extends AbstractLimaService implements Ledg DocumentReport result = new DocumentReportImpl(); result.setFormatter(decimalFormat); - result.setCurrency(currency); + result.setCurrency(decimalFormat.getDecimalFormatSymbols().getCurrencySymbol()); //result.setFromAccount(); //result.setToAccount(); result.setFromDate(beginDate); diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/ProvisionalEntryBookReportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/ProvisionalEntryBookReportServiceImpl.java index f96b261..51956d5 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/report/ProvisionalEntryBookReportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/ProvisionalEntryBookReportServiceImpl.java @@ -66,7 +66,7 @@ public class ProvisionalEntryBookReportServiceImpl implements ProvisionalEntryBo * - BIG_DECIMAL_FORMAT **/ @Override - public DocumentReport getEntryBookDocumentReport(Date beginDate, Date endDate, List<String> entryBookCodes, String currency, DecimalFormat bigDecimalFormat) { + public DocumentReport getEntryBookDocumentReport(Date beginDate, Date endDate, List<String> entryBookCodes, DecimalFormat bigDecimalFormat) { LimaServiceConfig config = LimaServiceConfig.getInstance(); String entryBookReportPath = config.getEntryBookEntryBookReportModelPath(); @@ -85,7 +85,7 @@ public class ProvisionalEntryBookReportServiceImpl implements ProvisionalEntryBo // general infos about balance report documentReport.setTitle(TITLE); - documentReport.setCurrency(currency); + documentReport.setCurrency(bigDecimalFormat.getDecimalFormatSymbols().getCurrencySymbol()); documentReport.setFromDate(beginDate); documentReport.setToDate(endDate); diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java b/lima-business/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java index c40813c..2325dee 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java +++ b/lima-business/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java @@ -2,7 +2,6 @@ package org.chorem.lima.business.utils; import org.chorem.lima.business.LimaServiceConfig; -import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; @@ -11,14 +10,9 @@ import java.text.DecimalFormatSymbols; */ public class BigDecimalToString { - public static String format(BigDecimal value) { + protected static DecimalFormat decimalFormat; - DecimalFormat formatter = getDecimalFormat(); - String result = formatter.format(value); - return result; - } - - public static DecimalFormat getDecimalFormat() { + public static void generateDecimalFormat() { LimaServiceConfig config = LimaServiceConfig.getInstance(); StringBuilder scale = new StringBuilder(); for (int i = 0; i < config.getScale(); i++) { @@ -28,17 +22,23 @@ public class BigDecimalToString { if (config.getCurrency()) { currency = " ¤"; } - DecimalFormat formatter = new DecimalFormat("##0." + scale.toString() + currency); + decimalFormat = new DecimalFormat("##0." + scale.toString() + currency); DecimalFormatSymbols symbol = new DecimalFormatSymbols(); //set decimalSeparator and thousandSeparator preferences symbol.setDecimalSeparator(config.getDecimalSeparator()); symbol.setMonetaryDecimalSeparator(config.getDecimalSeparator()); symbol.setGroupingSeparator(config.getThousandSeparator()); - formatter.setDecimalFormatSymbols(symbol); + decimalFormat.setDecimalFormatSymbols(symbol); //always set grouping - formatter.setGroupingUsed(true); - formatter.setGroupingSize(3); - return formatter; + decimalFormat.setGroupingUsed(true); + decimalFormat.setGroupingSize(3); + } + + public static DecimalFormat getDecimalFormat() { + if (decimalFormat == null) { + BigDecimalToString.generateDecimalFormat(); + } + return decimalFormat; } } diff --git a/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java b/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java index 70258ad..e692408 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java +++ b/lima-business/src/main/java/org/chorem/lima/business/utils/DocumentsEnum.java @@ -32,7 +32,7 @@ public enum DocumentsEnum { BALANCE(t("lima-business.document.balance"), "lima_balance"), LEDGER(t("lima-business.document.ledger"), "lima_ledger"), FINANCIALSTATEMENT(t("lima-business.document.financialstatement"), "lima_financialstatements"), - VAT(t("lima-business.document.vat"), "lima_vat"), +// VAT(t("lima-business.document.vat"), "lima_vat"), ACCOUNT(t("lima-business.document.account"), "lima_account"); private final String fileName; diff --git a/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java b/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java index 143e4cd..53d0eba 100644 --- a/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java +++ b/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java @@ -28,7 +28,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.actions.MiscAction; -import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.OptionsService; import org.chorem.lima.entity.LimaCallaoEntityEnum; import org.chorem.lima.service.LimaServiceFactory; @@ -193,7 +192,6 @@ public class LimaSwingConfig extends ApplicationConfig { */ public char getDecimalSeparator() { char decimalSeparator = getOption(Option.DECIMAL_SEPARATOR.key).charAt(0); - LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); return decimalSeparator; } @@ -205,8 +203,7 @@ public class LimaSwingConfig extends ApplicationConfig { */ public void setDecimalSeparator(String decimalSeparator) { setOption(Option.DECIMAL_SEPARATOR.key, decimalSeparator); - LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); - serviceConfig.setDecimalSeparator(decimalSeparator); + optionsService.setDecimalSeparator(decimalSeparator); saveForUser(); firePropertyChange("decimalSeparator", null, decimalSeparator); } @@ -228,14 +225,12 @@ public class LimaSwingConfig extends ApplicationConfig { */ public void setScale(String scale) { setOption(Option.SCALE.key, scale); - LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); - serviceConfig.setScale(scale); + optionsService.setScale(scale); saveForUser(); firePropertyChange("scale", null, scale); if (log.isInfoEnabled()) { log.info("new scale" + scale); } - optionsService.setScale(scale); } /** @@ -255,8 +250,7 @@ public class LimaSwingConfig extends ApplicationConfig { */ public void setThousandSeparator(String thousandSeparator) { setOption(Option.THOUSAND_SEPARATOR.key, thousandSeparator); - LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); - serviceConfig.setThousandSeparator(thousandSeparator); + optionsService.setThousandSeparator(thousandSeparator); saveForUser(); firePropertyChange("thousandSeparator", null, thousandSeparator); } @@ -277,8 +271,7 @@ public class LimaSwingConfig extends ApplicationConfig { */ public void setCurrency(boolean currency) { setOption(Option.CURRENCY.key, Boolean.toString(currency)); - LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); - serviceConfig.setCurrency(Boolean.toString(currency)); + optionsService.setCurrency(currency); saveForUser(); firePropertyChange("currency", null, currency); } diff --git a/lima-web/src/main/java/org/chorem/lima/web/action/DocumentService.java b/lima-web/src/main/java/org/chorem/lima/web/action/DocumentService.java index 3369e9a..4fcf5a7 100644 --- a/lima-web/src/main/java/org/chorem/lima/web/action/DocumentService.java +++ b/lima-web/src/main/java/org/chorem/lima/web/action/DocumentService.java @@ -538,29 +538,29 @@ public class DocumentService { //############## balance ############## - public DocumentReport createBalanceDocuments(Date beginDate, Date endDate, String fromToAccount, String currency) { + public DocumentReport createBalanceDocuments(Date beginDate, Date endDate, String fromToAccount) { - DocumentReport report = balanceReportService.getBalanceDocumentReport(beginDate, endDate, fromToAccount, currency, BigDecimalToString.getDecimalFormat()); + DocumentReport report = balanceReportService.getBalanceDocumentReport(beginDate, endDate, fromToAccount, BigDecimalToString.getDecimalFormat()); reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.BALANCE, BALANCE_FILE_PATH, Lists.newArrayList(report)); return report; } //############## General EntryBook ############# - public DocumentReport createGeneralEntryBooksDocuments(Date beginDate, Date endDate, String currency) { + public DocumentReport createGeneralEntryBooksDocuments(Date beginDate, Date endDate) { - DocumentReport report = generalEntryBookReportService.getGeneralEntryBookDocumentReport(beginDate, endDate, currency, BigDecimalToString.getDecimalFormat()); + DocumentReport report = generalEntryBookReportService.getGeneralEntryBookDocumentReport(beginDate, endDate, BigDecimalToString.getDecimalFormat()); reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.GENERAL_ENTRYBOOK, GENERAL_ENTRY_BOOK_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); return report; } - public DocumentReport createEntryBooksDocuments(Date beginDate, Date endDate, List<String> entryBookCodes, String currency) { - DocumentReport report = entryBookReportService.getEntryBookDocumentReport(beginDate, endDate, entryBookCodes, currency, BigDecimalToString.getDecimalFormat()); + public DocumentReport createEntryBooksDocuments(Date beginDate, Date endDate, List<String> entryBookCodes) { + DocumentReport report = entryBookReportService.getEntryBookDocumentReport(beginDate, endDate, entryBookCodes, BigDecimalToString.getDecimalFormat()); reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.ENTRYBOOKS, ENTRY_BOOKS_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); return report; } - public DocumentReport createLedgerDocuments(Date beginDate, Date endDate, String currency) { - DocumentReport report = ledgerReportService.getLedgerDocumentReport(beginDate, endDate, currency, BigDecimalToString.getDecimalFormat()); + public DocumentReport createLedgerDocuments(Date beginDate, Date endDate) { + DocumentReport report = ledgerReportService.getLedgerDocumentReport(beginDate, endDate, BigDecimalToString.getDecimalFormat()); reportBuilder.generatePDFReport(org.chorem.lima.business.utils.DocumentsEnum.LEDGER, LEDGER_REPORT_PDF_FILE_PATH, Lists.newArrayList(report)); return report; } diff --git a/lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java b/lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java index fd97351..65b69f5 100644 --- a/lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java +++ b/lima-web/src/main/java/org/chorem/lima/web/service/HttpServerService.java @@ -155,11 +155,9 @@ public class HttpServerService { IOUtils.copy(in, out); } } - else if (model != null /*&& format != null*/ && beginDate != null && endDate != null) { + else if (model != null && beginDate != null && endDate != null) { //FormatsEnum formatsEnum = FormatsEnum.valueOfExtension(format); String accountReport = null; - String entryBooksReport = null; - String ledgerReport = null; String financialReport = null; //create docs @@ -169,52 +167,36 @@ public class HttpServerService { switch (DocumentsEnum.valueOfLink(model)) { case BALANCE: - // TODO DCossé 18/11/14 get currency from config - documentService.createBalanceDocuments(beginDateFormat, endDateFormat, null, "€"); + documentService.createBalanceDocuments(beginDateFormat, endDateFormat, null); break; case ACCOUNT: accountReport = documentService.createAccountDocument( beginDateFormat, endDateFormat, account); break; case ENTRYBOOKS: - // TODO DCossé 18/11/14 get currency from config - documentService.createEntryBooksDocuments(beginDateFormat, endDateFormat, null, "€"); - if (log.isDebugEnabled()) { - log.debug("EntryBookReport :" + entryBooksReport); - } + documentService.createEntryBooksDocuments(beginDateFormat, endDateFormat, null); break; case GENERAL_ENTRYBOOK: - // TODO DCossé 18/11/14 get currency from config - documentService.createGeneralEntryBooksDocuments(beginDateFormat, endDateFormat, "€"); + documentService.createGeneralEntryBooksDocuments(beginDateFormat, endDateFormat); break; case FINANCIALSTATEMENT: financialReport = documentService.createFinancialStatementsDocuments( beginDateFormat, endDateFormat); break; case LEDGER: - documentService.createLedgerDocuments(beginDateFormat, endDateFormat, "€"); - break; - case VAT: - if (log.isDebugEnabled()) { - log.debug("autocomplete : " + autocomplete); - } -// documentService.createVatDocuments( -// beginDateFormat, endDateFormat, -// autocomplete); + documentService.createLedgerDocuments(beginDateFormat, endDateFormat); break; } } catch (ParseException eeePE) { log.error("Can't parse date", eeePE); } - if ( (accountReport != null || ledgerReport != null || financialReport != null)) { + if ( (accountReport != null || financialReport != null)) { String report; resp.setContentType(".html"); OutputStream out = resp.getOutputStream(); if (accountReport != null) { report = accountReport; - } else if (ledgerReport != null) { - report = ledgerReport; } else { report = financialReport; } @@ -293,12 +275,6 @@ public class HttpServerService { .append("\" type=\"date\" name=\"endDate\">\n<br/><br/>"); //+ "Format : <select name=\"format\">"); - /*TODO : voir pour générer des pdf avec éventuellement iReport*/ - /*for (FormatsEnum formatsEnum : FormatsEnum.values()) { - pageContent.append("<option value=\"" - + formatsEnum.getExtension() + "\">" - + formatsEnum.getDescription() + "</option>\n"); - }*/ pageContent.append(/*"</select>\n" + */"Documents : <select id=\"model\" name=\"model\" onchange='showAccountInput()'>"); diff --git a/lima-web/src/test/java/org/chorem/lima/web/action/ReportTest.java b/lima-web/src/test/java/org/chorem/lima/web/action/ReportTest.java index f636c90..a737087 100644 --- a/lima-web/src/test/java/org/chorem/lima/web/action/ReportTest.java +++ b/lima-web/src/test/java/org/chorem/lima/web/action/ReportTest.java @@ -54,6 +54,6 @@ public class ReportTest { Date beginDateFormat = df.parse("01/01/2013"); Date endDateFormat = df.parse("31/12/2014"); DocumentService documentService = new DocumentService(); - documentService.createBalanceDocuments(beginDateFormat, endDateFormat, null, "€"); + documentService.createBalanceDocuments(beginDateFormat, endDateFormat, null); } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.