Author: dcosse Date: 2014-04-15 18:09:41 +0200 (Tue, 15 Apr 2014) New Revision: 3778 Url: http://forge.chorem.org/projects/lima/repository/revisions/3778 Log: fixes #1015 fix EBP compta import failure Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-04-14 07:29:08 UTC (rev 3777) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2014-04-15 16:09:41 UTC (rev 3778) @@ -111,7 +111,7 @@ @Override public String createFinancialStatementsDocuments(Date beginDate, - Date endDate) throws LimaException { + Date endDate) throws LimaException { List<FinancialStatementAmounts> financialStatementAmounts = financialStatementService.financialStatementReport(beginDate, endDate); @@ -252,7 +252,7 @@ //############## Ledger ############## @Override public String createLedgerDocuments(Date beginDate, - Date endDate) throws LimaException { + Date endDate) throws LimaException { List<Object> list = new ArrayList<Object>(); String ledgerReport = constructHtmlHeader(t("lima-business.document.ledger")); @@ -289,7 +289,7 @@ ledgerReport += "<table align=\"left\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n"; String [] columnsNames = {t("lima-business.document.account"), t("lima-business.document.debit"), - t("lima-business.document.credit"), t("lima-business.document.solde")}; + t("lima-business.document.credit"), t("lima-business.document.solde")}; ledgerReport += constructTableHeader(columnsNames); ledgerReport += "<tbody>\n"; @@ -337,7 +337,7 @@ ledgerReport +="<tr>"; if (indexEntry == 0) { - ledgerReport += "<td><table align=\"right\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n"; + ledgerReport += "<td><table align=\"right\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n"; String [] columnsEntry = {t("lima-business.document.date"), t("lima-business.document.entrybook"), t("lima-business.document.voucher"), t("lima-business.document.description"), t("lima-business.document.debit"), @@ -389,7 +389,7 @@ @Override public String createEntryBooksDocuments(Date beginDate, - Date endDate) throws LimaException { + Date endDate) throws LimaException { String entryBookReport; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MMMMM yyyy"); try { @@ -439,7 +439,7 @@ String label = Strings.isNullOrEmpty(closedPeriodicEntryBook.getEntryBook().getLabel()) ? "-" :closedPeriodicEntryBook.getEntryBook().getLabel(); if (!journal.equals(label)) { entryBookReport += constructSubTitleHtml(t("lima-business.document.entrybook") - + " : " + label, + + " : " + label, subTitleSecPart); journal = label; } else { @@ -488,7 +488,7 @@ @Override public String createBalanceDocuments(Date beginDate, - Date endDate) throws LimaException { + Date endDate) throws LimaException { BalanceTrial balanceTrial = reportService.generateBalanceTrial(beginDate, endDate, null, false, true); @@ -566,7 +566,7 @@ @Override public String createGeneralEntryBooksDocuments(Date beginDate, - Date endDate) throws LimaException { + Date endDate) throws LimaException { String entryBookReport; try { @@ -575,9 +575,9 @@ if (beginDate != null && endDate != null) { String subTitle = t("lima-business.document.period1") + - simpleDateFormat.format(beginDate) + " " + - t("lima-business.document.period2") + - simpleDateFormat.format(endDate); + simpleDateFormat.format(beginDate) + " " + + t("lima-business.document.period2") + + simpleDateFormat.format(endDate); entryBookReport += constructSubTitleHtml(subTitle); FinancialPeriodDAO financialPeriodDAO = @@ -703,8 +703,8 @@ } } entryBookReport += "\t\t</tbody>\n" + - "\t</table>\n" + - "</body>\n</html>"; + "\t</table>\n" + + "</body>\n</html>"; } } catch (Exception ex) { throw new LimaException("Can't generate document", ex); @@ -720,12 +720,12 @@ String autocomplete) throws LimaException { String filePath = path + File.separator - + DocumentsEnum.VAT.getFileName() + ".pdf"; + + DocumentsEnum.VAT.getFileName() + ".pdf"; String path = LimaConfig.getInstance().getReportsDir().getAbsolutePath(); String filePathDefault = path + File.separator - + DocumentsEnum.VAT.getFileName() + "_default.pdf"; + + DocumentsEnum.VAT.getFileName() + "_default.pdf"; PDDocument doc; InputStream reportsStream; @@ -737,14 +737,14 @@ .getResourceAsStream("/reports/vat_form_fr.pdf"); if (reportsStream == null) { throw new LimaException("Could not find such file " - + "/reports/vat_form_fr.pdf"); + + "/reports/vat_form_fr.pdf"); } } else { try { reportsStream = new FileInputStream(filePathDefault); } catch (FileNotFoundException eee) { throw new LimaException("Could not find such file " - + filePathDefault, eee); + + filePathDefault, eee); } } @@ -804,7 +804,7 @@ ReportsDatas results; - if (beginDate != null && endDate != null && account != null) { + if (beginDate != null && endDate != null && accountFormat != null) { String subTitleFirstpart = t("lima.ui.fiscalperiod.fiscalperiod") + " : " + simpleDateFormat.format(beginDate) + " - " + simpleDateFormat.format(endDate); String subTitleSecPart = t("lima.ui.financialtransaction.account") + " : " + accountFormat.getAccountNumber() + " - " + accountFormat.getLabel(); @@ -815,14 +815,14 @@ List<Entry> entries = results.getListEntry(); String[] columnNames = {t("lima.table.number"), t("lima.table.date"), t("lima.table.entrybook"), - t("lima.table.voucher"), t("lima.table.description"), t("lima.table.letter"), - t("lima.table.debit"), t("lima.table.credit")}; + t("lima.table.voucher"), t("lima.table.description"), t("lima.table.letter"), + t("lima.table.debit"), t("lima.table.credit")}; accountReport += "\t<table border=\"1\" width=\"100%\" cellpadding=\"3\" cellspacing=\"0\">\n"; accountReport += constructTableHeader(columnNames); accountReport += "\t\t<tbody>\n"; - + boolean even = true; for(Entry entry : entries) { @@ -838,17 +838,17 @@ String[] columnData = {(StringUtils.isBlank(accountNumber)?"":accountNumber), (StringUtils.isBlank(transactionDate)?"":transactionDate), - (StringUtils.isBlank(code)?"":code), (StringUtils.isBlank(voucher)?"":voucher), - (StringUtils.isBlank(description)?"":description), (StringUtils.isBlank(lettering)?"":lettering), - (entry.getDebit() ? entry.getAmount() : BigDecimal.ZERO).toString(), - (entry.getDebit() ? BigDecimal.ZERO : entry.getAmount()).toString()}; + (StringUtils.isBlank(code)?"":code), (StringUtils.isBlank(voucher)?"":voucher), + (StringUtils.isBlank(description)?"":description), (StringUtils.isBlank(lettering)?"":lettering), + (entry.getDebit() ? entry.getAmount() : BigDecimal.ZERO).toString(), + (entry.getDebit() ? BigDecimal.ZERO : entry.getAmount()).toString()}; accountReport += constructTableLine(columnData, even); even = !even; } accountReport += "\t\t</tbody>\n\t</table>\n" + - "</body>\n"; + "</body>\n"; } else { JOptionPane.showMessageDialog(null, t("lima.reports.account.noaccount"), t("lima.reports.account.noaccounttitle"), JOptionPane.INFORMATION_MESSAGE); @@ -868,13 +868,13 @@ protected String constructHtmlHeader(String title) { String head = "<!DOCTYPE html>\n" + - "<html>\n" + - "<head>\n" + - "\t<meta charset=\"UTF-8\" />\n" + - "\t<title>" + title + "</title>\n" + - "</head>\n" + - "<body>\n" + - "\t<h1>" + title + "</h1>\n"; + "<html>\n" + + "<head>\n" + + "\t<meta charset=\"UTF-8\" />\n" + + "\t<title>" + title + "</title>\n" + + "</head>\n" + + "<body>\n" + + "\t<h1>" + title + "</h1>\n"; return head; } @@ -910,7 +910,7 @@ line += "\t\t</tr>\n"; return line; } - + protected String constructTableLine(String[] cells) { String line = "\t\t<tr>\n"; for (String cell : cells) {