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 4e1051d71b1d4a96e5c6403889563029e86fd65d Author: dcosse <japbiw74> Date: Tue Jan 13 16:05:08 2015 +0100 refs #769 path for generating report can be set through config file, it allows user to set it's own report builder file --- .../chorem/lima/business/api/OptionsService.java | 33 ++- .../business/api/report/LedgerReportService.java | 20 ++ .../report/ProvisionalEntryBookReportService.java | 5 +- .../chorem/lima/business/LimaServiceConfig.java | 191 +++++++++++-- .../lima/business/ejb/OptionsServiceImpl.java | 80 +++++- .../ejb/report/BalanceReportServiceImpl.java | 9 +- .../report/GeneralEntryBookReportServiceImpl.java | 13 +- .../ejb/report/LedgerReportServiceImpl.java | 143 ++++++++++ .../ProvisionalEntryBookReportServiceImpl.java | 45 ++-- .../lima/business/utils}/BigDecimalToString.java | 38 +-- .../resources/i18n/lima-business_en_GB.properties | 1 + .../resources/i18n/lima-business_fr_FR.properties | 6 + .../java/org/chorem/lima/entity/EntryTopiaDao.java | 2 +- lima-callao/src/main/xmi/accounting-model.zargo | Bin 51917 -> 53857 bytes .../src/main/java/org/chorem/lima/LimaMain.java | 20 ++ .../main/java/org/chorem/lima/LimaSwingConfig.java | 157 ++++++++++- .../org/chorem/lima/util/BigDecimalToString.java | 9 +- .../resources/i18n/lima-swing_en_GB.properties | 4 + .../resources/i18n/lima-swing_fr_FR.properties | 4 + .../provisionalEntryBook/EntryBookMainReport.jrxml | 6 +- .../provisionalEntryBook/EntryBookReport.jrxml | 74 ++--- .../FinancialPeriodReport.jrxml | 203 +++++++------- .../provisionalEntryBook/Transaction.jrxml | 124 --------- .../provisionalEntryBook/TransactionReport.jrxml | 297 +++++++++++++++++++++ .../chorem/lima/web/action/DocumentService.java | 169 ++++++------ .../lima/web/action/balance/ReportBuilder.java | 12 +- .../chorem/lima/web/service/HttpServerService.java | 24 +- 27 files changed, 1246 insertions(+), 443 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 882dab0..80a14c9 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 @@ -5,16 +5,16 @@ * Copyright (C) 2008 - 2011 CodeLutin * %% * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as + * it under the terms of the GNU General License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * GNU General License for more details. * - * You should have received a copy of the GNU General Public + * You should have received a copy of the GNU General * License along with this program. If not, see * <http://www.gnu.org/licenses/gpl-3.0.html>. * #L% @@ -48,4 +48,31 @@ public interface OptionsService { */ int getScale(); + void setReportsDir(String url); + + void setAccountReportPath(String path); + + void setBalanceReportPath(String path); + + void setBalanceReportAccountReportPath(String path); + + void setBalanceSubAccountReportPath(String path); + + void setGeneralEntryBookEntryBookMainReportPath(String path); + + void setGeneralEntryBookPeriodReportPath(String path); + + void setGeneralEntryBookGeneralEntryBookReportPath(String path); + + void setProvisionalEntryBookEntryBookMainReportPath(String path); + + void setProvisionalEntryBookEntryBookReportPath(String path); + + void setProvisionalEntryBookFinancialPeriodReportPath(String path); + + void setProvisionalEntryBookTransactionReportPath(String path); +// void setBigDecimalFormat(String format); +// +// String getBigDecimalFormat(); + } 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 new file mode 100644 index 0000000..f189ce5 --- /dev/null +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/report/LedgerReportService.java @@ -0,0 +1,20 @@ +package org.chorem.lima.business.api.report; + +import org.chorem.lima.beans.DocumentReport; + +import java.util.Date; + +/** + * Created by davidcosse on 20/11/14. + */ +public interface LedgerReportService { + + /** + * + * @param beginDate period from + * @param endDate period to + * @param currency current currency + * @return + */ + DocumentReport getLedgerDocumentReport(Date beginDate, Date endDate, String currency); +} 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 58049bd..dfa1b33 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 @@ -2,8 +2,10 @@ package org.chorem.lima.business.api.report; import org.chorem.lima.beans.DocumentReport; +import java.text.DecimalFormat; import java.util.Date; import java.util.List; +import java.util.Properties; /** * Created by davidcosse on 19/11/14. @@ -11,12 +13,11 @@ import java.util.List; 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 getProvisionalEntryBookDocumentReport(Date beginDate, Date endDate, List<String> entryBookCodes, String currency); + DocumentReport getProvisionalEntryBookDocumentReport(Date beginDate, Date endDate, List<String> entryBookCodes, String currency, 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 032a5b4..1b43a09 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 @@ -68,6 +68,8 @@ public class LimaServiceConfig { protected static volatile LimaServiceConfig instance; + protected final static String ROOT_PATH = new File("").getAbsolutePath(); + private LimaServiceConfig(String configFileName) { try { ApplicationConfig defaultConfig = new ApplicationConfig(LIMA_DEFAULT_CONF_FILENAME); @@ -109,7 +111,6 @@ public class LimaServiceConfig { } getInstance().setRootContextProperties(result); - } Properties result = getInstance().rootContextProperties; return result; @@ -195,11 +196,6 @@ public class LimaServiceConfig { return datadir; } - public File getReportsDir() { - File reportsDir = config.getOptionAsFile(ServiceConfigOption.REPORTS_DIR.getKey()); - return reportsDir; - } - public String getAddressServer() { String serverAddress = config.getOption(ServiceConfigOption.SERVER_ADRESS.getKey()); return serverAddress; @@ -211,9 +207,135 @@ public class LimaServiceConfig { return port; } - public String getScale() { - String scale = config.getOption(ServiceConfigOption.SCALE.getKey()); - return scale; + public String getVatPDFUrl() { + String vatPDFUrl = config.getOption(ServiceConfigOption.VAT_PDF_URL.getKey()); + return vatPDFUrl; + } + + public void setVatPDFUrl(String url) { + config.setOption(ServiceConfigOption.VAT_PDF_URL.key, url); + config.saveForUser(); + } + + // ** REPORT PART ** + + public File getReportsDir() { + String reportsDirPath = config.getOption(ServiceConfigOption.REPORTS_DIR.key); + File result = new File(reportsDirPath); + return result; + } + + public void setReportsDir(String url) { + config.setOption(ServiceConfigOption.REPORTS_DIR.key, url); + config.saveForUser(); + } + + public String getAccountReportPath() { + String vatPDFUrl = config.getOption(ServiceConfigOption.ACCOUNT_REPORT_PATH.getKey()); + return vatPDFUrl; + } + + public void setAccountReportPath(String path) { + config.setOption(ServiceConfigOption.ACCOUNT_REPORT_PATH.key, path); + config.saveForUser(); + } + + public String getBalanceReportPath() { + String result = config.getOption(ServiceConfigOption.BALANCE_REPORT_PATH.getKey()); + return result; + } + + public void setBalanceReportPath(String path) { + config.setOption(ServiceConfigOption.BALANCE_REPORT_PATH.key, path); + config.saveForUser(); + } + + public String getBalanceReportAccountReportPath() { + String result = config.getOption(ServiceConfigOption.BALANCE_REPORT_ACCOUNT_REPORT_PATH.getKey()); + return result; + } + + public void setBalanceReportAccountReportPath(String path) { + config.setOption(ServiceConfigOption.BALANCE_REPORT_ACCOUNT_REPORT_PATH.key, path); + config.saveForUser(); + } + public String getBalanceSubAccountReportPath() { + String result = config.getOption(ServiceConfigOption.BALANCE_SUB_ACCOUNT_REPORT_PATH.getKey()); + return result; + } + + public void setBalanceSubAccountReportPath(String path) { + config.setOption(ServiceConfigOption.BALANCE_SUB_ACCOUNT_REPORT_PATH.key, path); + config.saveForUser(); + } + public String getGeneralEntryBookEntryBookMainReportPath() { + String result = config.getOption(ServiceConfigOption.GENERAL_ENTRY_BOOK_ENTRY_BOOK_MAIN_REPORT_PATH.getKey()); + return result; + } + + public void setGeneralEntryBookEntryBookMainReportPath(String path) { + config.setOption(ServiceConfigOption.GENERAL_ENTRY_BOOK_ENTRY_BOOK_MAIN_REPORT_PATH.key, path); + config.saveForUser(); + } + public String getGeneralEntryBookEntryBookPeriodReportPath() { + String result = config.getOption(ServiceConfigOption.GENERAL_ENTRY_BOOK_ENTRY_BOOK_PERIOD_REPORT_PATH.getKey()); + return result; + } + + public void setGeneralEntryBookEntryBookPeriodReportPath(String path) { + config.setOption(ServiceConfigOption.GENERAL_ENTRY_BOOK_ENTRY_BOOK_PERIOD_REPORT_PATH.key, path); + config.saveForUser(); + } + + public String getGeneralEntryBookGeneralEntryBookEntryReportPath() { + String result = config.getOption(ServiceConfigOption.GENERAL_ENTRY_BOOK_GENERAL_ENTRY_BOOK_ENTRY_REPORT_PATH.getKey()); + return result; + } + + public void setGeneralEntryBookGeneralEntryBookEntryReportPath(String path) { + config.setOption(ServiceConfigOption.GENERAL_ENTRY_BOOK_GENERAL_ENTRY_BOOK_ENTRY_REPORT_PATH.key, path); + config.saveForUser(); + } + public String getProvisionalEntryBookEntryBookMainReportPath() { + String result = config.getOption(ServiceConfigOption.PROVISIONAL_ENTRY_BOOK_ENTRY_BOOK_MAIN_REPORT_PATH.getKey()); + return result; + } + + public void setProvisionalEntryBookEntryBookMainReportPath(String path) { + config.setOption(ServiceConfigOption.PROVISIONAL_ENTRY_BOOK_ENTRY_BOOK_MAIN_REPORT_PATH.key, path); + config.saveForUser(); + } + public String getProvisionalEntryBookEntryBookReportPath() { + String result = config.getOption(ServiceConfigOption.PROVISIONAL_ENTRY_BOOK_ENTRY_BOOK_REPORT_PATH.getKey()); + return result; + } + + public void setProvisionalEntryBookEntryBookReportPath(String path) { + config.setOption(ServiceConfigOption.PROVISIONAL_ENTRY_BOOK_ENTRY_BOOK_REPORT_PATH.key, path); + config.saveForUser(); + } + public String getProvisionalEntryBookFinancialPeriodReportPath() { + String result = config.getOption(ServiceConfigOption.PROVISIONAL_ENTRY_BOOK_FINANCIAL_PERIOD_REPORT_PATH.getKey()); + return result; + } + + public void setProvisionalEntryBookFinancialPeriodReportPath(String path) { + config.setOption(ServiceConfigOption.PROVISIONAL_ENTRY_BOOK_FINANCIAL_PERIOD_REPORT_PATH.key, path); + config.saveForUser(); + } + + public String getProvisionalEntryBookTransactionReportPath() { + String result = config.getOption(ServiceConfigOption.PROVISIONAL_ENTRY_BOOK_TRANSACTION_REPORT_PATH.getKey()); + return result; + } + + public void setProvisionalEntryBookTransactionReportPath(String path) { + config.setOption(ServiceConfigOption.PROVISIONAL_ENTRY_BOOK_TRANSACTION_REPORT_PATH.key, path); + config.saveForUser(); + } + + public int getScale() { + return config.getOptionAsInt(ServiceConfigOption.SCALE.key); } public void setScale(String locale) { @@ -221,16 +343,38 @@ public class LimaServiceConfig { config.saveForUser(); } - public String getVatPDFUrl() { - String vatPDFUrl = config.getOption(ServiceConfigOption.VAT_PDF_URL.getKey()); - return vatPDFUrl; + public boolean getCurrency() { + return config.getOptionAsBoolean(ServiceConfigOption.CURRENCY.key); } - public void setVatPDFUrl(String url) { - config.setOption(ServiceConfigOption.VAT_PDF_URL.key, url); + public void setCurrency(String locale) { + config.setOption(ServiceConfigOption.CURRENCY.key, locale); config.saveForUser(); } + public char getDecimalSeparator() { + char decimalSeparator = config.getOption(ServiceConfigOption.DECIMAL_SEPARATOR.key).charAt(0); + LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); + return decimalSeparator; + } + + public void setDecimalSeparator(String locale) { + config.setOption(ServiceConfigOption.DECIMAL_SEPARATOR.key, locale); + config.saveForUser(); + } + + public char getThousandSeparator() { + return config.getOption(ServiceConfigOption.THOUSAND_SEPARATOR.key).charAt(0); + } + + public void setThousandSeparator(String locale) { + config.setOption(ServiceConfigOption.THOUSAND_SEPARATOR.key, locale); + config.saveForUser(); + } + + // ** FIN REPORT PART ** + + /** * Lima option definition. * <p/> @@ -243,12 +387,27 @@ public class LimaServiceConfig { // CONFIG_FILE(CONFIG_FILE_NAME, n("lima.configFileName.description"), "lima.properties", String.class, true, true), APPLICATION_VERSION("application.version", n("application.version"), null, String.class, false, false), DATA_DIR("lima.data.dir", n("lima.config.data.dir.description"), "${user.home}/.lima", File.class, false, false), - REPORTS_DIR("lima.reports.dir", n("lima.config.reports.dir.description"), "${lima.data.dir}/reports", File.class, false, false), RULES_NATIONALTY("lima.rules", n("lima.config.rulesnationality.description"), FranceAccountingRules.class.getName(), String.class, false, false), HTTP_PORT("lima.httpport", n("lima.config.httpport.description"), "5462", String.class, false, false), SERVER_ADRESS("lima.serveraddress", n("lima.config.serveraddress.description"), "", String.class, false, false), + VAT_PDF_URL("lima.report.vatpdfurl", n("lima.config.reportvatpdfurl.description"), "default", String.class, false, false), + + REPORTS_DIR("lima.reports.dir",n("lima.config.reports.dir.description"),"${lima.data.dir}/reports", File.class, false, false), + ACCOUNT_REPORT_PATH("lima.accounts.accountReportPath", "", ROOT_PATH +"/lima-web/src/main/jasperreports/accounts/AccountReport.jrxml",String.class, false, false), + BALANCE_REPORT_PATH("lima.balance.balanceReportPath","", ROOT_PATH +"/lima-web/src/main/jasperreports/balance/BalanceReport.jrxml",String.class, false, false), + BALANCE_REPORT_ACCOUNT_REPORT_PATH("lima.balance.balanceReportAccountReportPath","", ROOT_PATH +"/lima-web/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml",String.class, false, false), + BALANCE_SUB_ACCOUNT_REPORT_PATH("lima.balance.balanceSubAccountReportPath",n("lima.config.documentReport.balanceReportAccount.description"), ROOT_PATH +"/lima-web/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml",String.class, false, false), + GENERAL_ENTRY_BOOK_ENTRY_BOOK_MAIN_REPORT_PATH("lima.generalEntryBook.entryBookMainReportPath", "", ROOT_PATH +"/lima-web/src/main/jasperreports/generalEntryBook/EntryBookMainReport.jrxml", String.class, false, false), + GENERAL_ENTRY_BOOK_ENTRY_BOOK_PERIOD_REPORT_PATH("lima.generalEntryBook.entryBookPeriodReportPath","", ROOT_PATH +"/lima-web/src/main/jasperreports/generalEntryBook/EntryBookPeriodReport.jrxml", String.class, false, false), + GENERAL_ENTRY_BOOK_GENERAL_ENTRY_BOOK_ENTRY_REPORT_PATH("lima.generalEntryBook.generalEntryBookEntryReportPath", "", ROOT_PATH +"/lima-web/src/main/jasperreports/generalEntryBook/GeneralEntryBookEntryReport.jrxml", String.class, false, false), + PROVISIONAL_ENTRY_BOOK_ENTRY_BOOK_MAIN_REPORT_PATH("lima.provisionalEntryBook.entryBookMainReportPath","", ROOT_PATH +"/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookMainReport.jrxml",String.class,false, false), + PROVISIONAL_ENTRY_BOOK_ENTRY_BOOK_REPORT_PATH("lima.provisionalEntryBook.entryBookReport","", ROOT_PATH +"/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookReport.jrxml",String.class,false, false), + PROVISIONAL_ENTRY_BOOK_FINANCIAL_PERIOD_REPORT_PATH("lima.provisionalEntryBook.financialPeriodReportPath","", ROOT_PATH +"/lima-web/src/main/jasperreports/provisionalEntryBook/FinancialPeriodReport.jrxml", String.class, false, false), + PROVISIONAL_ENTRY_BOOK_TRANSACTION_REPORT_PATH("lima.provisionalEntryBook.transactionReportPath","", ROOT_PATH +"/lima-web/src/main/jasperreports/provisionalEntryBook/TransactionReport.jrxml",String.class, false, false), SCALE("lima.scale", n("lima.config.scale.description"), "2", String.class, false, false), - VAT_PDF_URL("lima.report.vatpdfurl", n("lima.config.reportvatpdfurl.description"), "default", String.class, false, false); + CURRENCY("lima.config.currency","","false", Boolean.class, false, false), + DECIMAL_SEPARATOR("lima.data.bigDecimal.decimalSeparator","",",",Character.class, false, false), + THOUSAND_SEPARATOR("lima.thousandSeparator",""," ",Character.class, false, false); private final String key; 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 17659f6..772d489 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 @@ -31,7 +31,7 @@ import javax.ejb.Stateless; @Remote(OptionsService.class) public class OptionsServiceImpl extends AbstractLimaService implements OptionsService { - protected String scale; + protected int scale; protected String vatPDFUrl; @@ -41,13 +41,81 @@ public class OptionsServiceImpl extends AbstractLimaService implements OptionsSe } public int getScale() { - if (scale == null || scale.isEmpty()) { - return 2; - } else { - return Integer.valueOf(scale); - } + return scale; } + @Override + public void setReportsDir(String path) { + LimaServiceConfig.getInstance().setReportsDir(path); + } + + @Override + public void setAccountReportPath(String path) { + LimaServiceConfig.getInstance().setAccountReportPath(path); + } + + @Override + public void setBalanceReportPath(String path) { + LimaServiceConfig.getInstance().setBalanceReportPath(path); + } + + @Override + public void setBalanceReportAccountReportPath(String path) { + LimaServiceConfig.getInstance().setBalanceReportAccountReportPath(path); + } + + @Override + public void setBalanceSubAccountReportPath(String path) { + LimaServiceConfig.getInstance().setBalanceSubAccountReportPath(path); + } + + @Override + public void setGeneralEntryBookEntryBookMainReportPath(String path) { + LimaServiceConfig.getInstance().setGeneralEntryBookEntryBookMainReportPath(path); + } + + @Override + public void setGeneralEntryBookPeriodReportPath(String path) { + LimaServiceConfig.getInstance().setGeneralEntryBookEntryBookPeriodReportPath(path); + } + + @Override + public void setGeneralEntryBookGeneralEntryBookReportPath(String path) { + LimaServiceConfig.getInstance().setGeneralEntryBookGeneralEntryBookEntryReportPath(path); + } + + @Override + public void setProvisionalEntryBookEntryBookMainReportPath(String path) { + LimaServiceConfig.getInstance().setProvisionalEntryBookEntryBookMainReportPath(path); + } + + @Override + public void setProvisionalEntryBookEntryBookReportPath(String path) { + LimaServiceConfig.getInstance().setProvisionalEntryBookEntryBookReportPath(path); + } + + @Override + public void setProvisionalEntryBookFinancialPeriodReportPath(String path) { + LimaServiceConfig.getInstance().setProvisionalEntryBookFinancialPeriodReportPath(path); + } + + @Override + public void setProvisionalEntryBookTransactionReportPath(String path) { + LimaServiceConfig.getInstance().setProvisionalEntryBookTransactionReportPath(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); } 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 6a2ea1d..a90ad64 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 @@ -32,6 +32,7 @@ import org.chorem.lima.beans.DocumentReportImpl; import org.chorem.lima.beans.BalanceTrial; import org.chorem.lima.beans.BalanceTrialImpl; import org.chorem.lima.beans.ReportsDatas; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.FinancialPeriodService; import org.chorem.lima.business.api.IdentityService; @@ -47,7 +48,6 @@ import javax.ejb.EJB; import javax.ejb.Remote; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; -import java.io.File; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; @@ -74,9 +74,7 @@ public class BalanceReportServiceImpl extends AbstractLimaService implements Bal protected IdentityService identityService; protected static final Integer ACCOUNT_NUMBER_SIZE = 6; - protected static String ROOT_PATH = new File("").getAbsolutePath(); - protected static String BALANCE_REPORT_ACCOUNT_REPORT_PATH = ROOT_PATH + "/lima-web/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml"; - protected static String BALANCE_SUB_ACCOUNTS_REPORT_PATH = ROOT_PATH + "/lima-web/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml"; + protected static final String TITLE = "BALANCE"; protected static final Predicate<BalanceReportAccount> HAS_NO_ENTRY = new Predicate<BalanceReportAccount>() { @@ -93,6 +91,9 @@ public class BalanceReportServiceImpl extends AbstractLimaService implements Bal @Override public DocumentReport getBalanceDocumentReport(Date from, Date to, String selectedAccounts, String currency) { + String BALANCE_REPORT_ACCOUNT_REPORT_PATH = LimaServiceConfig.getInstance().getBalanceReportAccountReportPath(); + String BALANCE_SUB_ACCOUNTS_REPORT_PATH = LimaServiceConfig.getInstance().getBalanceSubAccountReportPath(); + DocumentReport result = new DocumentReportImpl(); Identity identity = identityService.getIdentity(); 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 40c8ea3..af5412d 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 @@ -14,6 +14,7 @@ import org.chorem.lima.beans.EntryBookPeriodReport; import org.chorem.lima.beans.EntryBookPeriodReportImpl; import org.chorem.lima.beans.GeneralEntryBookEntry; import org.chorem.lima.beans.GeneralEntryBookEntryImpl; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.ClosedPeriodicEntryBookService; import org.chorem.lima.business.api.EntryService; import org.chorem.lima.business.api.FinancialPeriodService; @@ -28,7 +29,6 @@ import javax.ejb.EJB; import javax.ejb.Remote; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; -import java.io.File; import java.math.BigDecimal; import java.util.Collection; import java.util.Date; @@ -68,13 +68,14 @@ public class GeneralEntryBookReportServiceImpl extends AbstractLimaService imple @EJB protected IdentityService identityService; - protected static String ROOT_PATH = new File("").getAbsolutePath(); - protected static String ENTRY_BOOK_PERIOD_REPORT_PATH = ROOT_PATH + "/lima-web/src/main/jasperreports/generalEntryBook/EntryBookPeriodReport.jrxml"; - protected static String GENERAL_ENTRY_BOOK_ENTRY_REPORT_PATH = ROOT_PATH + "/lima-web/src/main/jasperreports/generalEntryBook/GeneralEntryBookEntryReport.jrxml"; + protected static final String TITLE = "Journal Général Provisoire"; @Override public DocumentReport getEntryBookDocumentReport(Date beginDate, Date endDate, String currency) { + String entryBookPeriodReportPath = LimaServiceConfig.getInstance().getGeneralEntryBookEntryBookPeriodReportPath(); + String generalEntryBookEntryBookMainReportPath = LimaServiceConfig.getInstance().getGeneralEntryBookEntryBookMainReportPath(); + DocumentReport result = new DocumentReportImpl(); try { @@ -87,7 +88,7 @@ public class GeneralEntryBookReportServiceImpl extends AbstractLimaService imple result.setCurrency(currency); result.setFromDate(beginDate); result.setToDate(endDate); - result.setSubReportPath(ENTRY_BOOK_PERIOD_REPORT_PATH); + result.setSubReportPath(entryBookPeriodReportPath); List<FinancialPeriod> financialPeriods = financialPeriodService.getFinancialPeriods(beginDate, endDate); @@ -159,7 +160,7 @@ public class GeneralEntryBookReportServiceImpl extends AbstractLimaService imple if (subAmountCredit.compareTo(BigDecimal.ZERO) != 0 && subAmountDebit.compareTo(BigDecimal.ZERO) != 0) { EntryBookPeriodReport entryBookPeriodReport = new EntryBookPeriodReportImpl(); entryBookPeriodReport.setPeriod(financialPeriod.getBeginDate()); - entryBookPeriodReport.setSubReportPath(GENERAL_ENTRY_BOOK_ENTRY_REPORT_PATH); + entryBookPeriodReport.setSubReportPath(generalEntryBookEntryBookMainReportPath); entryBookPeriodReport.setSoldeDebit(subAmountDebit.compareTo(BigDecimal.ZERO) == 0 ? "" : subAmountDebit.toPlainString()); entryBookPeriodReport.setSoldeCredit(subAmountCredit.compareTo(BigDecimal.ZERO) == 0 ? "" : subAmountCredit.toPlainString()); entryBookPeriodReport.setGeneralEntryBookEntry(Lists.newArrayList(generalEntryBookEntries)); 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 new file mode 100644 index 0000000..cf97ecb --- /dev/null +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/report/LedgerReportServiceImpl.java @@ -0,0 +1,143 @@ +package org.chorem.lima.business.ejb.report; + +import org.chorem.lima.LimaTechnicalException; +import org.chorem.lima.beans.BalanceTrial; +import org.chorem.lima.beans.DocumentReport; +import org.chorem.lima.beans.ReportsDatas; +import org.chorem.lima.business.api.ReportService; +import org.chorem.lima.business.api.report.GeneralEntryBookReportService; +import org.chorem.lima.business.api.report.LedgerReportService; +import org.chorem.lima.business.ejb.AbstractLimaService; +import org.chorem.lima.business.utils.EntryComparator; +import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.Entry; +import org.chorem.lima.entity.EntryBook; + +import javax.ejb.EJB; +import javax.ejb.Remote; +import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import static org.nuiton.i18n.I18n.t; + +/** + * Created by davidcosse on 20/11/14. + */ +@Stateless +@Remote(LedgerReportService.class) +@TransactionAttribute +public class LedgerReportServiceImpl extends AbstractLimaService implements LedgerReportService { + + @EJB + protected ReportService reportService; + + @Override + public DocumentReport getLedgerDocumentReport(Date beginDate, Date endDate, String currency) { + return null; +// List<Object> list = new ArrayList<Object>(); +// +// if (beginDate != null && endDate != null) { +// try { +// +// BalanceTrial balanceTrial = reportService.generateLedger(beginDate, endDate, null, true); +// if (balanceTrial.getReportsDatas() != null) { +// for (ReportsDatas reportsDatas : balanceTrial.getReportsDatas()) { +// list.add(reportsDatas); +// List<Entry> entries = reportsDatas.getListEntry(); +// if (entries != null) { +// Collections.sort(entries, new EntryComparator()); +// list.addAll(entries); +// } +// } +// } +// +// //create pages +// int i = 0; +// int n = list.size(); +// +// boolean even = true; +// BigDecimal currentAmountDebit =BigDecimal.ZERO; +// BigDecimal currentAmountCredit =BigDecimal.ZERO; +// +// while (i < n) { +// +// int indexEntry = -1; +// +// for (Object object : list) { +// if (object instanceof ReportsDatas) { +// +//// ReportsDatas reportsDatas = (ReportsDatas) object; +//// +//// String accountS = ""; +//// Account account = reportsDatas.getAccount(); +//// if (account != null) { +//// accountS = account.getAccountNumber() + "\t" + account.getLabel(); +//// } +//// BigDecimal amountCredit = reportsDatas.getAmountCredit(); +//// BigDecimal amountDebit = reportsDatas.getAmountDebit(); +//// +//// String [] columnsTable = {accountS, +//// amountDebit.toString(), amountCredit.toString(), +//// amountDebit.subtract(amountCredit).toString()}; +// +// } else { +// indexEntry++; +// Entry entry = (Entry) object; +// +// String entryBookCode = ""; +// EntryBook entryBook = entry.getFinancialTransaction().getEntryBook(); +// if (entryBook != null) { +// entryBookCode = entryBook.getCode(); +// } +// BigDecimal amountDebit = BigDecimal.ZERO, +// amountCredit = BigDecimal.ZERO; +// if (entry.isDebit()) { +// amountDebit = entry.getAmount(); +// } else { +// amountCredit = entry.getAmount(); +// } +// +// String [] columnsTable = {t("lima-business.document.dateformat",entry.getFinancialTransaction().getTransactionDate()), +// entryBookCode, entry.getVoucher(), entry.getDescription(), +// amountDebit.toString(), amountCredit.toString(), amountDebit.subtract(amountCredit).toString()}; +// ledgerReport += constructTableLine(columnsTable, even); +// even = !even; +// } +// } +// +// // close inner +// ledgerReport += "</tbody></table>" + +// "</td>" + +// "</tr>"; +// +// for (Object objectList : list) { +// if (objectList instanceof Entry) { +// Entry entry = (Entry) objectList; +// if (entry.isDebit()) { +// currentAmountDebit = currentAmountDebit.add(entry.getAmount()); +// } else { +// currentAmountCredit = currentAmountCredit.add(entry.getAmount()); +// } +// } +// } +// +// i = i + n; +// } +// //final amounts +// String [] columnsTable = { boldBegin + t("lima-business.document.amounts") + boldEnd, +// boldBegin + currentAmountDebit.toString() + boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd, +// boldBegin + currentAmountDebit.subtract(currentAmountCredit).toString() + boldEnd}; +// ledgerReport += constructTableLine(columnsTable, even); +// +// +// } catch (Exception ex) { +// throw new LimaTechnicalException("Can't create document", ex); +// } +// } + } +} 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 beb9041..658d2d3 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 @@ -1,5 +1,6 @@ package org.chorem.lima.business.ejb.report; +import com.google.common.base.Preconditions; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -12,26 +13,24 @@ import org.chorem.lima.beans.FinancialPeriodReport; import org.chorem.lima.beans.FinancialPeriodReportImpl; import org.chorem.lima.beans.Transaction; import org.chorem.lima.beans.TransactionImpl; -import org.chorem.lima.business.api.ClosedPeriodicEntryBookService; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.EntryBookService; import org.chorem.lima.business.api.EntryService; import org.chorem.lima.business.api.FinancialPeriodService; import org.chorem.lima.business.api.FinancialTransactionService; import org.chorem.lima.business.api.IdentityService; import org.chorem.lima.business.api.report.ProvisionalEntryBookReportService; -import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.Identity; import javax.ejb.EJB; import javax.ejb.Remote; import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; -import java.io.File; import java.math.BigDecimal; +import java.text.DecimalFormat; import java.util.Date; import java.util.List; @@ -48,9 +47,6 @@ public class ProvisionalEntryBookReportServiceImpl implements ProvisionalEntryBo protected FinancialPeriodService financialPeriodService; @EJB - protected ClosedPeriodicEntryBookService closedPeriodicEntryBookService; - - @EJB protected EntryService entryService; @EJB @@ -62,16 +58,28 @@ public class ProvisionalEntryBookReportServiceImpl implements ProvisionalEntryBo @EJB protected FinancialTransactionService financialTransactionService; - protected static String ROOT_PATH = new File("").getAbsolutePath(); - protected static String ENTRY_BOOK_REPORT_PATH = ROOT_PATH + "/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookReport.jrxml"; - protected static String FINANCIAL_PERIOD_REPORT_PATH = ROOT_PATH + "/lima-web/src/main/jasperreports/provisionalEntryBook/FinancialPeriodReport.jrxml"; - protected static String TRANSACTION_REPORT_PATH = ROOT_PATH + "/lima-web/src/main/jasperreports/provisionalEntryBook/Transaction.jrxml"; protected static final String TITLE = "Récapitulatif par compte"; + /** + * - ENTRY_BOOK_REPORT_PATH + * - FINANCIAL_PERIOD_REPORT_PATH + * - TRANSACTION_REPORT_PATH + * - CURRENCY + * - BIG_DECIMAL_FORMAT + **/ @Override - public DocumentReport getProvisionalEntryBookDocumentReport(Date beginDate, Date endDate, List<String> entryBookCodes, String currency) { + public DocumentReport getProvisionalEntryBookDocumentReport(Date beginDate, Date endDate, List<String> entryBookCodes, String currency, DecimalFormat bigDecimalFormat) { + LimaServiceConfig config = LimaServiceConfig.getInstance(); + + String entryBookReportPath = config.getProvisionalEntryBookEntryBookReportPath(); + String financialPeriodReportPath = config.getProvisionalEntryBookFinancialPeriodReportPath(); + String transactionReportPath = config.getProvisionalEntryBookTransactionReportPath(); + DocumentReport documentReport = new DocumentReportImpl(); try { + Preconditions.checkArgument(StringUtils.isNoneBlank(entryBookReportPath)); + Preconditions.checkArgument(StringUtils.isNoneBlank(financialPeriodReportPath)); + Preconditions.checkArgument(StringUtils.isNoneBlank(transactionReportPath)); if (beginDate != null && endDate != null) { Identity identity = identityService.getIdentity(); @@ -82,7 +90,8 @@ public class ProvisionalEntryBookReportServiceImpl implements ProvisionalEntryBo documentReport.setCurrency(currency); documentReport.setFromDate(beginDate); documentReport.setToDate(endDate); - documentReport.setSubReportPath(ENTRY_BOOK_REPORT_PATH); + + documentReport.setSubReportPath(entryBookReportPath); BigDecimal documentReportDebit = BigDecimal.ZERO; BigDecimal documentReportCredit = BigDecimal.ZERO; @@ -100,11 +109,10 @@ public class ProvisionalEntryBookReportServiceImpl implements ProvisionalEntryBo for(EntryBook entryBook:entryBooks) { - EntryBookReport entryBookReport = new EntryBookReportImpl(); entryBookReport.setLibelle(entryBook.getLabel()); entryBookReport.setCode(entryBook.getCode()); - entryBookReport.setSubReportPath(FINANCIAL_PERIOD_REPORT_PATH); + entryBookReport.setSubReportPath(financialPeriodReportPath); BigDecimal entryBookSoldeDebit = BigDecimal.ZERO; BigDecimal entryBookSoldeCredit = BigDecimal.ZERO; @@ -113,7 +121,7 @@ public class ProvisionalEntryBookReportServiceImpl implements ProvisionalEntryBo for (FinancialPeriod financialPeriod : financialPeriods) { FinancialPeriodReport financialPeriodReport = new FinancialPeriodReportImpl(); - financialPeriodReport.setSubReportPath(TRANSACTION_REPORT_PATH); + financialPeriodReport.setSubReportPath(transactionReportPath); financialPeriodReport.setPeriod(financialPeriod.getBeginDate()); BigDecimal financialPeriodDebit = BigDecimal.ZERO; @@ -136,8 +144,9 @@ public class ProvisionalEntryBookReportServiceImpl implements ProvisionalEntryBo transaction.setAccount(entry.getAccount().getAccountNumber() + " - " + entry.getAccount().getLabel()); transaction.setLibelle(entry.getDescription()); transaction.setVoucher(entry.getVoucher()); - transaction.setDebit(debit.compareTo(BigDecimal.ZERO) == 0 ? "" : debit.toPlainString()); - transaction.setCredit(credit.compareTo(BigDecimal.ZERO) == 0 ? "" : credit.toPlainString()); + transaction.setDebit(debit); + transaction.setCredit(credit); + transaction.setFormatter(bigDecimalFormat); financialPeriodDebit = financialPeriodDebit.add(debit); financialPeriodCredit = financialPeriodCredit.add(credit); diff --git a/lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java b/lima-business/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java similarity index 55% copy from lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java copy to lima-business/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java index 5bc903f..c40813c 100644 --- a/lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java +++ b/lima-business/src/main/java/org/chorem/lima/business/utils/BigDecimalToString.java @@ -1,29 +1,6 @@ -package org.chorem.lima.util; +package org.chorem.lima.business.utils; -/* - * #%L - * Lima :: Swing - * %% - * Copyright (C) 2008 - 2014 CodeLutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import org.chorem.lima.LimaSwingApplicationContext; -import org.chorem.lima.LimaSwingConfig; +import org.chorem.lima.business.LimaServiceConfig; import java.math.BigDecimal; import java.text.DecimalFormat; @@ -36,7 +13,13 @@ public class BigDecimalToString { public static String format(BigDecimal value) { - LimaSwingConfig config = LimaSwingApplicationContext.getContext().getConfig(); + DecimalFormat formatter = getDecimalFormat(); + String result = formatter.format(value); + return result; + } + + public static DecimalFormat getDecimalFormat() { + LimaServiceConfig config = LimaServiceConfig.getInstance(); StringBuilder scale = new StringBuilder(); for (int i = 0; i < config.getScale(); i++) { scale.append("0"); @@ -55,8 +38,7 @@ public class BigDecimalToString { //always set grouping formatter.setGroupingUsed(true); formatter.setGroupingSize(3); - String result = formatter.format(value); - return result; + return formatter; } } diff --git a/lima-business/src/main/resources/i18n/lima-business_en_GB.properties b/lima-business/src/main/resources/i18n/lima-business_en_GB.properties index 2c2a7ab..aa2b1b3 100644 --- a/lima-business/src/main/resources/i18n/lima-business_en_GB.properties +++ b/lima-business/src/main/resources/i18n/lima-business_en_GB.properties @@ -126,6 +126,7 @@ lima-business.import.vatstatementalnomaster=FAILED \: The vatStatement %s has ma lima-business.import.vatstatementalreadyexist=FAILED \: The vatStatement %s already exists \!\n lima.config.configFileName.description=Filename of Lima's configuration lima.config.data.dir.description=Data directory of Lima +lima.config.documentReport.balanceReportAccount.description= lima.config.httpport.description=HTTP Port lima.config.reports.dir.description= lima.config.reportvatpdfurl.description= diff --git a/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties b/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties index 95dc0c4..e708dfe 100644 --- a/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties +++ b/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties @@ -121,6 +121,12 @@ lima-business.import.vatstatementalnomaster=u00C9chec \: Le plan %s possède le lima-business.import.vatstatementalreadyexist=u00C9chec \: Le plan %s exist déjà \!\n lima.config.configFileName.description=Nom du fichier de configuration de Lima lima.config.data.dir.description=Répertoire des données de Lima +lima.config.documentReport.balanceReportAccount.description= +lima.config.documentReport.bigDecimalFormat=formattage des montants +lima.config.documentReport.entryBookReportPath.description=fichier source (.jrxml) généré par Jasper Report gérant les beans 'EntryBookReport' +lima.config.documentReport.financialPeriodPath.description=fichier source (.jrxml) généré par Jasper Report gérant les beans 'FinancialPeriodReport' +lima.config.documentReport.generalEntryBookReportPath.description=fichier source (.jrxml) généré par Jasper Report gérant les beans 'DocumentReport' +lima.config.documentReport.transactionReportPath.description=fichier source (.jrxml) généré par Jasper Report gérant les beans 'Transaction' lima.config.httpport.description=Port HTTP lima.config.reports.dir.description=Dossier des rapports lima.config.reportvatpdfurl.description=Chemin du raport diff --git a/lima-callao/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java b/lima-callao/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java index d5c7bdc..bf49d86 100644 --- a/lima-callao/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java +++ b/lima-callao/src/main/java/org/chorem/lima/entity/EntryTopiaDao.java @@ -68,7 +68,7 @@ public class EntryTopiaDao extends AbstractEntryTopiaDao<Entry> { HqlAndParametersBuilder<Entry> builder = getEquilibredTransactionQuery(beginDate, endDate); builder.addEquals(Entry.PROPERTY_ACCOUNT, account); - + builder.setOrderByArguments(Entry.PROPERTY_FINANCIAL_TRANSACTION + "." + FinancialTransaction.PROPERTY_TRANSACTION_DATE); List<Entry> entries = findAll(builder.getHql(), builder.getHqlParameters()); return entries; diff --git a/lima-callao/src/main/xmi/accounting-model.zargo b/lima-callao/src/main/xmi/accounting-model.zargo index b1a5cd7..ff4bbc6 100644 Binary files a/lima-callao/src/main/xmi/accounting-model.zargo and b/lima-callao/src/main/xmi/accounting-model.zargo differ diff --git a/lima-swing/src/main/java/org/chorem/lima/LimaMain.java b/lima-swing/src/main/java/org/chorem/lima/LimaMain.java index 23070eb..e74b66c 100644 --- a/lima-swing/src/main/java/org/chorem/lima/LimaMain.java +++ b/lima-swing/src/main/java/org/chorem/lima/LimaMain.java @@ -25,6 +25,7 @@ package org.chorem.lima; import jaxx.runtime.SwingUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.MainView; @@ -201,8 +202,27 @@ public class LimaMain { public static HttpServerService getHttpServerService() { if (httpServerService == null) { + LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); + LimaSwingConfig swingConfig = LimaSwingConfig.getInstance(); + + serviceConfig.setBalanceReportPath(swingConfig.getBalanceReportPath()); + serviceConfig.setReportsDir(swingConfig.getReportsDir().getAbsolutePath()); + serviceConfig.setAccountReportPath(swingConfig.getAccountReportPath()); + serviceConfig.setBalanceReportPath(swingConfig.getBalanceReportPath()); + serviceConfig.setBalanceReportAccountReportPath(swingConfig.getBalanceReportAccountReportPath()); + serviceConfig.setBalanceSubAccountReportPath(swingConfig.getBalanceSubAccountReportPath()); + serviceConfig.setGeneralEntryBookEntryBookMainReportPath(swingConfig.getGeneralEntryBookEntryBookMainReportPath()); + serviceConfig.setGeneralEntryBookGeneralEntryBookEntryReportPath(swingConfig.getGeneralEntryBookGeneralEntryBookEntryReportPath()); + serviceConfig.setGeneralEntryBookGeneralEntryBookEntryReportPath(swingConfig.getGeneralEntryBookGeneralEntryBookEntryReportPath()); + serviceConfig.setProvisionalEntryBookEntryBookMainReportPath(swingConfig.getProvisionalEntryBookEntryBookMainReportPath()); + serviceConfig.setProvisionalEntryBookEntryBookReportPath(swingConfig.getProvisionalEntryBookEntryBookReportPath()); + serviceConfig.setProvisionalEntryBookFinancialPeriodReportPath(swingConfig.getProvisionalEntryBookFinancialPeriodReportPath()); + serviceConfig.setProvisionalEntryBookTransactionReportPath(swingConfig.getProvisionalEntryBookTransactionReportPath()); + + httpServerService = new HttpServerService(); } return httpServerService; } + } 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 18695df..59a72f4 100644 --- a/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java +++ b/lima-swing/src/main/java/org/chorem/lima/LimaSwingConfig.java @@ -28,6 +28,7 @@ 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; @@ -75,6 +76,8 @@ public class LimaSwingConfig extends ApplicationConfig { /** La version du logiciel. */ protected Version version; + protected final static String ROOT_PATH = new File("").getAbsolutePath(); + /** * Get copyright text (include version). * @@ -190,6 +193,7 @@ public class LimaSwingConfig extends ApplicationConfig { */ public char getDecimalSeparator() { char decimalSeparator = getOption(Option.DECIMAL_SEPARATOR.key).charAt(0); + LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); return decimalSeparator; } @@ -201,6 +205,8 @@ public class LimaSwingConfig extends ApplicationConfig { */ public void setDecimalSeparator(String decimalSeparator) { setOption(Option.DECIMAL_SEPARATOR.key, decimalSeparator); + LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); + serviceConfig.setDecimalSeparator(decimalSeparator); saveForUser(); firePropertyChange("decimalSeparator", null, decimalSeparator); } @@ -222,6 +228,8 @@ public class LimaSwingConfig extends ApplicationConfig { */ public void setScale(String scale) { setOption(Option.SCALE.key, scale); + LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); + serviceConfig.setScale(scale); saveForUser(); firePropertyChange("scale", null, scale); if (log.isInfoEnabled()) { @@ -247,6 +255,8 @@ public class LimaSwingConfig extends ApplicationConfig { */ public void setThousandSeparator(String thousandSeparator) { setOption(Option.THOUSAND_SEPARATOR.key, thousandSeparator); + LimaServiceConfig serviceConfig = LimaServiceConfig.getInstance(); + serviceConfig.setThousandSeparator(thousandSeparator); saveForUser(); firePropertyChange("thousandSeparator", null, thousandSeparator); } @@ -267,6 +277,8 @@ 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)); saveForUser(); firePropertyChange("currency", null, currency); } @@ -349,6 +361,68 @@ public class LimaSwingConfig extends ApplicationConfig { return getOptionAsBoolean((Option.SELECT_ALL_EDITING_CELL.key)); } + public File getReportsDir() { + String reportsDirPath = getOption(Option.REPORTS_DIR.key); + File reportsDir = new File(reportsDirPath); + return reportsDir; + } + + // reports + public String getAccountReportPath() { + String result = getOption(Option.ACCOUNT_REPORT_PATH.key); + return result; + } + + public String getBalanceReportPath() { + String result = getOption(Option.BALANCE_REPORT_PATH.key); + return result; + } + + public String getBalanceReportAccountReportPath() { + String result = getOption(Option.BALANCE_REPORT_ACCOUNT_REPORT_PATH.key); + return result; + } + + public String getBalanceSubAccountReportPath() { + String result = getOption(Option.BALANCE_SUB_ACCOUNT_REPORT_PATH.key); + return result; + } + + public String getGeneralEntryBookEntryBookMainReportPath() { + String result = getOption(Option.GENERAL_ENTRY_BOOK_ENTRY_BOOK_MAIN_REPORT_PATH.key); + return result; + } + + public String getGeneralEntryBookEntryBookPeriodReportPath() { + String result = getOption(Option.GENERAL_ENTRY_BOOK_ENTRY_BOOK_PERIOD_REPORT_PATH.key); + return result; + } + + public String getGeneralEntryBookGeneralEntryBookEntryReportPath() { + String result = getOption(Option.GENERAL_ENTRY_BOOK_GENERAL_ENTRY_BOOK_ENTRY_REPORT_PATH.key); + return result; + } + + public String getProvisionalEntryBookEntryBookMainReportPath() { + String result = getOption(Option.PROVISIONAL_ENTRY_BOOK_ENTRY_BOOK_MAIN_REPORT_PATH.getKey()); + return result; + } + + public String getProvisionalEntryBookEntryBookReportPath() { + String result = getOption(Option.PROVISIONAL_ENTRY_BOOK_ENTRY_BOOK_REPORT_PATH.getKey()); + return result; + } + + public String getProvisionalEntryBookFinancialPeriodReportPath() { + String result = getOption(Option.PROVISIONAL_ENTRY_BOOK_FINANCIAL_PERIOD_REPORT_PATH.getKey()); + return result; + } + + public String getProvisionalEntryBookTransactionReportPath() { + String result = getOption(Option.PROVISIONAL_ENTRY_BOOK_TRANSACTION_REPORT_PATH.getKey()); + return result; + } + /** Used in ???? */ protected static final String[] DEFAULT_JAXX_PCS = {"fullScreen", "locale", "decimalSeparator", "scale", "thousandSeparator", "currency"}; @@ -380,7 +454,6 @@ public class LimaSwingConfig extends ApplicationConfig { */ public enum Option implements ConfigOptionDef { - CONFIG_FILE(CONFIG_FILE_NAME, t("lima.config.configFileName.label"), n("lima.config.configFileName.description"), @@ -618,7 +691,79 @@ public class LimaSwingConfig extends ApplicationConfig { t("lima.config.cell.pair.selected.mandatory.foreground.label"), n("lima.config.cell.pair.selected.mandatory.foreground.description"), "#000000", - Color.class, false, false); + Color.class, false, false), + + REPORTS_DIR("lima.reports.dir", + "", + n("lima.config.reports.dir.description"), + "${lima.data.dir}/reports", File.class, false, false), + + + ACCOUNT_REPORT_PATH("lima.accounts.accountReportPath", + "", + "", + ROOT_PATH + "/lima-web/src/main/jasperreports/accounts/AccountReport.jrxml", + String.class, false, false), + + BALANCE_REPORT_PATH("lima.balance.balanceReportPath", + "", + "", + ROOT_PATH + "/lima-web/src/main/jasperreports/balance/BalanceReport.jrxml", + String.class, false, false), + + BALANCE_REPORT_ACCOUNT_REPORT_PATH("lima.balance.balanceReportAccountReportPath", + "", + "", + ROOT_PATH + "/lima-web/src/main/jasperreports/balance/BalanceReportAccountReport.jrxml", + String.class, false, false), + + BALANCE_SUB_ACCOUNT_REPORT_PATH("lima.balance.balanceSubAccountReportPath", + "", + n("lima.config.documentReport.balanceReportAccount.description"), + ROOT_PATH + "/lima-web/src/main/jasperreports/balance/BalanceSubAccountsReport.jrxml", + String.class, false, false), + + GENERAL_ENTRY_BOOK_ENTRY_BOOK_MAIN_REPORT_PATH("lima.generalEntryBook.entryBookMainReportPath", + "", + "", + ROOT_PATH + "/lima-web/src/main/jasperreports/generalEntryBook/EntryBookMainReport.jrxml", + String.class, false, false), + + GENERAL_ENTRY_BOOK_ENTRY_BOOK_PERIOD_REPORT_PATH("lima.generalEntryBook.entryBookPeriodReportPath", + "", + "", + ROOT_PATH + "/lima-web/src/main/jasperreports/generalEntryBook/EntryBookPeriodReport.jrxml", + String.class, false, false), + + + GENERAL_ENTRY_BOOK_GENERAL_ENTRY_BOOK_ENTRY_REPORT_PATH("lima.generalEntryBook.generalEntryBookEntryReportPath", + "", + "", + ROOT_PATH + "/lima-web/src/main/jasperreports/generalEntryBook/GeneralEntryBookEntryReport.jrxml", + String.class, false, false), + + PROVISIONAL_ENTRY_BOOK_ENTRY_BOOK_MAIN_REPORT_PATH("lima.provisionalEntryBook.entryBookMainReportPath", + "", + "", + ROOT_PATH + "/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookMainReport.jrxml", + String.class,false, false), + PROVISIONAL_ENTRY_BOOK_ENTRY_BOOK_REPORT_PATH("lima.provisionalEntryBook.entryBookReport", + "", + "", + ROOT_PATH + "/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookReport.jrxml", + String.class,false, false), + + PROVISIONAL_ENTRY_BOOK_FINANCIAL_PERIOD_REPORT_PATH("lima.provisionalEntryBook.financialPeriodReportPath", + "", + "", + ROOT_PATH + "/lima-web/src/main/jasperreports/provisionalEntryBook/FinancialPeriodReport.jrxml", + String.class, false, false), + + PROVISIONAL_ENTRY_BOOK_TRANSACTION_REPORT_PATH("lima.provisionalEntryBook.transactionReportPath", + "", + "", + ROOT_PATH + "/lima-web/src/main/jasperreports/provisionalEntryBook/TransactionReport.jrxml", + String.class, false, false); protected enum ComportmentEditingCellEnum {ALL, NOTHING} @@ -739,9 +884,15 @@ public class LimaSwingConfig extends ApplicationConfig { optionsService = LimaServiceFactory.getService(OptionsService.class); // scale server option - String scaleOption = getOption("scale"); + String scaleOption = getOption(Option.SCALE.key); if (StringUtils.isNotBlank(scaleOption)) { optionsService.setScale(scaleOption); } + + // report BigDecimal format +// String bigDecimalFormat = getOption(Option.BIG_DECIMAL_FORMAT.key); +// if (StringUtils.isNotBlank(bigDecimalFormat)) { +// optionsService.setBigDecimalFormat(bigDecimalFormat); +// } } } diff --git a/lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java b/lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java index 5bc903f..ee26da8 100644 --- a/lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java +++ b/lima-swing/src/main/java/org/chorem/lima/util/BigDecimalToString.java @@ -36,6 +36,12 @@ public class BigDecimalToString { public static String format(BigDecimal value) { + DecimalFormat formatter = getDecimalFormat(); + String result = formatter.format(value); + return result; + } + + public static DecimalFormat getDecimalFormat() { LimaSwingConfig config = LimaSwingApplicationContext.getContext().getConfig(); StringBuilder scale = new StringBuilder(); for (int i = 0; i < config.getScale(); i++) { @@ -55,8 +61,7 @@ public class BigDecimalToString { //always set grouping formatter.setGroupingUsed(true); formatter.setGroupingSize(3); - String result = formatter.format(value); - return result; + return formatter; } } diff --git a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties index 6559df7..7fd97de 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties @@ -90,12 +90,16 @@ lima.config.data.dir.description= lima.config.data.dir.label= lima.config.decimalSeparator.description= lima.config.decimalSeparator.label= +lima.config.documentReport.balanceReportAccount.description= +lima.config.documentReport.bigDecimalFormat.description= +lima.config.documentReport.bigDecimalFormat.label= lima.config.host.address.description= lima.config.host.address.label= lima.config.i18n.dir.description= lima.config.i18n.dir.label= lima.config.locale.description=Localization used by LIMA lima.config.locale.label= +lima.config.reports.dir.description= lima.config.resources.dir.description= lima.config.resources.dir.label= lima.config.scale.description= diff --git a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties index 91d9677..c09f545 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties @@ -89,6 +89,9 @@ lima.config.data.dir.description=Répertoire d'enregistrement des données de l' lima.config.data.dir.label=Répertoire des données lima.config.decimalSeparator.description=Caractères de séparation entre la partie entière et la parti décimale d'un nombre lima.config.decimalSeparator.label=Séparateur de décimales +lima.config.documentReport.balanceReportAccount.description= +lima.config.documentReport.bigDecimalFormat.description=format pour affichage des montants dans les rapports +lima.config.documentReport.bigDecimalFormat.label=format pour affichage des montants lima.config.host.address.description=Adresse du serveur distant lima.config.host.address.label=Serveur lima.config.i18n.dir.description=Dossier contenant les traduction de lima @@ -99,6 +102,7 @@ lima.config.numberSeparator.comma=Virgule lima.config.numberSeparator.dot=Point lima.config.numberSeparator.semicolon=Point-virgule lima.config.numberSeparator.space=Espace +lima.config.reports.dir.description= lima.config.resources.dir.description=Dossier contenant les fichiers ressouces de lima lima.config.resources.dir.label=Dossier ressources lima.config.scale.description=Nombre de caratères décimales pour les montants diff --git a/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookMainReport.jrxml b/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookMainReport.jrxml index 4e2e640..8808273 100644 --- a/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookMainReport.jrxml +++ b/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookMainReport.jrxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> -<!-- 2014-11-20T10:49:29 --> +<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> +<!-- 2015-01-09T11:11:04 --> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceReport" pageWidth="595" pageHeight="842" whenNoDataType="BlankPage" columnWidth="575" leftMargin="10" rightMargin="10" topMargin="10" bottomMargin="10" isSummaryNewPage="true" isSummaryWithPageHeaderAndFooter="true" isFloa [...] <property name="com.jaspersoft.studio.unit." value="pixel"/> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> @@ -115,7 +115,7 @@ <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> </box> <staticText> - <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="60" height="20" forecolor="#804000" uuid="63da28a1-a793-4bf5-81d4-6a4d6fc1e4df"> + <reportElement stretchType="RelativeToBandHeight" x="0" y="0" width="60" height="20" forecolor="#804000" backcolor="#FFFFFF" uuid="63da28a1-a793-4bf5-81d4-6a4d6fc1e4df"> <property name="local_mesure_unitwidth" value="pixel"/> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> diff --git a/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookReport.jrxml b/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookReport.jrxml index 36565c0..b5b4e2e 100644 --- a/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookReport.jrxml +++ b/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookReport.jrxml @@ -1,18 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> -<!-- 2014-11-20T12:48:02 --> -<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="51" whenNoDataType="BlankPage" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isFloatColumnFooter="true" whenResourceMissingType="Empty" isIgnoreP [...] +<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> +<!-- 2015-01-13T10:25:20 --> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="50" whenNoDataType="BlankPage" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isFloatColumnFooter="true" whenResourceMissingType="Empty" isIgnoreP [...] <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> <property name="com.jaspersoft.studio.unit." value="pixel"/> - <property name="com.jaspersoft.studio.unit.pageHeight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.pageWidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.topMargin" value="pixel"/> - <property name="com.jaspersoft.studio.unit.bottomMargin" value="pixel"/> - <property name="com.jaspersoft.studio.unit.leftMargin" value="pixel"/> - <property name="com.jaspersoft.studio.unit.rightMargin" value="pixel"/> - <property name="com.jaspersoft.studio.unit.columnWidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.columnSpacing" value="pixel"/> <style name="Default" isDefault="true" fontName="Arial"/> <style name="Default oblique" fontName="Monospaced"/> <queryString> @@ -39,16 +31,18 @@ <property name="com.jaspersoft.studio.unit.y" value="px"/> </reportElement> <box> - <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> </box> <textField pattern="" isBlankWhenNull="true"> - <reportElement mode="Transparent" x="0" y="0" width="578" height="10" isRemoveLineWhenBlank="true" forecolor="#736343" uuid="1472eda4-3df8-47ae-aba7-0aae2d2bedae"> + <reportElement mode="Transparent" x="0" y="0" width="434" height="10" isRemoveLineWhenBlank="true" forecolor="#736343" uuid="1472eda4-3df8-47ae-aba7-0aae2d2bedae"> <property name="local_mesure_unity" value="pixel"/> <property name="local_mesure_unitx" value="pixel"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <box> <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> @@ -62,6 +56,38 @@ </textElement> <textFieldExpression><![CDATA["Journal " + $F{code} + " " + $F{libelle}]]></textFieldExpression> </textField> + <textField> + <reportElement x="434" y="0" width="72" height="10" uuid="baca77fb-1d57-428f-8746-1bb482b61b55"> + <property name="local_mesure_unitx" value="pixel"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + </box> + </textField> + <textField> + <reportElement x="506" y="0" width="72" height="10" uuid="da04b7ce-dd80-4c40-a0cb-7d74dac0da00"> + <property name="local_mesure_unitx" value="pixel"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + </box> + </textField> </frame> </band> </pageHeader> @@ -78,21 +104,5 @@ <subreportExpression><![CDATA[JasperCompileManager.compileReport($F{subReportPath})]]></subreportExpression> </subreport> </band> - <band height="1"> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - <break> - <reportElement x="0" y="0" width="100" height="1" uuid="7f204895-3931-4eba-afb5-9614bcbb59f2"> - <printWhenExpression><![CDATA[new Boolean(($V{REPORT_COUNT} > 1 || $V{PAGE_NUMBER} > 1) && ($V{REPORT_COUNT}<=$F{financialPeriodReport}.size()))]]></printWhenExpression> - </reportElement> - </break> - </band> </detail> - <columnFooter> - <band height="1"> - <line> - <reportElement style="Default" x="0" y="0" width="578" height="1" forecolor="#FDCA97" uuid="ca761e3c-0dba-448f-a60d-afc241c74411"/> - </line> - </band> - </columnFooter> </jasperReport> diff --git a/lima-web/src/main/jasperreports/provisionalEntryBook/FinancialPeriodReport.jrxml b/lima-web/src/main/jasperreports/provisionalEntryBook/FinancialPeriodReport.jrxml index 3f7b304..8a0b4a8 100644 --- a/lima-web/src/main/jasperreports/provisionalEntryBook/FinancialPeriodReport.jrxml +++ b/lima-web/src/main/jasperreports/provisionalEntryBook/FinancialPeriodReport.jrxml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> -<!-- 2014-11-20T14:12:55 --> +<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> +<!-- 2015-01-13T15:57:01 --> <jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="51" whenNoDataType="BlankPage" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" isFloatColumnFooter="true" whenResourceMissingType="Empty" isIgnoreP [...] <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> @@ -42,16 +42,18 @@ <property name="com.jaspersoft.studio.unit.y" value="px"/> </reportElement> <box> - <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> </box> <textField pattern="" isBlankWhenNull="true"> - <reportElement x="0" y="0" width="578" height="10" forecolor="#736343" uuid="1472eda4-3df8-47ae-aba7-0aae2d2bedae"> + <reportElement x="0" y="0" width="434" height="10" forecolor="#736343" uuid="1472eda4-3df8-47ae-aba7-0aae2d2bedae"> <property name="local_mesure_unity" value="pixel"/> <property name="local_mesure_unitx" value="pixel"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <box> <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> @@ -65,6 +67,38 @@ </textElement> <textFieldExpression><![CDATA[new SimpleDateFormat("MMMM yyyy").format($F{period})]]></textFieldExpression> </textField> + <textField pattern=""> + <reportElement x="434" y="0" width="72" height="10" uuid="e6c93d97-54e3-4b70-9c28-56a3319bad77"> + <property name="local_mesure_unitx" value="pixel"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + </box> + </textField> + <textField> + <reportElement x="506" y="0" width="72" height="10" uuid="b5197d26-0ac8-4102-9a6e-857a6e2b2c99"> + <property name="local_mesure_unitx" value="pixel"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + </box> + </textField> </frame> </band> </pageHeader> @@ -80,16 +114,18 @@ <property name="com.jaspersoft.studio.unit.y" value="px"/> </reportElement> <box> - <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> </box> <textField pattern="" isBlankWhenNull="true"> - <reportElement x="0" y="0" width="578" height="10" isRemoveLineWhenBlank="true" forecolor="#736343" uuid="1472eda4-3df8-47ae-aba7-0aae2d2bedae"> + <reportElement x="0" y="0" width="434" height="10" isRemoveLineWhenBlank="true" forecolor="#736343" uuid="1472eda4-3df8-47ae-aba7-0aae2d2bedae"> <property name="local_mesure_unity" value="pixel"/> <property name="local_mesure_unitx" value="pixel"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <box> <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> @@ -103,6 +139,38 @@ </textElement> <textFieldExpression><![CDATA[new SimpleDateFormat("MMMM yyyy").format($F{period})]]></textFieldExpression> </textField> + <textField pattern=""> + <reportElement x="434" y="0" width="72" height="10" uuid="128b759f-c6d0-4310-a83c-8b9993d537dd"> + <property name="local_mesure_unitx" value="pixel"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + </box> + </textField> + <textField> + <reportElement x="506" y="0" width="72" height="10" uuid="49cc6926-8eb0-4e4c-9c53-6efc0a56a728"> + <property name="local_mesure_unitx" value="pixel"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + </box> + </textField> </frame> <subreport isUsingCache="false" runToBottom="false"> <reportElement key="subreport-5" positionType="Float" mode="Opaque" x="0" y="0" width="578" height="10" isRemoveLineWhenBlank="true" forecolor="#000000" backcolor="#FFFFFF" uuid="d7fbefd9-03b1-4eaf-b7c6-fb46c737190a"> @@ -125,80 +193,24 @@ <subreportExpression><![CDATA[JasperCompileManager.compileReport($F{subReportPath})]]></subreportExpression> </subreport> </band> - <band height="20" splitType="Prevent"> + <band height="10" splitType="Prevent"> <property name="local_mesure_unitheight" value="pixel"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> <frame> - <reportElement style="Default" stretchType="RelativeToTallestObject" mode="Opaque" x="0" y="0" width="578" height="20" forecolor="#FEEEDE" backcolor="#FEEEDE" uuid="571d1774-22c4-4ab4-901b-7470c74f0405"> + <reportElement style="Default" stretchType="RelativeToTallestObject" mode="Opaque" x="0" y="0" width="578" height="10" forecolor="#FEEEDE" backcolor="#FEEEDE" uuid="571d1774-22c4-4ab4-901b-7470c74f0405"> <property name="local_mesure_unitheight" value="pixel"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> <property name="local_mesure_unity" value="pixel"/> <property name="com.jaspersoft.studio.unit.y" value="px"/> </reportElement> <box> - <topPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#FDCA97"/> + <topPen lineWidth="0.0" lineColor="#804000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="1.0" lineStyle="Solid" lineColor="#804000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> </box> - <textField isBlankWhenNull="true"> - <reportElement x="0" y="0" width="434" height="10" forecolor="#736343" uuid="dc68030b-597d-47b5-8be9-eecfdde17f5e"> - <property name="local_mesure_unity" value="pixel"/> - <property name="local_mesure_unitx" value="pixel"/> - <property name="com.jaspersoft.studio.unit.x" value="px"/> - <property name="local_mesure_unitwidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.width" value="px"/> - <property name="local_mesure_unitheight" value="pixel"/> - <property name="com.jaspersoft.studio.unit.height" value="px"/> - </reportElement> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Left" verticalAlignment="Middle"> - <font size="8" isBold="true" isItalic="true"/> - <paragraph lineSpacingSize="0.0" leftIndent="80"/> - </textElement> - <textFieldExpression><![CDATA["Sous-total pour " + new SimpleDateFormat("MMMM yyyy").format($F{period})]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement style="Default" x="434" y="10" width="72" height="10" forecolor="#736343" uuid="53ba669a-6626-4e70-bbf0-fb243908a20e"> - <property name="local_mesure_unity" value="pixel"/> - <property name="com.jaspersoft.studio.unit.y" value="px"/> - </reportElement> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8" isBold="true"/> - <paragraph lineSpacingSize="0.0" rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{soldeDebit}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement style="Default" x="506" y="10" width="72" height="10" forecolor="#736343" uuid="edb8a8c1-ac7a-44cb-9de6-b231b00f966f"> - <property name="local_mesure_unity" value="pixel"/> - <property name="com.jaspersoft.studio.unit.y" value="px"/> - </reportElement> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8" isBold="true"/> - <paragraph lineSpacingSize="0.0" rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{soldeCredit}]]></textFieldExpression> - </textField> <textField pattern="" isBlankWhenNull="true"> - <reportElement x="0" y="10" width="434" height="10" forecolor="#736343" uuid="d3f672ab-80d2-4467-9ff9-73d4611a3025"> + <reportElement x="0" y="0" width="434" height="10" forecolor="#736343" uuid="d3f672ab-80d2-4467-9ff9-73d4611a3025"> <property name="local_mesure_unity" value="pixel"/> <property name="local_mesure_unitx" value="pixel"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> @@ -211,7 +223,7 @@ <box> <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> </box> <textElement textAlignment="Left" verticalAlignment="Middle"> @@ -220,52 +232,41 @@ </textElement> <textFieldExpression><![CDATA["Solde pour le journal " + $F{entryBookCode} + " jusqu'à fin " + new SimpleDateFormat("MMMM yyyy").format($F{period})]]></textFieldExpression> </textField> - <textField pattern="" isBlankWhenNull="true"> - <reportElement style="Default" x="434" y="0" width="72" height="10" forecolor="#736343" uuid="6edd06d5-7b8c-4b6e-b114-9c97f09b7fc4"> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="434" y="0" width="72" height="10" forecolor="#736343" uuid="53ba669a-6626-4e70-bbf0-fb243908a20e"> <property name="local_mesure_unity" value="pixel"/> <property name="com.jaspersoft.studio.unit.y" value="px"/> - <property name="local_mesure_unitx" value="pixel"/> - <property name="com.jaspersoft.studio.unit.x" value="px"/> </reportElement> <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> </box> <textElement textAlignment="Right" verticalAlignment="Middle"> <font fontName="Courier 10 Pitch" size="8" isBold="true"/> <paragraph lineSpacingSize="0.0" rightIndent="2"/> </textElement> - <textFieldExpression><![CDATA[$F{debit}]]></textFieldExpression> + <textFieldExpression><![CDATA[$F{soldeDebit}]]></textFieldExpression> </textField> - <textField pattern="" isBlankWhenNull="true"> - <reportElement style="Default" x="506" y="0" width="72" height="10" forecolor="#736343" uuid="57f02392-c1a0-4a55-abd1-559b2dbce366"> + <textField isBlankWhenNull="true"> + <reportElement style="Default" x="506" y="0" width="72" height="10" forecolor="#736343" uuid="edb8a8c1-ac7a-44cb-9de6-b231b00f966f"> <property name="local_mesure_unity" value="pixel"/> <property name="com.jaspersoft.studio.unit.y" value="px"/> - <property name="local_mesure_unitx" value="pixel"/> - <property name="com.jaspersoft.studio.unit.x" value="px"/> </reportElement> <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> </box> <textElement textAlignment="Right" verticalAlignment="Middle"> <font fontName="Courier 10 Pitch" size="8" isBold="true"/> <paragraph lineSpacingSize="0.0" rightIndent="2"/> </textElement> - <textFieldExpression><![CDATA[$F{credit}]]></textFieldExpression> + <textFieldExpression><![CDATA[$F{soldeCredit}]]></textFieldExpression> </textField> </frame> </band> </detail> - <columnFooter> - <band height="1"> - <line> - <reportElement style="Default" x="0" y="0" width="578" height="1" forecolor="#FDCA97" uuid="ca761e3c-0dba-448f-a60d-afc241c74411"/> - </line> - </band> - </columnFooter> </jasperReport> diff --git a/lima-web/src/main/jasperreports/provisionalEntryBook/Transaction.jrxml b/lima-web/src/main/jasperreports/provisionalEntryBook/Transaction.jrxml deleted file mode 100644 index 99b896a..0000000 --- a/lima-web/src/main/jasperreports/provisionalEntryBook/Transaction.jrxml +++ /dev/null @@ -1,124 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> -<!-- 2014-11-19T22:13:44 --> -<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="21" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="75ff86c6-c370-4f0b-a2d3-e17324a465bb"> - <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> - <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> - <property name="com.jaspersoft.studio.unit." value="pixel"/> - <style name="Default" isDefault="true" fontName="Arial"/> - <style name="Default oblique" fontName="Monospaced"/> - <queryString> - <![CDATA[]]> - </queryString> - <field name="libelle" class="java.lang.String"/> - <field name="debit" class="java.lang.String"/> - <field name="credit" class="java.lang.String"/> - <field name="transactionDate" class="java.util.Date"/> - <field name="account" class="java.lang.String"/> - <field name="voucher" class="java.lang.String"/> - <detail> - <band height="10" splitType="Stretch"> - <textField pattern="" isBlankWhenNull="true"> - <reportElement x="0" y="0" width="60" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"> - <property name="local_mesure_unitwidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.width" value="px"/> - </reportElement> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - </box> - <textElement textAlignment="Left" verticalAlignment="Middle"> - <font size="8"/> - <paragraph leftIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[new SimpleDateFormat("dd/MM/yyyy").format($F{transactionDate})]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="60" y="0" width="100" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"> - <property name="local_mesure_unitwidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.width" value="px"/> - <property name="local_mesure_unitx" value="pixel"/> - <property name="com.jaspersoft.studio.unit.x" value="px"/> - </reportElement> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - </box> - <textElement textAlignment="Left" verticalAlignment="Middle"> - <font size="8"/> - <paragraph leftIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{account}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="160" y="0" width="40" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"> - <property name="local_mesure_unitwidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.width" value="px"/> - </reportElement> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - </box> - <textElement textAlignment="Left" verticalAlignment="Middle"> - <font size="8"/> - <paragraph leftIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{voucher}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="200" y="0" width="234" height="10" uuid="0bcc6e5d-b2ee-474f-8e66-475933d55a16"> - <property name="local_mesure_unity" value="pixel"/> - <property name="local_mesure_unitwidth" value="pixel"/> - <property name="com.jaspersoft.studio.unit.width" value="px"/> - <property name="local_mesure_unitx" value="pixel"/> - <property name="com.jaspersoft.studio.unit.x" value="px"/> - </reportElement> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - </box> - <textElement textAlignment="Left" verticalAlignment="Middle"> - <font size="8"/> - <paragraph leftIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{libelle}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="434" y="0" width="72" height="10" uuid="53ba669a-6626-4e70-bbf0-fb243908a20e"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8"/> - <paragraph lineSpacingSize="0.0" rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{debit}]]></textFieldExpression> - </textField> - <textField isBlankWhenNull="true"> - <reportElement x="506" y="0" width="72" height="10" uuid="edb8a8c1-ac7a-44cb-9de6-b231b00f966f"/> - <box> - <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> - <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> - </box> - <textElement textAlignment="Right" verticalAlignment="Middle"> - <font fontName="Courier 10 Pitch" size="8"/> - <paragraph lineSpacingSize="0.0" rightIndent="2"/> - </textElement> - <textFieldExpression><![CDATA[$F{credit}]]></textFieldExpression> - </textField> - </band> - </detail> -</jasperReport> diff --git a/lima-web/src/main/jasperreports/provisionalEntryBook/TransactionReport.jrxml b/lima-web/src/main/jasperreports/provisionalEntryBook/TransactionReport.jrxml new file mode 100644 index 0000000..7ff7234 --- /dev/null +++ b/lima-web/src/main/jasperreports/provisionalEntryBook/TransactionReport.jrxml @@ -0,0 +1,297 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Created with Jaspersoft Studio version 5.6.2.final using JasperReports Library version 5.6.1 --> +<!-- 2015-01-13T15:57:19 --> +<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="BalanceClassesReport" pageWidth="578" pageHeight="30" columnWidth="578" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" whenResourceMissingType="Empty" isIgnorePagination="true" uuid="75ff86c6-c370-4f0b-a2d3-e17324a465bb"> + <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> + <property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.HorizontalRowLayout"/> + <property name="com.jaspersoft.studio.unit." value="pixel"/> + <style name="Default" isDefault="true" fontName="Arial"/> + <style name="Default oblique" fontName="Monospaced"/> + <queryString> + <![CDATA[]]> + </queryString> + <field name="libelle" class="java.lang.String"/> + <field name="debit" class="java.math.BigDecimal"/> + <field name="credit" class="java.math.BigDecimal"/> + <field name="transactionDate" class="java.util.Date"/> + <field name="account" class="java.lang.String"/> + <field name="voucher" class="java.lang.String"/> + <field name="formatter" class="java.text.DecimalFormat"/> + <variable name="EntryBookDebitSolde" class="java.math.BigDecimal" calculation="Sum"> + <variableExpression><![CDATA[$F{debit}]]></variableExpression> + <initialValueExpression><![CDATA[BigDecimal.ZERO]]></initialValueExpression> + </variable> + <variable name="EntryBookEndColomnDebitSolde" class="java.math.BigDecimal" resetType="Column" calculation="Sum"> + <variableExpression><![CDATA[$F{debit}]]></variableExpression> + <initialValueExpression><![CDATA[BigDecimal.ZERO]]></initialValueExpression> + </variable> + <variable name="EntryBookCreditSolde" class="java.math.BigDecimal" calculation="Sum"> + <variableExpression><![CDATA[$F{credit}]]></variableExpression> + <initialValueExpression><![CDATA[BigDecimal.ZERO]]></initialValueExpression> + </variable> + <variable name="EntryBookEndColomnCreditSolde" class="java.math.BigDecimal" resetType="Column" calculation="Sum"> + <variableExpression><![CDATA[$F{credit}]]></variableExpression> + <initialValueExpression><![CDATA[BigDecimal.ZERO]]></initialValueExpression> + </variable> + <detail> + <band height="10" splitType="Stretch"> + <textField pattern="" isBlankWhenNull="true"> + <reportElement x="0" y="0" width="60" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8"/> + <paragraph leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[new SimpleDateFormat("dd/MM/yyyy").format($F{transactionDate})]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement x="60" y="0" width="100" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitx" value="pixel"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8"/> + <paragraph leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{account}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement x="160" y="0" width="40" height="10" uuid="c5f32333-c77a-45f8-9bec-c8d61e15d85a"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8"/> + <paragraph leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{voucher}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="true"> + <reportElement x="200" y="0" width="234" height="10" uuid="0bcc6e5d-b2ee-474f-8e66-475933d55a16"> + <property name="local_mesure_unity" value="pixel"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitx" value="pixel"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + </box> + <textElement textAlignment="Left" verticalAlignment="Middle"> + <font size="8"/> + <paragraph leftIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[$F{libelle}]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="false"> + <reportElement x="506" y="0" width="72" height="10" uuid="edb8a8c1-ac7a-44cb-9de6-b231b00f966f"/> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + </box> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font fontName="Courier 10 Pitch" size="8"/> + <paragraph lineSpacingSize="0.0" rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[new Boolean($F{credit}.compareTo(BigDecimal.ZERO) != 0) ? $F{formatter}.format($F{credit}) : ""]]></textFieldExpression> + </textField> + <textField> + <reportElement x="434" y="0" width="72" height="10" uuid="39bdbda9-8233-4e46-b3ed-d5f0d06e2d86"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <textElement textAlignment="Right" verticalAlignment="Middle"> + <font fontName="Courier 10 Pitch" size="8"/> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[new Boolean($F{debit}.compareTo(BigDecimal.ZERO) != 0) ? $F{formatter}.format($F{debit}) : ""]]></textFieldExpression> + </textField> + </band> + </detail> + <columnFooter> + <band height="10"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <frame> + <reportElement mode="Transparent" x="0" y="0" width="578" height="10" uuid="48190dbf-c1d0-421a-bfcb-9c9db0c0c359"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + <bottomPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + </box> + <textField> + <reportElement x="0" y="0" width="434" height="10" forecolor="#736343" uuid="d622e85e-b93e-4be5-90e0-cf3b854f012d"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + </box> + <textElement> + <font size="8" isBold="true"/> + <paragraph leftIndent="80"/> + </textElement> + <textFieldExpression><![CDATA["Sous-total"]]></textFieldExpression> + </textField> + <textField pattern="" isBlankWhenNull="false"> + <reportElement key="" x="434" y="0" width="72" height="10" forecolor="#736343" uuid="75ef2eb9-6e2d-447c-9dd6-488a63fcdf04"> + <property name="local_mesure_unitx" value="pixel"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <printWhenExpression><![CDATA[new Boolean($V{EntryBookEndColomnDebitSolde}.compareTo(BigDecimal.ZERO) != 0)]]></printWhenExpression> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + </box> + <textElement textAlignment="Right"> + <font fontName="Courier 10 Pitch" size="8"/> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[new Boolean($V{EntryBookEndColomnDebitSolde}.compareTo(BigDecimal.ZERO) != 0) ? $F{formatter}.format($V{EntryBookEndColomnDebitSolde}) : ""]]></textFieldExpression> + </textField> + <textField isBlankWhenNull="false"> + <reportElement x="506" y="0" width="72" height="10" forecolor="#736343" uuid="c52c36a6-6a50-473b-9dad-0526f039b7c1"> + <property name="local_mesure_unitx" value="pixel"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#736343"/> + </box> + <textElement textAlignment="Right"> + <font fontName="Courier 10 Pitch" size="8"/> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[new Boolean($V{EntryBookEndColomnCreditSolde}.compareTo(BigDecimal.ZERO) != 0) ? $F{formatter}.format($V{EntryBookEndColomnCreditSolde}) : ""]]></textFieldExpression> + </textField> + </frame> + </band> + </columnFooter> + <lastPageFooter> + <band height="10"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <frame> + <reportElement mode="Opaque" x="0" y="0" width="578" height="10" forecolor="#FEEEDE" backcolor="#FEEEDE" uuid="d7d82e83-663d-410a-a61d-6211645557ce"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + </box> + <textField> + <reportElement x="0" y="0" width="434" height="10" forecolor="#736343" uuid="16735e42-8adf-47c5-8aa6-590bbc2327a9"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + </box> + <textElement> + <font size="8" isBold="true"/> + <paragraph leftIndent="80"/> + </textElement> + <textFieldExpression><![CDATA["Sous-total pour " + new SimpleDateFormat("MMMM yyyy").format($F{transactionDate})]]></textFieldExpression> + </textField> + <textField pattern=""> + <reportElement x="434" y="0" width="72" height="10" forecolor="#736343" uuid="4c23c4e2-1c93-4a78-b82b-895286708171"> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="local_mesure_unitx" value="pixel"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#804000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + </box> + <textElement textAlignment="Right"> + <font fontName="Courier 10 Pitch" size="8" isBold="true"/> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[new Boolean($V{EntryBookDebitSolde}.compareTo(BigDecimal.ZERO) != 0) ? $F{formatter}.format($V{EntryBookDebitSolde}) : ""]]></textFieldExpression> + </textField> + <textField> + <reportElement x="506" y="0" width="72" height="10" forecolor="#736343" uuid="a7b19080-fcc5-407b-ae5c-20a85afd363e"> + <property name="local_mesure_unitx" value="pixel"/> + <property name="com.jaspersoft.studio.unit.x" value="px"/> + <property name="local_mesure_unitwidth" value="pixel"/> + <property name="com.jaspersoft.studio.unit.width" value="px"/> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <box> + <topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <leftPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + <bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/> + <rightPen lineWidth="0.6" lineStyle="Solid" lineColor="#804000"/> + </box> + <textElement textAlignment="Right"> + <font fontName="Courier 10 Pitch" size="8" isBold="true"/> + <paragraph rightIndent="2"/> + </textElement> + <textFieldExpression><![CDATA[new Boolean($V{EntryBookCreditSolde}.compareTo(BigDecimal.ZERO) != 0) ? $F{formatter}.format($V{EntryBookCreditSolde}) : ""]]></textFieldExpression> + </textField> + </frame> + </band> + </lastPageFooter> +</jasperReport> 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 086b52d..2b014a9 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 @@ -26,8 +26,6 @@ import com.google.common.collect.Lists; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.pdfbox.examples.fdf.SetField; -import org.apache.pdfbox.pdmodel.PDDocument; import org.chorem.lima.LimaTechnicalException; import org.chorem.lima.beans.BalanceTrial; import org.chorem.lima.beans.DocumentReport; @@ -44,28 +42,27 @@ import org.chorem.lima.business.api.ReportService; import org.chorem.lima.business.api.VatStatementService; import org.chorem.lima.business.api.report.BalanceReportService; import org.chorem.lima.business.api.report.GeneralEntryBookReportService; +import org.chorem.lima.business.api.report.LedgerReportService; import org.chorem.lima.business.api.report.ProvisionalEntryBookReportService; +import org.chorem.lima.business.utils.BigDecimalToString; import org.chorem.lima.business.utils.EntryComparator; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.Identity; -import org.chorem.lima.entity.VatStatement; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.web.action.balance.ReportBuilder; import org.chorem.lima.web.utils.DocumentsEnum; import javax.swing.*; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; +import java.util.Properties; import static org.nuiton.i18n.I18n.t; @@ -88,18 +85,20 @@ public class DocumentService { protected ProvisionalEntryBookReportService provisionalEntryBookReportService; + protected LedgerReportService ledgerReportService; + protected ClosedPeriodicEntryBookService closedPeriodicEntryBookService; protected FinancialPeriodService financialPeriodService; protected EntryService entryService; - protected String path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath(); - protected ReportBuilder reportBuilder; protected AccountService accountService; + protected String path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath(); + protected final String BALANCE_FILE_PATH = path + File.separator + DocumentsEnum.BALANCE.getFileName() + ".pdf"; protected final String GENERAL_ENTRY_BOOK_REPORT_PDF_FILE_PATH = path + File.separator + DocumentsEnum.GENERAL_ENTRY_BOOK.getFileName() + ".pdf"; protected final String ENTRY_BOOKS_REPORT_PDF_FILE_PATH = path + File.separator + DocumentsEnum.ENTRY_BOOKS.getFileName() + ".pdf"; @@ -400,79 +399,79 @@ public class DocumentService { } //############## VAT ############## - public void createVatDocuments(Date beginDate, - Date endDate, - String autocomplete) { - - String filePath = path + File.separator - + DocumentsEnum.VAT.getFileName() + ".pdf"; - - String path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath(); - - String filePathDefault = path + File.separator - + DocumentsEnum.VAT.getFileName() + "_default.pdf"; - - PDDocument doc; - InputStream reportsStream; - - String vatPDFUrl = LimaServiceConfig.getInstance().getVatPDFUrl(); - - if (vatPDFUrl.equals("default")) { - reportsStream = DocumentService.class - .getResourceAsStream("/reports/vat_form_fr.pdf"); - if (reportsStream == null) { - throw new LimaTechnicalException("Could not find such file " - + "/reports/vat_form_fr.pdf"); - } - } else { - try { - reportsStream = new FileInputStream(filePathDefault); - } catch (FileNotFoundException eee) { - throw new LimaTechnicalException("Could not find such file " - + filePathDefault, eee); - } - } - - try { - - // load the document - doc = PDDocument.load(reportsStream); - - if (autocomplete != null) { - if (log.isDebugEnabled()) { - log.debug("autocomplete: " + autocomplete); - } - if (autocomplete.equals("true")) { - - SetField fields = new SetField(); - - //search for all VAT Statements from the report - List<VatStatement> vatStatementsList = vatStatementService.getAllVatStatements(); - if (log.isDebugEnabled()) { - log.debug("vatStatementsList.size() : " + vatStatementsList.size()); - } - for (VatStatement vatStatement : vatStatementsList) { - //search for amount to display - BigDecimal amount = vatStatementService.vatStatementAmounts(vatStatement, beginDate, endDate).getAmount(); - //display amount only if it is a child and has a BoxName - if (vatStatement.getBoxName() != null && !vatStatement.isHeader()) { - if (log.isDebugEnabled()) { - log.debug("Set field..."); - } - fields.setField(doc, vatStatement.getBoxName(), amount.toString()); - } - } - } - } - - // save the updated document to the new file and close - doc.save(filePath); - doc.close(); - - } catch (Exception ex) { - throw new LimaTechnicalException("Can't create document", ex); - } - } +// public void createVatDocuments(Date beginDate, +// Date endDate, +// String autocomplete) { +// +// String filePath = path + File.separator +// + DocumentsEnum.VAT.getFileName() + ".pdf"; +// +// String path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath(); +// +// String filePathDefault = path + File.separator +// + DocumentsEnum.VAT.getFileName() + "_default.pdf"; +// +// PDDocument doc; +// InputStream reportsStream; +// +// String vatPDFUrl = LimaServiceConfig.getInstance().getVatPDFUrl(); +// +// if (vatPDFUrl.equals("default")) { +// reportsStream = DocumentService.class +// .getResourceAsStream("/reports/vat_form_fr.pdf"); +// if (reportsStream == null) { +// throw new LimaTechnicalException("Could not find such file " +// + "/reports/vat_form_fr.pdf"); +// } +// } else { +// try { +// reportsStream = new FileInputStream(filePathDefault); +// } catch (FileNotFoundException eee) { +// throw new LimaTechnicalException("Could not find such file " +// + filePathDefault, eee); +// } +// } +// +// try { +// +// // load the document +// doc = PDDocument.load(reportsStream); +// +// if (autocomplete != null) { +// if (log.isDebugEnabled()) { +// log.debug("autocomplete: " + autocomplete); +// } +// if (autocomplete.equals("true")) { +// +// SetField fields = new SetField(); +// +// //search for all VAT Statements from the report +// List<VatStatement> vatStatementsList = vatStatementService.getAllVatStatements(); +// if (log.isDebugEnabled()) { +// log.debug("vatStatementsList.size() : " + vatStatementsList.size()); +// } +// for (VatStatement vatStatement : vatStatementsList) { +// //search for amount to display +// BigDecimal amount = vatStatementService.vatStatementAmounts(vatStatement, beginDate, endDate).getAmount(); +// //display amount only if it is a child and has a BoxName +// if (vatStatement.getBoxName() != null && !vatStatement.isHeader()) { +// if (log.isDebugEnabled()) { +// log.debug("Set field..."); +// } +// fields.setField(doc, vatStatement.getBoxName(), amount.toString()); +// } +// } +// } +// } +// +// // save the updated document to the new file and close +// doc.save(filePath); +// doc.close(); +// +// } catch (Exception ex) { +// throw new LimaTechnicalException("Can't create document", ex); +// } +// } public String createAccountDocument(Date beginDate, Date endDate, String account) { @@ -691,8 +690,14 @@ public class DocumentService { } public DocumentReport createEntryBooksDocuments(Date beginDate, Date endDate, List<String> entryBookCodes, String currency) { - DocumentReport report = provisionalEntryBookReportService.getProvisionalEntryBookDocumentReport(beginDate, endDate, entryBookCodes, currency); + DocumentReport report = provisionalEntryBookReportService.getProvisionalEntryBookDocumentReport(beginDate, endDate, entryBookCodes, currency, 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); +// 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/action/balance/ReportBuilder.java b/lima-web/src/main/java/org/chorem/lima/web/action/balance/ReportBuilder.java index b0d571d..ff4238e 100644 --- a/lima-web/src/main/java/org/chorem/lima/web/action/balance/ReportBuilder.java +++ b/lima-web/src/main/java/org/chorem/lima/web/action/balance/ReportBuilder.java @@ -34,12 +34,14 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaTechnicalException; import org.chorem.lima.beans.DocumentReport; +import org.chorem.lima.business.LimaServiceConfig; import org.chorem.lima.business.utils.DocumentsEnum; import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; /** * Created by davidcosse on 02/10/14. @@ -55,12 +57,12 @@ public class ReportBuilder { public ReportBuilder() { try { + LimaServiceConfig config = LimaServiceConfig.getInstance(); + // compile phase - String rootPath = new File("").getAbsolutePath(); - // TODO DCossé 06/11/14 find it from properties - balanceReport= JasperCompileManager.compileReport(rootPath + "/lima-web/src/main/jasperreports/balance/BalanceReport.jrxml"); - generalEntryBookReport = JasperCompileManager.compileReport(rootPath + "/lima-web/src/main/jasperreports/generalEntryBook/EntryBookMainReport.jrxml"); - provisionalEntryBookReport = JasperCompileManager.compileReport(rootPath + "/lima-web/src/main/jasperreports/provisionalEntryBook/EntryBookMainReport.jrxml"); + balanceReport= JasperCompileManager.compileReport(config.getBalanceReportPath()); + generalEntryBookReport = JasperCompileManager.compileReport(config.getGeneralEntryBookEntryBookMainReportPath()); + provisionalEntryBookReport = JasperCompileManager.compileReport(config.getProvisionalEntryBookEntryBookMainReportPath()); reportsByDocumentType = Maps.newHashMap(); reportsByDocumentType.put(DocumentsEnum.BALANCE, balanceReport); 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 936972d..feb90be 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 @@ -58,6 +58,7 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.Properties; import static org.nuiton.i18n.I18n.t; @@ -71,26 +72,31 @@ public class HttpServerService { protected Server server; - protected String path; + //protected String path; protected int port; private static final SimpleDateFormat DATEFORMAT = new SimpleDateFormat("yyyy-MM-dd"); - protected ReportBuilder reportBuilder = new ReportBuilder(); + protected ReportBuilder reportBuilder; public HttpServerService() { - path = LimaServiceConfig.getInstance().getReportsDir().getAbsolutePath(); + //File reportDir = (File) props.get("REPORTS_DIR"); + //path = reportDir.getAbsolutePath(); port = LimaServiceConfig.getInstance().getHttpPort(); accountService = LimaServiceFactory.getService(AccountService.class); documentService = new DocumentService(); + reportBuilder = new ReportBuilder(); } /** start the server */ public void start() { if (server == null) { try { - FileUtil.createDirectoryIfNecessary(new File(path)); + LimaServiceConfig config = LimaServiceConfig.getInstance(); + File reportDir = config.getReportsDir(); + + FileUtil.createDirectoryIfNecessary(reportDir); server = new Server(port); @@ -172,6 +178,7 @@ public class HttpServerService { 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); @@ -193,9 +200,9 @@ public class HttpServerService { if (log.isDebugEnabled()) { log.debug("autocomplete : " + autocomplete); } - documentService.createVatDocuments( - beginDateFormat, endDateFormat, - autocomplete); +// documentService.createVatDocuments( +// beginDateFormat, endDateFormat, +// autocomplete); break; } } catch (ParseException eeePE) { @@ -215,6 +222,9 @@ public class HttpServerService { } IOUtils.write(report, out, Charsets.UTF_8); } else { + LimaServiceConfig config = LimaServiceConfig.getInstance(); + File reportDir = config.getReportsDir(); + String path = reportDir.getAbsolutePath(); URL doc = new URL("file:" + path + File.separator + model + ".pdf"); if (log.isDebugEnabled()) { log.debug("file:" + path + File.separator + model + ".pdf"); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.