Lima-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
August 2012
- 5 participants
- 86 discussions
Author: mallon
Date: 2012-08-23 12:22:02 +0200 (Thu, 23 Aug 2012)
New Revision: 3632
Url: http://chorem.org/repositories/revision/lima/3632
Log:
refs #770 Mise ?\195?\160 jour de la documentation, concernant la saisie.
Modified:
trunk/src/site/resources/screens/lima_entries.png
trunk/src/site/resources/screens/lima_lettering.png
trunk/src/site/rst/saisie.rst
Modified: trunk/src/site/resources/screens/lima_entries.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/resources/screens/lima_lettering.png
===================================================================
(Binary files differ)
Modified: trunk/src/site/rst/saisie.rst
===================================================================
--- trunk/src/site/rst/saisie.rst 2012-08-22 15:43:11 UTC (rev 3631)
+++ trunk/src/site/rst/saisie.rst 2012-08-23 10:22:02 UTC (rev 3632)
@@ -38,10 +38,11 @@
.. image:: screens/lima_entries.png
-Choisissez alors l'exercice et la période dans laquelle vous souhaitez ajouter
+Choisissez alors l'exercice, la période et le journal dans lesquels vous souhaitez ajouter
des écritures. Pour ajouter une transaction, cliquez sur 'Ajouter une
-transaction'. Saisissez la date, puis le journal concerné par l'écriture.
-Pour ajouter une entrée, Cliquez sur 'Ajouter entrée'
+transaction'.
+Pour ajouter une entrée, sélectionner la transaction dans laquelle vous souhaitez
+ajouter l'entrée, puis cliquez sur 'Ajouter entrée'.
Note : Vous pouvez saisir plus rapidement en utilisant la touche 'Tab' pour
changer de cellule et tapper directement la valeur souhaitée. Si vous appuyez
@@ -49,18 +50,19 @@
transaction sera créée, soit la transaction n'est pas équilibrée et une nouvelle
entrée sera ajoutée.
-Les entrées non équilibrées
----------------------------
+Les entrées et transactions non équilibrées
+-------------------------------------------
-Les transactions non équilibrées sont affichées en rouge dans l'interface de
-saisie. Vous pouvez aussi toutes les retrouver sur un même écran pour les
+Les transactions non équilibrées, ou dont le débit et crédit sont nuls, sont
+affichées en rouge dans l'interface de saisie.
+Vous pouvez aussi toutes les retrouver sur un même écran pour les
corriger en cliquant sur 'Traitement->Entrées incorrectes'.
Choisissez votre Exercice, les entrées incorrectes s'affichent. Vous pouvez soit
-supprimer les transactions, soit modifier les entrées pour équilibre la
-transaction. Le raffraichissement n'est pas automatique. Une fois que vous avez
-effectué vos modifications. Vous pouvez revérifier vos entrées en cliquant sur
-le bouton de rafraichissement, en haut à gauche du tableau.
+supprimer les transactions, soit modifier les entrées pour équilibrer la
+transaction. Le rafraichissement n'est pas automatique.
+Une fois que vous avez effectué vos modifications, vous pouvez revérifier vos
+entrées en cliquant sur le bouton de rafraichissement, en haut à gauche du tableau.
.. image:: screens/lima_incorrectEntries.png
@@ -72,7 +74,7 @@
.. image:: screens/lima_searchEntry.png
-Bous pouvez utiliser un ou plusieurs filtres en les combinants. Les filtres
+Vous pouvez utiliser un ou plusieurs filtres en les combinants. Les filtres
possibles sont :
* Période (Exercice, période comptable ou dates)
@@ -85,4 +87,34 @@
intervalle…)
Lettrage
---------
\ No newline at end of file
+--------
+
+Pour lettrer vos entrées comptables, rendez-vous sur
+'Traitement->Lettrage'
+
+.. image:: screens/lima_lettering.png
+
+Il est possible de n'afficher que certaines écritures, via trois types de filtres différents :
+
+* Comptes : listes des comptes disponibles. Vous pouvez afficher toutes les écritures
+dont le numéro de compte est exactement celui sélectionner (Par exemple : 410), ou bien
+sélectionner une catégorie de compte (Par exemple : 4), permettant ainsi d'afficher
+toutes celles dont le numéro de compte débute par ce chiffre.
+* Périodes : dates de début et de fin entre lesquels les écritures seront sélectionnées.
+* Ecritures : vous pourrez afficher soit les écritures déjà lettrées, soit celles ne
+l'étant pas, ou encore celles des deux catégories.
+
+La zone 'Sélection courante' affiche le total du débit, du crédit, ainsi que la balance des
+écritures sélectionnées au sein du tableau.
+
+Il est donc possible de lettrer différentes écritures, à l'aide du bouton 'Lettrer',
+mais à condition que celles-ci permettent d'avoir un solde à zéro.
+Pour délettrer, il suffit de sélectionner les entrées souhaitées et de cliquer sur le
+bouton 'Délettrer'.
+Dans le cas où seulement quelques centimes séparent le débit et le crédit de deux entrées, il
+est possible d'utiliser le bouton 'Equilibrer', générant alors deux entrées supplémentaires.
+La première correspondra à la différence (En débit ou crédit) entre les deux premières entrées,
+permettant ainsi un équilibrage, et donc de pouvoir lettrer les trois écritures.
+La seconde entrée créée fera soit partie du compte 658, dans le cas d'une différence sur crédit,
+ou bien du compte 758, dans l'autre cas, avec un montant toujours équivalent à la différence.
+
1
0
r3631 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-swing/src/main/java/org/chorem/lima/ui/importexport lima-swing/src/main/resources/i18n
by mallon@users.chorem.org 22 Aug '12
by mallon@users.chorem.org 22 Aug '12
22 Aug '12
Author: mallon
Date: 2012-08-22 17:43:11 +0200 (Wed, 22 Aug 2012)
New Revision: 3631
Url: http://chorem.org/repositories/revision/lima/3631
Log:
fixes #784 Correction sur la methode de gestion des messages utilisateurs lors des imports.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
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-08-22 15:11:37 UTC (rev 3630)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2012-08-22 15:43:11 UTC (rev 3631)
@@ -45,7 +45,6 @@
import org.chorem.lima.business.api.VatStatementService;
import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.EntryComparator;
-import org.chorem.lima.business.utils.FormatsEnum;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountDAO;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
@@ -915,6 +914,9 @@
//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();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-08-22 15:11:37 UTC (rev 3630)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-08-22 15:43:11 UTC (rev 3631)
@@ -215,7 +215,7 @@
// display result dialog
if (verboseMode) {
String result = get();
- if (result.equals("")) {
+ if (result.equals(null)) {
JOptionPane.showMessageDialog(viewComponent, _("lima.ui.importexport.importerror"),
_("lima.ui.importexport.importtitle"), JOptionPane.ERROR_MESSAGE);
@@ -223,6 +223,7 @@
if (importMode) {
if (log.isDebugEnabled()) {
log.debug("importMode");
+ log.debug("importExportMethodeF : " + importExportMethodeF);
}
//special message when importing a VAT PDF
if (importExportMethodeF.equals(ImportExportEnum.PDF_VAT_IMPORT)) {
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-08-22 15:11:37 UTC (rev 3630)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-08-22 15:43:11 UTC (rev 3631)
@@ -153,7 +153,7 @@
lima.importexport.choiceencoding=Choix de l'encodage
lima.importexport.export=
lima.importexport.export.terminated=
-lima.importexport.usevatpdf=
+lima.importexport.usevatpdf=Êtes-vous sûr de vouloir utiliser ce pdf pour la déclaration de TVA ?
lima.init.closed=Lima fermé à %1$s
lima.init.errorclosing=Erreur lors de la fermeture
lima.ledger.documentcreationerror=Erreur lors de la création du document
1
0
r3630 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business/api lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction
by mallon@users.chorem.org 22 Aug '12
by mallon@users.chorem.org 22 Aug '12
22 Aug '12
Author: mallon
Date: 2012-08-22 17:11:37 +0200 (Wed, 22 Aug 2012)
New Revision: 3630
Url: http://chorem.org/repositories/revision/lima/3630
Log:
refs #769 Correction sur le menu 'Documents' et l affichage de la liste deroulante des formats.
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.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-08-22 11:33:49 UTC (rev 3629)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2012-08-22 15:11:37 UTC (rev 3630)
@@ -872,11 +872,10 @@
@Override
public void createVatDocuments(Date beginDate,
Date endDate,
- FormatsEnum format,
String autocomplete) throws LimaException {
String filePath = path + File.separator
- + DocumentsEnum.VAT.getFileName() + format.getExtension();
+ + DocumentsEnum.VAT.getFileName() + ".pdf";
String path = LimaConfig.getInstance().getReportsDir().getAbsolutePath();
@@ -909,22 +908,24 @@
// load the document
doc = PDDocument.load(reportsStream);
- if (autocomplete.equals("true")) {
+ if (autocomplete != null) {
+ if (autocomplete.equals("true")) {
- SetField fields = new SetField();
+ SetField fields = new SetField();
- //search for all VAT Statements from the report
- List<VatStatement> vatStatementsList = vatStatementService.getAllVatStatements();
- 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()) {
- fields.setField(doc, vatStatement.getBoxName(), amount.toString());
+ //search for all VAT Statements from the report
+ List<VatStatement> vatStatementsList = vatStatementService.getAllVatStatements();
+ 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()) {
+ fields.setField(doc, vatStatement.getBoxName(), amount.toString());
+ }
}
}
+ }
- }
// save the updated document to the new file and close
doc.save(filePath);
doc.close();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2012-08-22 11:33:49 UTC (rev 3629)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2012-08-22 15:11:37 UTC (rev 3630)
@@ -156,9 +156,8 @@
IOUtils.copy(in, out);
}
}
- //if doc pdf or html
- else if (model != null && format != null && beginDate != null && endDate != null) {
- FormatsEnum formatsEnum = FormatsEnum.valueOfExtension(format);
+ else if (model != null /*&& format != null*/ && beginDate != null && endDate != null) {
+ //FormatsEnum formatsEnum = FormatsEnum.valueOfExtension(format);
String accountReport = null;
String entryBooksReport = null;
String generalEntryBooksReport = null;
@@ -204,7 +203,7 @@
break;
case VAT:
documentService.createVatDocuments(
- beginDateFormat, endDateFormat, formatsEnum,
+ beginDateFormat, endDateFormat,
autocomplete);
break;
}
@@ -214,20 +213,11 @@
log.error("Can't parse date", eeePE);
}
- // FIXME echatellier 20120606 on connait le fichier
- // ou sera généré le rapport, et on peut donc le relire
- // après génération
- // fonctionne pour le moment, mais a modifier
- URL doc = new URL("file:" + path + File.separator + model + formatsEnum.getExtension());
- if (log.isDebugEnabled()) {
- log.debug("file:" + path + File.separator + model + formatsEnum.getExtension());
- log.debug(accountReport);
- }
- resp.setContentType(formatsEnum.getMimeType());
- OutputStream out = resp.getOutputStream();
- if (accountReport != null || entryBooksReport != null || generalEntryBooksReport != null
- || balanceReport != null || ledgerReport != null || financialReport != null) {
- String report = null;
+ if ( (accountReport != null || entryBooksReport != null || generalEntryBooksReport != null
+ || balanceReport != null || ledgerReport != null || financialReport != null)) {
+ String report;
+ resp.setContentType(".html");
+ OutputStream out = resp.getOutputStream();
if (accountReport != null) {
report = accountReport;
} else if (entryBooksReport != null) {
@@ -243,6 +233,12 @@
}
IOUtils.write(report, out, Charsets.UTF_8);
} else {
+ URL doc = new URL("file:" + path + File.separator + model + ".pdf");
+ if (log.isDebugEnabled()) {
+ log.debug("file:" + path + File.separator + model + ".pdf");
+ }
+ resp.setContentType(".pdf");
+ OutputStream out = resp.getOutputStream();
InputStream in = doc.openStream();
IOUtils.copy(in, out);
}
@@ -298,17 +294,18 @@
+ "\" type=\"date\" name=\"beginDate\">\n"
+ _("lima-business.document.date.end")
+ "<input value=\"" + DATEFORMAT.format(endDatePicker)
- + "\" type=\"date\" name=\"endDate\">\n<br/><br/>"
- + "Format : <select name=\"format\">");
+ + "\" type=\"date\" name=\"endDate\">\n<br/><br/>");
+ //+ "Format : <select name=\"format\">");
- for (FormatsEnum formatsEnum : FormatsEnum.values()) {
+ /*TODO : voir pour générer des pdf avec éventuellement iReport*/
+ /*for (FormatsEnum formatsEnum : FormatsEnum.values()) {
pageContent.append("<option value=\""
+ formatsEnum.getExtension() + "\">"
+ formatsEnum.getDescription() + "</option>\n");
- }
+ }*/
- pageContent.append("</select>\n"
- + "Documents : <select name=\"model\">");
+ pageContent.append(/*"</select>\n"
+ + */"Documents : <select name=\"model\">");
for (DocumentsEnum documentsEnum : DocumentsEnum.values()) {
pageContent.append("<option value=\""
@@ -316,12 +313,11 @@
+ documentsEnum.getDescription() + "</option>\n");
}
- pageContent.append("</select>\n"
+ pageContent.append("</select><input type=\"submit\">\n"
+ + "</form></td>"
+ "<tr><td class=\"tdright\"><img src=\"?img=entries.png\"/></td></tr>\n"
+ "<tr><td class=\"tdright\"><img src=\"?img=accounts.png\"/></td></tr>\n"
+ "<tr><td class=\"tdright\"><img src=\"?img=entrybooks.png\"/></td>\n"
- + "<td class=\"tdright\"><input type=\"submit\"></td></tr>"
- + "</form>\n"
+ "<tr><td class=\"tdright\"><img src=\"?img=fiscalperiods.png\"/></td></tr>\n"
+ "</table>\n"
+ "</body>\n"
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java 2012-08-22 11:33:49 UTC (rev 3629)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java 2012-08-22 15:11:37 UTC (rev 3630)
@@ -48,7 +48,7 @@
String createGeneralEntryBooksDocuments(Date beginDate, Date endDate) throws LimaException;
- void createVatDocuments(Date beginDate, Date endDate, FormatsEnum format, String autocomplete) throws LimaException;
+ void createVatDocuments(Date beginDate, Date endDate, String autocomplete) throws LimaException;
String createAccountDocument(Date beginDate, Date endDate, String account) throws LimaException;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-08-22 11:33:49 UTC (rev 3629)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTable.java 2012-08-22 15:11:37 UTC (rev 3630)
@@ -51,6 +51,8 @@
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.ParsePosition;
import java.util.Date;
/**
@@ -122,12 +124,18 @@
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
boolean isHighlighted = false;
+ Object valueDebit = adapter.getValueAt(adapter.row, 4);
+ Object valueCredit = adapter.getValueAt(adapter.row, 5);
Object value = adapter.getValueAt(adapter.row, 6);
if (value instanceof BigDecimal) {
BigDecimal currentBalance = (BigDecimal) value;
- // can compare two BigDecimals with different scales
- // e.g: 3.1 == 3.10
- if (currentBalance.compareTo(BigDecimal.ZERO) != 0) {
+ DecimalFormat decimalFormat = new DecimalFormat();
+ Double currentBalanceDouble = decimalFormat.parse(currentBalance.toString(), new ParsePosition(0)).doubleValue();
+ Double debitDouble = decimalFormat.parse(valueDebit.toString(), new ParsePosition(0)).doubleValue();
+ Double creditDouble = decimalFormat.parse(valueCredit.toString(), new ParsePosition(0)).doubleValue();
+
+ if (!currentBalanceDouble.toString().equals("0.0") || (valueDebit.equals(BigDecimal.ZERO) || debitDouble.toString().equals("0.0"))
+ && (valueCredit.equals(BigDecimal.ZERO) || creditDouble.toString().equals("0.0"))) {
isHighlighted = true;
}
}
@@ -147,9 +155,13 @@
Object valueDebit = adapter.getValueAt(adapter.row, 4);
Object valueCredit = adapter.getValueAt(adapter.row, 5);
+ boolean isEntry = !(adapter.getValueAt(adapter.row, 0) instanceof Date);
- return (valueDebit.equals(BigDecimal.ZERO) || valueDebit.toString().equals("0.00"))
- && (valueCredit.equals(BigDecimal.ZERO) || valueCredit.toString().equals("0.00"));
+ DecimalFormat decimalFormat = new DecimalFormat();
+ Double debitDouble = decimalFormat.parse(valueDebit.toString(), new ParsePosition(0)).doubleValue();
+ Double creditDouble = decimalFormat.parse(valueCredit.toString(), new ParsePosition(0)).doubleValue();
+ return (isEntry && (valueDebit.equals(BigDecimal.ZERO) || debitDouble.toString().equals("0.0"))
+ && (valueCredit.equals(BigDecimal.ZERO) || creditDouble.toString().equals("0.0")));
}
};
1
0
r3629 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by mallon@users.chorem.org 22 Aug '12
by mallon@users.chorem.org 22 Aug '12
22 Aug '12
Author: mallon
Date: 2012-08-22 13:33:49 +0200 (Wed, 22 Aug 2012)
New Revision: 3629
Url: http://chorem.org/repositories/revision/lima/3629
Log:
fixes #769 Correction sur l edition des journaux et du journal general, pour l affichage du label et du code de chaque journal.
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 2012-08-22 11:05:07 UTC (rev 3628)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2012-08-22 11:33:49 UTC (rev 3629)
@@ -856,6 +856,7 @@
generalEntryBooksDataInList.getDebit().toString(),
generalEntryBooksDataInList.getCredit().toString()};
entryBookReport += constructColumnsHtml(columnDataTotal, "");
+ entryBookCode = "";
}
}
}
1
0
r3628 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by mallon@users.chorem.org 22 Aug '12
by mallon@users.chorem.org 22 Aug '12
22 Aug '12
Author: mallon
Date: 2012-08-22 13:05:07 +0200 (Wed, 22 Aug 2012)
New Revision: 3628
Url: http://chorem.org/repositories/revision/lima/3628
Log:
refs #769 Correction sur l edition du grand livre et les sous-tableaux des entrees.
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 2012-08-22 10:06:55 UTC (rev 3627)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2012-08-22 11:05:07 UTC (rev 3628)
@@ -328,76 +328,6 @@
BigDecimal currentAmountCredit = new BigDecimal(0);
String accountcarry = "";
- /*ledgerReport += "<table>" +
- "<tr> " +
- "<td>" +
- "<table align=\"left\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n" +
- "<tr>\n";
-
- String boldItalicBegin = "<b>" + "<i>";
- String boldItalicEnd = "</i>" + "</b>";
- Identity identity = identityService.getIdentity();
-
- String [] columnsNameSociety = {boldItalicBegin + identity.getName()+ boldItalicEnd};
- ledgerReport += constructColumnsHtml(columnsNameSociety, "");
-
- ledgerReport += "<tr>\n";
- String [] columnsDescription = {"<i>" + identity.getDescription()+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsDescription, "");
-
- ledgerReport += "<tr>\n";
- String [] columnsAdressOne = {"<i>" + identity.getAddress() + "</i>"};
- ledgerReport += constructColumnsHtml(columnsAdressOne, "");
-
- ledgerReport += "<tr>\n";
- String [] columnsAdressTwo = {"<i>" + identity.getAddress2() + "</i>"};
- ledgerReport += constructColumnsHtml(columnsAdressTwo, "");
-
- ledgerReport += "<tr>\n";
- String [] columnsZipCode = {"<i>" + identity.getZipCode() + "</i>"};
- ledgerReport += constructColumnsHtml(columnsZipCode, "");
-
- ledgerReport += "<tr>\n";
- String [] columnsCity = {"<i>" + identity.getCity()+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsCity, "");
-
- ledgerReport += "</table>\n" +
- "</td>" +
- "<td valign=\"middle\" align=\"center\" style=\"width:100%\">" +
- "<p style=\"font-size:30px;\">" + _("lima-business.document.ledger") + "</p>" +
- "</td>" +
- "<td>" +
- "<table align=\"right\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n";
-
- ledgerReport += "<tr>\n";
- String [] columnsBusinessNumber = {boldItalicBegin + _("lima-business.document.businessnumber") +
- boldItalicEnd, "<i>" + identity.getBusinessNumber()+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsBusinessNumber, "");
-
- ledgerReport += "<tr>\n";
- String [] columnsClassifCode = {boldItalicBegin + _("lima-business.document.classificationcode") +
- boldItalicEnd, "<i>" + identity.getClassificationCode()+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsClassifCode, "");
-
- ledgerReport += "<tr>\n";
- String [] columnsVatNumber = {boldItalicBegin + _("lima-business.document.vatnumber") + boldItalicEnd,
- "<i>" + identity.getVatNumber()+ "</i>", };
- ledgerReport += constructColumnsHtml(columnsVatNumber, "");
-
- ledgerReport += "<tr>\n";
- String [] columnsPeriodOne = {boldItalicBegin + _("lima-business.document.period1") + boldItalicEnd, "<i>"
- + _("lima-business.document.period1format", beginDate)+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsPeriodOne, "");
-
- ledgerReport += "<tr>\n";
- String [] columnsPeriodTwo = {boldItalicBegin + _("lima-business.document.period2") + boldItalicEnd, "<i>"
- + _("lima-business.document.period2format", endDate)+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsPeriodTwo, "");
-
- ledgerReport += "</table>" +
- "</td>" +
- "</table>";*/
-
List<Object> subList = list.subList(i, j);
@@ -416,9 +346,15 @@
boldBegin + _("lima-business.document.credit") + boldEnd, boldBegin + _("lima-business.document.solde") + boldEnd};
ledgerReport += constructColumnsHtml(columnsNames, "");
+ int indexEntry = -1;
for (Object object : subList) {
if (object instanceof ReportsDatas) {
-
+ if (indexEntry != -1) {
+ indexEntry = -1;
+ ledgerReport += "</table>" +
+ "</td>" +
+ "</tr>";
+ }
ReportsDatas reportsDatas = (ReportsDatas) object;
String accountS = "";
@@ -435,6 +371,7 @@
ledgerReport += constructColumnsHtml(columnsTable, "");
} else {
+ indexEntry++;
Entry entry = (Entry) object;
String entryBookCode = "";
@@ -450,21 +387,22 @@
amountCredit = entry.getAmount();
}
- ledgerReport +="<tr><td>";
- ledgerReport += "<table align=\"right\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n" +
+ ledgerReport +="<tr>";
+ if (indexEntry == 0) {
+ ledgerReport += "<td><table align=\"right\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n" +
"<tr>\n";
- String [] columnsEntry = {boldBegin + _("lima-business.document.date")+ boldEnd,
- boldBegin + _("lima-business.document.entrybook") + boldEnd, boldBegin + _("lima-business.document.voucher") + boldEnd,
- boldBegin + _("lima-business.document.description") + boldEnd, boldBegin + _("lima-business.document.debit") + boldEnd,
- boldBegin + _("lima-business.document.credit") + boldEnd, boldBegin + _("lima-business.document.solde") + boldEnd};
- ledgerReport += constructColumnsHtml(columnsEntry, "");
+ String [] columnsEntry = {boldBegin + _("lima-business.document.date")+ boldEnd,
+ boldBegin + _("lima-business.document.entrybook") + boldEnd, boldBegin + _("lima-business.document.voucher") + boldEnd,
+ boldBegin + _("lima-business.document.description") + boldEnd, boldBegin + _("lima-business.document.debit") + boldEnd,
+ boldBegin + _("lima-business.document.credit") + boldEnd, boldBegin + _("lima-business.document.solde") + boldEnd};
+ ledgerReport += constructColumnsHtml(columnsEntry, "");
+ }
String [] columnsTable = {_("lima-business.document.dateformat",entry.getFinancialTransaction().getTransactionDate()),
entryBookCode, entry.getVoucher(), entry.getDescription(),
amountDebit.toString(), amountCredit.toString(), amountDebit.subtract(amountCredit).toString()};
ledgerReport += constructColumnsHtml(columnsTable, "");
- ledgerReport += "</table>" +
- "</td></tr>";
+ ledgerReport += "</tr>";
}
}
@@ -1024,7 +962,7 @@
List<Entry> entries = results.getListEntry();
String[] columnNames = {_("lima.table.number"), _("lima.table.date"), _("lima.table.entrybook"),
- _("lima.table.voucher"), _("lima.table.decription"), _("lima.table.letter"),
+ _("lima.table.voucher"), _("lima.table.description"), _("lima.table.letter"),
_("lima.table.debit"), _("lima.table.credit")};
accountReport += "<body>\n" +
1
0
r3627 - 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
by mallon@users.chorem.org 22 Aug '12
by mallon@users.chorem.org 22 Aug '12
22 Aug '12
Author: mallon
Date: 2012-08-22 12:06:55 +0200 (Wed, 22 Aug 2012)
New Revision: 3627
Url: http://chorem.org/repositories/revision/lima/3627
Log:
refs #769 Correction sur la methode d acquisition des comptes et sous-comptes entres au sein du plan BCR.
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.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
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-08-21 14:16:49 UTC (rev 3626)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2012-08-22 10:06:55 UTC (rev 3627)
@@ -25,20 +25,7 @@
package org.chorem.lima.business.ejb;
-import com.lowagie.text.BadElementException;
-import com.lowagie.text.Cell;
-import com.lowagie.text.Chapter;
-import com.lowagie.text.Document;
-import com.lowagie.text.DocumentException;
-import com.lowagie.text.Element;
import com.lowagie.text.Font;
-import com.lowagie.text.PageSize;
-import com.lowagie.text.Paragraph;
-import com.lowagie.text.Phrase;
-import com.lowagie.text.Rectangle;
-import com.lowagie.text.Table;
-import com.lowagie.text.html.HtmlWriter;
-import com.lowagie.text.pdf.PdfWriter;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -81,7 +68,6 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
@@ -137,130 +123,20 @@
}
- /**
- * 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,
- Date beginDate,
- Date endDate) {
- Paragraph paragraphHeaderPage = new Paragraph();
- Table t = null;
- try {
-
- //define table
- t = new Table(4, 5);
- t.setWidth(100f);
- float[] widths = {0.25f, 0.45f, 0.12f, 0.18f};
- t.setWidths(widths);
- t.setPadding(1.5f);
-
- //defaut cell
- Cell cell = new Cell();
- cell.setBorder(Rectangle.NO_BORDER);
- t.setDefaultCell(cell);
-
- //line 1
- t.addCell(new Phrase(identity.getName(), bolditalicFont));
- Cell titleCell = new Cell(new Phrase(title, titleFont));
- titleCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
- titleCell.setHorizontalAlignment(Element.ALIGN_CENTER);
- titleCell.setRowspan(2);
- t.addCell(titleCell);
- t.addCell(new Phrase(_("lima-business.document.businessnumber"),
- bolditalicFont));
- t.addCell(new Phrase(identity.getBusinessNumber(), italicFont));
- //line 2
- t.addCell(new Phrase(identity.getDescription(), italicFont));
- t.addCell(new Phrase(_("lima-business.document.classificationcode"),
- bolditalicFont));
- t.addCell(new Phrase(identity.getClassificationCode(), italicFont));
- //line 3
- t.addCell(new Phrase(identity.getAddress(), italicFont));
- t.addCell("");
- t.addCell(new Phrase(_("lima-business.document.vatnumber"),
- bolditalicFont));
- t.addCell(new Phrase(identity.getVatNumber(), italicFont));
- //line 4
- t.addCell(new Phrase(identity.getAddress2(), italicFont));
- t.addCell("");
- t.addCell(new Phrase(_("lima-business.document.period1"),
- bolditalicFont));
- 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(_("lima-business.document.period2format", endDate), italicFont));
- } catch (BadElementException eeBEE) {
- log.error("Can't create table", eeBEE);
- }
-
- paragraphHeaderPage.add(t);
- return paragraphHeaderPage;
- }
-
- /**
- * 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);
- infos.setWidth(100f);
- infos.setBorder(Rectangle.NO_BORDER);
- infos.setOffset(2);
- Cell c = new Cell();
- c.setBorder(Rectangle.NO_BORDER);
- c.setHorizontalAlignment(Element.ALIGN_CENTER);
- infos.setDefaultCell(c);
- 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;
- }
-
@Override
- public void createFinancialStatementsDocuments(Date beginDate,
- Date endDate,
- FormatsEnum format) throws LimaException {
- Document document = new Document(PageSize.A4, 8, 8, 8, 8);
+ public String createFinancialStatementsDocuments(Date beginDate,
+ Date endDate) throws LimaException {
List<FinancialStatementAmounts> financialStatementAmounts =
financialStatementService.financialStatementReport(beginDate, endDate);
+ String financialReport = "";
- Date newDate = new Date();
- String filePath = path + File.separator + DocumentsEnum.FINANCIALSTATEMENT.getFileName();
-
try {
- FileOutputStream fileOut = new FileOutputStream(filePath + format.getExtension());
- switch (format) {
- case HTML:
- HtmlWriter htmlWriter = HtmlWriter.getInstance(document, fileOut);
- break;
- case PDF:
- PdfWriter pdfWriter = PdfWriter.getInstance(document, fileOut);
- break;
- }
- document.open();
- int nbpages = 1;
+ financialReport = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n" +
+ "<html>\n" +
+ "<body>\n";
- Identity identity = identityService.getIdentity();
-
//Split list by financialstatement type
List<List<FinancialStatementAmounts>> listList =
new ArrayList<List<FinancialStatementAmounts>>();
@@ -280,6 +156,7 @@
}
}
listList.add(financialStatementAmounts.subList(min, size));
+ int printedType = -1;
//create pages
for (List<FinancialStatementAmounts> list : listList) {
@@ -287,10 +164,7 @@
int i = 0;
int n = list.size();
int max = n;
- // alloc nb rows max for pdf documents on one page
- if (format == FormatsEnum.PDF) {
- max = 35;
- }
+ printedType ++;
while (i < n) {
int j = i + max;
if (j > n) {
@@ -298,162 +172,113 @@
}
List<FinancialStatementAmounts> subFinancialStatementAmounts =
list.subList(i, j);
- //create page : header + table + footer
- Table headerTable = createFinancialStatementsHeaderTable();
- Table table = createFinancialStatementsTable(
- subFinancialStatementAmounts);
- //new page
- Chapter chapter = new Chapter(0);
- //headerPage
- chapter.add(createHeaderPage(title, identity, beginDate, endDate));
- //n° page
- chapter.add(createNumberPage(nbpages, newDate));
- //headerTable
- Paragraph paragraphHeaderTable = new Paragraph();
- paragraphHeaderTable.add(headerTable);
- chapter.add(paragraphHeaderTable);
- //table
- Paragraph paragraphTable = new Paragraph();
- paragraphTable.add(table);
- chapter.add(paragraphTable);
- //add page
- document.add(chapter);
- i = i + max;
- nbpages++;
- }
- }
- document.close();
+ financialReport += constructHeaderTitle(title, beginDate, endDate);
- } catch (FileNotFoundException eeFNFE) {
- log.error("Can't create pdf file", eeFNFE);
- } catch (DocumentException eeDE) {
- log.error("Can't create document", eeDE);
- }
- }
+ String boldBegin = "<b>";
+ String boldEnd = "</b>";
+ financialReport += "<table border=\"1\" width=\"100%\" cellpadding=\"3\" cellspacing=\"0\">\n" +
+ "<tr align=\"center\">\n";
- protected Table createFinancialStatementsHeaderTable() {
- Table t = null;
- try {
- t = new Table(4, 1);
- float[] widths = {0.4f, 0.2f, 0.2f, 0.2f};
- t.setWidths(widths);
- t.setWidth(100f);
- t.setPadding(3f);
- //defaut cell
- Cell cell = new Cell();
- cell.setBorder(Rectangle.LEFT);
- cell.setHorizontalAlignment(Element.ALIGN_CENTER);
- t.setDefaultCell(cell);
- t.setOffset(8);
- t.addCell(new Phrase(_("lima-business.document.label"),
- boldFont));
- t.addCell(new Phrase(_("lima-business.document.grossamount"),
- boldFont));
- t.addCell(new Phrase(_("lima-business.document.provisiondeprecationamount"),
- boldFont));
- t.addCell(new Phrase(_("lima-business.document.netamount"),
- boldFont));
+ if (printedType == 0) {
+ String[] columnHeaderTable = {boldBegin+_("lima-business.document.label")+boldEnd, boldBegin+_("lima-business.document.grossamount")+boldEnd,
+ boldBegin+_("lima-business.document.provisiondeprecationamount")+boldEnd, boldBegin+_("lima-business.document.netamount")+boldEnd};
+ financialReport += constructColumnsHtml(columnHeaderTable, "");
+ } else if (printedType == 1) {
+ String[] columnHeaderTable = {boldBegin+_("lima-business.document.label")+boldEnd, boldBegin+_("lima-business.document.amount")+boldEnd};
+ financialReport += constructColumnsHtml(columnHeaderTable, "");
+ } else {
+ String[] columnHeaderTable = {boldBegin+_("lima-business.document.label")+boldEnd, boldBegin+_("lima-business.document.amount")+boldEnd};
+ financialReport += constructColumnsHtml(columnHeaderTable, "");
+ }
- } catch (BadElementException eeBEE) {
- log.error("Can't create table", eeBEE);
- }
- return t;
+ for (FinancialStatementAmounts financialStatementAmount : subFinancialStatementAmounts) {
- }
+ String label = financialStatementAmount.getLabel();
+ int level = financialStatementAmount.getLevel();
+ BigDecimal grossAmount =
+ financialStatementAmount.getGrossAmount();
+ if (grossAmount == null) {
+ grossAmount = new BigDecimal(0);
+ }
+ BigDecimal provisionDeprecationAmount =
+ financialStatementAmount.getProvisionDeprecationAmount();
+ if (provisionDeprecationAmount == null) {
+ provisionDeprecationAmount = new BigDecimal(0);
+ }
- protected Table createFinancialStatementsTable(List<FinancialStatementAmounts> financialStatementAmounts) {
- int nbrow = financialStatementAmounts.size();
- Table t = null;
- try {
- //define table
- t = new Table(4, nbrow);
- t.setWidth(100f);
- float[] widths = {0.4f, 0.2f, 0.2f, 0.2f};
- t.setWidths(widths);
- t.setPadding(1.5f);
- t.setBorderWidth(1);
- t.setOffset(0);
- //define default cell
- Cell cell = new Cell();
- cell.setBorder(Rectangle.LEFT);
- cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
- t.setDefaultCell(cell);
+ String fontColor = "";
+ if (financialStatementAmount.getSubAmount() && level == 1) {
+ fontColor = "#CCCCCC";
+ } else if (financialStatementAmount.getSubAmount()) {
+ fontColor = "#C0C0C0";
+ } else {
+ fontColor = "#999999";
+ }
+ if (label == null) {
+ if (printedType == 0) {
+ String [] emptyColumn = {"","","",""};
+ financialReport += constructColumnsHtml(emptyColumn, fontColor);
+ } else {
+ String [] emptyColumn = {"", ""};
+ financialReport += constructColumnsHtml(emptyColumn, fontColor);
+ }
+ } else {
+ //cell1
+ StringBuffer tab = new StringBuffer();
+ for (int k = 0; k < level; k++) {
+ tab.append("\t");
+ }
+ //Phrase phrase;
+ String tabLabel = "";
+ if (financialStatementAmount.getHeader()) {
+ tabLabel = boldBegin + tab + label + boldEnd;
+ } else {
+ tabLabel = tab + label;
+ }
+ //cell2
+ String grossAmountStr = "";
+ if (grossAmount != BigDecimal.ZERO) {
+ grossAmountStr = grossAmount.toString();
+ }
- for (FinancialStatementAmounts financialStatementAmount : financialStatementAmounts) {
+ //cell 3
+ String provisionDeprecationAmountStr = "";
+ if (provisionDeprecationAmount != BigDecimal.ZERO) {
+ provisionDeprecationAmountStr = provisionDeprecationAmount.toString();
+ }
- String label = financialStatementAmount.getLabel();
- int level = financialStatementAmount.getLevel();
- BigDecimal grossAmount =
- financialStatementAmount.getGrossAmount();
- if (grossAmount == null) {
- grossAmount = new BigDecimal(0);
- }
- BigDecimal provisionDeprecationAmount =
- financialStatementAmount.getProvisionDeprecationAmount();
- if (provisionDeprecationAmount == null) {
- provisionDeprecationAmount = new BigDecimal(0);
- }
+ //cell 4
+ BigDecimal solde = grossAmount;
+ solde = solde.subtract(provisionDeprecationAmount);
+ String soldeStr = "";
+ if (solde != BigDecimal.ZERO) {
+ soldeStr = solde.toString();
+ }
- if (financialStatementAmount.getSubAmount() && level == 1) {
- cell.setGrayFill(0.88f);
- } else if (financialStatementAmount.getSubAmount()) {
- cell.setGrayFill(0.94f);
- } else {
- cell.setGrayFill(1f);
- }
- if (label == null) {
- t.addCell("");
- t.addCell("");
- t.addCell("");
- t.addCell("");
- } else {
- //cell1
- StringBuffer tab = new StringBuffer();
- for (int i = 0; i < level; i++) {
- tab.append("\t");
+ if (printedType == 0) {
+ String [] columns = {tabLabel, grossAmountStr, provisionDeprecationAmountStr, soldeStr};
+ financialReport += constructColumnsHtml(columns, "");
+ } else /*if (printedType == 1)*/ {
+ String [] columns = {tabLabel, soldeStr};
+ financialReport += constructColumnsHtml(columns, "");
+ } /*else {
+ String [] columns = {tabLabel, grossAmountStr, provisionDeprecationAmountStr, soldeStr};
+ financialReport += constructColumnsHtml(columns, "");
+ }*/
+ }
}
- Phrase phrase;
- if (financialStatementAmount.getHeader()) {
- phrase = new Phrase(tab + label, boldFont);
- } else {
- phrase = new Phrase(tab + label, normalFont);
- }
- Cell c = new Cell(phrase);
- c.setHorizontalAlignment(Element.ALIGN_LEFT);
- t.addCell(c);
- //cell2
- if (grossAmount != BigDecimal.ZERO) {
- phrase = new Phrase(String.valueOf(
- grossAmount), normalFont);
- } else {
- phrase = new Phrase("");
- }
- t.addCell(phrase);
- //cell 3
- if (provisionDeprecationAmount != BigDecimal.ZERO) {
- phrase = new Phrase(String.valueOf(
- provisionDeprecationAmount), normalFont);
- } else {
- phrase = new Phrase("");
- }
- t.addCell(phrase);
- //cell 4
- BigDecimal solde = grossAmount;
- solde = solde.subtract(provisionDeprecationAmount);
- if (solde != BigDecimal.ZERO) {
- phrase = new Phrase(solde.toString(), normalFont);
- } else {
- phrase = new Phrase("");
- }
- t.addCell(phrase);
+ i = i + max;
+ financialReport += "</table>";
}
}
+ financialReport += "</body>" +
+ "</html>";
- } catch (BadElementException eeBEE) {
- log.error("Can't create table", eeBEE);
+ } catch (Exception ex) {
+ log.error("Can't create document", ex);
}
- return t;
+ return financialReport;
}
//############## Ledger ##############
@@ -497,7 +322,13 @@
j = n;
}
- ledgerReport += "<table>" +
+ ledgerReport += constructHeaderTitle(_("lima-business.document.ledger"), beginDate, endDate);
+
+ BigDecimal currentAmountDebit = new BigDecimal(0);
+ BigDecimal currentAmountCredit = new BigDecimal(0);
+ String accountcarry = "";
+
+ /*ledgerReport += "<table>" +
"<tr> " +
"<td>" +
"<table align=\"left\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n" +
@@ -505,33 +336,30 @@
String boldItalicBegin = "<b>" + "<i>";
String boldItalicEnd = "</i>" + "</b>";
- BigDecimal currentAmountDebit = new BigDecimal(0);
- BigDecimal currentAmountCredit = new BigDecimal(0);
- String accountcarry = "";
Identity identity = identityService.getIdentity();
String [] columnsNameSociety = {boldItalicBegin + identity.getName()+ boldItalicEnd};
- ledgerReport += constructColumnsHtml(columnsNameSociety);
+ ledgerReport += constructColumnsHtml(columnsNameSociety, "");
ledgerReport += "<tr>\n";
String [] columnsDescription = {"<i>" + identity.getDescription()+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsDescription);
+ ledgerReport += constructColumnsHtml(columnsDescription, "");
ledgerReport += "<tr>\n";
String [] columnsAdressOne = {"<i>" + identity.getAddress() + "</i>"};
- ledgerReport += constructColumnsHtml(columnsAdressOne);
+ ledgerReport += constructColumnsHtml(columnsAdressOne, "");
ledgerReport += "<tr>\n";
String [] columnsAdressTwo = {"<i>" + identity.getAddress2() + "</i>"};
- ledgerReport += constructColumnsHtml(columnsAdressTwo);
+ ledgerReport += constructColumnsHtml(columnsAdressTwo, "");
ledgerReport += "<tr>\n";
String [] columnsZipCode = {"<i>" + identity.getZipCode() + "</i>"};
- ledgerReport += constructColumnsHtml(columnsZipCode);
+ ledgerReport += constructColumnsHtml(columnsZipCode, "");
ledgerReport += "<tr>\n";
String [] columnsCity = {"<i>" + identity.getCity()+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsCity);
+ ledgerReport += constructColumnsHtml(columnsCity, "");
ledgerReport += "</table>\n" +
"</td>" +
@@ -544,31 +372,31 @@
ledgerReport += "<tr>\n";
String [] columnsBusinessNumber = {boldItalicBegin + _("lima-business.document.businessnumber") +
boldItalicEnd, "<i>" + identity.getBusinessNumber()+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsBusinessNumber);
+ ledgerReport += constructColumnsHtml(columnsBusinessNumber, "");
ledgerReport += "<tr>\n";
String [] columnsClassifCode = {boldItalicBegin + _("lima-business.document.classificationcode") +
boldItalicEnd, "<i>" + identity.getClassificationCode()+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsClassifCode);
+ ledgerReport += constructColumnsHtml(columnsClassifCode, "");
ledgerReport += "<tr>\n";
String [] columnsVatNumber = {boldItalicBegin + _("lima-business.document.vatnumber") + boldItalicEnd,
"<i>" + identity.getVatNumber()+ "</i>", };
- ledgerReport += constructColumnsHtml(columnsVatNumber);
+ ledgerReport += constructColumnsHtml(columnsVatNumber, "");
ledgerReport += "<tr>\n";
String [] columnsPeriodOne = {boldItalicBegin + _("lima-business.document.period1") + boldItalicEnd, "<i>"
+ _("lima-business.document.period1format", beginDate)+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsPeriodOne);
+ ledgerReport += constructColumnsHtml(columnsPeriodOne, "");
ledgerReport += "<tr>\n";
String [] columnsPeriodTwo = {boldItalicBegin + _("lima-business.document.period2") + boldItalicEnd, "<i>"
+ _("lima-business.document.period2format", endDate)+ "</i>"};
- ledgerReport += constructColumnsHtml(columnsPeriodTwo);
+ ledgerReport += constructColumnsHtml(columnsPeriodTwo, "");
ledgerReport += "</table>" +
"</td>" +
- "</table>";
+ "</table>";*/
List<Object> subList = list.subList(i, j);
@@ -578,7 +406,7 @@
String [] columnsCarryBack = {boldBegin + accountcarry + boldEnd, boldBegin + _("lima-business.document.carryback") + boldEnd,
boldBegin + currentAmountDebit.toString() + boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentAmountDebit.subtract(currentAmountCredit).toString() + boldEnd};
- ledgerReport += constructColumnsHtml(columnsCarryBack);
+ ledgerReport += constructColumnsHtml(columnsCarryBack, "");
}
ledgerReport += "<table align=\"left\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n" +
@@ -586,7 +414,7 @@
String [] columnsNames = {boldBegin + _("lima-business.document.account")+ boldEnd, boldBegin + _("lima-business.document.debit") + boldEnd,
boldBegin + _("lima-business.document.credit") + boldEnd, boldBegin + _("lima-business.document.solde") + boldEnd};
- ledgerReport += constructColumnsHtml(columnsNames);
+ ledgerReport += constructColumnsHtml(columnsNames, "");
for (Object object : subList) {
if (object instanceof ReportsDatas) {
@@ -604,7 +432,7 @@
String [] columnsTable = {boldBegin + accountS + boldEnd,
boldBegin + amountDebit.toString() + boldEnd, boldBegin + amountCredit.toString() + boldEnd,
boldBegin + amountDebit.subtract(amountCredit).toString() + boldEnd};
- ledgerReport += constructColumnsHtml(columnsTable);
+ ledgerReport += constructColumnsHtml(columnsTable, "");
} else {
Entry entry = (Entry) object;
@@ -629,12 +457,12 @@
boldBegin + _("lima-business.document.entrybook") + boldEnd, boldBegin + _("lima-business.document.voucher") + boldEnd,
boldBegin + _("lima-business.document.description") + boldEnd, boldBegin + _("lima-business.document.debit") + boldEnd,
boldBegin + _("lima-business.document.credit") + boldEnd, boldBegin + _("lima-business.document.solde") + boldEnd};
- ledgerReport += constructColumnsHtml(columnsEntry);
+ ledgerReport += constructColumnsHtml(columnsEntry, "");
String [] columnsTable = {_("lima-business.document.dateformat",entry.getFinancialTransaction().getTransactionDate()),
entryBookCode, entry.getVoucher(), entry.getDescription(),
amountDebit.toString(), amountCredit.toString(), amountDebit.subtract(amountCredit).toString()};
- ledgerReport += constructColumnsHtml(columnsTable);
+ ledgerReport += constructColumnsHtml(columnsTable, "");
ledgerReport += "</table>" +
"</td></tr>";
}
@@ -662,14 +490,14 @@
String [] columnsTable = {"", boldBegin + _("lima-business.document.carryforward") + boldEnd,
boldBegin + currentAmountDebit.toString() + boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentAmountDebit.subtract(currentAmountCredit).toString() + boldEnd};
- ledgerReport += constructColumnsHtml(columnsTable);
+ ledgerReport += constructColumnsHtml(columnsTable, "");
}
//final amounts
if (i >= n - max) {
String [] columnsTable = { boldBegin + _("lima-business.document.amounts") + boldEnd,
boldBegin + currentAmountDebit.toString() + boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentAmountDebit.subtract(currentAmountCredit).toString() + boldEnd};
- ledgerReport += constructColumnsHtml(columnsTable);
+ ledgerReport += constructColumnsHtml(columnsTable, "");
}
i = i + max;
}
@@ -751,7 +579,7 @@
_("lima-business.document.debit"),
_("lima-business.document.credit")};
- entryBookReport += constructColumnsHtml(columnNames);
+ entryBookReport += constructColumnsHtml(columnNames, "");
for (Entry entry : entries) {
String numaccount = null;
@@ -764,10 +592,10 @@
(entry.getDebit() ? entry.getAmount() : BigDecimal.ZERO).toString(),
(entry.getDebit() ? BigDecimal.ZERO : entry.getAmount()).toString()};
- entryBookReport += constructColumnsHtml(columnData);
+ entryBookReport += constructColumnsHtml(columnData, "");
}
String [] columnDataTotal = {"", "", "", _("lima-business.document.amounts"), debit.toString(), credit.toString()};
- entryBookReport += constructColumnsHtml(columnDataTotal);
+ entryBookReport += constructColumnsHtml(columnDataTotal, "");
entryBookReport += "</table></p>\n";
}
}
@@ -816,8 +644,10 @@
}
List<ReportsDatas> subList = list.subList(i, j);
- balanceReport += "<body>\n" +
- "<table>" +
+ balanceReport += "<body>\n";
+ balanceReport += constructHeaderTitle(_("lima-business.document.balance"), beginDate, endDate);
+
+ /*balanceReport += "<table>" +
"<tr> " +
"<td>" +
"<table align=\"left\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n" +
@@ -827,27 +657,27 @@
String boldItalicEnd = "</i>" + "</b>";
String [] columnsNameSociety = {boldItalicBegin + identity.getName()+ boldItalicEnd};
- balanceReport += constructColumnsHtml(columnsNameSociety);
+ balanceReport += constructColumnsHtml(columnsNameSociety, "");
balanceReport += "<tr>\n";
String [] columnsDescription = {"<i>" + identity.getDescription()+ "</i>"};
- balanceReport += constructColumnsHtml(columnsDescription);
+ balanceReport += constructColumnsHtml(columnsDescription, "");
balanceReport += "<tr>\n";
String [] columnsAdressOne = {"<i>" + identity.getAddress() + "</i>"};
- balanceReport += constructColumnsHtml(columnsAdressOne);
+ balanceReport += constructColumnsHtml(columnsAdressOne, "");
balanceReport += "<tr>\n";
String [] columnsAdressTwo = {"<i>" + identity.getAddress2() + "</i>"};
- balanceReport += constructColumnsHtml(columnsAdressTwo);
+ balanceReport += constructColumnsHtml(columnsAdressTwo, "");
balanceReport += "<tr>\n";
String [] columnsZipCode = {"<i>" + identity.getZipCode() + "</i>"};
- balanceReport += constructColumnsHtml(columnsZipCode);
+ balanceReport += constructColumnsHtml(columnsZipCode, "");
balanceReport += "<tr>\n";
String [] columnsCity = {"<i>" + identity.getCity()+ "</i>"};
- balanceReport += constructColumnsHtml(columnsCity);
+ balanceReport += constructColumnsHtml(columnsCity, "");
balanceReport += "</table>\n" +
"</td>" +
@@ -860,38 +690,39 @@
balanceReport += "<tr>\n";
String [] columnsBusinessNumber = {boldItalicBegin + _("lima-business.document.businessnumber") +
boldItalicEnd, "<i>" + identity.getBusinessNumber()+ "</i>"};
- balanceReport += constructColumnsHtml(columnsBusinessNumber);
+ balanceReport += constructColumnsHtml(columnsBusinessNumber, "");
balanceReport += "<tr>\n";
String [] columnsClassifCode = {boldItalicBegin + _("lima-business.document.classificationcode") +
boldItalicEnd, "<i>" + identity.getClassificationCode()+ "</i>"};
- balanceReport += constructColumnsHtml(columnsClassifCode);
+ balanceReport += constructColumnsHtml(columnsClassifCode, "");
balanceReport += "<tr>\n";
String [] columnsVatNumber = {boldItalicBegin + _("lima-business.document.vatnumber") + boldItalicEnd,
"<i>" + identity.getVatNumber()+ "</i>", };
- balanceReport += constructColumnsHtml(columnsVatNumber);
+ balanceReport += constructColumnsHtml(columnsVatNumber, "");
balanceReport += "<tr>\n";
String [] columnsPeriodOne = {boldItalicBegin + _("lima-business.document.period1") + boldItalicEnd, "<i>"
+ _("lima-business.document.period1format", beginDate)+ "</i>"};
- balanceReport += constructColumnsHtml(columnsPeriodOne);
+ balanceReport += constructColumnsHtml(columnsPeriodOne, "");
balanceReport += "<tr>\n";
String [] columnsPeriodTwo = {boldItalicBegin + _("lima-business.document.period2") + boldItalicEnd, "<i>"
+ _("lima-business.document.period2format", endDate)+ "</i>"};
- balanceReport += constructColumnsHtml(columnsPeriodTwo);
+ balanceReport += constructColumnsHtml(columnsPeriodTwo, "");
balanceReport += "</table>" +
"</td>" +
- "</table>" +
- "<table border=\"1\" width=\"100%\" cellpadding=\"3\" cellspacing=\"0\">\n" +
+ "</table>"*/
+
+ balanceReport += "<table border=\"1\" width=\"100%\" cellpadding=\"3\" cellspacing=\"0\">\n" +
"<tr align=\"center\">\n";
String [] columnsNames = {_("lima-business.document.accountnumber"), _("lima-business.document.description"),
_("lima-business.document.movementdebit"), _("lima-business.document.movementcredit"),
_("lima-business.document.soldedebit"), _("lima-business.document.soldecredit")};
- balanceReport += constructColumnsHtml(columnsNames);
+ balanceReport += constructColumnsHtml(columnsNames, "");
if (n > max) {
String boldBegin = "<b>";
@@ -899,7 +730,7 @@
String [] columnsBalanceAmount = {"", boldBegin + _("lima-business.document.carryback") + boldEnd,
boldBegin + currentAmountDebit.toString() + boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentSoldeDebit.toString() + boldEnd,boldBegin + currentSoldeCredit.toString() + boldEnd};
- balanceReport += constructColumnsHtml(columnsBalanceAmount);
+ balanceReport += constructColumnsHtml(columnsBalanceAmount, "");
balanceReport += "</table>\n";
}
@@ -910,7 +741,7 @@
String [] columnsBalanceAmount = {reportsDatas.getAccount().getAccountNumber(), reportsDatas.getAccount().getLabel(),
reportsDatas.getAmountDebit().toString(), reportsDatas.getAmountCredit().toString(),
soldeDebit, soldeCredit};
- balanceReport += constructColumnsHtml(columnsBalanceAmount);
+ balanceReport += constructColumnsHtml(columnsBalanceAmount, "");
}
for (ReportsDatas reportsDatas : subList) {
@@ -929,7 +760,7 @@
String [] columnsBalanceAmount = {"", boldBegin + _("lima-business.document.carryforward") + boldEnd,
boldBegin + currentAmountDebit.toString() + boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentSoldeDebit.toString() + boldEnd,boldBegin + currentSoldeCredit.toString() + boldEnd};
- balanceReport += constructColumnsHtml(columnsBalanceAmount);
+ balanceReport += constructColumnsHtml(columnsBalanceAmount, "");
balanceReport += "</table>\n";
}
@@ -940,7 +771,7 @@
String [] columnsBalanceAmount = {"", boldBegin + _("lima-business.document.amounts") + boldEnd,
boldBegin + currentAmountDebit.toString() + boldEnd, boldBegin + currentAmountCredit.toString() + boldEnd,
boldBegin + currentSoldeDebit.toString() + boldEnd,boldBegin + currentSoldeCredit.toString() + boldEnd};
- balanceReport += constructColumnsHtml(columnsBalanceAmount);
+ balanceReport += constructColumnsHtml(columnsBalanceAmount, "");
balanceReport += "</table>\n";
}
i = i + max;
@@ -1055,7 +886,7 @@
_("lima-business.document.date"), _("lima-business.document.debit"),
_("lima-business.document.credit")};
- entryBookReport += constructColumnsHtml(columnNames);
+ entryBookReport += constructColumnsHtml(columnNames, "");
String entryBookCode = "";
for (GeneralEntryBooksDatas generalEntryBooksDataInList : list) {
@@ -1075,7 +906,7 @@
_("lima-business.document.monthformat", generalEntryBooksDataInList.getPeriod()),
generalEntryBooksDataInList.getDebit().toString(),
generalEntryBooksDataInList.getCredit().toString()};
- entryBookReport += constructColumnsHtml(columnData);
+ entryBookReport += constructColumnsHtml(columnData, "");
} else {
String amount;
if (generalEntryBooksDataInList.getAmount()) {
@@ -1086,7 +917,7 @@
String[] columnDataTotal = {"", "", "<b>"+ (StringUtils.isBlank(amount)?"":amount) + "</b>",
generalEntryBooksDataInList.getDebit().toString(),
generalEntryBooksDataInList.getCredit().toString()};
- entryBookReport += constructColumnsHtml(columnDataTotal);
+ entryBookReport += constructColumnsHtml(columnDataTotal, "");
}
}
}
@@ -1200,7 +1031,7 @@
"<table border=\"1\" width=\"100%\" cellpadding=\"3\" cellspacing=\"0\">\n" +
"<tr align=\"center\">\n";
- accountReport += constructColumnsHtml(columnNames);
+ accountReport += constructColumnsHtml(columnNames, "");
for(Entry entry : entries) {
@@ -1221,7 +1052,7 @@
(entry.getDebit() ? entry.getAmount() : BigDecimal.ZERO).toString(),
(entry.getDebit() ? BigDecimal.ZERO : entry.getAmount()).toString()};
- accountReport += constructColumnsHtml(columnData);
+ accountReport += constructColumnsHtml(columnData, "");
}
accountReport += "</table>\n" +
@@ -1270,16 +1101,92 @@
return subTitle;
}
- protected String constructColumnsHtml(String[] columnsNames) {
+ protected String constructColumnsHtml(String[] columnsNames, String fontColor) {
String columns = "";
for (String name : columnsNames) {
- columns += "<td>" + name + "</td>\n";
+ columns += "<td style=\"background-color:"+fontColor+";\">" + name + "</td>\n";
}
columns += "<tr>\n";
+
return columns;
}
+ protected String constructHeaderTitle(String title, Date beginDate, Date endDate) {
+ String headerTitle = "";
+ Identity identity = identityService.getIdentity();
+
+ headerTitle += "<table>" +
+ "<tr> " +
+ "<td>" +
+ "<table align=\"left\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n" +
+ "<tr>\n";
+
+ String boldItalicBegin = "<b>" + "<i>";
+ String boldItalicEnd = "</i>" + "</b>";
+
+ String [] columnsNameSociety = {boldItalicBegin + identity.getName()+ boldItalicEnd};
+ headerTitle += constructColumnsHtml(columnsNameSociety, "");
+
+ headerTitle += "<tr>\n";
+ String [] columnsDescription = {"<i>" + identity.getDescription()+ "</i>"};
+ headerTitle += constructColumnsHtml(columnsDescription, "");
+
+ headerTitle += "<tr>\n";
+ String [] columnsAdressOne = {"<i>" + identity.getAddress() + "</i>"};
+ headerTitle += constructColumnsHtml(columnsAdressOne, "");
+ headerTitle += "<tr>\n";
+ String [] columnsAdressTwo = {"<i>" + identity.getAddress2() + "</i>"};
+ headerTitle += constructColumnsHtml(columnsAdressTwo, "");
+
+ headerTitle += "<tr>\n";
+ String [] columnsZipCode = {"<i>" + identity.getZipCode() + "</i>"};
+ headerTitle += constructColumnsHtml(columnsZipCode, "");
+
+ headerTitle += "<tr>\n";
+ String [] columnsCity = {"<i>" + identity.getCity()+ "</i>"};
+ headerTitle += constructColumnsHtml(columnsCity, "");
+
+ headerTitle += "</table>\n" +
+ "</td>" +
+ "<td valign=\"middle\" align=\"center\" style=\"width:100%\">" +
+ "<p style=\"font-size:30px;\">" + title + "</p>" +
+ "</td>" +
+ "<td>" +
+ "<table align=\"right\" border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"font-size:13px;\" >\n";
+
+ headerTitle += "<tr>\n";
+ String [] columnsBusinessNumber = {boldItalicBegin + _("lima-business.document.businessnumber") +
+ boldItalicEnd, "<i>" + identity.getBusinessNumber()+ "</i>"};
+ headerTitle += constructColumnsHtml(columnsBusinessNumber, "");
+
+ headerTitle += "<tr>\n";
+ String [] columnsClassifCode = {boldItalicBegin + _("lima-business.document.classificationcode") +
+ boldItalicEnd, "<i>" + identity.getClassificationCode()+ "</i>"};
+ headerTitle += constructColumnsHtml(columnsClassifCode, "");
+
+ headerTitle += "<tr>\n";
+ String [] columnsVatNumber = {boldItalicBegin + _("lima-business.document.vatnumber") + boldItalicEnd,
+ "<i>" + identity.getVatNumber()+ "</i>", };
+ headerTitle += constructColumnsHtml(columnsVatNumber, "");
+
+ headerTitle += "<tr>\n";
+ String [] columnsPeriodOne = {boldItalicBegin + _("lima-business.document.period1") + boldItalicEnd, "<i>"
+ + _("lima-business.document.period1format", beginDate)+ "</i>"};
+ headerTitle += constructColumnsHtml(columnsPeriodOne, "");
+
+ headerTitle += "<tr>\n";
+ String [] columnsPeriodTwo = {boldItalicBegin + _("lima-business.document.period2") + boldItalicEnd, "<i>"
+ + _("lima-business.document.period2format", endDate)+ "</i>"};
+ headerTitle += constructColumnsHtml(columnsPeriodTwo, "");
+
+ headerTitle += "</table>" +
+ "</td>" +
+ "</table>";
+
+ return headerTitle;
+ }
+
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2012-08-21 14:16:49 UTC (rev 3626)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2012-08-22 10:06:55 UTC (rev 3627)
@@ -164,7 +164,7 @@
String generalEntryBooksReport = null;
String balanceReport = null;
String ledgerReport = null;
- //String financialReport = null;
+ String financialReport = null;
//create docs
try {
@@ -195,8 +195,8 @@
}
break;
case FINANCIALSTATEMENT:
- documentService.createFinancialStatementsDocuments(
- beginDateFormat, endDateFormat, formatsEnum);
+ financialReport = documentService.createFinancialStatementsDocuments(
+ beginDateFormat, endDateFormat);
break;
case LEDGER:
ledgerReport = documentService.createLedgerDocuments(
@@ -226,7 +226,7 @@
resp.setContentType(formatsEnum.getMimeType());
OutputStream out = resp.getOutputStream();
if (accountReport != null || entryBooksReport != null || generalEntryBooksReport != null
- || balanceReport != null || ledgerReport != null /*|| financialReport != null*/) {
+ || balanceReport != null || ledgerReport != null || financialReport != null) {
String report = null;
if (accountReport != null) {
report = accountReport;
@@ -238,9 +238,9 @@
report = balanceReport;
} else if (ledgerReport != null) {
report = ledgerReport;
- } /*else {
+ } else {
report = financialReport;
- }*/
+ }
IOUtils.write(report, out, Charsets.UTF_8);
} else {
InputStream in = doc.openStream();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2012-08-21 14:16:49 UTC (rev 3626)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2012-08-22 10:06:55 UTC (rev 3627)
@@ -87,7 +87,13 @@
BigDecimal debit = new BigDecimal(0);
BigDecimal solde = new BigDecimal(0);
List<Entry> entries = new ArrayList<Entry>();
-
+
+ reportsDatas = generateSubAccountReports(account,
+ beginDate, endDate);
+ debit = debit.add(reportsDatas.getAmountDebit());
+ credit = credit.add(reportsDatas.getAmountCredit());
+ entries.addAll(reportsDatas.getListEntry());
+
//Get allsubaccounts and thirdParts accounts
List<Account> accounts = accountService.getAllSubAccounts(account);
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-08-21 14:16:49 UTC (rev 3626)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2012-08-22 10:06:55 UTC (rev 3627)
@@ -21,6 +21,7 @@
lima-business.document.accountnumber=Account N°
lima-business.document.adress=
lima-business.document.adresssuite=
+lima-business.document.amount=
lima-business.document.amounts=Amounts
lima-business.document.amountsperiod=Amounts %1$tB %1$tY
lima-business.document.balance=Balance
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-08-21 14:16:49 UTC (rev 3626)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2012-08-22 10:06:55 UTC (rev 3627)
@@ -21,12 +21,14 @@
lima-business.document.accountnumber=N° Compte
lima-business.document.adress=Adresse
lima-business.document.adresssuite=Adresse - suite
+lima-business.document.amount=Total
lima-business.document.amounts=Totaux
lima-business.document.amountsperiod=Totaux %1$tB %1$tY
lima-business.document.balance=Balance
lima-business.document.businessnumber=N° Siret
lima-business.document.carryback=Report
lima-business.document.carryforward=À reporter
+lima-business.document.charge=Charge
lima-business.document.city=Ville
lima-business.document.classificationcode=NAF
lima-business.document.createdate=Date de tirage %1$te/%1$tm/%1$tY à %1$tH\:%1$tM
@@ -54,10 +56,9 @@
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.product=Produit
lima-business.document.provisiondeprecationamount=Amortissements et provisions
lima-business.document.society=Nom
-lima-business.document.product=Produit
-lima-business.document.charge=Charge
lima-business.document.solde=Solde
lima-business.document.soldecredit=Solde Créditeur
lima-business.document.soldedebit=Solde Débiteur
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java 2012-08-21 14:16:49 UTC (rev 3626)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java 2012-08-22 10:06:55 UTC (rev 3627)
@@ -38,7 +38,7 @@
public interface DocumentService {
- void createFinancialStatementsDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException;
+ String createFinancialStatementsDocuments(Date beginDate, Date endDate) throws LimaException;
String createLedgerDocuments(Date beginDate, Date endDate) throws LimaException;
1
0
Author: mallon
Date: 2012-08-21 16:16:49 +0200 (Tue, 21 Aug 2012)
New Revision: 3626
Url: http://chorem.org/repositories/revision/lima/3626
Log:
refs #769 Correction Bilan et resultat
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java
trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.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-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -27,12 +27,18 @@
import com.lowagie.text.BadElementException;
import com.lowagie.text.Cell;
+import com.lowagie.text.Chapter;
+import com.lowagie.text.Document;
+import com.lowagie.text.DocumentException;
import com.lowagie.text.Element;
import com.lowagie.text.Font;
+import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.Rectangle;
import com.lowagie.text.Table;
+import com.lowagie.text.html.HtmlWriter;
+import com.lowagie.text.pdf.PdfWriter;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -75,6 +81,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
@@ -227,122 +234,226 @@
}
@Override
- public String createFinancialStatementsDocuments(Date beginDate,
- Date endDate) throws LimaException {
- String financialStatementReport = null;
+ public void createFinancialStatementsDocuments(Date beginDate,
+ Date endDate,
+ FormatsEnum format) throws LimaException {
+ Document document = new Document(PageSize.A4, 8, 8, 8, 8);
+ List<FinancialStatementAmounts> financialStatementAmounts =
+ financialStatementService.financialStatementReport(beginDate, endDate);
+
+ Date newDate = new Date();
+ String filePath = path + File.separator + DocumentsEnum.FINANCIALSTATEMENT.getFileName();
+
try {
+ FileOutputStream fileOut = new FileOutputStream(filePath + format.getExtension());
- financialStatementReport = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n" +
- "<html>\n";
- financialStatementReport += constructHeadHtml(_("lima.reports.financialstatement"));
- financialStatementReport += "<body>\n";
+ switch (format) {
+ case HTML:
+ HtmlWriter htmlWriter = HtmlWriter.getInstance(document, fileOut);
+ break;
+ case PDF:
+ PdfWriter pdfWriter = PdfWriter.getInstance(document, fileOut);
+ break;
+ }
+ document.open();
+ int nbpages = 1;
- if (beginDate != null && endDate != null) {
+ Identity identity = identityService.getIdentity();
- List<FinancialStatementAmounts> financialStatementAmounts =
- financialStatementService.financialStatementReport(beginDate, endDate);
- //Split list by financialstatement type
- List<List<FinancialStatementAmounts>> listList =
- new ArrayList<List<FinancialStatementAmounts>>();
- Boolean first = true;
- int min = 0;
- int size = financialStatementAmounts.size();
- for (int i = 0; i < size; i++) {
- FinancialStatementAmounts fStatementAmounts =
- financialStatementAmounts.get(i);
- if (fStatementAmounts.getLevel() == 1 && !fStatementAmounts.getSubAmount()) {
- if (first) {
- first = false;
- } else {
- listList.add(financialStatementAmounts.subList(min, i - 1));
- }
- min = i;
+ //Split list by financialstatement type
+ List<List<FinancialStatementAmounts>> listList =
+ new ArrayList<List<FinancialStatementAmounts>>();
+ Boolean first = true;
+ int min = 0;
+ int size = financialStatementAmounts.size();
+ for (int i = 0; i < size; i++) {
+ FinancialStatementAmounts fStatementAmounts =
+ financialStatementAmounts.get(i);
+ if (fStatementAmounts.getLevel() == 1 && !fStatementAmounts.getSubAmount()) {
+ if (first) {
+ first = false;
+ } else {
+ listList.add(financialStatementAmounts.subList(min, i - 1));
}
+ min = i;
}
- listList.add(financialStatementAmounts.subList(min, size));
+ }
+ listList.add(financialStatementAmounts.subList(min, size));
- String boldBegin = "<b>";
- String boldEnd = "</b>";
- //create pages
- for (List<FinancialStatementAmounts> list : listList) {
- String subTitle = list.get(0).getLabel();
- financialStatementReport += constructSubTitleHtml(boldBegin + subTitle + boldEnd, "");
- int i = 0;
- int n = list.size();
- int max = n;
- while (i < n) {
- int j = i + max;
- if (j > n) {
- j = n;
- }
+ //create pages
+ for (List<FinancialStatementAmounts> list : listList) {
+ String title = list.get(0).getLabel();
+ int i = 0;
+ int n = list.size();
+ int max = n;
+ // alloc nb rows max for pdf documents on one page
+ if (format == FormatsEnum.PDF) {
+ max = 35;
+ }
+ while (i < n) {
+ int j = i + max;
+ if (j > n) {
+ j = n;
+ }
+ List<FinancialStatementAmounts> subFinancialStatementAmounts =
+ list.subList(i, j);
+ //create page : header + table + footer
+ Table headerTable = createFinancialStatementsHeaderTable();
+ Table table = createFinancialStatementsTable(
+ subFinancialStatementAmounts);
+ //new page
+ Chapter chapter = new Chapter(0);
+ //headerPage
+ chapter.add(createHeaderPage(title, identity, beginDate, endDate));
+ //n° page
+ chapter.add(createNumberPage(nbpages, newDate));
+ //headerTable
+ Paragraph paragraphHeaderTable = new Paragraph();
+ paragraphHeaderTable.add(headerTable);
+ chapter.add(paragraphHeaderTable);
+ //table
+ Paragraph paragraphTable = new Paragraph();
+ paragraphTable.add(table);
+ chapter.add(paragraphTable);
+ //add page
+ document.add(chapter);
+ i = i + max;
+ nbpages++;
+ }
+ }
- financialStatementReport += "<table border=\"1\" width=\"100%\" cellpadding=\"3\" cellspacing=\"0\">\n" +
- "<tr align=\"center\">\n";
+ document.close();
- String columnNames [] = {_("lima-business.document.label"), _("lima-business.document.grossamount"),
- _("lima-business.document.provisiondeprecationamount"), _("lima-business.document.netamount")};
- financialStatementReport += constructColumnsHtml(columnNames);
+ } catch (FileNotFoundException eeFNFE) {
+ log.error("Can't create pdf file", eeFNFE);
+ } catch (DocumentException eeDE) {
+ log.error("Can't create document", eeDE);
+ }
+ }
- String tabLabel = "";
- String bigAmountString = "0";
- String provisionDeprecationAmountString = "0";
- String soldeString = "0";
- List<FinancialStatementAmounts> subFinancialStatementAmounts = list.subList(i, j);
- for (FinancialStatementAmounts financialStatementAmount : subFinancialStatementAmounts) {
+ protected Table createFinancialStatementsHeaderTable() {
+ Table t = null;
+ try {
+ t = new Table(4, 1);
+ float[] widths = {0.4f, 0.2f, 0.2f, 0.2f};
+ t.setWidths(widths);
+ t.setWidth(100f);
+ t.setPadding(3f);
+ //defaut cell
+ Cell cell = new Cell();
+ cell.setBorder(Rectangle.LEFT);
+ cell.setHorizontalAlignment(Element.ALIGN_CENTER);
+ t.setDefaultCell(cell);
+ t.setOffset(8);
+ t.addCell(new Phrase(_("lima-business.document.label"),
+ boldFont));
+ t.addCell(new Phrase(_("lima-business.document.grossamount"),
+ boldFont));
+ t.addCell(new Phrase(_("lima-business.document.provisiondeprecationamount"),
+ boldFont));
+ t.addCell(new Phrase(_("lima-business.document.netamount"),
+ boldFont));
- String label = financialStatementAmount.getLabel();
- int level = financialStatementAmount.getLevel();
- BigDecimal bigAmount =
- financialStatementAmount.getGrossAmount();
- if (bigAmount == null) {
- bigAmount = new BigDecimal(0);
- }
- BigDecimal provisionDeprecationAmount =
- financialStatementAmount.getProvisionDeprecationAmount();
- if (provisionDeprecationAmount == null) {
- provisionDeprecationAmount = new BigDecimal(0);
- }
+ } catch (BadElementException eeBEE) {
+ log.error("Can't create table", eeBEE);
+ }
+ return t;
- StringBuffer tab = new StringBuffer();
- for (int k = 0; k < level; k++) {
- tab.append("\t");
- }
+ }
- if (financialStatementAmount.getHeader()) {
- tabLabel = boldBegin + tab + label + boldEnd;
- } else {
- tabLabel = tab + label;
- }
- if (bigAmount != BigDecimal.ZERO) {
- bigAmountString = bigAmount.toString();
- }
- if (provisionDeprecationAmount != BigDecimal.ZERO) {
- provisionDeprecationAmountString = provisionDeprecationAmount.toString();
- }
- BigDecimal solde = bigAmount;
- solde = solde.subtract(provisionDeprecationAmount);
- if (solde != BigDecimal.ZERO) {
- soldeString = solde.toString();
- }
- }
+ protected Table createFinancialStatementsTable(List<FinancialStatementAmounts> financialStatementAmounts) {
+ int nbrow = financialStatementAmounts.size();
+ Table t = null;
+ try {
+ //define table
+ t = new Table(4, nbrow);
+ t.setWidth(100f);
+ float[] widths = {0.4f, 0.2f, 0.2f, 0.2f};
+ t.setWidths(widths);
+ t.setPadding(1.5f);
+ t.setBorderWidth(1);
+ t.setOffset(0);
+ //define default cell
+ Cell cell = new Cell();
+ cell.setBorder(Rectangle.LEFT);
+ cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
+ t.setDefaultCell(cell);
- String columnData [] = {(StringUtils.isBlank(tabLabel)?"": tabLabel), bigAmountString,
- provisionDeprecationAmountString, soldeString};
- financialStatementReport += constructColumnsHtml(columnData);
- i = i + max;
- financialStatementReport += "</table>" +
- "<p>";
+ for (FinancialStatementAmounts financialStatementAmount : financialStatementAmounts) {
+
+ String label = financialStatementAmount.getLabel();
+ int level = financialStatementAmount.getLevel();
+ BigDecimal grossAmount =
+ financialStatementAmount.getGrossAmount();
+ if (grossAmount == null) {
+ grossAmount = new BigDecimal(0);
+ }
+ BigDecimal provisionDeprecationAmount =
+ financialStatementAmount.getProvisionDeprecationAmount();
+ if (provisionDeprecationAmount == null) {
+ provisionDeprecationAmount = new BigDecimal(0);
+ }
+
+ if (financialStatementAmount.getSubAmount() && level == 1) {
+ cell.setGrayFill(0.88f);
+ } else if (financialStatementAmount.getSubAmount()) {
+ cell.setGrayFill(0.94f);
+ } else {
+ cell.setGrayFill(1f);
+ }
+ if (label == null) {
+ t.addCell("");
+ t.addCell("");
+ t.addCell("");
+ t.addCell("");
+ } else {
+ //cell1
+ StringBuffer tab = new StringBuffer();
+ for (int i = 0; i < level; i++) {
+ tab.append("\t");
}
+ Phrase phrase;
+ if (financialStatementAmount.getHeader()) {
+ phrase = new Phrase(tab + label, boldFont);
+ } else {
+ phrase = new Phrase(tab + label, normalFont);
+ }
+ Cell c = new Cell(phrase);
+ c.setHorizontalAlignment(Element.ALIGN_LEFT);
+ t.addCell(c);
+ //cell2
+ if (grossAmount != BigDecimal.ZERO) {
+ phrase = new Phrase(String.valueOf(
+ grossAmount), normalFont);
+ } else {
+ phrase = new Phrase("");
+ }
+ t.addCell(phrase);
+ //cell 3
+ if (provisionDeprecationAmount != BigDecimal.ZERO) {
+ phrase = new Phrase(String.valueOf(
+ provisionDeprecationAmount), normalFont);
+ } else {
+ phrase = new Phrase("");
+ }
+ t.addCell(phrase);
+ //cell 4
+ BigDecimal solde = grossAmount;
+ solde = solde.subtract(provisionDeprecationAmount);
+ if (solde != BigDecimal.ZERO) {
+ phrase = new Phrase(solde.toString(), normalFont);
+ } else {
+ phrase = new Phrase("");
+ }
+ t.addCell(phrase);
}
}
- financialStatementReport += "</body>" +
- "</html>";
- } catch (Exception ex) {
- log.error("Can't create document", ex);
+ } catch (BadElementException eeBEE) {
+ log.error("Can't create table", eeBEE);
}
- return financialStatementReport;
+ return t;
}
//############## Ledger ##############
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2012-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -223,13 +223,12 @@
Date selectedEndDate,
FinancialStatementDatas result) throws LimaException {
- List<FinancialStatement> financialStatements =
- getChildrenFinancialStatement(financialStatement);
+ List<FinancialStatement> financialStatements = getChildrenFinancialStatement(financialStatement);
BigDecimal grossAmount = new BigDecimal(0),
- provisionDeprecationAmount = new BigDecimal(0);
- List<FinancialStatementAmounts> subResult =
- new ArrayList<FinancialStatementAmounts>();
+ provisionDeprecationAmount = new BigDecimal(0);
+ List<FinancialStatementAmounts> subResult = new ArrayList<FinancialStatementAmounts>();
+
for (FinancialStatement subFinancialStatement : financialStatements) {
FinancialStatementAmounts financialStatementAmounts =
financialStatementAmounts(subFinancialStatement,
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2012-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -164,7 +164,7 @@
String generalEntryBooksReport = null;
String balanceReport = null;
String ledgerReport = null;
- String financialReport = null;
+ //String financialReport = null;
//create docs
try {
@@ -195,8 +195,8 @@
}
break;
case FINANCIALSTATEMENT:
- financialReport = documentService.createFinancialStatementsDocuments(
- beginDateFormat, endDateFormat);
+ documentService.createFinancialStatementsDocuments(
+ beginDateFormat, endDateFormat, formatsEnum);
break;
case LEDGER:
ledgerReport = documentService.createLedgerDocuments(
@@ -226,7 +226,7 @@
resp.setContentType(formatsEnum.getMimeType());
OutputStream out = resp.getOutputStream();
if (accountReport != null || entryBooksReport != null || generalEntryBooksReport != null
- || balanceReport != null || ledgerReport != null || financialReport != null) {
+ || balanceReport != null || ledgerReport != null /*|| financialReport != null*/) {
String report = null;
if (accountReport != null) {
report = accountReport;
@@ -238,9 +238,9 @@
report = balanceReport;
} else if (ledgerReport != null) {
report = ledgerReport;
- } else {
+ } /*else {
report = financialReport;
- }
+ }*/
IOUtils.write(report, out, Charsets.UTF_8);
} else {
InputStream in = doc.openStream();
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-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2012-08-21 14:16:49 UTC (rev 3626)
@@ -56,6 +56,8 @@
lima-business.document.period2format=%1$te/%1$tm/%1$tY
lima-business.document.provisiondeprecationamount=Amortissements et provisions
lima-business.document.society=Nom
+lima-business.document.product=Produit
+lima-business.document.charge=Charge
lima-business.document.solde=Solde
lima-business.document.soldecredit=Solde Créditeur
lima-business.document.soldedebit=Solde Débiteur
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java 2012-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/DocumentService.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -38,7 +38,7 @@
public interface DocumentService {
- String createFinancialStatementsDocuments(Date beginDate, Date endDate) throws LimaException;
+ void createFinancialStatementsDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException;
String createLedgerDocuments(Date beginDate, Date endDate) throws LimaException;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2012-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsViewHandler.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -81,7 +81,7 @@
// init data models
List<Account> account = accountService.getAllAccounts();
view.getAccountComboboxModel().setObjects(account);
- List<FiscalPeriod> fiscalPeriod = fiscalPeriodService.getAllUnblockedFiscalPeriods();
+ List<FiscalPeriod> fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods();
List<FinancialPeriod> financialPeriod = financialPeriodService.getUnblockedFinancialPeriods();
view.getIntervalPanel().init(fiscalPeriod, financialPeriod);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceReportsViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceReportsViewHandler.java 2012-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceReportsViewHandler.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -79,7 +79,7 @@
public void init() {
// init data models
- List<FiscalPeriod> fiscalPeriod = fiscalPeriodService.getAllBlockedFiscalPeriods();
+ List<FiscalPeriod> fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods();
List<FinancialPeriod> financialPeriod = financialPeriodService.getUnblockedFinancialPeriods();
view.getIntervalPanel().init(fiscalPeriod, financialPeriod);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -129,7 +129,7 @@
}
/**
- * Round the value to higher, and the number of decimal to 2;
+ * Split decimal with scale config
* @return bigDecimal value
* */
@Override
@@ -144,10 +144,15 @@
int pointIndex = stringValue.indexOf(".");
if (pointIndex != -1) {
LimaConfig config = LimaContext.getContext().getConfig();
- int decimal = config.getScale() + pointIndex + 1;
- String roundedStringValue = stringValue.substring(0, pointIndex) +
- stringValue.substring(pointIndex, decimal);
- cellEditorValue = new BigDecimal(roundedStringValue);
+ String actualDecimals = stringValue.substring(pointIndex, stringValue.length()-1);
+ if (config.getScale() > actualDecimals.length()) {
+ cellEditorValue = new BigDecimal(stringValue);
+ } else {
+ int decimalLength = config.getScale() + pointIndex + 1;
+ String roundedStringValue = stringValue.substring(0, pointIndex) +
+ stringValue.substring(pointIndex, decimalLength);
+ cellEditorValue = new BigDecimal(roundedStringValue);
+ }
} else {
cellEditorValue = new BigDecimal(stringValue);
}
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-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsViewHandler.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -84,7 +84,7 @@
* Init data models and displayed objects.
*/
public void init() {
- List<FiscalPeriod> blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
+ List<FiscalPeriod> blockedFiscalPeriods = fiscalPeriodService.getAllFiscalPeriods();
List<FinancialPeriod> financialPeriod = financialPeriodService.getUnblockedFinancialPeriods();
view.getIntervalPanel().init(blockedFiscalPeriods, financialPeriod);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx 2012-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx 2012-08-21 14:16:49 UTC (rev 3626)
@@ -39,13 +39,12 @@
]]>
</script>
- <row weightx="1" weighty="0" anchor="center">
- <cell fill='both'>
+ <row>
+ <cell>
<IntervalPanel id="intervalPanel"/>
</cell>
<cell>
- <JButton text="lima.common.ok"
- onActionPerformed="getHandler().createDocument()"/>
+ <JButton text="lima.common.ok" onActionPerformed="getHandler().createDocument()"/>
</cell>
</row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2012-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -82,7 +82,7 @@
public void init() {
// init data models
- List<FiscalPeriod> fiscalPeriod = fiscalPeriodService.getAllBlockedFiscalPeriods();
+ List<FiscalPeriod> fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods();
List<FinancialPeriod> financialPeriod = financialPeriodService.getUnblockedFinancialPeriods();
view.getIntervalPanel().init(fiscalPeriod, financialPeriod);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2012-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerViewHandler.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -94,7 +94,7 @@
public void init() {
// init data models
- List<FiscalPeriod> fiscalPeriod = fiscalPeriodService.getAllUnblockedFiscalPeriods();
+ List<FiscalPeriod> fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods();
List<FinancialPeriod> financialPeriod = financialPeriodService.getUnblockedFinancialPeriods();
view.getIntervalPanel().init(fiscalPeriod, financialPeriod);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2012-08-21 13:25:54 UTC (rev 3625)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2012-08-21 14:16:49 UTC (rev 3626)
@@ -70,7 +70,7 @@
* Init data models and displayed objects.
*/
public void init() {
- List<FiscalPeriod> blockedFiscalPeriods = fiscalPeriodService.getAllBlockedFiscalPeriods();
+ List<FiscalPeriod> blockedFiscalPeriods = fiscalPeriodService.getAllFiscalPeriods();
List<FinancialPeriod> financialPeriod = financialPeriodService.getUnblockedFinancialPeriods();
view.getIntervalPanel().init(blockedFiscalPeriods, financialPeriod);
}
1
0
r3625 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport
by echatellier@users.chorem.org 21 Aug '12
by echatellier@users.chorem.org 21 Aug '12
21 Aug '12
Author: echatellier
Date: 2012-08-21 15:25:54 +0200 (Tue, 21 Aug 2012)
New Revision: 3625
Url: http://chorem.org/repositories/revision/lima/3625
Log:
deprecate econding attribute (must be properly handled)
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-08-21 10:08:39 UTC (rev 3624)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2012-08-21 13:25:54 UTC (rev 3625)
@@ -75,6 +75,9 @@
/** Parent view. */
protected Component viewComponent;
+ /**
+ * @deprecated etat de la classe, non multi thread, gerer ca différement.
+ */
protected EncodingEnum encodingEnum;
protected ImportService importService;
1
0
r3624 - in trunk/lima-swing/src/main/java/org/chorem/lima/ui: financialtransactionsearch lettering
by mallon@users.chorem.org 21 Aug '12
by mallon@users.chorem.org 21 Aug '12
21 Aug '12
Author: mallon
Date: 2012-08-21 12:08:39 +0200 (Tue, 21 Aug 2012)
New Revision: 3624
Url: http://chorem.org/repositories/revision/lima/3624
Log:
fixes #771 Ajout de l autocompletion dans la liste deroulante des lettres.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2012-08-20 15:52:18 UTC (rev 3623)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchTable.java 2012-08-21 10:08:39 UTC (rev 3624)
@@ -73,7 +73,6 @@
addKeyListener(this);
addMouseListener(this);
- setEnabled(false);
//Get new date editor
setDefaultEditor(Date.class, new DateTableCellEditor());
@@ -96,8 +95,12 @@
addColorTransaction();
// highlight unbalanced financial transactions
addColorNonBalancedTransaction();
- }
+ /*TODO : 'setEnabled' a supprimer, lors de la refonte du système de
+ * recherche et de saisie*/
+ setEnabled(false);
+ }
+
/**
* Cette méthode permet de colorer toutes les transactions dans le tableau
* afin de bien distinguer les transactions et entrées comptables.
@@ -208,105 +211,6 @@
clearSelection();
}
}
-
-
- //FIXME 2011.06.11
- //Needs fixing
- //Exception in thread "AWT-EventQueue-0"
- //java.lang.IndexOutOfBoundsException:
- //valid viewIndex: 0 <= index < 42 but was: 42
- /**
- * Touche tab
- * Incrémente le curseur de case tant que la case n'est pas editable
- * Ajoute une entrée comptable si tab est sur
- * la dernière cellule et si la transaction est non équilibré
- * sinon rajoute une transaction
- */
-
- /*if (e.getKeyChar() == KeyEvent.VK_TAB) {
- int max_x = this.getColumnCount();
- int max_y = this.getRowCount();
- x_tab = this.getSelectedColumn();
- y_tab = this.getSelectedRow();
- Boolean end = true;
-
- if (x_tab < max_x - 1){
- x_tab++;
- }
- //end of row
- else {
- x_tab=0;
- y_tab++;
- }
-
- //skip all cell while not editable or if end of table add entry or transaction or end of table
- while (!isCellEditable(y_tab, x_tab) && end ){
- //if end of row
- if (x_tab == max_x-1) {
- Object object = this.handler.tableModel.getElementAt(y_tab);
-
- //if transaction, add entry
- if (object instanceof FinancialTransaction){
- FinancialTransaction financialTransaction = (FinancialTransaction) object;
- if (financialTransaction.getEntry().size() == 0){
- handler.addEntry();
- this.setColumnSelectionInterval(1, 1);
- }
- }
- //if entry
- else {
- //FIXME set value is doing after key pressed
- // so update not terminated before get balanced
- //Swing Worker stop the UI 500ms
- // found best solution ?
- final JXTable table = this;
- final int y_t = y_tab;
- final int m_t = max_y;
- new SwingWorker<Void,Void>() {
- @Override protected Void doInBackground() throws InterruptedException {
- Thread.sleep(500);
- return null;
- }
- @Override protected void done() {
- Object object = handler.tableModel.getElementAt(y_tab-1);
- FinancialTransaction financialTransaction = null;
- if (object instanceof Entry){
- financialTransaction = ((Entry) object).getFinancialTransaction();
- }
- else if (object instanceof FinancialTransaction){
- financialTransaction = (FinancialTransaction) object;
- }
- BigDecimal amountC = financialTransaction.getAmountCredit();
- BigDecimal amountD = financialTransaction.getAmountDebit();
- if (amountC == amountD){
- if (y_t == m_t-1){
- handler.addFinancialTransaction();
- table.setColumnSelectionInterval(0, 0);
- }
- }
- else {
- handler.addEntry();
- table.setColumnSelectionInterval(1, 1);
- y_tab++;
- // positionne la sélection sur la nouvelle ligne créée
- table.setRowSelectionInterval(y_tab, y_tab);
- x_tab=0;
- }
- }
- }.execute();
- }
- end = false;
- }
- else {
- if (x_tab < max_x){
- this.setRowSelectionInterval(y_tab, y_tab);
- this.setColumnSelectionInterval(x_tab, x_tab);
- x_tab++;
- }
- }
- }
- }*/
-
}
@Override
@@ -335,4 +239,5 @@
@Override
public void mouseExited(MouseEvent e) {
}
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2012-08-20 15:52:18 UTC (rev 3623)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/FinancialTransactionSearchViewHandler.java 2012-08-21 10:08:39 UTC (rev 3624)
@@ -310,6 +310,7 @@
if (tableModel != null) {
tableModel.refresh(financialTransactionSearch);
}
+
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2012-08-20 15:52:18 UTC (rev 3623)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionsearch/LetterSearchComboBox.java 2012-08-21 10:08:39 UTC (rev 3624)
@@ -1,8 +1,8 @@
package org.chorem.lima.ui.financialtransactionsearch;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.chorem.lima.ui.combobox.LetterComboBoxModel;
+import org.jdesktop.swingx.autocomplete.AutoCompleteDecorator;
+import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
import javax.swing.JComboBox;
import java.awt.event.ActionEvent;
@@ -26,6 +26,19 @@
LetterComboBoxModel letterComboBoxModel = new LetterComboBoxModel();
setModel(letterComboBoxModel);
setEditable(true);
+ ObjectToStringConverter objectToStringConverter = new ObjectToStringConverter() {
+ @Override
+ public String getPreferredStringForItem(Object item) {
+ String result = null;
+ if (item != null) {
+ if (item instanceof String) {
+ result = item.toString();
+ }
+ }
+ return result;
+ }
+ };
+ AutoCompleteDecorator.decorate(this, objectToStringConverter);
getEditor().getEditorComponent().addKeyListener(this);
addActionListener(this);
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-08-20 15:52:18 UTC (rev 3623)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-08-21 10:08:39 UTC (rev 3624)
@@ -9,15 +9,15 @@
* %%
* 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
+ * 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
+ *
+ * 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%
@@ -108,8 +108,12 @@
}
public void balanceAndActions() {
+ if (log.isDebugEnabled()) {
+ log.debug("balanceAndActions");
+ }
if (view.getTable().getSelectedRows().length == 0) {
onButtonModeChanged(buttonMode.ALL);
+ onBalanceChanged(null);
} else if (!letteringNotExist(view.getTable().getSelectedRow())) {
//lettred entries
@@ -232,9 +236,13 @@
BigDecimal debitVal = debit ? amount : BigDecimal.ZERO;
BigDecimal creditVal = debit ? BigDecimal.ZERO : amount;
+ if (log.isDebugEnabled()) {
+ log.debug("Balance calculation");
+ }
+
if (debitVal.equals(BigDecimal.ZERO)){
- if (creditVal.equals(BigDecimal.ZERO)){
+ if (!creditVal.equals(BigDecimal.ZERO)){
editModel.setCredit(creditVal);
editModel.setSolde(creditVal, true);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java 2012-08-20 15:52:18 UTC (rev 3623)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LettringSelectionModel.java 2012-08-21 10:08:39 UTC (rev 3624)
@@ -39,7 +39,6 @@
protected LetteringTableModel letteringTableModel;
protected Entry entry;
protected int lineSelected;
- protected boolean letteringEntrySelected;
protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
public LettringSelectionModel(LetteringTableModel letteringTableModel){
@@ -89,7 +88,6 @@
super.removeSelectionInterval(row, column);
}
- letteringEntrySelected = false;
}
}
1
0
r3623 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering
by mallon@users.chorem.org 20 Aug '12
by mallon@users.chorem.org 20 Aug '12
20 Aug '12
Author: mallon
Date: 2012-08-20 17:52:18 +0200 (Mon, 20 Aug 2012)
New Revision: 3623
Url: http://chorem.org/repositories/revision/lima/3623
Log:
Correction concernant l equilibrage du panneau de lettrage
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-08-20 15:40:24 UTC (rev 3622)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-08-20 15:52:18 UTC (rev 3623)
@@ -34,7 +34,6 @@
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.ejb.FinancialTransactionServiceImpl;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.FiscalPeriod;
@@ -49,7 +48,6 @@
import java.util.Date;
import java.util.List;
-import static org.nuiton.i18n.I18n._;
/**
* Handler associated with financial transaction view.
@@ -139,8 +137,8 @@
BigDecimal secondSelectedEntryAmount = secondSelectedEntry.getAmount();
if ( secondSelectedEntry.getDebit() != firstSelectedEntry.getDebit()
- && firstSelectedEntryAmount.subtract(secondSelectedEntryAmount).abs().compareTo(BigDecimal.ZERO) >=0
- && firstSelectedEntryAmount.subtract(secondSelectedEntryAmount).abs().compareTo(BigDecimal.ONE) <=0) {
+ && (firstSelectedEntryAmount.subtract(secondSelectedEntryAmount).abs().compareTo(BigDecimal.ZERO) >0
+ && firstSelectedEntryAmount.subtract(secondSelectedEntryAmount).abs().compareTo(BigDecimal.ONE) <0) ) {
onButtonModeChanged(buttonMode.EQUALIZED);
}
}else {
@@ -234,14 +232,14 @@
BigDecimal debitVal = debit ? amount : BigDecimal.ZERO;
BigDecimal creditVal = debit ? BigDecimal.ZERO : amount;
- if (debitVal == BigDecimal.ZERO){
+ if (debitVal.equals(BigDecimal.ZERO)){
- if (creditVal != BigDecimal.ZERO){
+ if (creditVal.equals(BigDecimal.ZERO)){
editModel.setCredit(creditVal);
editModel.setSolde(creditVal, true);
}
- }else if (creditVal == BigDecimal.ZERO){
+ }else if (creditVal.equals(BigDecimal.ZERO)){
editModel.setDebit(debitVal);
editModel.setSolde(debitVal, false);
}else{
1
0