From mallon@users.chorem.org Fri Aug 17 16:41:36 2012 From: mallon@users.chorem.org To: lima-commits@list.chorem.org Subject: [Lima-commits] r3611 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/resources/i18n lima-business-api/src/main/java/org/chorem/lima/business/api lima-swing/src/main/java/org/chorem/lima/ui lima-swing/src/main/java/org/chorem/lima/ui/balance Date: Fri, 17 Aug 2012 16:41:36 +0200 Message-ID: <20120817144136.9C7F05DF32@nuiton.codelutin.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0818247799289704289==" --===============0818247799289704289== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Author: mallon Date: 2012-08-17 16:41:36 +0200 (Fri, 17 Aug 2012) New Revision: 3611 Url: http://chorem.org/repositories/revision/lima/3611 Log: refs #769 Modification du jaxx, et mise en place de l affichage html des donn= ees filtrees, pour l edition de la balance. Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceReportsVi= ew.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceReportsVi= ewHandler.java Removed: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandl= er.java Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/Documen= tService.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentSer= viceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerS= erviceImpl.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-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/Docu= mentServiceImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentSe= rviceImpl.java 2012-08-17 11:03:36 UTC (rev 3610) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentSe= rviceImpl.java 2012-08-17 14:41:36 UTC (rev 3611) @@ -816,7 +816,7 @@ entryBookReport +=3D "

\n"; } } - entryBookReport +=3D "\n"; + entryBookReport +=3D "\n"; } } catch (Exception ex) { throw new LimaException("Can't create document", ex); @@ -828,213 +828,177 @@ //############## Balance ############## =20 @Override - public void createBalanceDocuments(Date beginDate, - Date endDate, - FormatsEnum format) throws LimaExcept= ion { - Document document =3D new Document(PageSize.A4, 8, 8, 8, 8); + public String createBalanceDocuments(Date beginDate, + Date endDate) throws LimaException { =20 BalanceTrial balanceTrial =3D reportService.generateBalanceTrial(beginDate, endDate, null,= false, true); =20 List list =3D (List) balanceTrial.getRep= ortsDatas(); =20 - try { - Date newDate =3D new Date(); + String balanceReport =3D ""; + balanceReport +=3D "\n" + + "\n"; =20 - BigDecimal currentAmountDebit =3D new BigDecimal(0); - BigDecimal currentAmountCredit =3D new BigDecimal(0); - BigDecimal currentSoldeDebit =3D new BigDecimal(0); - BigDecimal currentSoldeCredit =3D new BigDecimal(0); + if (beginDate !=3D null && endDate !=3D null) { + try{ + BigDecimal currentAmountDebit =3D new BigDecimal(0); + BigDecimal currentAmountCredit =3D new BigDecimal(0); + BigDecimal currentSoldeDebit =3D new BigDecimal(0); + BigDecimal currentSoldeCredit =3D new BigDecimal(0); =20 - String filePath =3D path + File.separator + DocumentsEnum.BALANC= E.getFileName(); - FileOutputStream fileOut =3D new FileOutputStream(filePath + for= mat.getExtension()); - switch (format) { - case HTML: - HtmlWriter htmlWriter =3D HtmlWriter.getInstance(documen= t, fileOut); - break; - case PDF: - PdfWriter pdfWriter =3D PdfWriter.getInstance(document, = fileOut); - break; - } - document.open(); - int nbpages =3D 1; - Identity identity =3D identityService.getIdentity(); + Identity identity =3D identityService.getIdentity(); =20 - //create pages - int i =3D 0; - int n =3D list.size(); - int max =3D n; - // alloc nb rows max for pdf documents on one page - if (format =3D=3D FormatsEnum.PDF) { - max =3D 26; - } - while (i < n) { - int j =3D i + max; - if (j > n) { - j =3D n; - } - List subList =3D list.subList(i, j); - //create page : header + table + footer - Table headerTable =3D createBalanceHeaderTable(); - //new page - Chapter chapter =3D new Chapter(0); - //headerPage - chapter.add(createHeaderPage(DocumentsEnum.BALANCE.getDescri= ption(), - identity, beginDate, endDate)); - //n=C2=B0 page - chapter.add(createNumberPage(nbpages, newDate)); - //headerTable - Paragraph paragraphHeaderTable =3D new Paragraph(); - paragraphHeaderTable.add(headerTable); - chapter.add(paragraphHeaderTable); - //backward amounts - if (n > max && nbpages > 1) { - Paragraph backwardParagraph =3D new Paragraph(); - backwardParagraph.add(createBalanceAmountTable( - _("lima-business.document.carryback"), - currentAmountDebit, currentAmountCredit, - currentSoldeDebit, currentSoldeCredit)); - chapter.add(backwardParagraph); - } - //table - Paragraph paragraphTable =3D new Paragraph(); - Table table =3D createBalanceTable(subList); - paragraphTable.add(table); - chapter.add(paragraphTable); - for (ReportsDatas reportsDatas : subList) { - currentAmountDebit =3D currentAmountDebit.add(reportsDat= as.getAmountDebit()); - currentAmountCredit =3D currentAmountCredit.add(reportsD= atas.getAmountCredit()); - if (reportsDatas.getSoldeDebit()) { - currentSoldeDebit =3D currentSoldeDebit.add(reportsD= atas.getAmountSolde()); - } else { - currentSoldeCredit =3D currentSoldeCredit.add(report= sDatas.getAmountSolde()); + //create pages + int i =3D 0; + int n =3D list.size(); + int max =3D n; + + while (i < n) { + int j =3D i + max; + if (j > n) { + j =3D n; } - } - //forward amounts - if (n > max && i <=3D n - max) { - Paragraph forwardParagraph =3D new Paragraph(); - forwardParagraph.add(createBalanceAmountTable( - _("lima-business.document.carryforward"), - currentAmountDebit, currentAmountCredit, - currentSoldeDebit, currentSoldeCredit)); - chapter.add(forwardParagraph); - } - //final amounts - if (i >=3D n - max) { - Paragraph finalAmountParagraph =3D new Paragraph(); - finalAmountParagraph.add(createBalanceAmountTable( - _("lima-business.document.amounts"), - currentAmountDebit, currentAmountCredit, - currentSoldeDebit, currentSoldeCredit)); - chapter.add(finalAmountParagraph); - } - //add page - document.add(chapter); - i =3D i + max; - nbpages++; - } - document.close(); + List subList =3D list.subList(i, j); =20 - } catch (FileNotFoundException eeFNFE) { - log.error("Can't create pdf file", eeFNFE); - } catch (DocumentException eeDE) { - log.error("Can't create document", eeDE); - } - } + balanceReport +=3D "\n" + + "" + + " " + + "" + + "" + + "" + + "
" + + "\n" + + "\n"; =20 - public Table createBalanceHeaderTable() { - Table t =3D null; - try { - t =3D new Table(6, 1); - float[] widths =3D {0.07f, 0.33f, 0.15f, 0.15f, 0.15f, 0.15f}; - t.setWidths(widths); - t.setWidth(100f); - t.setPadding(3.5f); - //defaut cell - Cell cell =3D new Cell(); - cell.setBorder(Rectangle.LEFT); - cell.setHorizontalAlignment(Element.ALIGN_CENTER); - t.setDefaultCell(cell); - t.setOffset(8); - t.addCell(new Phrase(_("lima-business.document.accountnumber"), = boldFont)); - t.addCell(new Phrase(_("lima-business.document.description"), bo= ldFont)); - t.addCell(new Phrase(_("lima-business.document.movementdebit"), = boldFont)); - t.addCell(new Phrase(_("lima-business.document.movementcredit"),= boldFont)); - t.addCell(new Phrase(_("lima-business.document.soldedebit"), bol= dFont)); - t.addCell(new Phrase(_("lima-business.document.soldecredit"), bo= ldFont)); + String boldItalicBegin =3D "" + ""; + String boldItalicEnd =3D "" + ""; =20 - } catch (BadElementException eeBEE) { - log.error("Can't create table", eeBEE); - } - return t; + String [] columnsNameSociety =3D {boldItalicBegin + _("l= ima-business.document.society") + + boldItalicEnd, "" + identity.getName()+ "= "}; + balanceReport +=3D constructColumnsHtml(columnsNameSocie= ty); =20 - } + balanceReport +=3D "\n"; + String [] columnsBusinessNumber =3D {boldItalicBegin + _= ("lima-business.document.businessnumber") + + boldItalicEnd, "" + identity.getBusinessNumbe= r()+ ""}; + balanceReport +=3D constructColumnsHtml(columnsBusinessN= umber); =20 - public Table createBalanceTable(List subList) { - int nbrow =3D subList.size(); - Table t =3D null; - try { - //define table - t =3D new Table(6, nbrow); - t.setWidth(100f); - float[] widths =3D {0.07f, 0.33f, 0.15f, 0.15f, 0.15f, 0.15f}; - t.setWidths(widths); - t.setPadding(1.5f); - t.setBorderWidth(1); - t.setOffset(0); - //define default cell - Cell cell =3D new Cell(); - cell.setBorder(Rectangle.LEFT); - cell.setHorizontalAlignment(Element.ALIGN_RIGHT); - t.setDefaultCell(cell); + balanceReport +=3D "\n"; + String [] columnsDescription =3D {boldItalicBegin + _("l= ima-business.document.description") + boldItalicEnd, + "" + identity.getDescription()+ ""}; + balanceReport +=3D constructColumnsHtml(columnsDescripti= on); =20 - for (ReportsDatas reportsDatas : subList) { + balanceReport +=3D "\n"; + String [] columnsClassifCode =3D {boldItalicBegin + _("l= ima-business.document.classificationcode") + + boldItalicEnd, "" + identity.getClassificatio= nCode()+ ""}; + balanceReport +=3D constructColumnsHtml(columnsClassifCo= de); =20 - String soldeDebit =3D String.valueOf(reportsDatas.getSoldeDe= bit() ? reportsDatas.getAmountSolde() : 0); - String soldeCredit =3D String.valueOf(reportsDatas.getSoldeD= ebit() ? 0 : reportsDatas.getAmountSolde()); + balanceReport +=3D "\n"; + String [] columnsVatNumber =3D {boldItalicBegin + _("lim= a-business.document.vatnumber") + boldItalicEnd, + "" + identity.getVatNumber()+ "", }; + balanceReport +=3D constructColumnsHtml(columnsVatNumber= ); =20 - t.addCell(new Phrase(reportsDatas.getAccount().getAccountNum= ber(), normalFont)); - t.addCell(new Phrase(reportsDatas.getAccount().getLabel(), n= ormalFont)); - t.addCell(new Phrase(String.valueOf(reportsDatas.getAmountDe= bit()), normalFont)); - t.addCell(new Phrase(String.valueOf(reportsDatas.getAmountCr= edit()), normalFont)); - t.addCell(new Phrase(soldeDebit, normalFont)); - t.addCell(new Phrase(soldeCredit, normalFont)); - } - } catch (DocumentException eeDE) { - log.error("Can't create table", eeDE); + balanceReport +=3D "\n"; + String [] columnsAdressOne =3D {boldItalicBegin + _("lim= a-business.document.adress") + boldItalicEnd, + "" + identity.getAddress() + ""}; + balanceReport +=3D constructColumnsHtml(columnsAdressOne= ); =20 - } - return t; - } + balanceReport +=3D "\n"; + String [] columnsAdressTwo =3D {boldItalicBegin + _("lim= a-business.document.adresssuite") + boldItalicEnd, + "" + identity.getAddress2() + ""}; + balanceReport +=3D constructColumnsHtml(columnsAdressTwo= ); =20 - public Table createBalanceAmountTable(String title, - BigDecimal amountDebit, - BigDecimal amountCredit, - BigDecimal soldeDebit, - BigDecimal soldeCredit) { - Table t =3D null; - try { - t =3D new Table(5, 1); - float[] widths =3D {0.4f, 0.15f, 0.15f, 0.15f, 0.15f}; - t.setWidths(widths); - t.setWidth(100f); - t.setPadding(3f); - t.setOffset(0); - //defaut cell - Cell cell =3D new Cell(); - cell.setBorder(Rectangle.RIGHT); - cell.setHorizontalAlignment(Element.ALIGN_RIGHT); - t.setDefaultCell(cell); + balanceReport +=3D "\n"; + String [] columnsZipCode =3D {boldItalicBegin + _("lima-= business.document.zipcode") + boldItalicEnd, + "" + identity.getZipCode() + ""}; + balanceReport +=3D constructColumnsHtml(columnsZipCode); =20 - t.addCell(new Phrase(title, boldFont)); - t.addCell(new Phrase(amountDebit.toString(), boldFont)); - t.addCell(new Phrase(amountCredit.toString(), boldFont)); - t.addCell(new Phrase(soldeDebit.toString(), boldFont)); - t.addCell(new Phrase(soldeCredit.toString(), boldFont)); - } catch (BadElementException eeBEE) { - log.error("Can't create table", eeBEE); + balanceReport +=3D "\n"; + String [] columnsCity =3D {boldItalicBegin + _("lima-bus= iness.document.city") + boldItalicEnd, + "" + identity.getCity()+ ""}; + balanceReport +=3D constructColumnsHtml(columnsCity); + + balanceReport +=3D "\n"; + String [] columnsPeriodOne =3D {boldItalicBegin + _("lim= a-business.document.period1") + boldItalicEnd, "" + + _("lima-business.document.period1format", begi= nDate)+ ""}; + balanceReport +=3D constructColumnsHtml(columnsPeriodOne= ); + + balanceReport +=3D "\n"; + String [] columnsPeriodTwo =3D {boldItalicBegin + _("lim= a-business.document.period2") + boldItalicEnd, "" + + _("lima-business.document.period2format", endD= ate)+ ""}; + balanceReport +=3D constructColumnsHtml(columnsPeriodTwo= ); + + balanceReport +=3D "
\n" + + "
" + + "

" + _("lima-busi= ness.document.balance") + "

" + + "
" + + "\n" + + "\n"; + + String [] columnsNames =3D {_("lima-business.document.ac= countnumber"), _("lima-business.document.description"), + _("lima-business.document.movementdebit"), _("li= ma-business.document.movementcredit"), + _("lima-business.document.soldedebit"), _("lima-= business.document.soldecredit")}; + balanceReport +=3D constructColumnsHtml(columnsNames); + + if (n > max) { + String boldBegin =3D ""; + String boldEnd =3D ""; + String [] columnsBalanceAmount =3D {"", boldBegin + = _("lima-business.document.carryback") + boldEnd, + boldBegin + currentAmountDebit.toString() + = boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd, + boldBegin + currentSoldeDebit.toString() + b= oldEnd,boldBegin + currentSoldeCredit.toString() + boldEnd}; + balanceReport +=3D constructColumnsHtml(columnsBalan= ceAmount); + balanceReport +=3D "
\n"; + } + + for (ReportsDatas reportsDatas : subList) { + String soldeDebit =3D String.valueOf(reportsDatas.ge= tSoldeDebit() ? reportsDatas.getAmountSolde() : 0); + String soldeCredit =3D String.valueOf(reportsDatas.g= etSoldeDebit() ? 0 : reportsDatas.getAmountSolde()); + + String [] columnsBalanceAmount =3D {reportsDatas.get= Account().getAccountNumber(), reportsDatas.getAccount().getLabel(), + reportsDatas.getAmountDebit().toString(), re= portsDatas.getAmountCredit().toString(), + soldeDebit, soldeCredit}; + balanceReport +=3D constructColumnsHtml(columnsBalan= ceAmount); + } + + for (ReportsDatas reportsDatas : subList) { + currentAmountDebit =3D currentAmountDebit.add(report= sDatas.getAmountDebit()); + currentAmountCredit =3D currentAmountCredit.add(repo= rtsDatas.getAmountCredit()); + if (reportsDatas.getSoldeDebit()) { + currentSoldeDebit =3D currentSoldeDebit.add(repo= rtsDatas.getAmountSolde()); + } else { + currentSoldeCredit =3D currentSoldeCredit.add(re= portsDatas.getAmountSolde()); + } + } + + if (n > max && i <=3D n - max) { + String boldBegin =3D ""; + String boldEnd =3D ""; + String [] columnsBalanceAmount =3D {"", boldBegin + = _("lima-business.document.carryforward") + boldEnd, + boldBegin + currentAmountDebit.toString() + = boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd, + boldBegin + currentSoldeDebit.toString() + b= oldEnd,boldBegin + currentSoldeCredit.toString() + boldEnd}; + balanceReport +=3D constructColumnsHtml(columnsBalan= ceAmount); + balanceReport +=3D "\n"; + } + + //final amounts + if (i >=3D n - max) { + String boldBegin =3D ""; + String boldEnd =3D ""; + String [] columnsBalanceAmount =3D {"", boldBegin + = _("lima-business.document.amounts") + boldEnd, + boldBegin + currentAmountDebit.toString() + = boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd, + boldBegin + currentSoldeDebit.toString() + b= oldEnd,boldBegin + currentSoldeCredit.toString() + boldEnd}; + balanceReport +=3D constructColumnsHtml(columnsBalan= ceAmount); + balanceReport +=3D "\n"; + } + i =3D i + max; + } + balanceReport +=3D "\n"; + } catch (Exception ex) { + log.error("Can't create document", ex); + } } - return t; + + return balanceReport; } =20 //############## General EntryBook ############## Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/Http= ServerServiceImpl.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServer= ServiceImpl.java 2012-08-17 11:03:36 UTC (rev 3610) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServer= ServiceImpl.java 2012-08-17 14:41:36 UTC (rev 3611) @@ -162,6 +162,7 @@ String accountReport =3D null; String entryBooksReport =3D null; String generalEntryBooksReport =3D null; + String balanceReport =3D null; =20 //create docs try { @@ -170,8 +171,8 @@ =20 switch (DocumentsEnum.valueOfLink(model)) { case BALANCE: - documentService.createBalanceDocuments( - beginDateFormat, endDateFormat, form= atsEnum); + balanceReport =3D documentService.createBala= nceDocuments( + beginDateFormat, endDateFormat); break; case ACCOUNT: accountReport =3D documentService.createAcco= untDocument( @@ -222,14 +223,17 @@ } resp.setContentType(formatsEnum.getMimeType()); OutputStream out =3D resp.getOutputStream(); - if (accountReport !=3D null || entryBooksReport !=3D nul= l || generalEntryBooksReport !=3D null) { + if (accountReport !=3D null || entryBooksReport !=3D nul= l || generalEntryBooksReport !=3D null + || balanceReport !=3D null) { String report =3D null; if (accountReport !=3D null) { report =3D accountReport; } else if (entryBooksReport !=3D null) { report =3D entryBooksReport; + } else if (generalEntryBooksReport !=3D null) { + report =3D generalEntryBooksReport; } else { - report =3D generalEntryBooksReport; + report =3D balanceReport; } IOUtils.write(report, out, Charsets.UTF_8); } else { Modified: trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.pro= perties =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.propertie= s 2012-08-17 11:03:36 UTC (rev 3610) +++ trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.propertie= s 2012-08-17 14:41:36 UTC (rev 3611) @@ -19,12 +19,15 @@ lima-business.defaultaccountingrules.missingentrybook=3DCan't block financia= lperiod / missing EntryBook in transactions lima-business.document.account=3D lima-business.document.accountnumber=3DAccount N=C2=B0 +lima-business.document.adress=3D +lima-business.document.adresssuite=3D lima-business.document.amounts=3DAmounts lima-business.document.amountsperiod=3DAmounts %1$tB %1$tY lima-business.document.balance=3DBalance lima-business.document.businessnumber=3DBusiness N=C2=B0 lima-business.document.carryback=3DCarry Back lima-business.document.carryforward=3Dreporter=C3=80 +lima-business.document.city=3D lima-business.document.classificationcode=3DClassification Code lima-business.document.createdate=3DEditing Date %1$tm/%1$te/%1$tY at %1$tH\= :%1$tM lima-business.document.credit=3DCredit @@ -52,12 +55,14 @@ lima-business.document.period2=3Dto lima-business.document.period2format=3D%1$tm/%1$te/%1$tY lima-business.document.provisiondeprecationamount=3DProvision Deprecation Am= ount +lima-business.document.society=3D lima-business.document.solde=3DSolde lima-business.document.soldecredit=3DCredit solde lima-business.document.soldedebit=3DDebit solde lima-business.document.vat=3DVAT form lima-business.document.vatnumber=3DVAT N=C2=B0 lima-business.document.voucher=3DVoucher +lima-business.document.zipcode=3D lima-business.entrybook.entrybookalreadyexist=3DAn EntryBook already exists = with this label \: %s lima-business.financialstatement.check.nothing=3DNot found \: %s - %s \n lima-business.financialstatement.check.warn=3DWarning this function is just = an help.\n Many accounts must no calculate on Financial statement.\n Some acc= ount marked not found is normally.\n\n Modified: trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.pro= perties =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.propertie= s 2012-08-17 11:03:36 UTC (rev 3610) +++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.propertie= s 2012-08-17 14:41:36 UTC (rev 3611) @@ -19,12 +19,15 @@ lima-business.defaultaccountingrules.missingentrybook=3DImpossible de bloque= r la p=C3=A9riode financi=C3=A8re / il manque un journal dans une transaction= (%1$te/%1$tm/%1$tY) lima-business.document.account=3D lima-business.document.accountnumber=3DN=C2=B0 Compte +lima-business.document.adress=3DAdresse +lima-business.document.adresssuite=3DAdresse - suite lima-business.document.amounts=3DTotaux lima-business.document.amountsperiod=3DTotaux %1$tB %1$tY lima-business.document.balance=3DBalance lima-business.document.businessnumber=3DN=C2=B0 Siret lima-business.document.carryback=3DReport lima-business.document.carryforward=3D=C3=80 reporter +lima-business.document.city=3DVille lima-business.document.classificationcode=3DNAF lima-business.document.createdate=3DDate de tirage %1$te/%1$tm/%1$tY =C3=A0 = %1$tH\:%1$tM lima-business.document.credit=3DCr=C3=A9dit @@ -52,12 +55,14 @@ lima-business.document.period2=3Dau=20 lima-business.document.period2format=3D%1$te/%1$tm/%1$tY lima-business.document.provisiondeprecationamount=3DAmortissements et provis= ions +lima-business.document.society=3DNom lima-business.document.solde=3DSolde lima-business.document.soldecredit=3DSolde Cr=C3=A9diteur lima-business.document.soldedebit=3DSolde D=C3=A9biteur lima-business.document.vat=3DD=C3=A9claration de TVA lima-business.document.vatnumber=3DN=C2=B0 TVA lima-business.document.voucher=3DPi=C3=A8ce comptable +lima-business.document.zipcode=3DCode postal lima-business.entrybook.entrybookalreadyexist=3DUn journal existe d=C3=A9j= =C3=A0 avec ce libell=C3=A9 \: %s lima-business.financialstatement.check.nothing=3DIntrouvable \: %s - %s \n lima-business.financialstatement.check.warn=3DAttention cette fonctionnalit= =C3=A9 n'est qu'une aide utilisateur.\n Certains comptes ne doivent pas =C3= =AAtre pr=C3=A9sent au bilan et compte de r=C3=A9sultat.\n Il est donc normal= que des comptes sont marqu=C3=A9s comme introuvable.\n\n Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/= DocumentService.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/Docume= ntService.java 2012-08-17 11:03:36 UTC (rev 3610) +++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/Docume= ntService.java 2012-08-17 14:41:36 UTC (rev 3611) @@ -42,7 +42,7 @@ =20 void createLedgerDocuments(Date beginDate, Date endDate, FormatsEnum for= mat) throws LimaException; =20 - void createBalanceDocuments(Date beginDate, Date endDate, FormatsEnum fo= rmat) throws LimaException; + String createBalanceDocuments(Date beginDate, Date endDate) throws LimaE= xception; =20 String createEntryBooksDocuments(Date beginDate, Date endDate) throws Li= maException; =20 Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.j= ava =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 20= 12-08-17 11:03:36 UTC (rev 3610) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 20= 12-08-17 14:41:36 UTC (rev 3611) @@ -38,7 +38,7 @@ import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.account.AccountView; import org.chorem.lima.ui.accountsreports.AccountsReportsView; -import org.chorem.lima.ui.balance.BalanceView; +import org.chorem.lima.ui.balance.BalanceReportsView; import org.chorem.lima.ui.entrybook.EntryBookView; import org.chorem.lima.ui.entrybooksreports.EntryBooksReportsView; import org.chorem.lima.ui.financialperiod.FinancialPeriodView; @@ -451,7 +451,7 @@ =20 public void showBalanceView(JAXXContext rootContext) { MainView mainView =3D getUI(rootContext); - BalanceView balanceView =3D new BalanceView(mainView); + BalanceReportsView balanceView =3D new BalanceReportsView(mainView); showTab(mainView, _("lima.reports.balance"), balanceView); swingSession.add(balanceView); } Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceRepo= rtsView.jaxx (from rev 3587, trunk/lima-swing/src/main/java/org/chorem/lima/u= i/balance/BalanceView.jaxx) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceReportsV= iew.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceReportsV= iew.jaxx 2012-08-17 14:41:36 UTC (rev 3611) @@ -0,0 +1,56 @@ + + + + + + javax.swing.ListSelectionModel + javax.swing.text.Document + org.jdesktop.swingx.decorator.HighlighterFactory + org.chorem.lima.business.utils.FormatsEnum + org.chorem.lima.enums.ComboBoxDatesEnum + org.chorem.lima.ui.common.IntervalPanel + + + + + + + + + + + + + +
\ No newline at end of file Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balanc= e/BalanceReportsView.jaxx ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceRepo= rtsViewHandler.java (from rev 3587, trunk/lima-swing/src/main/java/org/chorem= /lima/ui/balance/BalanceViewHandler.java) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceReportsV= iewHandler.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceReportsV= iewHandler.java 2012-08-17 14:41:36 UTC (rev 3611) @@ -0,0 +1,110 @@ +/* + * #%L + * Lima Swing + *=20 + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric + * %% + * 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=20 + * License, or (at your option) any later version. + *=20 + * 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. + *=20 + * You should have received a copy of the GNU General Public=20 + * License along with this program. If not, see + * . + * #L% + */ + +package org.chorem.lima.ui.balance; + +import java.awt.Desktop; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.lima.LimaConfig; +import org.chorem.lima.business.api.FinancialPeriodService; +import org.chorem.lima.business.api.FiscalPeriodService; +import org.chorem.lima.business.api.HttpServerService; +import org.chorem.lima.business.api.ReportService; +import org.chorem.lima.business.utils.DocumentsEnum; +import org.chorem.lima.entity.FinancialPeriod; +import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.service.LimaServiceFactory; + +/** + * Handler associated with accounts reports view. + * By : $Author$ + */ +public class BalanceReportsViewHandler { + + protected BalanceReportsView view; + + /** log. */ + private static final Log log =3D LogFactory.getLog(BalanceReportsViewHan= dler.class); + + /** Services. */ + protected ReportService reportService; + protected HttpServerService httpServerServiceMonitorable; + protected FiscalPeriodService fiscalPeriodService; + protected FinancialPeriodService financialPeriodService; + + private static SimpleDateFormat dateFormat =3D + new SimpleDateFormat("yyyy-MM-dd"); + + protected BalanceReportsViewHandler(BalanceReportsView view) { + this.view =3D view; + + reportService =3D LimaServiceFactory.getService(ReportService.class); + fiscalPeriodService =3D LimaServiceFactory.getService(FiscalPeriodSe= rvice.class); + financialPeriodService =3D LimaServiceFactory.getService(FinancialPe= riodService.class); + } + + /** + * Init data models and displayed objects. + */ + public void init() { + + // init data models + List fiscalPeriod =3D fiscalPeriodService.getAllBlocke= dFiscalPeriods(); + List financialPeriod =3D financialPeriodService.get= UnblockedFinancialPeriods(); + view.getIntervalPanel().init(fiscalPeriod, financialPeriod); + } + + public void createDocument() { + + Date beginDate =3D view.getIntervalPanel().getBeginDate(); + Date endDate =3D view.getIntervalPanel().getEndDate(); + + if (beginDate !=3D null & endDate !=3D null) { + String address =3D LimaConfig.getInstance().getHostAdress(); + + try { + int port =3D LimaServiceFactory.getService(HttpServerService= .class).getHttpPort(); + String url =3D "http://" + address + ":" + port + "/?beginDa= te=3D" + + dateFormat.format(beginDate) + + "&endDate=3D" + dateFormat.format(endDate) + = "&format=3D.html&model=3D" + + DocumentsEnum.BALANCE.getFileName(); + Desktop.getDesktop().browse(new URI(url)); + } catch (IOException e) { + log.error("Can't open browser", e); + } catch (URISyntaxException e) { + log.error("Can't create news URI", e); + } + } + } + +} Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balanc= e/BalanceReportsViewHandler.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceVie= w.jaxx =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jax= x 2012-08-17 11:03:36 UTC (rev 3610) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jax= x 2012-08-17 14:41:36 UTC (rev 3611) @@ -1,113 +0,0 @@ - - - - - - javax.swing.ListSelectionModel - javax.swing.text.Document - org.jdesktop.swingx.decorator.HighlighterFactory - org.chorem.lima.business.utils.FormatsEnum - org.chorem.lima.enums.ComboBoxDatesEnum - org.chorem.lima.ui.common.IntervalPanel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - -
- - - \ No newline at end of file Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceVie= wHandler.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHand= ler.java 2012-08-17 11:03:36 UTC (rev 3610) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHand= ler.java 2012-08-17 14:41:36 UTC (rev 3611) @@ -1,216 +0,0 @@ -/* - * #%L - * Lima Swing - *=20 - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2008 - 2012 CodeLutin, Chatellier Eric - * %% - * 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=20 - * License, or (at your option) any later version. - *=20 - * 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. - *=20 - * You should have received a copy of the GNU General Public=20 - * License along with this program. If not, see - * . - * #L% - */ - -package org.chorem.lima.ui.balance; - -import static org.nuiton.i18n.I18n._; - -import java.awt.Desktop; -import java.io.IOException; -import java.math.BigDecimal; -import java.net.URI; -import java.net.URISyntaxException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; - -import javax.swing.JOptionPane; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.LimaConfig; -import org.chorem.lima.beans.BalanceTrial; -import org.chorem.lima.business.ServiceListener; -import org.chorem.lima.business.api.FinancialPeriodService; -import org.chorem.lima.business.api.FinancialTransactionService; -import org.chorem.lima.business.api.FiscalPeriodService; -import org.chorem.lima.business.api.HttpServerService; -import org.chorem.lima.business.api.ImportService; -import org.chorem.lima.business.api.ReportService; -import org.chorem.lima.business.utils.DocumentsEnum; -import org.chorem.lima.business.utils.FormatsEnum; -import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.service.LimaServiceFactory; - -/** - * Handler associated with accounts reports view. - * By : $Author$ - */ -public class BalanceViewHandler implements ServiceListener { - - protected BalanceView view; - - /** log. */ - private static final Log log =3D LogFactory.getLog(BalanceViewHandler.cl= ass); - - /** Services. */ - protected ReportService reportService; - protected HttpServerService httpServerServiceMonitorable; - protected FiscalPeriodService fiscalPeriodService; - protected FinancialPeriodService financialPeriodService; - - private static SimpleDateFormat dateFormat =3D - new SimpleDateFormat("yyyy-MM-dd"); - - protected BalanceViewHandler(BalanceView view) { - this.view =3D view; - - reportService =3D LimaServiceFactory.getService(ReportService.class); - fiscalPeriodService =3D LimaServiceFactory.getService(FiscalPeriodSe= rvice.class); - financialPeriodService =3D LimaServiceFactory.getService(FinancialPe= riodService.class); - LimaServiceFactory.addServiceListener(ImportService.class, this); - LimaServiceFactory.addServiceListener(FinancialTransactionService.cl= ass, this); - } - - /** - * Init data models and displayed objects. - */ - public void init() { - - // init data models - List fiscalPeriod =3D fiscalPeriodService.getAllUnbloc= kedFiscalPeriods(); - List financialPeriod =3D financialPeriodService.get= UnblockedFinancialPeriods(); - view.getIntervalPanel().init(fiscalPeriod, financialPeriod); - } - - public void intervalChanged() { - refreshData(); - } - - public void accountFilterChanged() { - refreshData(); - } - =20 - public void movmentedFilterChanged() { - refreshData(); - } - - /** - * Refresh table data depending on item selected on combo boxes. - */ - protected void refreshData() { - =20 - Date beginDate =3D view.getIntervalPanel().getBeginDate(); - Date endDate =3D view.getIntervalPanel().getEndDate(); - - String account =3D view.getBalanceFilter().getText().trim(); - =20 - if (beginDate !=3D null && endDate !=3D null) { - BalanceTrial balanceTrial =3D reportService.generateBalanceTrial= (beginDate, - endDate, account, false, view.getMovmentedFilter().isSel= ected()); - =20 - BalanceTableModel dataModel =3D view.getBalanceTableModel(); - dataModel.setBalanceTrial(balanceTrial); - =20 - updateFooter(balanceTrial); - } - } - - /** - * Update footer labels containing reports total sum fields. - *=20 - * @param balanceTrial result to render - */ - protected void updateFooter(BalanceTrial balanceTrial) { - // set amounts credit and debit and solde - view.amountCreditLabel.setText( - balanceTrial.getAmountCredit().toString()); - view.amountDebitLabel.setText( - balanceTrial.getAmountDebit().toString()); - BigDecimal amountSolde =3D balanceTrial.getAmountSolde(); - view.amountSoldeLabel.setText(amountSolde.toString()); - - - if (BigDecimal.ZERO.equals(amountSolde)) { - view.amountSoldeLabel.setText(_("lima.common.solde")); - } else { - // set label solde: credit or debit - if (balanceTrial.getSoldeDebit()) { - view.amountSoldeLabel.setText(_("lima.common.soldedebit")); - } else { - view.amountSoldeLabel.setText(_("lima.common.soldecredit")); - } - } - } - - public void createDocument() { - - Date beginDate =3D view.getIntervalPanel().getBeginDate(); - Date endDate =3D view.getIntervalPanel().getEndDate(); - - if (beginDate !=3D null & endDate !=3D null) { - - //looks for all blocked fiscal periods - List blockedFiscalPeriods =3D fiscalPeriodService.= getAllBlockedFiscalPeriods(); - - //tells if the fiscaPeriod as been found and is blocked - boolean error =3D true; - - for (FiscalPeriod blockedFiscalPeriod : blockedFiscalPeriods) { - if (blockedFiscalPeriod.getBeginDate().equals(beginDate) - && blockedFiscalPeriod.getEndDate().equals(endDate) - && blockedFiscalPeriod.getLocked()) { - error =3D false; - } - } - - //shows error message to user if the fiscalPeriod is unblocked - if (error) { - JOptionPane.showMessageDialog( - view, - _("lima.balance.documentcreationfiscalerror"), - _("lima.common.error"), - JOptionPane.ERROR_MESSAGE); - } else { - - FormatsEnum selectedEnum =3D - (FormatsEnum) view.getDocumentEditor().getSelectedIt= em(); - String address =3D LimaConfig.getInstance().getHostAdress(); - - try { - int port =3D LimaServiceFactory.getService(HttpServerSer= vice.class).getHttpPort(); - String url =3D "http://" + address + ":" + port + "/?beg= inDate=3D" - + dateFormat.format(beginDate) - + "&endDate=3D" + dateFormat.format(endDate= ) + "&format=3D" - + selectedEnum.getExtension() + "&model=3D" - + DocumentsEnum.BALANCE.getFileName(); - Desktop.getDesktop().browse(new URI(url)); - } catch (IOException e) { - log.error("Can't open browser", e); - } catch (URISyntaxException e) { - log.error("Can't create news URI", e); - } - } - } - } - - @Override - public void notifyMethod(String serviceName, String methodName) { - if (serviceName.contains("FinancialTransaction") || methodName.conta= ins("importAccount") || methodName.contains("importAll")) { - refreshData(); - } - } -} --===============0818247799289704289==--