Author: echatellier Date: 2012-06-06 15:36:35 +0200 (Wed, 06 Jun 2012) New Revision: 3448 Url: http://chorem.org/repositories/revision/lima/3448 Log: D?\195?\169placement des dateformat en dur dans les fichiers i18n Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties trunk/lima-callao/src/main/xmi/accounting.zargo trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.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 2012-06-06 13:36:02 UTC (rev 3447) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2012-06-06 13:36:35 UTC (rev 3448) @@ -93,7 +93,6 @@ @TransactionAttribute public class DocumentServiceImpl extends AbstractLimaService implements DocumentService { - //Services @EJB private IdentityService identityService; @@ -108,17 +107,6 @@ protected String path; - //SDFs - private static final SimpleDateFormat dateFormat = - new SimpleDateFormat("dd/MM/yyyy"); - - private static final SimpleDateFormat hourFormat = - new SimpleDateFormat("HH:mm"); - - private static final SimpleDateFormat monthYearFormat = - new SimpleDateFormat("MMM yyyy"); - - //FONTs private static final Font titleFont = new Font(Font.HELVETICA, 14, Font.BOLD, Color.BLACK); @@ -134,16 +122,23 @@ private static final Font bolditalicFont = new Font(Font.HELVETICA, 9, Font.BOLDITALIC, Color.BLACK); - public DocumentServiceImpl() { path = LimaConfig.getInstance().getReportsDir().getAbsolutePath(); } - - public Paragraph createHeaderPage(String title, + /** + * Crée l'entete du document avec le titre, l'ientité, et les dates. + * + * @param title + * @param identity + * @param beginDate + * @param endDate + * @return + */ + protected Paragraph createHeaderPage(String title, Identity identity, - String beginDate, - String endDate) { + Date beginDate, + Date endDate) { Paragraph paragraphHeaderPage = new Paragraph(); Table t = null; try { @@ -186,14 +181,14 @@ t.addCell(""); t.addCell(new Phrase(_("lima-business.document.period1"), bolditalicFont)); - t.addCell(new Phrase(beginDate, italicFont)); + t.addCell(new Phrase(_("lima-business.document.period1format", beginDate), italicFont)); //line 5 t.addCell(new Phrase(identity.getZipCode() + " " + identity.getCity(), italicFont)); t.addCell(""); t.addCell(new Phrase(_("lima-business.document.period2"), bolditalicFont)); - t.addCell(new Phrase(endDate, italicFont)); + t.addCell(new Phrase(_("lima-business.document.period2format", endDate), italicFont)); } catch (BadElementException eeBEE) { log.error("Can't create table", eeBEE); } @@ -202,10 +197,15 @@ return paragraphHeaderPage; } - - public Paragraph createNumberPage(int nbPages, - String dateS, - String hourS) throws BadElementException { + /** + * Sous tableau. + * + * @param nbPages + * @param date + * @return + * @throws BadElementException + */ + protected Paragraph createNumberPage(int nbPages, Date date) throws BadElementException { //n° page Paragraph paragraphPage = new Paragraph(); Table infos = new Table(2); @@ -216,18 +216,12 @@ c.setBorder(Rectangle.NO_BORDER); c.setHorizontalAlignment(Element.ALIGN_CENTER); infos.setDefaultCell(c); - infos.addCell(new Phrase(_("lima-business.document.createdate1") - + dateS + _("lima-business.document.createdate2") - + hourS, normalFont)); - infos.addCell(new Phrase(_("lima-business.document.pagenumber") - + nbPages, normalFont)); + infos.addCell(new Phrase(_("lima-business.document.createdate", date), normalFont)); + infos.addCell(new Phrase(_("lima-business.document.pagenumber", nbPages), normalFont)); paragraphPage.add(infos); return paragraphPage; } - //############## FinancialStatements ############## - - @Override public void createFinancialStatementsDocuments(Date beginDate, Date endDate, @@ -238,9 +232,6 @@ financialStatementService.financialStatementReport(beginDate, endDate); Date newDate = new Date(); - String dateS = dateFormat.format(newDate); - String hourS = hourFormat.format(newDate); - String filePath = path + File.separator + DocumentsEnum.FINANCIALSTATEMENT.getFileName(); try { @@ -303,10 +294,9 @@ //new page Chapter chapter = new Chapter(0); //headerPage - chapter.add(createHeaderPage(title, identity, - dateFormat.format(beginDate), dateFormat.format(endDate))); + chapter.add(createHeaderPage(title, identity, beginDate, endDate)); //n° page - chapter.add(createNumberPage(nbpages, dateS, hourS)); + chapter.add(createNumberPage(nbpages, newDate)); //headerTable Paragraph paragraphHeaderTable = new Paragraph(); paragraphHeaderTable.add(headerTable); @@ -480,8 +470,6 @@ } Date newDate = new Date(); - String dateS = dateFormat.format(newDate); - String hourS = hourFormat.format(newDate); BigDecimal currentAmountDebit = new BigDecimal(0); BigDecimal currentAmountCredit = new BigDecimal(0); @@ -521,9 +509,9 @@ Chapter chapter = new Chapter(0); //headerPage chapter.add(createHeaderPage(DocumentsEnum.LEDGER.getDescription(), identity, - dateFormat.format(beginDate), dateFormat.format(endDate))); + beginDate, endDate)); //n° page - chapter.add(createNumberPage(nbpages, dateS, hourS)); + chapter.add(createNumberPage(nbpages, newDate)); //headerTable Paragraph paragraphHeaderTable = new Paragraph(); paragraphHeaderTable.add(headerTable); @@ -673,9 +661,8 @@ amountCredit = entry.getAmount(); } - t.addCell(new Phrase(dateFormat.format( - entry.getFinancialTransaction().getTransactionDate()), - normalFont)); + t.addCell(new Phrase(_("lima-business.document.dateformat", + entry.getFinancialTransaction().getTransactionDate()), normalFont)); t.addCell(new Phrase(entryBookCode, normalFont)); t.addCell(new Phrase(entry.getVoucher(), normalFont)); t.addCell(new Phrase(entry.getDescription(), normalFont)); @@ -739,8 +726,6 @@ try { Date newDate = new Date(); - String dateS = dateFormat.format(newDate); - String hourS = hourFormat.format(newDate); String filePath = path + File.separator + DocumentsEnum.ENTRYBOOKS.getFileName(); FileOutputStream fileOut = new FileOutputStream(filePath + format.getExtension()); @@ -790,8 +775,8 @@ } //create pages - String title = closedPeriodicEntryBook.getEntryBook().getLabel() - + "\n" + monthYearFormat.format( + String title = _("lima-business.document.entrybooktitle", + closedPeriodicEntryBook.getEntryBook().getLabel(), closedPeriodicEntryBook.getFinancialPeriod().getBeginDate()); //list = list.subList(1, list.size()); int i = 0; @@ -815,9 +800,9 @@ Chapter chapter = new Chapter(0); //headerPage chapter.add(createHeaderPage(title, identity, - dateFormat.format(beginDate), dateFormat.format(endDate))); + beginDate, endDate)); //n° page - chapter.add(createNumberPage(nbpages, dateS, hourS)); + chapter.add(createNumberPage(nbpages, newDate)); //headerTable Paragraph paragraphHeaderTable = new Paragraph(); paragraphHeaderTable.add(headerTable); @@ -875,7 +860,7 @@ } - public Table createEntryBooksTable(List<Entry> entries) { + protected Table createEntryBooksTable(List<Entry> entries) { int nbrow = entries.size(); Table t = null; try { @@ -894,9 +879,8 @@ t.setDefaultCell(cell); for (Entry entry : entries) { - t.addCell(new Phrase(dateFormat.format( - entry.getFinancialTransaction().getTransactionDate()), - normalFont)); + t.addCell(new Phrase(_("lima-business.document.dateformat", + entry.getFinancialTransaction().getTransactionDate()), normalFont)); String account = ""; if (entry.getAccount() != null) { account = entry.getAccount().getAccountNumber(); @@ -957,9 +941,6 @@ try { Date newDate = new Date(); - String dateS = dateFormat.format(newDate); - String hourS = hourFormat.format(newDate); -// String fileDateS = filedateFormat.format(newDate); BigDecimal currentAmountDebit = new BigDecimal(0); BigDecimal currentAmountCredit = new BigDecimal(0); @@ -999,9 +980,10 @@ //new page Chapter chapter = new Chapter(0); //headerPage - chapter.add(createHeaderPage(DocumentsEnum.BALANCE.getDescription(), identity, dateFormat.format(beginDate), dateFormat.format(endDate))); + chapter.add(createHeaderPage(DocumentsEnum.BALANCE.getDescription(), + identity, beginDate, endDate)); //n° page - chapter.add(createNumberPage(nbpages, dateS, hourS)); + chapter.add(createNumberPage(nbpages, newDate)); //headerTable Paragraph paragraphHeaderTable = new Paragraph(); paragraphHeaderTable.add(headerTable); @@ -1169,8 +1151,6 @@ try { Date newDate = new Date(); - String dateS = dateFormat.format(newDate); - String hourS = hourFormat.format(newDate); String filePath = path + File.separator + DocumentsEnum.GENERAL_ENTRYBOOK.getFileName(); FileOutputStream fileOut = new FileOutputStream(filePath + format.getExtension()); @@ -1233,8 +1213,7 @@ closedPeriodicEntryBook.getEntryBook().getCode()); generalEntryBooksDatas.setDescription( closedPeriodicEntryBook.getEntryBook().getLabel()); - generalEntryBooksDatas.setPeriod( - monthYearFormat.format(financialPeriod.getBeginDate())); + generalEntryBooksDatas.setPeriod(financialPeriod.getBeginDate()); generalEntryBooksDatas.setCredit(credit); generalEntryBooksDatas.setDebit(debit); list.add(generalEntryBooksDatas); @@ -1246,8 +1225,7 @@ generalEntryBooksDatas.setSubAmount(true); generalEntryBooksDatas.setCredit(subAmountCredit); generalEntryBooksDatas.setDebit(subAmountDebit); - generalEntryBooksDatas.setPeriod( - monthYearFormat.format(financialPeriod.getBeginDate())); + generalEntryBooksDatas.setPeriod(financialPeriod.getBeginDate()); list.add(generalEntryBooksDatas); amountCredit = amountCredit.add(subAmountCredit); amountDebit = amountDebit.add(subAmountDebit); @@ -1283,10 +1261,10 @@ //headerPage chapter.add(createHeaderPage( DocumentsEnum.GENERAL_ENTRYBOOK.getDescription(), - identity, dateFormat.format(beginDate), - dateFormat.format(endDate))); + identity, beginDate, + endDate)); //n° page - chapter.add(createNumberPage(nbpages, dateS, hourS)); + chapter.add(createNumberPage(nbpages, newDate)); //headerTable Paragraph paragraphHeaderTable = new Paragraph(); paragraphHeaderTable.add(headerTable); @@ -1359,9 +1337,8 @@ generalEntryBooksDatas.getCode(), normalFont)); t.addCell(new Phrase( generalEntryBooksDatas.getDescription(), normalFont)); + t.addCell(new Phrase(_("lima-business.document.monthformat", generalEntryBooksDatas.getPeriod()), normalFont)); t.addCell(new Phrase( - generalEntryBooksDatas.getPeriod(), normalFont)); - t.addCell(new Phrase( String.valueOf(generalEntryBooksDatas.getDebit()), normalFont)); t.addCell(new Phrase( Modified: trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties =================================================================== --- trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2012-06-06 13:36:02 UTC (rev 3447) +++ trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2012-06-06 13:36:35 UTC (rev 3448) @@ -24,26 +24,30 @@ lima-business.document.carryback=Carry Back lima-business.document.carryforward=reporterÀ lima-business.document.classificationcode=Classification Code -lima-business.document.createdate1=Editing Date -lima-business.document.createdate2=to +lima-business.document.createdate=Editing Date %1$tm/%1$te/%1$tY at %1$tH\:%1$tM lima-business.document.credit=Credit lima-business.document.date=Date lima-business.document.date.begin=Begin date lima-business.document.date.end=End date +lima-business.document.dateformat=%1$tm/%1$te/%1$tY lima-business.document.debit=Debit lima-business.document.description=Description lima-business.document.entrybook=EntryBook +lima-business.document.entrybooktitle=%s\n%2$tB %2$tY lima-business.document.financialstatement=FinancialStatement lima-business.document.generalentrybook=General EntryBook lima-business.document.grossamount=Gross Amount lima-business.document.label=Label lima-business.document.ledger=Ledger +lima-business.document.monthformat=%1$tB %1$tY lima-business.document.movementcredit=Credit movement lima-business.document.movementdebit=Debit movement lima-business.document.netamount=Net Amount -lima-business.document.pagenumber=Page N° +lima-business.document.pagenumber=Page N° %d lima-business.document.period1=Periode from +lima-business.document.period1format=%1$tm/%1$te/%1$tY lima-business.document.period2=to +lima-business.document.period2format=%1$tm/%1$te/%1$tY lima-business.document.provisiondeprecationamount=Provision Deprecation Amount lima-business.document.solde=Solde lima-business.document.soldecredit=Credit solde Modified: trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties =================================================================== --- trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2012-06-06 13:36:02 UTC (rev 3447) +++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2012-06-06 13:36:35 UTC (rev 3448) @@ -24,26 +24,30 @@ lima-business.document.carryback=Report lima-business.document.carryforward=À reporter lima-business.document.classificationcode=NAF -lima-business.document.createdate1=Date de tirage -lima-business.document.createdate2=à +lima-business.document.createdate=Date de tirage %1$te/%1$tm/%1$tY à %1$tH\:%1$tM lima-business.document.credit=Crédit lima-business.document.date=Date lima-business.document.date.begin=Date de début \: lima-business.document.date.end=Date de fin \: +lima-business.document.dateformat=%1$te/%1$tm/%1$tY lima-business.document.debit=Débit lima-business.document.description=Description lima-business.document.entrybook=Journal +lima-business.document.entrybooktitle=%s\n%2$tB %2$tY lima-business.document.financialstatement=Bilan et compte de résultat lima-business.document.generalentrybook=Journal Général lima-business.document.grossamount=Brut lima-business.document.label=Libellé lima-business.document.ledger=Grand Livre +lima-business.document.monthformat=%1$tB %1$tY lima-business.document.movementcredit=Mouvement Créditeur lima-business.document.movementdebit=Mouvement Débiteur lima-business.document.netamount=Net -lima-business.document.pagenumber=N° page +lima-business.document.pagenumber=N° page %d lima-business.document.period1=Période du +lima-business.document.period1format=%1$te/%1$tm/%1$tY lima-business.document.period2=au +lima-business.document.period2format=%1$te/%1$tm/%1$tY lima-business.document.provisiondeprecationamount=Amortissements et provisions lima-business.document.solde=Solde lima-business.document.soldecredit=Solde Créditeur Modified: trunk/lima-callao/src/main/xmi/accounting.zargo =================================================================== (Binary files differ) Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-06-06 13:36:02 UTC (rev 3447) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-06-06 13:36:35 UTC (rev 3448) @@ -187,13 +187,16 @@ } //shows error message to user if the fiscalPeriod is unblocked - if (error) { + //FIXME echatellier 20120605 why ? + // ui is only filled with non blocked periods, else case + // can NEVER happen + /*if (error) { JOptionPane.showMessageDialog( view, _("lima.entrybooksreports.documentcreationfiscalerror"), _("lima.entrybooksreports.documentcreationfiscaltitle"), JOptionPane.ERROR_MESSAGE); - } else { + } else {*/ int port = LimaServiceFactory.getService(HttpServerService.class).getHttpPort(); FormatsEnum selectedEnum = (FormatsEnum) view.getDocumentEditor().getSelectedItem(); @@ -219,7 +222,7 @@ } catch (URISyntaxException e) { log.error("Can't create news URI", e); } - } + //} } }
participants (1)
-
echatellier@users.chorem.org