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
- 1853 discussions
r2948 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui/home resources/i18n
by jpepin@users.chorem.org 25 Jun '10
by jpepin@users.chorem.org 25 Jun '10
25 Jun '10
Author: jpepin
Date: 2010-06-25 16:59:10 +0200 (Fri, 25 Jun 2010)
New Revision: 2948
Url: http://chorem.org/repositories/revision/lima/2948
Log:
Modification accueil, utilisation de JEditorPane au lieu de vbox et jlabel.
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java
trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2010-06-24 17:18:43 UTC (rev 2947)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2010-06-25 14:59:10 UTC (rev 2948)
@@ -11,6 +11,11 @@
}
]]>
</script>
+ <row weightx="1" weighty="1" anchor="west">
+ <cell>
+ <JLabel font='{new Font("Arial", 0, 16)}' text="LIMA"/>
+ </cell>
+ </row>
<row weightx="1" weighty="1">
<cell>
<JPanel id="limaHomeChartAccount"
@@ -18,12 +23,7 @@
minimumSize='{getFixedSize()}'
preferredSize='{getFixedSize()}'
layout='{new BoxLayout(limaHomeChartAccount,BoxLayout.X_AXIS)}'>
- <VBox id="homeBoxAccount"
- margin='0'
- horizontalAlignment='center'
- verticalAlignment='middle'>
- <JLabel id="textHomeAccount"/>
- </VBox>
+ <JEditorPane id="textHomeAccount" />
</JPanel>
</cell>
</row>
@@ -34,12 +34,7 @@
minimumSize='{getFixedSize()}'
preferredSize='{getFixedSize()}'
layout='{new BoxLayout(limaHomeEntryBook,BoxLayout.X_AXIS)}'>
- <VBox id="homeBoxEntryBook"
- margin='0'
- horizontalAlignment='center'
- verticalAlignment='middle'>
- <JLabel id="textHomeEntryBook"/>
- </VBox>
+ <JEditorPane id="textHomeEntryBook"/>
</JPanel>
</cell>
</row>
@@ -50,12 +45,7 @@
minimumSize='{getFixedSize()}'
preferredSize='{getFixedSize()}'
layout='{new BoxLayout(limaHomeFiscalYear,BoxLayout.X_AXIS)}'>
- <VBox id="homeBoxFiscalYear"
- margin='0'
- horizontalAlignment='center'
- verticalAlignment='middle'>
- <JLabel id="textHomeFiscalYear"/>
- </VBox>
+ <JEditorPane id="textHomeFiscalYear"/>
</JPanel>
</cell>
</row>
@@ -66,16 +56,11 @@
minimumSize='{getFixedSize()}'
preferredSize='{getFixedSize()}'
layout='{new BoxLayout(limaHomeDaily,BoxLayout.X_AXIS)}'>
- <VBox id="homeBoxDaily"
- margin='0'
- horizontalAlignment='center'
- verticalAlignment='middle'>
- <JLabel id="textHomeDaily"/>
- </VBox>
+ <JEditorPane id="textHomeDaily"/>
</JPanel>
</cell>
</row>
- <row insets="40" weightx="1" weighty="1" anchor="west">
+ <row weightx="1" weighty="1" anchor="west">
<cell>
<JLabel icon='{new ImageIcon(getClass().getResource("/images/logo-codelutin.png"))}'/>
</cell>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-06-24 17:18:43 UTC (rev 2947)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-06-25 14:59:10 UTC (rev 2948)
@@ -2,6 +2,7 @@
import static org.nuiton.i18n.I18n._;
import java.awt.Color;
+import java.awt.Component;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -49,78 +50,106 @@
redBackground = new Color(255, 102, 102);
}
+ public void goToAccountChart(){
+
+ }
public void refresh(){
try {
+ //ACCOUNT
List<Account> accounts = accountService.getAllAccounts();
+ view.getTextHomeAccount().setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
+ view.getTextHomeAccount().setOpaque(true);
+ view.getTextHomeAccount().setContentType("text/html");
+ view.getTextHomeAccount().setEditable(false);
if (accounts.size()>0){
- view.homeBoxAccount.setBackground(greenBackground);
String accountsString = _("limahome.chartaccounts1") + " " +
accounts.size() + " " + _("limahome.chartaccounts2");
- view.textHomeAccount.setText(accountsString);
+ view.getTextHomeAccount().setBackground(greenBackground);
+ view.getTextHomeAccount().setText("<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://accountcharts'>"+accountsString+"</a></p>");
}
else {
- view.homeBoxAccount.setBackground(redBackground);
- String accountsString = "<html>"+_("limahome.fiscalperiodnoopen") +
- "<br/>"+_("limahome.createchartaccounts")+"</html>";
- view.textHomeAccount.setText(accountsString);
+ view.getTextHomeAccount().setBackground(redBackground);
+ String accountsString = "<p style=vertical-align:'bottom', horizontal-align:'center'>"+_("limahome.fiscalperiodnoopen") +
+ "<br/><a href='lima://accountcharts'>"+_("limahome.createchartaccounts")+"</a>";
+ view.getTextHomeAccount().setText(accountsString+"</p>");
}
+ //ENTRYBOOK
List<EntryBook> entryBooks = entryBookService.getAllEntryBooks();
+ view.getTextHomeEntryBook().setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
+ view.getTextHomeEntryBook().setOpaque(true);
+ view.getTextHomeEntryBook().setContentType("text/html");
+ view.getTextHomeEntryBook().setEditable(false);
if (entryBooks.size()>0){
- view.homeBoxEntryBook.setBackground(greenBackground);
- String entryBooksString = "<html>"+_("limahome.entrybooks1") +
+ view.getTextHomeEntryBook().setBackground(greenBackground);
+ String entryBooksString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://entrybookcharts'>"+_("limahome.entrybooks1") +
" " + entryBooks.size() + " " + _("limahome.entrybooks2") +
- "<br/><ul>";
+ "</a><br/><ul>";
for (EntryBook entryBook : entryBooks) {
entryBooksString += "<li>"+entryBook.getCode() +
" - "+entryBook.getLabel()+"</li>";
}
- view.textHomeEntryBook.setText(entryBooksString+"</ul></html>");
+ view.getTextHomeEntryBook().setText(entryBooksString+"</ul>"+"</p>");
}
else {
- view.homeBoxEntryBook.setBackground(redBackground);
- view.textHomeEntryBook.setText(_("limahome.fiscalperiodnoopen"));
+ view.getTextHomeEntryBook().setBackground(redBackground);
+ view.getTextHomeEntryBook().setText("<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://entrybookcharts'>"+_("limahome.entrybooknoopen")+"</a></p>");
}
+ //FISCAL PERIOD
List<FiscalPeriod> fiscalPeriods =
fiscalPeriodService.getAllFiscalPeriods();
List<FiscalPeriod> unblockedFiscalPeriods =
fiscalPeriodService.getAllUnblockedFiscalPeriods();
+
+ view.getTextHomeFiscalYear().setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
+ view.getTextHomeFiscalYear().setOpaque(true);
+ view.getTextHomeFiscalYear().setContentType("text/html");
+ view.getTextHomeFiscalYear().setEditable(false);
+ view.getTextHomeDaily().setUI(new javax.swing.plaf.basic.BasicEditorPaneUI());
+ view.getTextHomeDaily().setOpaque(true);
+ view.getTextHomeDaily().setContentType("text/html");
+ view.getTextHomeDaily().setEditable(false);
+
if (unblockedFiscalPeriods.size()>0){
- view.homeBoxFiscalYear.setBackground(greenBackground);
- String fiscalString = "<html>"+unblockedFiscalPeriods.size() +
+ view.getTextHomeFiscalYear().setBackground(greenBackground);
+ String fiscalString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://fiscalcharts'>"
+ + unblockedFiscalPeriods.size() +
" " + _("limahome.fiscalperiodopened")+"<br/>" +
(fiscalPeriods.size()-unblockedFiscalPeriods.size()) +
- " " + _("limahome.fiscalperiodclosed")+"</html>";
- view.textHomeFiscalYear.setText(fiscalString);
+ " " + _("limahome.fiscalperiodclosed");
+ view.getTextHomeFiscalYear().setText(fiscalString+"</a></p>");
+ //FINACIAL TRANSACTION
List<FinancialTransaction> financialTransactions =
financialTransactionService.
getAllFinancialTransactionsUnbalanced(fiscalPeriods.get(0));
if (financialTransactions.size()>0){
- view.homeBoxDaily.setBackground(redBackground);
- String transactionsString = financialTransactions.size() +
- _("limahome.transactionunbalanced");
- view.textHomeAccount.setText(transactionsString);
+ view.getTextHomeDaily().setBackground(redBackground);
+ String transactionsString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://financialtransactionunbalanced'>"
+ + financialTransactions.size() +
+ _("limahome.transactionunbalanced")+"</a></p>";
+ view.getTextHomeDaily().setText(transactionsString);
}
else {
- view.homeBoxDaily.setBackground(greenBackground);
- String transactionsString =_("limahome.transactionbalanced");
- view.textHomeDaily.setText(transactionsString);
+ view.getTextHomeDaily().setBackground(greenBackground);
+ String transactionsString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://financialtransactionbalanced'>"
+ + _("limahome.transactionbalanced");
+ view.getTextHomeDaily().setText(transactionsString+"</a></p>");
}
}
else {
- view.homeBoxFiscalYear.setBackground(redBackground);
- view.homeBoxDaily.setBackground(redBackground);
- String fiscalString = "<html>"+_("limahome.fiscalperiodnoopen");
+ view.getTextHomeFiscalYear().setBackground(redBackground);
+ view.getTextHomeDaily().setBackground(redBackground);
+ String fiscalString = "<p style=vertical-align:'bottom', horizontal-align:'center'><a href='lima://fiscalcharts'>" + _("limahome.fiscalperiodnoopen");
if (fiscalPeriods.size()>0){
fiscalString += fiscalPeriods.size() +
_("limahome.fiscalperiodclosed");
}
- view.textHomeFiscalYear.setText(fiscalString+"</html>");
+ view.getTextHomeFiscalYear().setText(fiscalString+"</a></p>");
}
} catch (LimaException eee) {
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-24 17:18:43 UTC (rev 2947)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-25 14:59:10 UTC (rev 2948)
@@ -2,7 +2,9 @@
DEBUG\ delete\ all=
Do\ you\ really\ want\ to\ delete\ entry\ book\ %s\ ?=
Global\ lima\ exception=
+LIMA=
Loading\ accounting...=
+hello\ world=
lima.about.message=
lima.account=Account
lima.account.label=Label
@@ -167,10 +169,13 @@
lima.transaction.period=Period
lima.voucher=Voucher
lima.warning.nimbus.landf=Could not find Numbus Look&Feel
+limahome.chartaccounts1=
+limahome.chartaccounts2=
limahome.createchartaccounts=
limahome.createchartaccounts1=
limahome.createchartaccounts2=
limahome.entrybooks1=
+limahome.entrybooks2=
limahome.fiscalperiodclosed=
limahome.fiscalperiodnoopen=
limahome.fiscalperiodopened=
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 2010-06-24 17:18:43 UTC (rev 2947)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-25 14:59:10 UTC (rev 2948)
@@ -2,7 +2,9 @@
DEBUG\ delete\ all=
Do\ you\ really\ want\ to\ delete\ entry\ book\ %s\ ?=
Global\ lima\ exception=
+LIMA=
Loading\ accounting...=
+hello\ world=
lima.about.message=\u00C0 propos de Lima
lima.account=Compte
lima.account.label=
1
0
r2947 - in trunk/lima-swing/src/main: java/org/chorem/lima/ui java/org/chorem/lima/ui/financialtransaction java/org/chorem/lima/ui/home resources/i18n resources/images
by jpepin@users.chorem.org 24 Jun '10
by jpepin@users.chorem.org 24 Jun '10
24 Jun '10
Author: jpepin
Date: 2010-06-24 19:18:43 +0200 (Thu, 24 Jun 2010)
New Revision: 2947
Url: http://chorem.org/repositories/revision/lima/2947
Log:
Cr?\195?\169ation de la vue d'accueil.
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java
trunk/lima-swing/src/main/resources/images/logo-codelutin.png
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/HomeView.jaxx
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/HomeView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/HomeView.jaxx 2010-06-23 16:26:43 UTC (rev 2946)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/HomeView.jaxx 2010-06-24 17:18:43 UTC (rev 2947)
@@ -1,7 +0,0 @@
-<Table insets="0,0,0,0" fill="both">
- <row>
- <cell>
- <JLabel text="lima.home"/>
- </cell>
- </row>
-</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-06-23 16:26:43 UTC (rev 2946)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-06-24 17:18:43 UTC (rev 2947)
@@ -46,6 +46,7 @@
import org.chorem.lima.ui.financialtransaction.FinancialTransactionView;
import org.chorem.lima.ui.financialtransaction.LetteringView;
import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedView;
+import org.chorem.lima.ui.home.HomeView;
import org.chorem.lima.ui.ledger.LedgerView;
import org.chorem.lima.util.ErrorHelper;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2010-06-23 16:26:43 UTC (rev 2946)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java 2010-06-24 17:18:43 UTC (rev 2947)
@@ -100,7 +100,8 @@
//select the new line
ListSelectionModel selectionModel =
table.getSelectionModel();
- selectionModel.setSelectionInterval(indexSelectedRow+1, indexSelectedRow+1);
+ selectionModel.setSelectionInterval(
+ indexSelectedRow+1, indexSelectedRow+1);
//focus on second column
table.changeSelection(indexSelectedRow+1, 1, false, false);
table.requestFocusInWindow();
@@ -151,7 +152,8 @@
//select the upper line
ListSelectionModel selectionModel =
table.getSelectionModel();
- selectionModel.setSelectionInterval(indexSelectedRow-1, indexSelectedRow-1);
+ selectionModel.setSelectionInterval(
+ indexSelectedRow-1, indexSelectedRow-1);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't remove transaction or entry", eee);
Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx (from rev 2944, trunk/lima-swing/src/main/java/org/chorem/lima/ui/HomeView.jaxx)
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeView.jaxx 2010-06-24 17:18:43 UTC (rev 2947)
@@ -0,0 +1,83 @@
+<Table>
+ <HomeViewHandler id="handler" javaBean='new HomeViewHandler(this)' />
+ <Dimension id="fixedSize" javaBean='new Dimension(600,150)' />
+
+ <script>
+ <![CDATA[
+ import static org.nuiton.i18n.I18n._;
+
+ void $afterCompleteSetup() {
+ getHandler().refresh();
+ }
+ ]]>
+ </script>
+ <row weightx="1" weighty="1">
+ <cell>
+ <JPanel id="limaHomeChartAccount"
+ border='{BorderFactory.createTitledBorder(_("lima.charts.account"))}'
+ minimumSize='{getFixedSize()}'
+ preferredSize='{getFixedSize()}'
+ layout='{new BoxLayout(limaHomeChartAccount,BoxLayout.X_AXIS)}'>
+ <VBox id="homeBoxAccount"
+ margin='0'
+ horizontalAlignment='center'
+ verticalAlignment='middle'>
+ <JLabel id="textHomeAccount"/>
+ </VBox>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JPanel id="limaHomeEntryBook"
+ border='{BorderFactory.createTitledBorder(_("lima.charts.entrybook"))}'
+ minimumSize='{getFixedSize()}'
+ preferredSize='{getFixedSize()}'
+ layout='{new BoxLayout(limaHomeEntryBook,BoxLayout.X_AXIS)}'>
+ <VBox id="homeBoxEntryBook"
+ margin='0'
+ horizontalAlignment='center'
+ verticalAlignment='middle'>
+ <JLabel id="textHomeEntryBook"/>
+ </VBox>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JPanel id="limaHomeFiscalYear"
+ border='{BorderFactory.createTitledBorder(_("lima.charts.fiscalyear"))}'
+ minimumSize='{getFixedSize()}'
+ preferredSize='{getFixedSize()}'
+ layout='{new BoxLayout(limaHomeFiscalYear,BoxLayout.X_AXIS)}'>
+ <VBox id="homeBoxFiscalYear"
+ margin='0'
+ horizontalAlignment='center'
+ verticalAlignment='middle'>
+ <JLabel id="textHomeFiscalYear"/>
+ </VBox>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JPanel id="limaHomeDaily"
+ border='{BorderFactory.createTitledBorder(_("lima.daily"))}'
+ minimumSize='{getFixedSize()}'
+ preferredSize='{getFixedSize()}'
+ layout='{new BoxLayout(limaHomeDaily,BoxLayout.X_AXIS)}'>
+ <VBox id="homeBoxDaily"
+ margin='0'
+ horizontalAlignment='center'
+ verticalAlignment='middle'>
+ <JLabel id="textHomeDaily"/>
+ </VBox>
+ </JPanel>
+ </cell>
+ </row>
+ <row insets="40" weightx="1" weighty="1" anchor="west">
+ <cell>
+ <JLabel icon='{new ImageIcon(getClass().getResource("/images/logo-codelutin.png"))}'/>
+ </cell>
+ </row>
+</Table>
\ No newline at end of file
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-06-24 17:18:43 UTC (rev 2947)
@@ -0,0 +1,131 @@
+package org.chorem.lima.ui.home;
+
+import static org.nuiton.i18n.I18n._;
+import java.awt.Color;
+import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.AccountService;
+import org.chorem.lima.business.EntryBookService;
+import org.chorem.lima.business.FinancialTransactionService;
+import org.chorem.lima.business.FiscalPeriodService;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.service.LimaServiceFactory;
+
+public class HomeViewHandler {
+
+ private static final Log log = LogFactory.getLog(HomeViewHandler.class);
+
+ private HomeView view;
+
+ protected AccountService accountService;
+
+ protected EntryBookService entryBookService;
+
+ protected FinancialTransactionService financialTransactionService;
+
+ protected FiscalPeriodService fiscalPeriodService;
+
+
+ private Color greenBackground;
+ private Color redBackground;
+
+ protected HomeViewHandler(HomeView view) {
+ this.view=view;
+ accountService =
+ LimaServiceFactory.getInstance().getAccountService();
+ entryBookService =
+ LimaServiceFactory.getInstance().getEntryBookService();
+ financialTransactionService =
+ LimaServiceFactory.getInstance().getTransactionService();
+ fiscalPeriodService =
+ LimaServiceFactory.getInstance().getFiscalPeriodService();
+
+ greenBackground = new Color(153, 255, 153);
+ redBackground = new Color(255, 102, 102);
+ }
+
+
+ public void refresh(){
+
+ try {
+ List<Account> accounts = accountService.getAllAccounts();
+ if (accounts.size()>0){
+ view.homeBoxAccount.setBackground(greenBackground);
+ String accountsString = _("limahome.chartaccounts1") + " " +
+ accounts.size() + " " + _("limahome.chartaccounts2");
+ view.textHomeAccount.setText(accountsString);
+ }
+ else {
+ view.homeBoxAccount.setBackground(redBackground);
+ String accountsString = "<html>"+_("limahome.fiscalperiodnoopen") +
+ "<br/>"+_("limahome.createchartaccounts")+"</html>";
+ view.textHomeAccount.setText(accountsString);
+ }
+
+ List<EntryBook> entryBooks = entryBookService.getAllEntryBooks();
+ if (entryBooks.size()>0){
+ view.homeBoxEntryBook.setBackground(greenBackground);
+ String entryBooksString = "<html>"+_("limahome.entrybooks1") +
+ " " + entryBooks.size() + " " + _("limahome.entrybooks2") +
+ "<br/><ul>";
+ for (EntryBook entryBook : entryBooks) {
+ entryBooksString += "<li>"+entryBook.getCode() +
+ " - "+entryBook.getLabel()+"</li>";
+ }
+ view.textHomeEntryBook.setText(entryBooksString+"</ul></html>");
+ }
+ else {
+ view.homeBoxEntryBook.setBackground(redBackground);
+ view.textHomeEntryBook.setText(_("limahome.fiscalperiodnoopen"));
+ }
+
+ List<FiscalPeriod> fiscalPeriods =
+ fiscalPeriodService.getAllFiscalPeriods();
+ List<FiscalPeriod> unblockedFiscalPeriods =
+ fiscalPeriodService.getAllUnblockedFiscalPeriods();
+ if (unblockedFiscalPeriods.size()>0){
+ view.homeBoxFiscalYear.setBackground(greenBackground);
+ String fiscalString = "<html>"+unblockedFiscalPeriods.size() +
+ " " + _("limahome.fiscalperiodopened")+"<br/>" +
+ (fiscalPeriods.size()-unblockedFiscalPeriods.size()) +
+ " " + _("limahome.fiscalperiodclosed")+"</html>";
+ view.textHomeFiscalYear.setText(fiscalString);
+
+ List<FinancialTransaction> financialTransactions =
+ financialTransactionService.
+ getAllFinancialTransactionsUnbalanced(fiscalPeriods.get(0));
+ if (financialTransactions.size()>0){
+ view.homeBoxDaily.setBackground(redBackground);
+ String transactionsString = financialTransactions.size() +
+ _("limahome.transactionunbalanced");
+ view.textHomeAccount.setText(transactionsString);
+ }
+ else {
+ view.homeBoxDaily.setBackground(greenBackground);
+ String transactionsString =_("limahome.transactionbalanced");
+ view.textHomeDaily.setText(transactionsString);
+ }
+
+ }
+ else {
+ view.homeBoxFiscalYear.setBackground(redBackground);
+ view.homeBoxDaily.setBackground(redBackground);
+ String fiscalString = "<html>"+_("limahome.fiscalperiodnoopen");
+ if (fiscalPeriods.size()>0){
+ fiscalString += fiscalPeriods.size() +
+ _("limahome.fiscalperiodclosed");
+ }
+ view.textHomeFiscalYear.setText(fiscalString+"</html>");
+
+ }
+ } catch (LimaException eee) {
+ log.debug("Can't get datas home", eee);
+ }
+ }
+
+}
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-23 16:26:43 UTC (rev 2946)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-24 17:18:43 UTC (rev 2947)
@@ -1,78 +1,33 @@
-Bloqu\u00E9e=
-Can't\ add\ fiscal\ period=
-Can't\ block\ financialperiod=
-Can't\ delete\ all\ fiscal\ period=
Confirmation=
DEBUG\ delete\ all=
Do\ you\ really\ want\ to\ delete\ entry\ book\ %s\ ?=
-Exercice=
Global\ lima\ exception=
Loading\ accounting...=
-TODO\ begincalendarPanel=
-TODO\ endcalendarPanel=
-calendarPanel\ TODO=
lima.about.message=
lima.account=Account
lima.account.label=Label
lima.account.number=Number
-lima.account.type=Account type
-lima.account.type1=
-lima.account.type2=
-lima.account.type3=
-lima.account.type4=
-lima.accountplan=Plan de comptes
-lima.accounts=Accounts
lima.accountsreports.accountfilter=Filter
lima.accountsreports.begincalendar=
lima.accountsreports.endcalendar=
-lima.actif=Asset
-lima.action.commandline.disable.main.ui=Do not launch main ui
lima.action.commandline.help=Show help in console
lima.action.fullscreen=Full screen
lima.action.fullscreen.tip=Open ui in full screen
lima.action.normalscreen=Normal screen
lima.action.normalscreen.tip=Open ui in normal screen
-lima.add=Add
lima.add.entry=Add an entry
-lima.add.financialstatementheader=
-lima.add.financialstatementmovement=
-lima.add.lettering=Add a letter
lima.add.transaction=Add a transaction
-lima.all=All
-lima.all.criteria=All criteria are met
lima.amount=Amount
lima.amountcredit=
lima.amountdebit=
-lima.any.criteria=Any criteria are met
-lima.balance.account.libelle=Title
-lima.balance.account.number=N\u00B0 account
-lima.balance.move.credit=Credit
-lima.balance.move.debit=Debit
-lima.balance.solde.credit=Balance credit
-lima.balance.solde.debit=Balance debit
-lima.balance.total=Total
-lima.bilan=Bilan
-lima.bilan.actif=Actif
-lima.bilan.brut=Brut
-lima.bilan.depreciation=Depreciation
-lima.bilan.net=Net
-lima.bilan.passif=Passif
-lima.bilan.total=Total
-lima.block=block
-lima.cancel=Cancel
-lima.charge=Expense
lima.charts.account=Accounts chart
lima.charts.entrybook=EntryBooks chart
lima.charts.financialperiod=Financial Periods
lima.charts.financialstatement=
lima.charts.fiscalyear=Fiscal Years
lima.close=Closed
-lima.closure=Closure
-lima.closure.period.begin=Period from
-lima.closure.timespan.warning=Warning\: when the period is blocked, it is possible to add, edit and delete entries on the accounting period.
lima.common.add=
lima.common.addSubLedger=
-lima.common.all=
lima.common.cancel=
lima.common.ok=
lima.common.print=
@@ -86,27 +41,12 @@
lima.config.configFileName.description=
lima.config.locale.description=
lima.config.ui.flaunchui.description=
-lima.config.ui.fullscreen=
lima.config.ui.fullscreen.description=
lima.credit=Credit
lima.daily=Daily
lima.date=Date
-lima.date.april=April
-lima.date.august=August
-lima.date.december=December
-lima.date.february=February
-lima.date.january=January
-lima.date.july=July
-lima.date.june=June
-lima.date.march=March
-lima.date.may=May
-lima.date.november=November
-lima.date.october=October
-lima.date.september=September
lima.debit=Debit
lima.description=Description
-lima.edit=Edit
-lima.edit.transaction=Edit transaction
lima.entries=Entries
lima.entries.addtransaction=
lima.entries.lettering=
@@ -121,110 +61,42 @@
lima.entrybook.type3=
lima.entrybook.type4=
lima.entrybook.type5=
-lima.entrybooks=EntryBooks
lima.error=Error
-lima.error.account.double=It exists an account with a same number
-lima.error.account.not.exist=This account doesn't exist
-lima.error.account.not.master=This account has not an account master
-lima.error.account.with.entries=This account has some entries
-lima.error.entry.not.exist=
-lima.error.entry.not.remove=
lima.error.errorpane.htmlmessage=<html><body><b>An application error happened</b>\:<br/>%s</body></html>
lima.error.errorpane.title=Lima error
-lima.error.journal.double=A journal exist with this name
-lima.error.journal.not.exist=This journal doesn't exist
-lima.error.journal.with.transactions=This journal has some transactions
-lima.error.period.all.timespan=
-lima.error.period.create.timespan=
-lima.error.period.next.not.blocked=
-lima.error.period.not.exist=
-lima.error.period.prec.not.blocked=It exists periods not blocked
-lima.error.period.timespan.block=
-lima.error.period.timespan.not.blocked=
-lima.error.transaction.exist.not.balanced=It exists transactions not balanced
-lima.error.transaction.not.create=This transaction has not been created
-lima.error.transaction.not.exist=This transaction doesn't exist
-lima.error.transaction.not.journal=This transaction has not a journal
-lima.error.transaction.not.period=This transaction has not a period
-lima.error.transaction.not.remove=This transaction has not been removed
-lima.error.transaction.period.not.blocked=The period is blocked
-lima.exception.number.format=Numeric format only accepted
lima.export=Export
-lima.export.CSV=CSV Export
-lima.export.PDF=PDF Export
lima.export.account=Export PCG
lima.export.all=Export all datas (XML)
lima.export.all.csv=Exporter all datas (CSV)
-lima.filter.after=After
-lima.filter.before=Before
-lima.filter.contains=Contains
-lima.filter.equals.to=Equals to
-lima.filter.greater.than=Greater than
-lima.filter.less.than=Less than
-lima.filter.not.contains=Not contains
-lima.filter.starts.with=Starts with
lima.financialperiod.block=
-lima.financialperiod.management=
lima.financialstatement.accounts=
lima.financialstatement.creditaccounts=
lima.financialstatement.debitaccounts=
lima.financialstatement.formula=
-lima.financialstatement.header=
lima.financialstatement.header.add=
lima.financialstatement.label=
lima.financialstatement.movement.add=
lima.financialstatement.provisiondeprecationaccounts=
-lima.financialstatement.style=
lima.financialstatement.subamount=
-lima.financialstatementreports=
-lima.find.transaction=Find transaction
lima.fiscalperiod.addFiscalPeriod=
lima.fiscalperiod.block=
-lima.fiscalperiod.periodFilterLabel=
-lima.fiscalyear=
-lima.fiscalyear.addperiod=
-lima.fiscalyear.closefiscalyear=
-lima.fiscalyear.closeperiod=
-lima.fiscalyear.listclosed=
-lima.fiscalyear.management=
-lima.grand.livre=General Ledger
-lima.home=Home - TODO
-lima.identity.address=
-lima.identity.adress=
-lima.identity.city=
lima.identity.contact=
-lima.identity.country=
-lima.identity.email=
-lima.identity.fax=
-lima.identity.name=
-lima.identity.phone=
-lima.identity.siret=
-lima.identity.website=
-lima.identity.zipcode=
lima.import=Import
lima.import.account=Import PCG
lima.import.all=Import all datas
lima.import.all.csv=Import all datas (CSV)
lima.import.all.csv.ebp=Import all datas (EBP)
-lima.import.error=Your datas had't not been loaded
lima.import.journal=Import journal
-lima.import.success=Your datas had been loaded
lima.init.closed=Lima closed at %1$s
-lima.init.context.done=Context was initialized in %1$s
lima.init.errorclosing=
-lima.init.ui.done=UI initialized
-lima.lettered=Lettered
-lima.lettering=Lettering
lima.lettering.add=
lima.lettering.entries=
lima.lettering.from=
lima.lettering.lettered=
lima.lettering.letteredall=
-lima.lettering.not.lettered=
lima.lettering.notlettered=
lima.lettering.remove=
lima.lettering.to=
-lima.loading=Loading
lima.menu.file=File
lima.menu.help=Help
lima.menu.help.about=About
@@ -233,78 +105,23 @@
lima.menu.help.i18n.fr=French
lima.menu.help.i18n.uk=English
lima.menu.help.site=WebSite
-lima.menubar.closure=Closure
-lima.menubar.closure.addPeriod=Add a period
-lima.menubar.closure.listperiod=See all periods
-lima.menubar.closure.period=close a period (annual)
-lima.menubar.closure.timespan=close a period (monthly)
-lima.message.config.loaded=Config was loaded
-lima.message.error.empty.line=Please choose an account
lima.message.help.usage=
lima.misc.supportemail.description=
-lima.model.account=Account
-lima.model.balance=Balance
-lima.model.credit=Credit
-lima.model.date=Date
-lima.model.debit=Debit
-lima.model.description=Description
-lima.model.etat=Etat
-lima.model.journal=Journal
-lima.model.lettering=Lettering
-lima.model.name=Name
-lima.model.period=Period
-lima.model.prefix=Prefix
-lima.model.status=Status
-lima.model.voucher=Voucher
-lima.name=Name
-lima.non.valids.transactions=No valids transactions
-lima.not.lettered=Not lettered
-lima.number=Number
-lima.ok=OK
lima.open=Open
lima.openejb.remotemode.description=
-lima.passif=Liability
-lima.period=Period
-lima.period.addFiscalPeriod=
lima.period.begindate=
-lima.period.block=
-lima.period.close=Close
lima.period.enddate=
-lima.period.filter=
-lima.period.open=Open
-lima.period.periodFilterLabel=
lima.preferences=Preferences
-lima.prefix=Prefix
-lima.print=Print
-lima.produit=Revenue
-lima.progressBar.export.etape1=Create the file
-lima.progressBar.export.etape2=Create informations
-lima.progressBar.export.etape3=Create periods
-lima.progressBar.export.etape4=Create journals
-lima.progressBar.export.etape5=Create accounts
-lima.progressBar.export.etape6=Create transactions
-lima.progressBar.export.etape7=Save the file
-lima.progressBar.export.title=Save
-lima.progressBar.load.etape1=Loading journals
-lima.progressBar.load.etape2=Loading accounts
-lima.progressBar.load.etape3=Loading status
-lima.progressBar.load.etape4=Loading periods
-lima.progressBar.load.etape5=Loading transactions
lima.question=Question
-lima.question.confirmremove.account=This account have subaccounts, do you want remove this account ?
lima.question.financialperiod.blocked=
lima.question.fiscalperiod.blocked=
lima.question.fiscalperiod.morethan12=
lima.question.load.accounts=There is no existing accounts in Lima. Do you want to load default accounts ?
lima.question.remove.account=Do you want to remove this account ?
lima.question.remove.entry=Do you want to remove this entry ?
-lima.question.remove.journal=Do you want to remove this journal ?
lima.question.remove.transaction=Do you want to remove this transaction ?
-lima.quit=Quit
lima.refresh=\u21BB
lima.remove=Remove
-lima.remove.lettering=Remove a letter
-lima.remove.transaction=Remove a transaction
lima.reports=Reports
lima.reports.accounts=Edit account
lima.reports.balance=Balance
@@ -313,46 +130,13 @@
lima.reports.ledger=Ledger
lima.response.no=No
lima.response.yes=Yes
-lima.result=Result
-lima.result.charge=CHARGES
-lima.result.loss=Perte
-lima.result.produit=PRODUITS
-lima.result.profit=B\u00E9n\u00E9fice
-lima.result.total.charge=TOTAL CHARGES
-lima.result.total.produit=TOTAL PRODUITS
-lima.search=Search
-lima.search.items.where=Search items where
-lima.search.title.criteria.box=Criteria
-lima.since=Since
lima.solde=
lima.soldecredit=
lima.soldedebit=
-lima.status.tr.balanced=Balanced
-lima.status.tr.finalized=Finalized
-lima.status.tr.wip=Work in progress
lima.structure=Structure
-lima.style.1=
-lima.subledger.accountnumber=
lima.subledger.code=Code
-lima.subledger.label=
-lima.subledger.type=
-lima.success=Success
-lima.tab.account=Account
-lima.tab.accounts=
-lima.tab.balance=Balance
-lima.tab.bilan=Results
-lima.tab.closure=Closure
-lima.tab.financialperiod=
-lima.tab.fiscalperiod=
lima.tab.home=Home
-lima.tab.journal=Journal
-lima.tab.lettering=Lettering
-lima.tab.period=Period
-lima.tab.reports=Reports
lima.tab.result=Result
-lima.tab.search.result=Search result
-lima.tab.subledgers=
-lima.tab.transaction=Transaction
lima.table.account=
lima.table.balance=
lima.table.closure=
@@ -379,34 +163,16 @@
lima.table.voucher=
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=About Lima...
-lima.to=To
-lima.transaction.column.account=Account
-lima.transaction.column.balance=Balance
-lima.transaction.column.credit=Credit
-lima.transaction.column.date=Date
-lima.transaction.column.debit=Debit
-lima.transaction.column.description=Description
-lima.transaction.column.document=Voucher
-lima.transaction.column.entrybook=Entrybook
-lima.transaction.column.period=Period
-lima.transaction.column.position=
-lima.transaction.column.solde=Solde
-lima.transaction.column.status=Status
-lima.transaction.column.voucher=
lima.transaction.confirmdelete=
-lima.transaction.entrybook=
lima.transaction.period=Period
-lima.ui.add.account=Add account
-lima.ui.add.journal=Add journal
-lima.ui.block.timespan=Block period
-lima.ui.unblock.timespan=Unblock period
-lima.ui.update.account=Update account
-lima.ui.update.journal=Update journal
-lima.unblock=Unblock
-lima.update=Update
-lima.view=View
-lima.view.flatten=Flatten view
lima.voucher=Voucher
-lima.warning.entrybookscloded=All EntryBook of this financial period are blocked
lima.warning.nimbus.landf=Could not find Numbus Look&Feel
-lima.warning.no.ui=No ui display detected
+limahome.createchartaccounts=
+limahome.createchartaccounts1=
+limahome.createchartaccounts2=
+limahome.entrybooks1=
+limahome.fiscalperiodclosed=
+limahome.fiscalperiodnoopen=
+limahome.fiscalperiodopened=
+limahome.transactionbalanced=
+limahome.transactionunbalanced=
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 2010-06-23 16:26:43 UTC (rev 2946)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-24 17:18:43 UTC (rev 2947)
@@ -1,66 +1,31 @@
-Bloqu\u00E9e=
-Can't\ add\ fiscal\ period=
-Can't\ block\ financialperiod=
-Can't\ delete\ all\ fiscal\ period=
Confirmation=
DEBUG\ delete\ all=
Do\ you\ really\ want\ to\ delete\ entry\ book\ %s\ ?=
Global\ lima\ exception=
Loading\ accounting...=
-TODO\ begincalendarPanel=
-TODO\ endcalendarPanel=
-\\\\u21BB=
-calendarPanel\ TODO=
lima.about.message=\u00C0 propos de Lima
lima.account=Compte
lima.account.label=
-lima.account.menu=Plan de comptes
lima.account.number=
-lima.account.parentnumber=
-lima.account.type=Type de compte
-lima.account.type1=Actif
-lima.account.type2=Passif
-lima.account.type3=Produit
-lima.account.type4=Charge
-lima.accounts=Comptes
lima.accountsreports.accountfilter=Filtrer
lima.accountsreports.begincalendar=Date d\u00E9but
lima.accountsreports.endcalendar=Date fin
-lima.actif=Actif
-lima.action.commandline.disable.main.ui=Ne pas lancer l'ui
lima.action.commandline.help=Afficher l'aide en console
lima.action.fullscreen=Plein Ecran
lima.action.fullscreen.tip=Passer en mode plein \u00E9cran
lima.action.normalscreen=Ecran normal
lima.action.normalscreen.tip=Revenir en \u00E9cran normal
lima.add.entry=Ajouter entr\u00E9e
-lima.add.financialstatement.movement.add=Mouvement
-lima.add.lettering=
lima.add.transaction=Ajouter transaction
-lima.all=Tous
-lima.all.criteria=Tous les crit\u00E8res correspondent
lima.amount=Montant
lima.amountcredit=Total Cr\u00E9dit
lima.amountdebit=Total D\u00E9bit
-lima.any.criteria=Au moins un crit\u00E8re correspond
-lima.balance.total=Total
-lima.bilan=Bilan
-lima.bilan.actif=Actif
-lima.bilan.brut=Brut
-lima.bilan.depreciation=Amort. et Prov.
-lima.bilan.net=Net
-lima.bilan.passif=Passif
-lima.bilan.total=Total
-lima.block=Bloquer
-lima.charge=Charge
lima.charts.account=Plan comptable
lima.charts.entrybook=Journaux
lima.charts.financialperiod=P\u00E9riodes comptables
lima.charts.financialstatement=Plan BCR
lima.charts.fiscalyear=Exercices
lima.close=Ferm\u00E9
-lima.closure.period.begin=P\u00E9riode de
-lima.closure.timespan.warning=Attention \: lorsque la p\u00E9riode est bloqu\u00E9e, il n'est plus possible d'ajouter, modifier et supprimer les entr\u00E9es comptables sur cette p\u00E9riode.
lima.common.add=Ajout Compte G\u00E9n\u00E9ral
lima.common.addSubLedger=Ajouter Compte Tiers
lima.common.cancel=Annuler
@@ -69,7 +34,6 @@
lima.common.quit=Quitter
lima.common.remove=Supprimer
lima.common.update=Modifier
-lima.comon.print=Imprimer
lima.config.category.directories=R\u00E9pertoires
lima.config.category.directories.description=R\u00E9pertoires utilis\u00E9s par Lima
lima.config.category.other=Autre
@@ -77,27 +41,12 @@
lima.config.configFileName.description=
lima.config.locale.description=Locale utilis\u00E9e par l'application
lima.config.ui.flaunchui.description=
-lima.config.ui.fullscreen=Drapeau pour utiliser le mode plein \u00E9cran
lima.config.ui.fullscreen.description=
lima.credit=Credit
lima.daily=Quotidien
lima.date=Date
-lima.date.april=Avril
-lima.date.august=Ao\u00FBt
-lima.date.december=D\u00E9cembre
-lima.date.february=F\u00E9vrier
-lima.date.january=Janvier
-lima.date.july=Juillet
-lima.date.june=Juin
-lima.date.march=Mars
-lima.date.may=Mai
-lima.date.november=Novembre
-lima.date.october=Octobre
-lima.date.september=Septembre
lima.debit=Debit
lima.description=Description
-lima.edit=Editer
-lima.edit.transaction=Editer une transaction
lima.entries=Traitement
lima.entries.addtransaction=Saisir des \u00E9critures
lima.entries.lettering=Ajouter une lettre
@@ -112,50 +61,14 @@
lima.entrybook.type3=Tr\u00E9sorerie
lima.entrybook.type4=G\u00E9n\u00E9ral
lima.entrybook.type5=Situation
-lima.entrybooks=Journaux
lima.error=Erreur
-lima.error.account.double=Il existe un compte avec ce m\u00EAme num\u00E9ro de compte
-lima.error.account.not.exist=Ce num\u00E9ro de compte n'existe pas
-lima.error.account.not.master=Ce compte ne poss\u00E8de pas de compte principal
-lima.error.account.with.entries=Ce compte poss\u00E8de des entr\u00E9es comptables
-lima.error.entry.not.exist=
-lima.error.entry.not.remove=
lima.error.errorpane.htmlmessage=<html><body><b>Une erreur s'est produite</b>\:<br/>%s</body></html>
lima.error.errorpane.title=Lima erreur
-lima.error.journal.double=Un journal poss\u00E8de d\u00E9j\u00E0 ce nom
-lima.error.journal.not.exist=Ce journal n'existe pas
-lima.error.journal.with.transactions=Ce journal poss\u00E8de des transactions comptables
-lima.error.period.all.timespan=
-lima.error.period.create.timespan=
-lima.error.period.next.not.blocked=
-lima.error.period.not.exist=
-lima.error.period.prec.not.blocked=Il existe des p\u00E9riodes pr\u00E9c\u00E9dentes non bloqu\u00E9es
-lima.error.period.timespan.block=
-lima.error.period.timespan.not.blocked=
-lima.error.transaction.exist.not.balanced=Il existe des transactions non \u00E9quilibr\u00E9es
-lima.error.transaction.not.create=La transaction n'a pu \u00EAtre cr\u00E9\u00E9e
-lima.error.transaction.not.exist=La transaction n'existe pas
-lima.error.transaction.not.journal=La transaction doit \u00EAtre associ\u00E9e \u00E0 un journal
-lima.error.transaction.not.period=La transaction doit \u00EAtre associ\u00E9e \u00E0 une p\u00E9riode
-lima.error.transaction.not.remove=La transaction n'a pu \u00EAtre supprim\u00E9e.
-lima.error.transaction.period.not.blocked=La p\u00E9riode de la transaction est bloqu\u00E9e.
-lima.exception.number.format=Uniquement un format num\u00E9rique est accept\u00E9
lima.export=Export
-lima.export.CSV=CSV
-lima.export.PDF=PDF
lima.export.account=Exporter le PCG
lima.export.all=Exporter toutes les donn\u00E9es (XML)
lima.export.all.csv=Exporter toutes les donn\u00E9es (CSV)
-lima.filter.after=Apr\u00E8s
-lima.filter.before=Avant
-lima.filter.contains=Contient
-lima.filter.equals.to=Egal \u00E0
-lima.filter.greater.than=Sup\u00E9rieur \u00E0
-lima.filter.less.than=Inf\u00E9rieur \u00E0
-lima.filter.not.contains=Ne contient pas
-lima.filter.starts.with=Commence par
lima.financialperiod.block=Cloturer une p\u00E9riode
-lima.financialperiod.management=
lima.financialstatement.accounts=Liste de comptes au cr\u00E9dit et au d\u00E9bit
lima.financialstatement.creditaccounts=Liste de comptes au cr\u00E9dit
lima.financialstatement.debitaccounts=Liste de comptes au d\u00E9bit
@@ -165,42 +78,17 @@
lima.financialstatement.movement.add=Ajouter un regrouprement
lima.financialstatement.provisiondeprecationaccounts=Liste de comptes d'amortissement et provisions
lima.financialstatement.subamount=Calculer un sous-total
-lima.find.transaction=Rechercher transaction
lima.fiscalperiod.addFiscalPeriod=Nouvel exercice
lima.fiscalperiod.block=Cloturer un exercice
-lima.fiscalperiod.periodFilterLabel=
-lima.fiscalyear.addperiod=Ajouter une p\u00E9riode
-lima.fiscalyear.closefiscalyear=Cl\u00F4turer l'exercice
-lima.fiscalyear.closeperiod=Cl\u00F4turer une p\u00E9riode
-lima.fiscalyear.listclosed=Voir toutes les cl\u00F4tures
-lima.fiscalyear.management=
-lima.grand.livre=Grand-Livre
-lima.home=Page d'accueil - TODO
-lima.identity.address=Adresse
-lima.identity.city=Ville
lima.identity.contact=Contact
-lima.identity.country=Pays
-lima.identity.email=eMail
-lima.identity.fax=Fax
-lima.identity.name=Nom
-lima.identity.phone=Tel
-lima.identity.siret=Siret
-lima.identity.website=Site Web
-lima.identity.zipcode=Code Postal
lima.import=Import
lima.import.account=Importer le PCG
lima.import.all=Importer une nouvelle base (XML)
lima.import.all.csv=Importer une nouvelle base (CSV)
lima.import.all.csv.ebp=Importer des donn\u00E9es de EBP
-lima.import.error=Vos donn\u00E9es n'ont pu \u00EAtre charg\u00E9es
lima.import.journal=Importer le journal
-lima.import.success=Vos donn\u00E9es ont bien \u00E9t\u00E9 charg\u00E9es
lima.init.closed=Lima ferm\u00E9 \u00E0 %1$s
-lima.init.context.done=Initialisation du context termin\u00E9 en %1$s
lima.init.errorclosing=
-lima.init.ui.done=Initialisation des interface graphiques termin\u00E9e
-lima.lettered=Lettr\u00E9
-lima.lettering=Lettrage
lima.lettering.add=Ajouter une lettre
lima.lettering.entries=Op\u00E9ration de saisie
lima.lettering.from=De
@@ -209,7 +97,6 @@
lima.lettering.notlettered=Non lettr\u00E9e
lima.lettering.remove=Supprimer
lima.lettering.to=\u00C0
-lima.loading=Chargement
lima.menu.file=Fichier
lima.menu.help=Aide
lima.menu.help.about=\u00C0 Propos
@@ -218,67 +105,23 @@
lima.menu.help.i18n.fr=Fran\u00E7ais
lima.menu.help.i18n.uk=Anglais
lima.menu.help.site=Acc\u00E9der au site de Lima
-lima.menubar.closure.addPeriod=
-lima.message.config.loaded=
-lima.message.error.empty.line=Veuillez choisir un compte
lima.message.help.usage=
lima.misc.supportemail.description=
-lima.model.account=Compte
-lima.model.balance=Balance
-lima.model.credit=Cr\u00E9dit
-lima.model.date=Date
-lima.model.debit=D\u00E9bit
-lima.model.description=Description
-lima.model.etat=Etat
-lima.model.journal=Journal
-lima.model.lettering=Lettrage
-lima.model.name=Nom
-lima.model.period=P\u00E9riode
-lima.model.prefix=Pr\u00E9fixe
-lima.model.status=Statut
-lima.model.voucher=Document
-lima.name=Nom
-lima.non.valids.transactions=Ecritures non valides
-lima.not.lettered=Non lettr\u00E9
-lima.number=Num\u00E9ro
lima.open=Ouvert
lima.openejb.remotemode.description=
-lima.passif=Passif
-lima.period=
lima.period.begindate=D\u00E9but
-lima.period.close=
lima.period.enddate=Fin
-lima.period.open=
lima.preferences=Pr\u00E9f\u00E9rences
-lima.prefix=Pr\u00E9fixe
-lima.produit=Produit
-lima.progressBar.export.etape1=Cr\u00E9ation base du fichier
-lima.progressBar.export.etape2=Cr\u00E9ation informations
-lima.progressBar.export.etape3=Cr\u00E9ation des p\u00E9riodes
-lima.progressBar.export.etape4=Cr\u00E9ation des journaux
-lima.progressBar.export.etape5=Cr\u00E9ation des comptes
-lima.progressBar.export.etape6=Cr\u00E9ation des transactions
-lima.progressBar.export.etape7=Enregistrement du fichier
-lima.progressBar.export.title=Sauvegarde
-lima.progressBar.load.etape1=Chargement des journaux
-lima.progressBar.load.etape2=Chargement des comptes
-lima.progressBar.load.etape3=Chargement des status
-lima.progressBar.load.etape4=Chargement des p\u00E9riodes
-lima.progressBar.load.etape5=Chargement des transactions
lima.question=Question
-lima.question.confirmremove.account=Ce compte poss\u00E8de des sous comptes, voulez-vous supprimer ce compte ?
lima.question.financialperiod.blocked=
lima.question.fiscalperiod.blocked=\u00C8tes vous s\u00FBre de vouloir cl\u00F4turer cette exercice ? Cette action est irr\u00E9versible \!
lima.question.fiscalperiod.morethan12=La p\u00E9riode s\u00E9lectionner n'est pas de 12 mois, voulez-vous continuer ?
lima.question.load.accounts=Il n'y a aucun plan comptable existant dans Lima. Voulez-vous en charger un par d\u00E9faut ?
lima.question.remove.account=Voulez-vous supprimer ce compte?
lima.question.remove.entry=Voulez-vous supprimer cette ligne de transaction?
-lima.question.remove.journal=Voulez-vous supprimer ce journal?
lima.question.remove.transaction=Voulez-vous supprimer cette transaction?
lima.refresh=\u21BB
lima.remove=
-lima.remove.lettering=Supprimer la lettre
-lima.remove.transaction=Supprimer une transaction
lima.reports=Rapports
lima.reports.accounts=Edition compte
lima.reports.balance=Balance
@@ -287,34 +130,12 @@
lima.reports.ledger=Grand Livre
lima.response.no=Non
lima.response.yes=Oui
-lima.result=Compte de r\u00E9sultat
-lima.result.charge=CHARGES
-lima.result.loss=Perte
-lima.result.produit=PRODUITS
-lima.result.profit=B\u00E9n\u00E9fice
-lima.result.total.charge=TOTAL CHARGES
-lima.result.total.produit=TOTAL PRODUITS
-lima.search=Rechercher
-lima.search.items.where=Trouver les \u00E9critures o\u00F9
-lima.search.title.criteria.box=Crit\u00E8res
-lima.since=Depuis
lima.solde=Solde
lima.soldecredit=Solde Cr\u00E9diteur
lima.soldedebit=Solde D\u00E9biteur
-lima.status.tr.balanced=Equilibr\u00E9e
-lima.status.tr.finalized=Valid\u00E9e
-lima.status.tr.wip=En cours
lima.structure=Structure
-lima.style.1=
-lima.subledger.accountnumber=
lima.subledger.code=Code
-lima.subledger.label=
-lima.subledger.type=
-lima.success=Succ\u00E8s
-lima.tab.bilan=
-lima.tab.fiscalperiod=Exercice
lima.tab.home=Accueil
-lima.tab.reports=
lima.tab.result=
lima.table.account=Compte
lima.table.balance=Balance
@@ -342,21 +163,19 @@
lima.table.voucher=Pi\u00E8ce comptable
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=A propos de Lima...
-lima.to=A
lima.transaction.confirmdelete=
-lima.transaction.entrybook=Journal
lima.transaction.period=P\u00E9riode
-lima.ui.add.account=Ajouter un compte
-lima.ui.add.journal=Ajouter un journal
-lima.ui.block.timespan=Bloquer une p\u00E9riode mensuelle
-lima.ui.unblock.timespan=D\u00E9bloquer une p\u00E9riode mensuelle
-lima.ui.update.account=Mettre \u00E0 jour le compte
-lima.ui.update.journal=Mettre \u00E0 jour le journal
-lima.unblock=D\u00E9bloquer
-lima.update=
-lima.view=Vue
-lima.view.flatten=Vue aplatie
lima.voucher=Document
-lima.warning.entrybookscloded=Impossible tous les journaux de cette p\u00E9riode sont ferm\u00E9s
lima.warning.nimbus.landf=Le look and feel nymbus n'a pas \u00E9t\u00E9 trouv\u00E9
-lima.warning.no.ui=Aucun environnement graphique d\u00E9tect\u00E9.
+limahome.accountsnoopen=Aucun compte \!
+limahome.chartaccounts1=Le plan comptable possede
+limahome.chartaccounts2=comptes
+limahome.createchartaccounts=Cr\u00E9er le plan comptable
+limahome.entrybooknoopen=Aucun journal ouvert \!
+limahome.entrybooks1=Les
+limahome.entrybooks2=journaux sont \:
+limahome.fiscalperiodclosed=exercices clotur\u00E9s
+limahome.fiscalperiodnoopen=Aucun exercice ouvert \!
+limahome.fiscalperiodopened=exercices ouverts
+limahome.transactionbalanced=Toutes les entr\u00E9es sont \u00E9quilibr\u00E9es
+limahome.transactionunbalanced=ne sont pas \u00E9quilibr\u00E9e \!
Added: trunk/lima-swing/src/main/resources/images/logo-codelutin.png
===================================================================
(Binary files differ)
Property changes on: trunk/lima-swing/src/main/resources/images/logo-codelutin.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
1
0
Author: jpepin
Date: 2010-06-23 18:26:43 +0200 (Wed, 23 Jun 2010)
New Revision: 2946
Url: http://chorem.org/repositories/revision/lima/2946
Log:
G?\195?\169n?\195?\169ration bilan et compte de r?\195?\169sultat (suite). Ajout d'un champ de calcul ?\195?\160 partir d'une extension de compte, pour calculer le r?\195?\169sultat.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java
trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -302,20 +302,22 @@
// Check rules for account if have entries
accountingRules.removeAccountRules(account, transaction);
-
+
+ // remove account
+ Account accountToDelete = accountDAO.findByTopiaId(account.getTopiaId());
+ accountDAO.delete(accountToDelete);
+
//get all subaccounts
List<Account> accounts = getAllChildrenAccounts(account, new ArrayList<Account>());
-
//if account have sub accounts
if (accounts.size() > 0){
for (Account subAccount : accounts) {
// Check rules for subaccount if have entries
- accountingRules.removeAccountRules(account, transaction);
- accountDAO.delete(subAccount);
+ accountingRules.removeAccountRules(subAccount, transaction);
+ Account subAccountToDelete = accountDAO.findByTopiaId(subAccount.getTopiaId());
+ accountDAO.delete(subAccountToDelete);
}
}
- // remove account
- accountDAO.delete(account);
//commit
commitTransaction(transaction);
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 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -21,11 +21,15 @@
import static org.nuiton.i18n.I18n._;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
+import java.util.StringTokenizer;
+
import javax.ejb.EJB;
import javax.ejb.Stateless;
+
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.FinancialStatementAmounts;
@@ -125,20 +129,24 @@
TopiaContext transaction = null;
try {
transaction = beginTransaction();
- FinancialStatementDAO financialStatementHeaderDAO =
+ FinancialStatementDAO financialStatementDAO =
LimaCallaoDAOHelper.getFinancialStatementDAO(transaction);
- //get all subFinancialStatementHeader and FinancialStatementMovement
+
+ // remove financialstatement
+ FinancialStatement financialStatementToDelete = financialStatementDAO.findByTopiaId(financialStatement.getTopiaId());
+ financialStatementDAO.delete(financialStatementToDelete);
+
+ //get all subFinancialStatement
List<FinancialStatement> financialStatements = getAllChildrenFinancialStatement(financialStatement, new ArrayList<FinancialStatement>());
- //if FinancialStatementHeader have subFinancialStatementHeader
+ //if FinancialStatement have subFinancialStatement
if (financialStatements.size() > 0){
for (FinancialStatement subFinancialStatement : financialStatements) {
- financialStatementHeaderDAO.delete(subFinancialStatement);
+ FinancialStatement subFinancialStatementToDelete = financialStatementDAO.findByTopiaId(subFinancialStatement.getTopiaId());
+ financialStatementDAO.delete(subFinancialStatementToDelete);
}
}
- // remove account
- financialStatementHeaderDAO.delete(financialStatement);
//commit
commitTransaction(transaction);
@@ -180,7 +188,8 @@
TopiaQuery query = financialStatementDAO.createQuery();
- query.addEquals("masterFinancialStatement", masterFinancialStatement);
+ query.addEquals("masterFinancialStatement", masterFinancialStatement)
+ .addOrder(FinancialStatement.LABEL);
financialStatements = financialStatementDAO.findAllByQuery(query);
}
catch (TopiaException ex) {
@@ -259,9 +268,40 @@
FinancialStatementDatas financialStatementDatas = financialStatementReport(subFinancialStatement, selectedBeginDate, selectedEndDate, result, topiaContext);
grossAmount += financialStatementDatas.getFinancialStatementAmounts().getGrossAmount();
provisionDeprecationAmount += financialStatementDatas.getFinancialStatementAmounts().getProvisionDeprecationAmount();
- subResult.add(financialStatementDatas.getFinancialStatementAmounts());
- if (financialStatementDatas.getListResult() != null){
- subResult.addAll(financialStatementDatas.getListResult());
+
+
+ FinancialStatementAmounts headerfinancialStatementAmounts = financialStatementDatas.getFinancialStatementAmounts();
+ //Si sous-total
+ if (subFinancialStatement.getSubAmount()){
+ FinancialStatementAmounts header = new FinancialStatementAmountsImpl();
+ header.setLabel(headerfinancialStatementAmounts.getLabel());
+ header.setLevel(headerfinancialStatementAmounts.getLevel());
+ header.setHeader(true);
+ //ajoute header
+ subResult.add(header);
+ //ajoute liste
+ if (financialStatementDatas.getListResult() != null){
+ subResult.addAll(financialStatementDatas.getListResult());
+ }
+ //ajoute sstotal
+ FinancialStatementAmounts subAmount = new FinancialStatementAmountsImpl();
+ subAmount.setLabel("TOTAL "+headerfinancialStatementAmounts.getLabel());
+ subAmount.setLevel(headerfinancialStatementAmounts.getLevel());
+ subAmount.setGrossAmount(headerfinancialStatementAmounts.getGrossAmount());
+ subAmount.setProvisionDeprecationAmount(headerfinancialStatementAmounts.getProvisionDeprecationAmount());
+ subAmount.setSubAmount(true);
+ subResult.add(subAmount);
+ //ajoute ligne vide
+ subResult.add(new FinancialStatementAmountsImpl());
+
+ }//sinon
+ else {
+ //ajoute head avec amount
+ subResult.add(headerfinancialStatementAmounts);
+ //ajoute liste
+ if (financialStatementDatas.getListResult() != null){
+ subResult.addAll(financialStatementDatas.getListResult());
+ }
}
}
}
@@ -290,52 +330,121 @@
new FinancialStatementAmountsImpl();
try {
+ // DEBIT & CREDIT
String accountsString = financialStatement.getAccounts();
- List<Account> accountsList = accountServiceLocal.
- stringToListAccountsWithTransaction(accountsString, topiaContext);
Double amount = 0.0;
- for (Account account : accountsList) {
- ReportsDatas reportsDatas = reportServiceLocal.
- generateAccountReportsWithTransaction(account,
- selectedBeginDate, selectedEndDate, topiaContext);
- amount += reportsDatas.getAmountSolde();
+ if (accountsString != null){
+ List<Account> accountsList = accountServiceLocal.
+ stringToListAccountsWithTransaction(accountsString, topiaContext);
+ for (Account account : accountsList) {
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(account,
+ selectedBeginDate, selectedEndDate, topiaContext);
+ amount += reportsDatas.getAmountSolde();
+ }
}
+ // CREDIT
String creditAccountsString = financialStatement.getCreditAccounts();
- List<Account> creditAccountsList = accountServiceLocal.
- stringToListAccountsWithTransaction(creditAccountsString, topiaContext);
Double creditAmount = 0.0;
- for (Account account : creditAccountsList) {
- ReportsDatas reportsDatas = reportServiceLocal.
- generateAccountReportsWithTransaction(account,
- selectedBeginDate, selectedEndDate, topiaContext);
- creditAmount += reportsDatas.getAmountCredit();
+ if (creditAccountsString != null){
+ List<Account> creditAccountsList = accountServiceLocal.
+ stringToListAccountsWithTransaction(creditAccountsString, topiaContext);
+ for (Account account : creditAccountsList) {
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(account,
+ selectedBeginDate, selectedEndDate, topiaContext);
+ creditAmount += reportsDatas.getAmountCredit();
+ }
}
+
+ // DEBIT
String debitAccountsString = financialStatement.getDebitAccounts();
- List<Account> debitAccountsList = accountServiceLocal.
- stringToListAccountsWithTransaction(debitAccountsString, topiaContext);
Double debitAmount = 0.0;
- for (Account account : debitAccountsList) {
- ReportsDatas reportsDatas = reportServiceLocal.
- generateAccountReportsWithTransaction(account,
- selectedBeginDate, selectedEndDate, topiaContext);
- debitAmount += reportsDatas.getAmountCredit();
+ if (debitAccountsString != null){
+ List<Account> debitAccountsList = accountServiceLocal.
+ stringToListAccountsWithTransaction(debitAccountsString, topiaContext);
+ for (Account account : debitAccountsList) {
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(account,
+ selectedBeginDate, selectedEndDate, topiaContext);
+ debitAmount += reportsDatas.getAmountCredit();
+ }
}
+
+ // PROVISION & DEPRECATION
String provisionDeprecationAccountsString =
financialStatement.getProvisionDeprecationAccounts();
- List<Account> provisionDeprecationAccountsList = accountServiceLocal.
+ Double provisionDeprecationAmount = 0.0;
+ if (provisionDeprecationAccountsString != null){
+ List<Account> provisionDeprecationAccountsList = accountServiceLocal.
stringToListAccountsWithTransaction(provisionDeprecationAccountsString, topiaContext);
- Double provisionDeprecationAmount = 0.0;
- for (Account account : provisionDeprecationAccountsList) {
- ReportsDatas reportsDatas = reportServiceLocal.
- generateAccountReportsWithTransaction(account,
- selectedBeginDate, selectedEndDate, topiaContext);
- provisionDeprecationAmount += reportsDatas.getAmountSolde();
+ for (Account account : provisionDeprecationAccountsList) {
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(account,
+ selectedBeginDate, selectedEndDate, topiaContext);
+ provisionDeprecationAmount += reportsDatas.getAmountSolde();
+ }
}
+
- financialStatementAmounts.setGrossAmount(amount+creditAmount+debitAmount);
+ // FORMULA
+ String formulaString =
+ financialStatement.getFormula();
+ Double formulaAmount = 0.0;
+ if (formulaString != null){
+ //Remove Spaces
+ formulaString = StringUtils.deleteWhitespace(formulaString);
+ log.debug(formulaString);
+ //Split simple quote
+ StringTokenizer stQuote = new StringTokenizer(formulaString, "'");
+ while (stQuote.hasMoreTokens()) {
+ String s = stQuote.nextToken();
+ log.debug(s);
+ if (s.contentEquals("-")){
+ s = stQuote.nextToken();
+ List<Account> accountsStringList = accountServiceLocal.
+ stringToListAccountsWithTransaction(s, topiaContext);
+ Double resAmount = 0.0;
+ for (Account accountString : accountsStringList) {
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(accountString,
+ selectedBeginDate, selectedEndDate, topiaContext);
+ resAmount += reportsDatas.getAmountSolde();
+ }
+ formulaAmount-=resAmount;
+ }
+ else if (s.contains("-")){
+ List<Account> accountsStringList = accountServiceLocal.
+ stringToListAccountsWithTransaction(s, topiaContext);
+ Double resAmount = 0.0;
+ for (Account accountString : accountsStringList) {
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(accountString,
+ selectedBeginDate, selectedEndDate, topiaContext);
+ resAmount += reportsDatas.getAmountSolde();
+ }
+ formulaAmount+=resAmount;
+ }
+ else{
+ List<Account> accountsStringList = accountServiceLocal.
+ stringToListAccountsWithTransaction(s, topiaContext);
+ Double resAmount = 0.0;
+ for (Account accountString : accountsStringList) {
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(accountString,
+ selectedBeginDate, selectedEndDate, topiaContext);
+ resAmount += reportsDatas.getAmountSolde();
+ }
+ formulaAmount+=resAmount;}
+ }
+ }
+
+
+ // set result
+ financialStatementAmounts.setGrossAmount(amount+creditAmount+debitAmount+formulaAmount);
financialStatementAmounts.setLabel(financialStatement.getLabel());
financialStatementAmounts.setProvisionDeprecationAmount(provisionDeprecationAmount);
financialStatementAmounts.setLevel(
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-06-23 16:26:43 UTC (rev 2946)
@@ -145,7 +145,7 @@
<JMenuItem text="lima.reports.entrybooks" onActionPerformed='getHandler().showEntryBookReports(this)'/>
<JMenuItem text="lima.reports.balance" onActionPerformed='getHandler().showBalanceView(this)'/>
<JMenuItem text="lima.reports.ledger" onActionPerformed='getHandler().showLedgerView(this)'/>
- <JMenuItem text="lima.financialstatementreports" onActionPerformed='getHandler().showFinancialStatementReportsView(this)' actionIcon='rapport'/>
+ <JMenuItem text="lima.reports.financialstatement" onActionPerformed='getHandler().showFinancialStatementReportsView(this)' actionIcon='rapport'/>
</JMenu>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -70,10 +70,10 @@
String res = null;
switch (column) {
case 0:
- res = _("lima.account.number");
+ res = _("lima.table.number");
break;
case 1:
- res = _("lima.account.label");
+ res = _("lima.table.label");
break;
}
return res;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -103,22 +103,22 @@
String res = "n/a";
switch (column) {
case 0:
- res = _("lima.transaction.column.date"); //Date
+ res = _("lima.table.date"); //Date
break;
case 1:
- res = _("lima.transaction.column.entrybook"); //EntryBook
+ res = _("lima.table.entrybook"); //EntryBook
break;
case 2:
- res = _("lima.transaction.column.voucher"); // Voucher
+ res = _("lima.table.voucher"); // Voucher
break;
case 3:
- res = _("lima.transaction.column.description"); //Description
+ res = _("lima.table.description"); //Description
break;
case 4:
- res = _("lima.transaction.column.debit"); //Debit
+ res = _("lima.table.debit"); //Debit
break;
case 5:
- res = _("lima.transaction.column.credit"); //Credit
+ res = _("lima.table.credit"); //Credit
break;
}
return res;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -92,22 +92,22 @@
String res = "n/a";
switch (column) {
case 0:
- res = _("lima.account.number"); // Numero de compte
+ res = _("lima.table.number"); // Numero de compte
break;
case 1:
- res = _("lima.account.label"); // Label
+ res = _("lima.table.label"); // Label
break;
case 2:
- res = _("lima.balance.move.debit"); // Total Debit
+ res = _("lima.table.move.debit"); // Total Debit
break;
case 3:
- res = _("lima.balance.move.credit"); // Total Credit
+ res = _("lima.table.move.credit"); // Total Credit
break;
case 4:
- res = _("lima.balance.solde.debit"); //Solde Debit
+ res = _("lima.table.solde.debit"); //Solde Debit
break;
case 5:
- res = _("lima.balance.solde.credit"); //Solde Credit
+ res = _("lima.table.solde.credit"); //Solde Credit
break;
}
return res;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -80,13 +80,13 @@
String res = "n/a";
switch (column) {
case 0:
- res = _("lima.entrybook.code");
+ res = _("lima.table.code");
break;
case 1:
- res = _("lima.entrybook.label");
+ res = _("lima.table.label");
break;
case 2:
- res = _("lima.entrybook.type");
+ res = _("lima.table.type");
break;
}
return res;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybooksreports/EntryBooksReportsTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -102,22 +102,22 @@
String res = "n/a";
switch (column) {
case 0:
- res = _("lima.transaction.column.date"); //Date
+ res = _("lima.table.date"); //Date
break;
case 1:
- res = _("lima.transaction.column.account"); //Account
+ res = _("lima.table.account"); //Account
break;
case 2:
- res = _("lima.transaction.column.voucher"); // Voucher
+ res = _("lima.table.voucher"); // Voucher
break;
case 3:
- res = _("lima.transaction.column.description"); //Description
+ res = _("lima.table.description"); //Description
break;
case 4:
- res = _("lima.transaction.column.debit"); //Debit
+ res = _("lima.table.debit"); //Debit
break;
case 5:
- res = _("lima.transaction.column.credit"); //Credit
+ res = _("lima.table.credit"); //Credit
break;
}
return res;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -82,13 +82,13 @@
switch(columnIndex) {
case 0 :
- result = _("lima.model.period");
+ result = _("lima.table.period");
break;
case 1:
- result = _("lima.entrybook");
+ result = _("lima.table.entrybook");
break;
case 2:
- result = _("lima.closure");
+ result = _("lima.table.closure");
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -69,7 +69,7 @@
String res = null;
switch (column) {
case 0:
- res = _("lima.account.label");
+ res = _("lima.table.label");
break;
}
return res;
@@ -195,7 +195,7 @@
/**
- * Update financialStatementHeader.
+ * Update financialStatement
*
* @param path
* @param account
@@ -210,7 +210,7 @@
/**
- * Remove financialStatementHeader or financialStatementMovement
+ * Remove financialStatement
*
* @param path
* @param object
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -48,11 +48,7 @@
private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
protected FinancialStatementChartView view;
-
- protected JXTreeTable treeTable;
-
- protected FinancialStatementChartTreeTableModel treeTableModel;
-
+
protected FinancialStatementChartViewHandler(FinancialStatementChartView view) {
this.view = view;
}
@@ -61,10 +57,10 @@
* Add new account with account form.
*/
public void addFinancialStatementHeader() {
- treeTable = view.getTreeTable();
- treeTableModel =
- (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+ JXTreeTable treeTable = view.getTreeTable();
+ FinancialStatementChartTreeTableModel treeTableModel = (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+
FinancialStatement newFinancialStatementHeader = new FinancialStatementImpl();
FinancialStatementHeaderForm financialStatementHeaderForm = new FinancialStatementHeaderForm(view);
financialStatementHeaderForm.setFinancialStatement(newFinancialStatementHeader);
@@ -107,9 +103,8 @@
public void addFinancialStatementMovement(){
- treeTable = view.getTreeTable();
- treeTableModel =
- (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+ JXTreeTable treeTable = view.getTreeTable();
+ FinancialStatementChartTreeTableModel treeTableModel = (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
FinancialStatement newFinancialStatementMovement = new FinancialStatementImpl();
FinancialStatementMovementForm financialStatementMovementForm = new FinancialStatementMovementForm(view);
@@ -151,9 +146,8 @@
*/
public void updateFinancialStatement() {
- treeTable = view.getTreeTable();
- treeTableModel =
- (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+ JXTreeTable treeTable = view.getTreeTable();
+ FinancialStatementChartTreeTableModel treeTableModel = (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
// get selected account
int selectedRow = view.treeTable.getSelectedRow();
@@ -207,9 +201,8 @@
* Ask for user to remove for selected account, and remove it if confirmed.
*/
public void removeFinancialStatement() {
- treeTable = view.getTreeTable();
- treeTableModel =
- (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+ JXTreeTable treeTable = view.getTreeTable();
+ FinancialStatementChartTreeTableModel treeTableModel = (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
// Any row selected
int selectedRow = view.treeTable.getSelectedRow();
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx 2010-06-23 16:26:43 UTC (rev 2946)
@@ -86,6 +86,17 @@
onRemoveUpdate='getFinancialStatement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())' />
</cell>
</row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.formula"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="formulaTextField" text="{getFinancialStatement().getFormula()}"/>
+ <javax.swing.text.Document javaBean="getFormulaTextField().getDocument()"
+ onInsertUpdate='getFinancialStatement().setFormula(getFormulaTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setFormula(getFormulaTextField().getText())' />
+ </cell>
+ </row>
<row>
<cell fill="none">
<JButton text="lima.common.ok" onActionPerformed="dispose()"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -27,6 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.beans.FinancialStatementAmounts;
import org.chorem.lima.business.FinancialPeriodService;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
@@ -66,7 +67,7 @@
//highlight financial financial transactions
colorTitle1();
- // addTitle2();
+ colorTitle2();
//Renderer for font
FinancialStatementReportTableCellRenderer renderer = new FinancialStatementReportTableCellRenderer();
@@ -77,7 +78,7 @@
}
/*
- * Color the background row in grey if the month number is even (pair in french)
+ * Color the background row in grey if the level is 1
*/
protected void colorTitle1() {
@@ -87,11 +88,10 @@
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
Boolean result = false;
- FinancialStatement financialStatementHeader = new FinancialStatementImpl();
Object object = model.getElementAt(adapter.row);
- if (model.getElementAt(adapter.row) instanceof FinancialStatement){
- financialStatementHeader = (FinancialStatement) object;
- result = financialStatementHeader.getLevel() == 1;
+ if (model.getElementAt(adapter.row) instanceof FinancialStatementAmounts){
+ FinancialStatementAmounts financialStatementAmounts = (FinancialStatementAmounts) object;
+ result = financialStatementAmounts.getLevel() == 1;
}
return result;
}
@@ -102,32 +102,27 @@
}
/*
- * Color the font in red if period are closed
+ * Color the background in light grey if is a subamount
*/
- protected void addTitle2() {
- /* HighlightPredicate predicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
- ClosedPeriodicEntryBook closedPeriodicEntryBook =
- new ClosedPeriodicEntryBookImpl();
- ClosedPeriodicEntryBook selectedClosedPeriodicEntryBook =
- (ClosedPeriodicEntryBook) model.getElementAt(adapter.row);
- // true if locked
- try {
- closedPeriodicEntryBook =
- financialPeriodService.getClosedPeriodicEntryBook(
- selectedClosedPeriodicEntryBook.getEntryBook(),
- selectedClosedPeriodicEntryBook.getFinancialPeriod());
- } catch (LimaException eee) {
- log.debug("Can't get closePeriodicEntryBook",eee);
- }
- return (closedPeriodicEntryBook.getLocked());
- }
- };
- colorTransaction =
- new ColorHighlighter(predicate, null, new Color(222,0,0));
- addHighlighter(colorTransaction);*/
- }
+ protected void colorTitle2() {
+
+
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ Boolean result = false;
+ Object object = model.getElementAt(adapter.row);
+ if (model.getElementAt(adapter.row) instanceof FinancialStatementAmounts){
+ FinancialStatementAmounts financialStatementAmounts = (FinancialStatementAmounts) object;
+ result = financialStatementAmounts.getSubAmount();
+ }
+ return result;
+ }
+ };
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(244,244,244), null);
+ addHighlighter(colorTransaction);
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -46,32 +46,24 @@
table, value, isSelected, hasFocus, row, column);
// Si le bilan est un soustotal, alors la ligne est en gras
- if (object instanceof FinancialStatement){
- FinancialStatement financialStatementHeader = (FinancialStatement) object;
+ if (object instanceof FinancialStatementAmounts){
+ FinancialStatementAmounts financialStatementAmounts = (FinancialStatementAmounts) object;
- if (financialStatementHeader.getLevel() == 1)
+ if (financialStatementAmounts.getLevel() == 1)
{
setFont(new Font("Verdana", Font.BOLD, 14));
}
- if (financialStatementHeader.getLevel() == 2)
+ if (financialStatementAmounts.getHeader())
{
setFont(new Font("Verdana", Font.BOLD, 12));
}
- }
- else {
-
- if (column == 0){
- cell.setFont(new Font("Verdana", Font.ITALIC, 12));
- }
- if (object instanceof FinancialStatementAmounts){
- if (((FinancialStatementAmounts) object).getHeader()){
- cell.setFont(new Font("Verdana", Font.BOLD, 12));
+ if (!financialStatementAmounts.getHeader() && !financialStatementAmounts.getSubAmount()){
+ if (column == 0){
+ cell.setFont(new Font("Verdana", Font.ITALIC, 12));
}
- }
-
+ }
}
-
// Alignement des cellules
/* switch (column) {
case 0:
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -64,9 +64,6 @@
/** DatePicker EndDate. */
protected Date selectedEndDate;
- /** Text field Accounts */
- protected String selectedAccounts;
-
/** data cache */
protected List<FinancialStatementAmounts> cacheDataList;
@@ -121,48 +118,44 @@
public Object getValueAt(int row, int column) {
Object result = cacheDataList.get(row);
//get entries for the period for the current row
- if (result instanceof FinancialStatement) {
- FinancialStatement currentRow = (FinancialStatement) result;
- switch (column) {
- case 0:
- result = "";
- for (int i = 0; i < currentRow.getLevel(); i++) {
- result = result+"\t";
- }
- result = result+currentRow.getLabel();
- break;
- case 1:
- result = null;
- break;
- case 2:
- result = null;
- break;
- case 3:
- result = null;
- break;
- }
-
- }
- else {
+ if (result instanceof FinancialStatementAmounts) {
FinancialStatementAmounts currentRow = (FinancialStatementAmounts) result;
Double grossAmount = currentRow.getGrossAmount();
Double provisionDeprecationAmount = currentRow.getProvisionDeprecationAmount();
switch (column) {
- case 0:
+ case 0:
result = "";
- for (int i = 0; i <= currentRow.getLevel(); i++) {
- result = result+"\t";
- }
- result = result+currentRow.getLabel();
+ String label = currentRow.getLabel();
+ if ( label != null){
+ for (int i = 0; i <= currentRow.getLevel(); i++) {
+ result = result+"\t";
+ }
+ result = result+label;
+ }
break;
case 1:
- result = grossAmount;
+ if (grossAmount == 0){
+ result = null;
+ }
+ else {
+ result = grossAmount;
+ }
break;
case 2:
- result = provisionDeprecationAmount;
+ if (provisionDeprecationAmount == 0){
+ result = null;
+ }
+ else {
+ result = provisionDeprecationAmount;
+ }
break;
case 3:
- result = grossAmount-provisionDeprecationAmount;
+ if (grossAmount-provisionDeprecationAmount == 0){
+ result = null;
+ }
+ else {
+ result = grossAmount-provisionDeprecationAmount;
+ }
break;
}
}
@@ -185,10 +178,6 @@
selectedEndDate = date;
}
- public void setAccountFilter(String accounts) {
- selectedAccounts = accounts;
- }
-
/**
* get all account fot the selected period
* @return
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 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx 2010-06-23 16:26:43 UTC (rev 2946)
@@ -68,21 +68,14 @@
onActionPerformed="getModelTable().setEndDate(endDatePicker.getDate());
getHandler().refresh()"/>
</cell>
- <cell anchor="east">
- <JTextField id="accountFilter"/>
- </cell>
- <cell anchor="west">
- <JButton text="lima.accountsreports.accountfilter"
- onActionPerformed="getModelTable().setAccountFilter(accountFilter.getText());
- getHandler().refresh()"/>
- </cell>
</row>
<row>
<cell fill="both" weightx="1" weighty="1" columns="7">
<JScrollPane>
- <org.jdesktop.swingx.JXTable id="table" rowHeight="24"
- model="{getModelTable()}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
+ <org.chorem.lima.ui.financialstatementreport.FinancialStatementReportTable id="table" rowHeight="24"
+ constructorParams="getHandler()"
+ model="{getModelTable()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
<javax.swing.ListSelectionModel javaBean="getTable().getSelectionModel()"/>
</JScrollPane>
</cell>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -186,31 +186,31 @@
switch (column) {
case 0:
- result = _("lima.transaction.column.date");
+ result = _("lima.table.date");
break;
case 1:
- result = _("lima.transaction.column.entrybook");
+ result = _("lima.table.entrybook");
break;
case 2:
- result = _("lima.transaction.column.voucher");
+ result = _("lima.table.voucher");
break;
case 3:
- result = _("lima.transaction.column.account");
+ result = _("lima.table.account");
break;
case 4:
- result = _("lima.transaction.column.description");
+ result = _("lima.table.description");
break;
case 5:
- result = _("lima.transaction.column.position");
+ result = _("lima.table.position");
break;
case 6:
- result = _("lima.transaction.column.debit");
+ result = _("lima.table.debit");
break;
case 7:
- result = _("lima.transaction.column.credit");
+ result = _("lima.table.credit");
break;
case 8:
- result = _("lima.transaction.column.balance");
+ result = _("lima.table.balance");
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -168,31 +168,31 @@
switch (column) {
case 0:
- result = _("lima.transaction.column.date");
+ result = _("lima.table.date");
break;
case 1:
- result = _("lima.transaction.column.entrybook");
+ result = _("lima.table.entrybook");
break;
case 2:
- result = _("lima.transaction.column.voucher");
+ result = _("lima.table.voucher");
break;
case 3:
- result = _("lima.transaction.column.account");
+ result = _("lima.table.account");
break;
case 4:
- result = _("lima.transaction.column.description");
+ result = _("lima.table.description");
break;
case 5:
- result = _("lima.transaction.column.position");
+ result = _("lima.table.position");
break;
case 6:
- result = _("lima.transaction.column.debit");
+ result = _("lima.table.debit");
break;
case 7:
- result = _("lima.transaction.column.credit");
+ result = _("lima.table.credit");
break;
case 8:
- result = _("lima.transaction.column.balance");
+ result = _("lima.table.balance");
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/fiscalperiod/FiscalPeriodTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -93,10 +93,10 @@
switch(columnIndex) {
case 0 :
- result = _("lima.tab.fiscalperiod");
+ result = _("lima.table.fiscalperiod");
break;
case 1:
- result = _("lima.closure");
+ result = _("lima.table.closure");
break;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-06-23 16:26:43 UTC (rev 2946)
@@ -107,28 +107,28 @@
String res = "n/a";
switch (column) {
case 0:
- res = _("lima.transaction.column.account"); //Account
+ res = _("lima.table.account"); //Account
break;
case 1:
- res = _("lima.transaction.column.date"); //Date
+ res = _("lima.table.date"); //Date
break;
case 2:
- res = _("lima.transaction.column.entrybook");
+ res = _("lima.table.entrybook");
break;
case 3:
- res = _("lima.transaction.column.voucher"); // Voucher
+ res = _("lima.table.voucher"); // Voucher
break;
case 4:
- res = _("lima.transaction.column.description"); //Description
+ res = _("lima.table.description"); //Description
break;
case 5:
- res = _("lima.transaction.column.debit"); //Debit
+ res = _("lima.table.debit"); //Debit
break;
case 6:
- res = _("lima.transaction.column.credit"); //Credit
+ res = _("lima.table.credit"); //Credit
break;
case 7:
- res = _("lima.transaction.column.solde");
+ res = _("lima.table.solde");
break;
}
return res;
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-23 16:26:43 UTC (rev 2946)
@@ -168,6 +168,7 @@
lima.financialstatement.accounts=
lima.financialstatement.creditaccounts=
lima.financialstatement.debitaccounts=
+lima.financialstatement.formula=
lima.financialstatement.header=
lima.financialstatement.header.add=
lima.financialstatement.label=
@@ -352,10 +353,30 @@
lima.tab.search.result=Search result
lima.tab.subledgers=
lima.tab.transaction=Transaction
+lima.table.account=
+lima.table.balance=
+lima.table.closure=
+lima.table.code=
+lima.table.credit=
+lima.table.date=
+lima.table.debit=
+lima.table.description=
+lima.table.entrybook=
+lima.table.fiscalperiod=
lima.table.grossamount=
lima.table.label=
+lima.table.move.credit=
+lima.table.move.debit=
lima.table.netamount=
+lima.table.number=
+lima.table.period=
+lima.table.position=
lima.table.provisiondeprecationamount=
+lima.table.solde=
+lima.table.solde.credit=
+lima.table.solde.debit=
+lima.table.type=
+lima.table.voucher=
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=About Lima...
lima.to=To
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 2010-06-22 11:34:43 UTC (rev 2945)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-23 16:26:43 UTC (rev 2946)
@@ -13,9 +13,9 @@
calendarPanel\ TODO=
lima.about.message=\u00C0 propos de Lima
lima.account=Compte
-lima.account.label=Libell\u00E9
+lima.account.label=
lima.account.menu=Plan de comptes
-lima.account.number=Num\u00E9ro du compte
+lima.account.number=
lima.account.parentnumber=
lima.account.type=Type de compte
lima.account.type1=Actif
@@ -43,12 +43,6 @@
lima.amountcredit=Total Cr\u00E9dit
lima.amountdebit=Total D\u00E9bit
lima.any.criteria=Au moins un crit\u00E8re correspond
-lima.balance.account.libelle=Libell\u00E9
-lima.balance.account.number=N\u00B0 de compte
-lima.balance.move.credit=Mouvement au cr\u00E9dit
-lima.balance.move.debit=Mouvement au d\u00E9bit
-lima.balance.solde.credit=Solde cr\u00E9dit
-lima.balance.solde.debit=Solde d\u00E9bit
lima.balance.total=Total
lima.bilan=Bilan
lima.bilan.actif=Actif
@@ -62,10 +56,9 @@
lima.charts.account=Plan comptable
lima.charts.entrybook=Journaux
lima.charts.financialperiod=P\u00E9riodes comptables
-lima.charts.financialstatement=
+lima.charts.financialstatement=Plan BCR
lima.charts.fiscalyear=Exercices
lima.close=Ferm\u00E9
-lima.closure=Cloture
lima.closure.period.begin=P\u00E9riode de
lima.closure.timespan.warning=Attention \: lorsque la p\u00E9riode est bloqu\u00E9e, il n'est plus possible d'ajouter, modifier et supprimer les entr\u00E9es comptables sur cette p\u00E9riode.
lima.common.add=Ajout Compte G\u00E9n\u00E9ral
@@ -111,9 +104,9 @@
lima.entries.searchunbalancedtransaction=Entr\u00E9es non \u00E9quilibr\u00E9es
lima.entrybook=Journal
lima.entrybook.add=Ajouter un journal
-lima.entrybook.code=Code
-lima.entrybook.label=Libelle
-lima.entrybook.type=Type
+lima.entrybook.code=
+lima.entrybook.label=
+lima.entrybook.type=
lima.entrybook.type1=Achats
lima.entrybook.type2=Ventes
lima.entrybook.type3=Tr\u00E9sorerie
@@ -163,17 +156,15 @@
lima.filter.starts.with=Commence par
lima.financialperiod.block=Cloturer une p\u00E9riode
lima.financialperiod.management=
-lima.financialstatement.accounts=
-lima.financialstatement.creditaccounts=
-lima.financialstatement.debitaccounts=
-lima.financialstatement.header=
-lima.financialstatement.header.add=Regrouprement
-lima.financialstatement.label=
-lima.financialstatement.movement.add=
-lima.financialstatement.provisiondeprecationaccounts=
-lima.financialstatement.style=
-lima.financialstatement.subamount=
-lima.financialstatementreports=
+lima.financialstatement.accounts=Liste de comptes au cr\u00E9dit et au d\u00E9bit
+lima.financialstatement.creditaccounts=Liste de comptes au cr\u00E9dit
+lima.financialstatement.debitaccounts=Liste de comptes au d\u00E9bit
+lima.financialstatement.formula=Formule de compte, ex \: '7'-'6'+'510-520'
+lima.financialstatement.header.add=Ajouter une cat\u00E9gorie
+lima.financialstatement.label=Libell\u00E9
+lima.financialstatement.movement.add=Ajouter un regrouprement
+lima.financialstatement.provisiondeprecationaccounts=Liste de comptes d'amortissement et provisions
+lima.financialstatement.subamount=Calculer un sous-total
lima.find.transaction=Rechercher transaction
lima.fiscalperiod.addFiscalPeriod=Nouvel exercice
lima.fiscalperiod.block=Cloturer un exercice
@@ -292,7 +283,7 @@
lima.reports.accounts=Edition compte
lima.reports.balance=Balance
lima.reports.entrybooks=Edition journal
-lima.reports.financialstatement=
+lima.reports.financialstatement=Bilan et Compte de r\u00E9sultat
lima.reports.ledger=Grand Livre
lima.response.no=Non
lima.response.yes=Oui
@@ -321,28 +312,37 @@
lima.subledger.type=
lima.success=Succ\u00E8s
lima.tab.bilan=
-lima.tab.fiscalperiod=
+lima.tab.fiscalperiod=Exercice
lima.tab.home=Accueil
lima.tab.reports=
lima.tab.result=
-lima.table.grossamount=
-lima.table.label=
-lima.table.netamount=
-lima.table.provisiondeprecationamount=
+lima.table.account=Compte
+lima.table.balance=Balance
+lima.table.closure=Cloture
+lima.table.code=Code
+lima.table.credit=Cr\u00E9dit
+lima.table.date=Date
+lima.table.debit=D\u00E9bit
+lima.table.description=Description
+lima.table.entrybook=Journal
+lima.table.fiscalperiod=Exercice
+lima.table.grossamount=Brut
+lima.table.label=Libell\u00E9
+lima.table.move.credit=Mouvement au cr\u00E9dit
+lima.table.move.debit=Mouvement au d\u00E9bit
+lima.table.netamount=Net
+lima.table.number=Num\u00E9ro du compte
+lima.table.period=P\u00E9riode
+lima.table.position=Statut
+lima.table.provisiondeprecationamount=Amortissements et provisions
+lima.table.solde=Solde
+lima.table.solde.credit=Solde cr\u00E9dit
+lima.table.solde.debit=Solde d\u00E9bit
+lima.table.type=Type
+lima.table.voucher=Pi\u00E8ce comptable
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=A propos de Lima...
lima.to=A
-lima.transaction.column.account=Compte
-lima.transaction.column.balance=Balance
-lima.transaction.column.credit=Cr\u00E9dit
-lima.transaction.column.date=Date
-lima.transaction.column.debit=D\u00E9bit
-lima.transaction.column.description=Description
-lima.transaction.column.entrybook=Journal
-lima.transaction.column.period=P\u00E9riode
-lima.transaction.column.position=Statut
-lima.transaction.column.solde=Solde
-lima.transaction.column.voucher=Pi\u00E8ce comptable
lima.transaction.confirmdelete=
lima.transaction.entrybook=Journal
lima.transaction.period=P\u00E9riode
1
0
22 Jun '10
Author: jpepin
Date: 2010-06-22 13:34:43 +0200 (Tue, 22 Jun 2010)
New Revision: 2945
Url: http://chorem.org/repositories/revision/lima/2945
Log:
M?\195?\169thodes minimales de calcul du bilan et compte de r?\195?\169sultat. R?\195?\169vision du mod?\195?\168le pour encapsuler les donn?\195?\169es.
Added:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java
Removed:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.properties
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx
trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties
trunk/pom.xml
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java 2010-06-22 11:34:43 UTC (rev 2945)
@@ -23,22 +23,21 @@
import java.util.List;
import javax.ejb.Remote;
-import org.chorem.lima.entity.FinancialStatementHeader;
-import org.chorem.lima.entity.FinancialStatementMovement;
+import org.chorem.lima.beans.FinancialStatementAmounts;
+import org.chorem.lima.entity.FinancialStatement;
+
@Remote
public interface FinancialStatementService {
- public void createFinancialStatementHeader(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
- public void updateFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
- public void removeFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
+
+ public void createFinancialStatement(FinancialStatement masterFinancialStatement, FinancialStatement financialStatement) throws LimaException, LimaBusinessException;
+ public void updateFinancialStatement(FinancialStatement financialStatement) throws LimaException, LimaBusinessException;
+ public void removeFinancialStatement(FinancialStatement financialStatement) throws LimaException, LimaBusinessException;
- public void createFinancialStatementMovement(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
- public void updateFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
- public void removeFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
+ public List<FinancialStatement> getChildrenFinancialStatement(FinancialStatement financialStatement) throws LimaException;
+ public List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement, List<FinancialStatement> financialStatements) throws LimaException, LimaBusinessException;
- public List<Object> getChildrenFinancialStatement(FinancialStatementHeader financialStatementHeader) throws LimaException;
- public List<Object> getAllChildrenFinancialStatement(FinancialStatementHeader financialStatementHeader, List<Object> objects) throws LimaException, LimaBusinessException;
+ public List<FinancialStatementAmounts> financialStatementReport(Date selectedBeginDate, Date selectedEndDate) throws LimaException;
- public List<Object> financialStatementReports(Date selectedBeginDate, Date selectedEndDate) throws LimaException;
}
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 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-22 11:34:43 UTC (rev 2945)
@@ -21,6 +21,7 @@
import static org.nuiton.i18n.I18n._;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Date;
import java.util.List;
import javax.ejb.EJB;
@@ -29,6 +30,8 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.beans.FinancialStatementAmounts;
import org.chorem.lima.beans.FinancialStatementAmountsImpl;
+import org.chorem.lima.beans.FinancialStatementDatas;
+import org.chorem.lima.beans.FinancialStatementDatasImpl;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.AccountServiceLocal;
import org.chorem.lima.business.AccountingRules;
@@ -39,10 +42,8 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportServiceLocal;
import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.FinancialStatementHeader;
-import org.chorem.lima.entity.FinancialStatementHeaderDAO;
-import org.chorem.lima.entity.FinancialStatementMovement;
-import org.chorem.lima.entity.FinancialStatementMovementDAO;
+import org.chorem.lima.entity.FinancialStatement;
+import org.chorem.lima.entity.FinancialStatementDAO;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
@@ -78,32 +79,33 @@
accountingRules = config.getAccountingRules();
}
+
@Override
- public void createFinancialStatementHeader(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException {
+ public void createFinancialStatement(FinancialStatement masterFinancialStatement, FinancialStatement financialStatement) throws LimaException, LimaBusinessException {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
// check if FinancialStatementHeader label already exist
- FinancialStatementHeaderDAO financialStatementHeaderDAO =
- LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
+ FinancialStatementDAO financialStatementDAO =
+ LimaCallaoDAOHelper.getFinancialStatementDAO(transaction);
- FinancialStatementHeader existFinancialStatementHeader =
- financialStatementHeaderDAO.findByLabel(financialStatementHeader.getLabel());
+ FinancialStatement existFinancialStatementHeader =
+ financialStatementDAO.findByLabel(financialStatement.getLabel());
if (existFinancialStatementHeader != null) {
throw new LimaBusinessException(_(
"An financialStatement already exists with this label : %s",
- financialStatementHeader.getLabel()));
+ financialStatement.getLabel()));
}
- financialStatementHeaderDAO.create(financialStatementHeader);
+ financialStatementDAO.create(financialStatement);
// check if parent account exist;
- if (masterFinancialStatementHeader != null) {
- masterFinancialStatementHeader.addSubFinancialStatementHeaders(financialStatementHeader);
- financialStatementHeaderDAO.update(masterFinancialStatementHeader);
+ if (masterFinancialStatement != null) {
+ masterFinancialStatement.addSubFinancialStatements(financialStatement);
+ financialStatementDAO.update(masterFinancialStatement);
}
commitTransaction(transaction);
@@ -116,74 +118,27 @@
}
}
+
@Override
- public void createFinancialStatementMovement(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException {
+ public void removeFinancialStatement(FinancialStatement financialStatement) throws LimaException, LimaBusinessException {
- TopiaContext transaction = null;
- try {
- transaction = beginTransaction();
-
- // check if FinancialStatementMovement label already exist
- FinancialStatementMovementDAO financialStatementMovementDAO =
- LimaCallaoDAOHelper.getFinancialStatementMovementDAO(transaction);
- FinancialStatementHeaderDAO financialStatementHeaderDAO =
- LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
-
- FinancialStatementMovement existFinancialStatementMovement =
- financialStatementMovementDAO.findByLabel(financialStatementMovement.getLabel());
-
- if (existFinancialStatementMovement != null) {
- throw new LimaBusinessException(_(
- "An financialStatement already exists with this label : %s",
- financialStatementMovement.getLabel()));
- }
-
- // check if masterFinancialStatementHeader exist;
- if (masterFinancialStatementHeader != null) {
- //create it
- financialStatementMovementDAO.create(financialStatementMovement);
- //update master
- masterFinancialStatementHeader.addFinancialStatementMovement(financialStatementMovement);
- financialStatementHeaderDAO.update(masterFinancialStatementHeader);
- }
-
- commitTransaction(transaction);
- }
- catch (Exception ex) {
- doCatch(transaction, ex, log);
- }
- finally {
- doFinally(transaction, log);
- }
-
- }
-
- @Override
- public void removeFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException {
-
TopiaContext transaction = null;
try {
transaction = beginTransaction();
- FinancialStatementHeaderDAO financialStatementHeaderDAO =
- LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
+ FinancialStatementDAO financialStatementHeaderDAO =
+ LimaCallaoDAOHelper.getFinancialStatementDAO(transaction);
//get all subFinancialStatementHeader and FinancialStatementMovement
- List<Object> objects = getAllChildrenFinancialStatement(financialStatementHeader, new ArrayList<Object>());
+ List<FinancialStatement> financialStatements = getAllChildrenFinancialStatement(financialStatement, new ArrayList<FinancialStatement>());
//if FinancialStatementHeader have subFinancialStatementHeader
- if (objects.size() > 0){
- for (Object object : objects) {
- if (object instanceof FinancialStatementHeader){
- financialStatementHeaderDAO.delete((FinancialStatementHeader) object);
- }
- else {
- //remove financial statement movement
- removeFinancialStatementMovementWithTransaction((FinancialStatementMovement) object, transaction);
- }
+ if (financialStatements.size() > 0){
+ for (FinancialStatement subFinancialStatement : financialStatements) {
+ financialStatementHeaderDAO.delete(subFinancialStatement);
}
}
// remove account
- financialStatementHeaderDAO.delete(financialStatementHeader);
+ financialStatementHeaderDAO.delete(financialStatement);
//commit
commitTransaction(transaction);
@@ -198,82 +153,35 @@
}
- @Override
- public void removeFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException {
- TopiaContext transaction = null;
- try {
- transaction = beginTransaction();
- removeFinancialStatementMovementWithTransaction(financialStatementMovement, transaction);
- }
- catch (TopiaException ex) {
- doCatch(transaction, ex, log);
- }
- finally {
- doFinally(transaction, log);
- }
- }
-
-
- public void removeFinancialStatementMovementWithTransaction(FinancialStatementMovement financialStatementMovement, TopiaContext topiaContext) throws LimaException, LimaBusinessException {
- try{
- FinancialStatementMovementDAO financialStatementMovementDAO =
- LimaCallaoDAOHelper.getFinancialStatementMovementDAO(topiaContext);
- financialStatementMovementDAO.delete(financialStatementMovement);
- //commit
- commitTransaction(topiaContext);
- }
- catch (TopiaException ex) {
- doCatch(topiaContext, ex, log);
- }
- }
@Override
- public List<Object> getAllChildrenFinancialStatement(FinancialStatementHeader financialStatementHeader, List<Object> objects) throws LimaException, LimaBusinessException {
- List<Object> childFinancialStatement = getChildrenFinancialStatement(financialStatementHeader);
- for (Object child : childFinancialStatement) {
- objects.add(child);
- if (child instanceof FinancialStatementHeader){
- getAllChildrenFinancialStatement((FinancialStatementHeader) child, objects);
- }
+ public List<FinancialStatement> getAllChildrenFinancialStatement(FinancialStatement financialStatement, List<FinancialStatement> result) throws LimaException, LimaBusinessException {
+ List<FinancialStatement> childFinancialStatements = getChildrenFinancialStatement(financialStatement);
+ for (FinancialStatement childFinancialStatement: childFinancialStatements) {
+ result.add(childFinancialStatement);
+ getAllChildrenFinancialStatement(childFinancialStatement, result);
}
- return objects;
+ return result;
}
+
@Override
- public List<Object> getChildrenFinancialStatement(FinancialStatementHeader masterFinancialStatementHeader) throws LimaException {
- List<Object> objects = new ArrayList<Object>();
+ public List<FinancialStatement> getChildrenFinancialStatement(FinancialStatement masterFinancialStatement) throws LimaException {
+ List<FinancialStatement> financialStatements = null;
TopiaContext transaction = null;
try {
transaction = beginTransaction();
- FinancialStatementHeaderDAO financialStatementHeaderDAO =
- LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
+ FinancialStatementDAO financialStatementDAO =
+ LimaCallaoDAOHelper.getFinancialStatementDAO(transaction);
- TopiaQuery query = financialStatementHeaderDAO.createQuery();
- if (masterFinancialStatementHeader == null){
- query.addEquals("masterFinancialStatementHeader", masterFinancialStatementHeader);
- }
- //TODO virer addwhere, garder addEquals
- else {
- query.addWhere("masterFinancialStatementHeader = :value")
- .addParam("value", masterFinancialStatementHeader);
- }
- objects.addAll(financialStatementHeaderDAO.findAllByQuery(query));
-
- if (objects.isEmpty()){
- FinancialStatementMovementDAO financialStatementMovementDAO =
- LimaCallaoDAOHelper.getFinancialStatementMovementDAO(transaction);
- TopiaQuery query2 = financialStatementMovementDAO.createQuery();
- if (masterFinancialStatementHeader != null){
- query2.addWhere("financialStatementHeader = :value")
- .addParam("value", masterFinancialStatementHeader);
- }
- objects.addAll(financialStatementMovementDAO.findAllByQuery(query2));
- }
+ TopiaQuery query = financialStatementDAO.createQuery();
+ query.addEquals("masterFinancialStatement", masterFinancialStatement);
+ financialStatements = financialStatementDAO.findAllByQuery(query);
}
catch (TopiaException ex) {
doCatch(transaction, ex, log);
@@ -281,20 +189,21 @@
finally {
doFinally(transaction, log);
}
- return objects;
+ return financialStatements;
}
+
@Override
- public void updateFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException {
+ public void updateFinancialStatement(FinancialStatement financialStatement) throws LimaException, LimaBusinessException {
TopiaContext transaction = null;
try {
transaction = beginTransaction();
// DAO
- FinancialStatementHeaderDAO financialStatementHeaderDAO =
- LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
+ FinancialStatementDAO financialStatementHeaderDAO =
+ LimaCallaoDAOHelper.getFinancialStatementDAO(transaction);
//update
- financialStatementHeaderDAO.update(financialStatementHeader);
+ financialStatementHeaderDAO.update(financialStatement);
//commit
commitTransaction(transaction);
}
@@ -306,101 +215,131 @@
}
}
+
+
+ /**
+ * remote methode to get list of financial statement
+ */
@Override
- public void updateFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException {
+ public List<FinancialStatementAmounts> financialStatementReport(Date selectedBeginDate, Date selectedEndDate) throws LimaException{
TopiaContext transaction = null;
+ List<FinancialStatementAmounts> result = null;
try {
- transaction = beginTransaction();
+ transaction = beginTransaction();
+ //create list form tree
+ result = financialStatementReport(null, selectedBeginDate, selectedEndDate, new FinancialStatementDatasImpl(), transaction).getListResult();
- // DAO
- FinancialStatementMovementDAO financialStatementMovementDAO =
- LimaCallaoDAOHelper.getFinancialStatementMovementDAO(transaction);
- //update
- financialStatementMovementDAO.update(financialStatementMovement);
- //commit
- commitTransaction(transaction);
- }
+ }
catch (TopiaException ex) {
doCatch(transaction, ex, log);
}
finally {
doFinally(transaction, log);
- }
+ }
+ return result;
}
-
- @Override
- public List<Object> financialStatementReports(Date selectedBeginDate, Date selectedEndDate) throws LimaException {
- List<Object> result = new ArrayList<Object>();
- TopiaContext transaction = null;
- try {
- transaction = beginTransaction();
- List<Object> financialStatementList = getAllChildrenFinancialStatement(null, new ArrayList<Object>());
-
- for (Object object : financialStatementList) {
- if (object instanceof FinancialStatementMovement){
- FinancialStatementAmounts financialStatementAmounts = financialStatementMovementAmounts((FinancialStatementMovement) object, selectedBeginDate, selectedEndDate, transaction);
- result.add(financialStatementAmounts);
+
+
+ public FinancialStatementDatas financialStatementReport(FinancialStatement financialStatement, Date selectedBeginDate, Date selectedEndDate,FinancialStatementDatas result, TopiaContext topiaContext) throws LimaException{
+
+ List<FinancialStatement> financialStatements =
+ getChildrenFinancialStatement(financialStatement);
+ try {
+ Double grossAmount = 0.0, provisionDeprecationAmount = 0.0;
+ List<FinancialStatementAmounts> subResult = new ArrayList<FinancialStatementAmounts>();
+ for (FinancialStatement subFinancialStatement : financialStatements) {
+ FinancialStatementAmounts financialStatementAmounts = financialStatementAmounts(subFinancialStatement, selectedBeginDate, selectedEndDate, topiaContext);
+ if (!subFinancialStatement.getHeader()){
+ //on calcul
+ grossAmount += financialStatementAmounts.getGrossAmount();
+ provisionDeprecationAmount += financialStatementAmounts.getProvisionDeprecationAmount();
+ subResult.add(financialStatementAmounts);
}
else {
- result.add(object);
+ FinancialStatementDatas financialStatementDatas = financialStatementReport(subFinancialStatement, selectedBeginDate, selectedEndDate, result, topiaContext);
+ grossAmount += financialStatementDatas.getFinancialStatementAmounts().getGrossAmount();
+ provisionDeprecationAmount += financialStatementDatas.getFinancialStatementAmounts().getProvisionDeprecationAmount();
+ subResult.add(financialStatementDatas.getFinancialStatementAmounts());
+ if (financialStatementDatas.getListResult() != null){
+ subResult.addAll(financialStatementDatas.getListResult());
+ }
}
}
- }
- catch (TopiaException ex) {
- doCatch(transaction, ex, log);
- }
- finally {
- doFinally(transaction, log);
- }
-
+ FinancialStatementAmounts financialStatementAmounts = new FinancialStatementAmountsImpl();
+ financialStatementAmounts.setGrossAmount(grossAmount);
+ financialStatementAmounts.setProvisionDeprecationAmount(provisionDeprecationAmount);
+ if (financialStatement != null){
+ financialStatementAmounts.setLabel(financialStatement.getLabel());
+ financialStatementAmounts.setHeader(financialStatement.getHeader());
+ financialStatementAmounts.setLevel(financialStatement.getLevel());
+ }
+ result.setFinancialStatementAmounts(financialStatementAmounts);
+ result.setListResult(subResult);
+ }
+ catch (LimaException eee) {
+ doCatch(topiaContext, eee, log);
+ }
return result;
}
- public FinancialStatementAmounts financialStatementMovementAmounts(FinancialStatementMovement financialStatementMovement, Date selectedBeginDate, Date selectedEndDate, TopiaContext topiaContext) throws LimaException{
- FinancialStatementAmounts financialStatementAmounts = new FinancialStatementAmountsImpl();
+ /**
+ * Permet de calculer tous les comptes contenu dans un mouvement
+ */
+ public FinancialStatementAmounts financialStatementAmounts(FinancialStatement financialStatement, Date selectedBeginDate, Date selectedEndDate, TopiaContext topiaContext) throws LimaException{
+ FinancialStatementAmounts financialStatementAmounts =
+ new FinancialStatementAmountsImpl();
try {
- String accountsString = financialStatementMovement.getAccounts();
+ String accountsString = financialStatement.getAccounts();
List<Account> accountsList = accountServiceLocal.
stringToListAccountsWithTransaction(accountsString, topiaContext);
Double amount = 0.0;
for (Account account : accountsList) {
- ReportsDatas reportsDatas = reportServiceLocal.generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext);
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(account,
+ selectedBeginDate, selectedEndDate, topiaContext);
amount += reportsDatas.getAmountSolde();
}
- String creditAccountsString = financialStatementMovement.getCreditAccounts();
+ String creditAccountsString = financialStatement.getCreditAccounts();
List<Account> creditAccountsList = accountServiceLocal.
stringToListAccountsWithTransaction(creditAccountsString, topiaContext);
Double creditAmount = 0.0;
for (Account account : creditAccountsList) {
- ReportsDatas reportsDatas = reportServiceLocal.generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext);
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(account,
+ selectedBeginDate, selectedEndDate, topiaContext);
creditAmount += reportsDatas.getAmountCredit();
}
- String debitAccountsString = financialStatementMovement.getDebitAccounts();
+ String debitAccountsString = financialStatement.getDebitAccounts();
List<Account> debitAccountsList = accountServiceLocal.
stringToListAccountsWithTransaction(debitAccountsString, topiaContext);
Double debitAmount = 0.0;
for (Account account : debitAccountsList) {
- ReportsDatas reportsDatas = reportServiceLocal.generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext);
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(account,
+ selectedBeginDate, selectedEndDate, topiaContext);
debitAmount += reportsDatas.getAmountCredit();
}
String provisionDeprecationAccountsString =
- financialStatementMovement.getProvisionDeprecationAccounts();
+ financialStatement.getProvisionDeprecationAccounts();
List<Account> provisionDeprecationAccountsList = accountServiceLocal.
stringToListAccountsWithTransaction(provisionDeprecationAccountsString, topiaContext);
Double provisionDeprecationAmount = 0.0;
for (Account account : provisionDeprecationAccountsList) {
- ReportsDatas reportsDatas = reportServiceLocal.generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext);
+ ReportsDatas reportsDatas = reportServiceLocal.
+ generateAccountReportsWithTransaction(account,
+ selectedBeginDate, selectedEndDate, topiaContext);
provisionDeprecationAmount += reportsDatas.getAmountSolde();
}
financialStatementAmounts.setGrossAmount(amount+creditAmount+debitAmount);
- financialStatementAmounts.setLabel(financialStatementMovement.getLabel());
+ financialStatementAmounts.setLabel(financialStatement.getLabel());
financialStatementAmounts.setProvisionDeprecationAmount(provisionDeprecationAmount);
- financialStatementAmounts.setHeaderLevel(financialStatementMovement.getFinancialStatementHeader().getLevel());
+ financialStatementAmounts.setLevel(
+ financialStatement.getLevel());
}
Deleted: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java 2010-06-22 11:34:43 UTC (rev 2945)
@@ -1,18 +0,0 @@
-package org.chorem.lima.entity;
-
-public class FinancialStatementHeaderImpl extends FinancialStatementHeaderAbstract{
-
- protected Integer level;
-
- @Override
- public int getLevel() {
- if (level == null) {
- if (masterFinancialStatementHeader != null){
- level = masterFinancialStatementHeader.getLevel() + 1;
- } else {
- level = 1;
- }
- }
- return level;
- }
-}
Copied: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java (from rev 2944, trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java)
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementImpl.java 2010-06-22 11:34:43 UTC (rev 2945)
@@ -0,0 +1,18 @@
+package org.chorem.lima.entity;
+
+public class FinancialStatementImpl extends FinancialStatementAbstract{
+
+ protected Integer level;
+
+ @Override
+ public int getLevel() {
+ if (level == null) {
+ if (masterFinancialStatement != null){
+ level = masterFinancialStatement.getLevel() + 1;
+ } else {
+ level = 1;
+ }
+ }
+ return level;
+ }
+}
Modified: trunk/lima-callao/src/main/xmi/accounting.properties
===================================================================
--- trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-22 11:34:43 UTC (rev 2945)
@@ -4,10 +4,8 @@
org.chorem.lima.entity.Account.attribute.subLedgers.tagvalue.lazy=false
org.chorem.lima.entity.FinancialTransaction.attribute.financialPeriod.tagvalue.lazy=false
org.chorem.lima.entity.FiscalPeriod.attribute.financialPeriod.tagvalue.lazy=false
-org.chorem.lima.entity.FinancialStatementHeader.attribute.subFinancialStatementHeaders.tagvalue.lazy=false
-org.chorem.lima.entity.FinancialStatementHeader.attribute.financialStatementMovement.tagvalue.lazy=false
-org.chorem.lima.entity.FinancialStatementHeader.attribute.masterFinancialStatementHeader.tagvalue.lazy=false
-org.chorem.lima.entity.FinancialStatementMovement.attribute.financialStatementHeader.tagvalue.lazy=false
+org.chorem.lima.entity.FinancialStatement.attribute.subFinancialStatements.tagvalue.lazy=false
+org.chorem.lima.entity.FinancialStatement.attribute.masterFinancialStatement.tagvalue.lazy=false
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
@@ -25,9 +25,8 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialStatementService;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.entity.FinancialStatementHeader;
-import org.chorem.lima.entity.FinancialStatementHeaderImpl;
-import org.chorem.lima.entity.FinancialStatementMovement;
+import org.chorem.lima.entity.FinancialStatement;
+import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
@@ -54,7 +53,7 @@
*/
public FinancialStatementChartTreeTableModel() {
//create root for the tree
- super(new FinancialStatementHeaderImpl());
+ super(new FinancialStatementImpl());
// Gets factory service
financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService();
}
@@ -88,9 +87,8 @@
}
}
else {
- if (node instanceof FinancialStatementHeader){
- FinancialStatementHeader parentFinancialStatementHeader =
- (FinancialStatementHeader) node;
+ FinancialStatement parentFinancialStatementHeader =
+ (FinancialStatement) node;
try {
result = financialStatementService.getChildrenFinancialStatement(
parentFinancialStatementHeader).size();
@@ -98,7 +96,6 @@
log.debug("Can't count child", eee);
}
}
- }
return result;
}
@@ -107,20 +104,20 @@
Object result = null;
if (parent == getRoot()) {
try {
- List<Object> allObjects =
+ List<FinancialStatement> financialStatements =
financialStatementService.getChildrenFinancialStatement(null);
- result = allObjects.get(index);
+ result = financialStatements.get(index);
} catch (LimaException eee) {
log.debug("Can't get child", eee);
}
}
else {
- FinancialStatementHeader parentFinancialStatementHeader =
- (FinancialStatementHeader) parent;
+ FinancialStatement parentFinancialStatement =
+ (FinancialStatement) parent;
try {
- List<Object> objects = financialStatementService.
- getChildrenFinancialStatement(parentFinancialStatementHeader);
- result = objects.get(index);
+ List<FinancialStatement> financialStatements = financialStatementService.
+ getChildrenFinancialStatement(parentFinancialStatement);
+ result = financialStatements.get(index);
} catch (LimaException eee) {
log.debug("Can't get child", eee);
}
@@ -134,20 +131,20 @@
if (parent == getRoot()) {
try {
- List<Object> allObjects =
+ List<FinancialStatement> financialStatements =
financialStatementService.getChildrenFinancialStatement(null);
- result = allObjects.indexOf(child);
+ result = financialStatements.indexOf(child);
} catch (LimaException eee) {
log.debug("Can't get index child", eee);
}
}
else {
- FinancialStatementHeader parentFinancialStatementHeader =
- (FinancialStatementHeader) parent;
+ FinancialStatement parentFinancialStatement =
+ (FinancialStatement) parent;
try {
- List<Object> objects = financialStatementService.
- getChildrenFinancialStatement(parentFinancialStatementHeader);
- result = objects.indexOf(child);
+ List<FinancialStatement> financialStatements = financialStatementService.
+ getChildrenFinancialStatement(parentFinancialStatement);
+ result = financialStatements.indexOf(child);
} catch (LimaException eee) {
log.debug("Can't get index child", eee);
}
@@ -158,22 +155,12 @@
@Override
public Object getValueAt(Object node, int column) {
Object result = "n/a";
- if (node instanceof FinancialStatementHeader) {
- FinancialStatementHeader financialStatementHeader = (FinancialStatementHeader) node;
+ FinancialStatement financialStatement = (FinancialStatement) node;
switch (column) {
case 0:
- result = financialStatementHeader.getLabel();
+ result = financialStatement.getLabel();
break;
}
- }
- else {
- FinancialStatementMovement financialStatementMovement = (FinancialStatementMovement) node;
- switch (column) {
- case 0:
- result = financialStatementMovement.getLabel();
- break;
- }
- }
return result;
}
@@ -194,34 +181,18 @@
* @param account
* @throws LimaException
*/
- public void addFinancialStatementHeader(TreePath path, FinancialStatementHeader financialStatementHeader) throws LimaException {
+ public void addFinancialStatement(TreePath path, FinancialStatement financialStatement) throws LimaException {
// Calling account service
- FinancialStatementHeader parentFinancialStatementHeader =
- (FinancialStatementHeader) path.getLastPathComponent();
+ FinancialStatement parentFinancialStatementHeader =
+ (FinancialStatement) path.getLastPathComponent();
if (parentFinancialStatementHeader == getRoot()) {
parentFinancialStatementHeader = null;
}
- financialStatementService.createFinancialStatementHeader(
- parentFinancialStatementHeader, financialStatementHeader);
- modelSupport.fireTreeStructureChanged(path.getParentPath());
+ financialStatementService.createFinancialStatement(
+ parentFinancialStatementHeader, financialStatement);
+ modelSupport.fireTreeStructureChanged(path);
}
- /**
- * Add FinancialStatementMovement (path can't be null).
- *
- * @param path
- * @param account
- * @throws LimaException
- */
- public void addFinancialStatementMovement(TreePath path, FinancialStatementMovement financialStatementMovement) throws LimaException {
- // Calling account service
- FinancialStatementHeader parentFinancialStatementHeader =
- (FinancialStatementHeader) path.getLastPathComponent();
- if (parentFinancialStatementHeader != getRoot()) {
- financialStatementService.createFinancialStatementMovement(parentFinancialStatementHeader, financialStatementMovement);
- modelSupport.fireTreeStructureChanged(path);
- }
- }
/**
* Update financialStatementHeader.
@@ -230,16 +201,9 @@
* @param account
* @throws LimaException
*/
- public void updateFinancialStatement(TreePath path, Object object) throws LimaException {
+ public void updateFinancialStatement(TreePath path, FinancialStatement financialStatement) throws LimaException {
- int index = getIndexOfChild(
- path.getParentPath().getLastPathComponent(), object);
- if (object instanceof FinancialStatementHeader){
- financialStatementService.updateFinancialStatementHeader((FinancialStatementHeader) object);
- }
- else {
- financialStatementService.updateFinancialStatementMovement((FinancialStatementMovement) object);
- }
+ financialStatementService.updateFinancialStatement(financialStatement);
modelSupport.fireTreeStructureChanged(path);
}
@@ -252,18 +216,12 @@
* @param object
* @throws LimaException
*/
- public void removeFinancialStatementObject(TreePath path, Object object) throws LimaException {
+ public void removeFinancialStatementObject(TreePath path, FinancialStatement financialStatement) throws LimaException {
// Calling account service
int index = getIndexOfChild(
- path.getParentPath().getLastPathComponent(), object);
- if (object instanceof FinancialStatementHeader){
- financialStatementService.removeFinancialStatementHeader((FinancialStatementHeader) object);
- }
- else {
- financialStatementService.removeFinancialStatementMovement((FinancialStatementMovement) object);
- }
-
- modelSupport.fireChildRemoved(path.getParentPath(), index, object);
+ path.getParentPath().getLastPathComponent(), financialStatement);
+ financialStatementService.removeFinancialStatement(financialStatement);
+ modelSupport.fireChildRemoved(path.getParentPath(), index, financialStatement);
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-06-22 11:34:43 UTC (rev 2945)
@@ -25,10 +25,8 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
-import org.chorem.lima.entity.FinancialStatementHeader;
-import org.chorem.lima.entity.FinancialStatementHeaderImpl;
-import org.chorem.lima.entity.FinancialStatementMovement;
-import org.chorem.lima.entity.FinancialStatementMovementImpl;
+import org.chorem.lima.entity.FinancialStatement;
+import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.ui.financialstatementchart.FinancialStatementHeaderForm;
import org.chorem.lima.ui.financialstatementchart.FinancialStatementMovementForm;
import org.chorem.lima.util.DialogHelper;
@@ -67,15 +65,16 @@
treeTableModel =
(FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
- FinancialStatementHeader newFinancialStatementHeader = (FinancialStatementHeader) new FinancialStatementHeaderImpl();
+ FinancialStatement newFinancialStatementHeader = new FinancialStatementImpl();
FinancialStatementHeaderForm financialStatementHeaderForm = new FinancialStatementHeaderForm(view);
- financialStatementHeaderForm.setHeader(newFinancialStatementHeader);
+ financialStatementHeaderForm.setFinancialStatement(newFinancialStatementHeader);
// jaxx constructor don't call super() ?
financialStatementHeaderForm.setLocationRelativeTo(view);
financialStatementHeaderForm.setVisible(true);
// null == cancel action
- newFinancialStatementHeader = financialStatementHeaderForm.getHeader();
+ newFinancialStatementHeader = financialStatementHeaderForm.getFinancialStatement();
+ newFinancialStatementHeader.setHeader(true);
if (newFinancialStatementHeader != null) {
// get current selection path
TreePath treePath = null;
@@ -88,7 +87,7 @@
// add it
try {
- treeTableModel.addFinancialStatementHeader(treePath, newFinancialStatementHeader);
+ treeTableModel.addFinancialStatement(treePath, newFinancialStatementHeader);
} catch (LimaBusinessException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add financialStatementHeader", eee);
@@ -112,13 +111,13 @@
treeTableModel =
(FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
- FinancialStatementMovement newFinancialStatementMovement = new FinancialStatementMovementImpl();
+ FinancialStatement newFinancialStatementMovement = new FinancialStatementImpl();
FinancialStatementMovementForm financialStatementMovementForm = new FinancialStatementMovementForm(view);
- financialStatementMovementForm.setMovement(newFinancialStatementMovement);
+ financialStatementMovementForm.setFinancialStatement(newFinancialStatementMovement);
// jaxx constructor don't call super() ?
financialStatementMovementForm.setLocationRelativeTo(view);
financialStatementMovementForm.setVisible(true);
- newFinancialStatementMovement=financialStatementMovementForm.getMovement();
+ newFinancialStatementMovement=financialStatementMovementForm.getFinancialStatement();
// null == cancel action
if (newFinancialStatementMovement != null) {
@@ -129,7 +128,7 @@
// add it
try {
treeTableModel.
- addFinancialStatementMovement(treePath, newFinancialStatementMovement);
+ addFinancialStatement(treePath, newFinancialStatementMovement);
} catch (LimaBusinessException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add FinancialStatementMovement", eee);
@@ -159,40 +158,41 @@
// get selected account
int selectedRow = view.treeTable.getSelectedRow();
TreePath treePath = view.treeTable.getPathForRow(selectedRow); // not null
- Object selectedObject = treePath.getLastPathComponent();
+ FinancialStatement financialStatement = (FinancialStatement) treePath.getLastPathComponent();
//update Account or update SubLedger
- if (selectedObject != null) {
+ if (financialStatement != null) {
// get current selection path
if ( selectedRow != -1) {
treePath = view.treeTable.getPathForRow(selectedRow);
} else {
treePath = new TreePath(treeTableModel.getRoot());
}
- //test if selectedrow is account or ledger
- if (selectedObject instanceof FinancialStatementHeader){
+ //test if selectedrow is account or ledger
+ log.debug(financialStatement.getHeader());
+ if (financialStatement.getHeader()){
FinancialStatementHeaderForm financialStatementHeaderForm = new FinancialStatementHeaderForm(view);
- financialStatementHeaderForm.setHeader((FinancialStatementHeader) selectedObject);
+ financialStatementHeaderForm.setFinancialStatement(financialStatement);
// jaxx constructor don't call super() ?
financialStatementHeaderForm.setLocationRelativeTo(view);
financialStatementHeaderForm.setVisible(true);
// null == cancel action
- selectedObject = financialStatementHeaderForm.getHeader();
+ financialStatement = financialStatementHeaderForm.getFinancialStatement();
}
- // else is a subledger
+ // else is a movement
else{
FinancialStatementMovementForm financialStatementMovementForm = new FinancialStatementMovementForm(view);
- financialStatementMovementForm.setMovement((FinancialStatementMovement) selectedObject);
+ financialStatementMovementForm.setFinancialStatement(financialStatement);
// jaxx constructor don't call super() ?
financialStatementMovementForm.setLocationRelativeTo(view);
financialStatementMovementForm.setVisible(true);
// null == cancel action
- selectedObject = financialStatementMovementForm.getMovement();
+ financialStatement = financialStatementMovementForm.getFinancialStatement();
}
//if action confirmed
- if (selectedObject != null){
+ if (financialStatement != null){
// update it
try {
- treeTableModel.updateFinancialStatement(treePath, selectedObject);
+ treeTableModel.updateFinancialStatement(treePath, financialStatement);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add update", eee);
@@ -222,10 +222,10 @@
if (n == JOptionPane.YES_OPTION) {
// update view of treetable
TreePath treePath = view.treeTable.getPathForRow(selectedRow);
- Object object = treePath.getLastPathComponent();
+ FinancialStatement financialStatement = (FinancialStatement) treePath.getLastPathComponent();
try{
- treeTableModel.removeFinancialStatementObject(treePath, object);
+ treeTableModel.removeFinancialStatementObject(treePath, financialStatement);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't delete account", eee);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx 2010-06-22 11:34:43 UTC (rev 2945)
@@ -17,13 +17,13 @@
<JDialog modal="true">
- <org.chorem.lima.entity.FinancialStatementHeader id="header" javaBean='null'/>
+ <org.chorem.lima.entity.FinancialStatement id="financialStatement" javaBean='null'/>
<Boolean id="addState" javaBean='true'/>
<script>
<![CDATA[
protected void performCancel() {
- setHeader(null);
+ setFinancialStatement(null);
dispose();
}
]]>
@@ -35,13 +35,20 @@
<JLabel text="lima.financialstatement.label"/>
</cell>
<cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getHeader().getLabel()}"/>
+ <JTextField id="descriptionTextField" text="{getFinancialStatement().getLabel()}"/>
<javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getHeader().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getHeader().setLabel(getDescriptionTextField().getText())' />
+ onInsertUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())' />
</cell>
</row>
<row>
+ <cell>
+ <JCheckBox id='subAmountCheckBox' text='lima.financialstatement.subamount'
+ selected="{getFinancialStatement().getSubAmount()}"
+ onActionPerformed="getFinancialStatement().setSubAmount(subAmountCheckBox.isSelected())"/>
+ </cell>
+ </row>
+ <row>
<cell fill="none">
<JButton text="lima.common.ok" onActionPerformed="dispose()"/>
</cell>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementMovementForm.jaxx 2010-06-22 11:34:43 UTC (rev 2945)
@@ -17,14 +17,14 @@
<JDialog modal="true">
- <org.chorem.lima.entity.FinancialStatementMovement id="movement" javaBean='null'/>
+ <org.chorem.lima.entity.FinancialStatement id="financialStatement" javaBean='null'/>
<Boolean id="addState" javaBean='true'/>
<script>
<![CDATA[
protected void performCancel() {
- setMovement(null);
+ setFinancialStatement(null);
dispose();
}
]]>
@@ -36,10 +36,10 @@
<JLabel text="lima.financialstatement.label"/>
</cell>
<cell fill="horizontal">
- <JTextField id="descriptionTextField" text="{getMovement().getLabel()}"/>
+ <JTextField id="descriptionTextField" text="{getFinancialStatement().getLabel()}"/>
<javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
- onInsertUpdate='getMovement().setLabel(getDescriptionTextField().getText())'
- onRemoveUpdate='getMovement().setLabel(getDescriptionTextField().getText())' />
+ onInsertUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setLabel(getDescriptionTextField().getText())' />
</cell>
</row>
<row>
@@ -47,10 +47,10 @@
<JLabel text="lima.financialstatement.accounts"/>
</cell>
<cell fill="horizontal">
- <JTextField id="accountsTextField" text="{getMovement().getAccounts()}"/>
+ <JTextField id="accountsTextField" text="{getFinancialStatement().getAccounts()}"/>
<javax.swing.text.Document javaBean="getAccountsTextField().getDocument()"
- onInsertUpdate='getMovement().setAccounts(getAccountsTextField().getText())'
- onRemoveUpdate='getMovement().setAccounts(getAccountsTextField().getText())' />
+ onInsertUpdate='getFinancialStatement().setAccounts(getAccountsTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setAccounts(getAccountsTextField().getText())' />
</cell>
</row>
<row>
@@ -58,10 +58,10 @@
<JLabel text="lima.financialstatement.creditaccounts"/>
</cell>
<cell fill="horizontal">
- <JTextField id="debitAccountsTextField" text="{getMovement().getDebitAccounts()}"/>
+ <JTextField id="debitAccountsTextField" text="{getFinancialStatement().getDebitAccounts()}"/>
<javax.swing.text.Document javaBean="getDebitAccountsTextField().getDocument()"
- onInsertUpdate='getMovement().setDebitAccounts(getDebitAccountsTextField().getText())'
- onRemoveUpdate='getMovement().setDebitAccounts(getDebitAccountsTextField().getText())' />
+ onInsertUpdate='getFinancialStatement().setDebitAccounts(getDebitAccountsTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setDebitAccounts(getDebitAccountsTextField().getText())' />
</cell>
</row>
<row>
@@ -69,10 +69,10 @@
<JLabel text="lima.financialstatement.debitaccounts"/>
</cell>
<cell fill="horizontal">
- <JTextField id="creditAccountsTextField" text="{getMovement().getCreditAccounts()}"/>
+ <JTextField id="creditAccountsTextField" text="{getFinancialStatement().getCreditAccounts()}"/>
<javax.swing.text.Document javaBean="getCreditAccountsTextField().getDocument()"
- onInsertUpdate='getMovement().setCreditAccounts(getCreditAccountsTextField().getText())'
- onRemoveUpdate='getMovement().setCreditAccounts(getCreditAccountsTextField().getText())' />
+ onInsertUpdate='getFinancialStatement().setCreditAccounts(getCreditAccountsTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setCreditAccounts(getCreditAccountsTextField().getText())' />
</cell>
</row>
<row>
@@ -80,10 +80,10 @@
<JLabel text="lima.financialstatement.provisiondeprecationaccounts"/>
</cell>
<cell fill="horizontal">
- <JTextField id="provisionDeprecationAccountsTextField" text="{getMovement().getProvisionDeprecationAccounts()}"/>
+ <JTextField id="provisionDeprecationAccountsTextField" text="{getFinancialStatement().getProvisionDeprecationAccounts()}"/>
<javax.swing.text.Document javaBean="getProvisionDeprecationAccountsTextField().getDocument()"
- onInsertUpdate='getMovement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())'
- onRemoveUpdate='getMovement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())' />
+ onInsertUpdate='getFinancialStatement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())'
+ onRemoveUpdate='getFinancialStatement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())' />
</cell>
</row>
<row>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-06-22 11:34:43 UTC (rev 2945)
@@ -31,8 +31,8 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl;
-import org.chorem.lima.entity.FinancialStatementHeader;
-import org.chorem.lima.entity.FinancialStatementHeaderImpl;
+import org.chorem.lima.entity.FinancialStatement;
+import org.chorem.lima.entity.FinancialStatementImpl;
import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.decorator.BorderHighlighter;
@@ -87,10 +87,10 @@
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
Boolean result = false;
- FinancialStatementHeader financialStatementHeader = new FinancialStatementHeaderImpl();
+ FinancialStatement financialStatementHeader = new FinancialStatementImpl();
Object object = model.getElementAt(adapter.row);
- if (model.getElementAt(adapter.row) instanceof FinancialStatementHeader){
- financialStatementHeader = (FinancialStatementHeader) object;
+ if (model.getElementAt(adapter.row) instanceof FinancialStatement){
+ financialStatementHeader = (FinancialStatement) object;
result = financialStatementHeader.getLevel() == 1;
}
return result;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2010-06-22 11:34:43 UTC (rev 2945)
@@ -20,9 +20,8 @@
import javax.swing.table.*;
import javax.swing.*;
-
-import org.chorem.lima.entity.FinancialStatementHeader;
-
+import org.chorem.lima.beans.FinancialStatementAmounts;
+import org.chorem.lima.entity.FinancialStatement;
import java.awt.*;
@@ -47,8 +46,8 @@
table, value, isSelected, hasFocus, row, column);
// Si le bilan est un soustotal, alors la ligne est en gras
- if (object instanceof FinancialStatementHeader){
- FinancialStatementHeader financialStatementHeader = (FinancialStatementHeader) object;
+ if (object instanceof FinancialStatement){
+ FinancialStatement financialStatementHeader = (FinancialStatement) object;
if (financialStatementHeader.getLevel() == 1)
{
@@ -61,9 +60,16 @@
}
}
else {
+
if (column == 0){
cell.setFont(new Font("Verdana", Font.ITALIC, 12));
}
+ if (object instanceof FinancialStatementAmounts){
+ if (((FinancialStatementAmounts) object).getHeader()){
+ cell.setFont(new Font("Verdana", Font.BOLD, 12));
+ }
+ }
+
}
// Alignement des cellules
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-22 11:34:43 UTC (rev 2945)
@@ -20,7 +20,6 @@
package org.chorem.lima.ui.financialstatementreport;
import static org.nuiton.i18n.I18n._;
-
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -34,8 +33,7 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
import org.chorem.lima.entity.Account;
-import org.chorem.lima.entity.FinancialStatementHeader;
-import org.chorem.lima.entity.FinancialStatementMovement;
+import org.chorem.lima.entity.FinancialStatement;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
@@ -70,7 +68,7 @@
protected String selectedAccounts;
/** data cache */
- protected List<Object> cacheDataList;
+ protected List<FinancialStatementAmounts> cacheDataList;
/**
* Constructor.
@@ -123,8 +121,8 @@
public Object getValueAt(int row, int column) {
Object result = cacheDataList.get(row);
//get entries for the period for the current row
- if (result instanceof FinancialStatementHeader) {
- FinancialStatementHeader currentRow = (FinancialStatementHeader) result;
+ if (result instanceof FinancialStatement) {
+ FinancialStatement currentRow = (FinancialStatement) result;
switch (column) {
case 0:
result = "";
@@ -143,6 +141,7 @@
result = null;
break;
}
+
}
else {
FinancialStatementAmounts currentRow = (FinancialStatementAmounts) result;
@@ -151,7 +150,7 @@
switch (column) {
case 0:
result = "";
- for (int i = 0; i <= currentRow.getHeaderLevel(); i++) {
+ for (int i = 0; i <= currentRow.getLevel(); i++) {
result = result+"\t";
}
result = result+currentRow.getLabel();
@@ -194,13 +193,10 @@
* get all account fot the selected period
* @return
*/
- public List<Object> getDataList(){
- List<Object> results = null;
-
+ public List<FinancialStatementAmounts> getDataList(){
+ List<FinancialStatementAmounts> results = null;
try {
- //results = financialStatementService.getAllChildrenFinancialStatement(null, new ArrayList<Object>());
- results = financialStatementService.financialStatementReports(selectedBeginDate, selectedEndDate);
- //results = reportService.generateBalanceTrial(selectedBeginDate, selectedEndDate, selectedAccounts, false);
+ results = financialStatementService.financialStatementReport(selectedBeginDate, selectedEndDate);
}
catch (LimaException eee) {
if (log.isErrorEnabled()) {
@@ -208,6 +204,7 @@
}
ErrorHelper.showErrorDialog("Can't get entries list", eee);
}
+ log.debug(results);
return results;
}
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 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx 2010-06-22 11:34:43 UTC (rev 2945)
@@ -80,11 +80,9 @@
<row>
<cell fill="both" weightx="1" weighty="1" columns="7">
<JScrollPane>
- <org.chorem.lima.ui.financialstatementreport.FinancialStatementReportTable
- id="table" rowHeight="24"
- constructorParams="getHandler()" model="{getModelTable()}"
- selectionMode="{ListSelectionModel.SINGLE_INTERVAL_SELECTION}"
- columnControlVisible="true" />
+ <org.jdesktop.swingx.JXTable id="table" rowHeight="24"
+ model="{getModelTable()}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"/>
<javax.swing.ListSelectionModel javaBean="getTable().getSelectionModel()"/>
</JScrollPane>
</cell>
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-22 11:34:43 UTC (rev 2945)
@@ -168,11 +168,13 @@
lima.financialstatement.accounts=
lima.financialstatement.creditaccounts=
lima.financialstatement.debitaccounts=
+lima.financialstatement.header=
lima.financialstatement.header.add=
lima.financialstatement.label=
lima.financialstatement.movement.add=
lima.financialstatement.provisiondeprecationaccounts=
lima.financialstatement.style=
+lima.financialstatement.subamount=
lima.financialstatementreports=
lima.find.transaction=Find transaction
lima.fiscalperiod.addFiscalPeriod=
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 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-22 11:34:43 UTC (rev 2945)
@@ -166,11 +166,13 @@
lima.financialstatement.accounts=
lima.financialstatement.creditaccounts=
lima.financialstatement.debitaccounts=
+lima.financialstatement.header=
lima.financialstatement.header.add=Regrouprement
lima.financialstatement.label=
lima.financialstatement.movement.add=
lima.financialstatement.provisiondeprecationaccounts=
lima.financialstatement.style=
+lima.financialstatement.subamount=
lima.financialstatementreports=
lima.find.transaction=Rechercher transaction
lima.fiscalperiod.addFiscalPeriod=Nouvel exercice
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-19 18:58:30 UTC (rev 2944)
+++ trunk/pom.xml 2010-06-22 11:34:43 UTC (rev 2945)
@@ -242,7 +242,7 @@
<!-- customized libs version -->
<nuiton-utils.version>1.2.2</nuiton-utils.version>
<eugene.version>2.0.2-SNAPSHOT</eugene.version>
- <topia.version>2.4-SNAPSHOT</topia.version>
+ <topia.version>2.3.4</topia.version>
<jaxx.version>2.0.2</jaxx.version>
<i18n.version>1.2.2</i18n.version>
1
0
Author: tchemit
Date: 2010-06-19 20:58:30 +0200 (Sat, 19 Jun 2010)
New Revision: 2944
Url: http://chorem.org/repositories/revision/lima/2944
Log:
Utilisation de mavenpom4redmine 2.2
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-17 16:15:50 UTC (rev 2943)
+++ trunk/pom.xml 2010-06-19 18:58:30 UTC (rev 2944)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.1.5</version>
+ <version>2.2</version>
</parent>
<groupId>org.chorem</groupId>
1
0
r2943 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport
by jpepin@users.chorem.org 17 Jun '10
by jpepin@users.chorem.org 17 Jun '10
17 Jun '10
Author: jpepin
Date: 2010-06-17 18:15:50 +0200 (Thu, 17 Jun 2010)
New Revision: 2943
Url: http://chorem.org/repositories/revision/lima/2943
Log:
Modification UI G?\195?\169n?\195?\169ration Compte de r?\195?\169sultat et Bilan : ajout de style de police, identation en fonction du nombre de niveau, et surbrillance.
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.properties
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
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 2010-06-17 11:08:41 UTC (rev 2942)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-17 16:15:50 UTC (rev 2943)
@@ -400,6 +400,7 @@
financialStatementAmounts.setGrossAmount(amount+creditAmount+debitAmount);
financialStatementAmounts.setLabel(financialStatementMovement.getLabel());
financialStatementAmounts.setProvisionDeprecationAmount(provisionDeprecationAmount);
+ financialStatementAmounts.setHeaderLevel(financialStatementMovement.getFinancialStatementHeader().getLevel());
}
Modified: trunk/lima-callao/src/main/xmi/accounting.properties
===================================================================
--- trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-17 11:08:41 UTC (rev 2942)
+++ trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-17 16:15:50 UTC (rev 2943)
@@ -7,7 +7,9 @@
org.chorem.lima.entity.FinancialStatementHeader.attribute.subFinancialStatementHeaders.tagvalue.lazy=false
org.chorem.lima.entity.FinancialStatementHeader.attribute.financialStatementMovement.tagvalue.lazy=false
org.chorem.lima.entity.FinancialStatementHeader.attribute.masterFinancialStatementHeader.tagvalue.lazy=false
+org.chorem.lima.entity.FinancialStatementMovement.attribute.financialStatementHeader.tagvalue.lazy=false
+
#model.tagvalue.dbSchema=Callao
model.tagvalue.String=text
\ No newline at end of file
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-06-17 11:08:41 UTC (rev 2942)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-06-17 16:15:50 UTC (rev 2943)
@@ -20,16 +20,22 @@
import java.awt.Color;
import java.awt.Component;
+import java.awt.Font;
import java.text.SimpleDateFormat;
+import javax.swing.border.LineBorder;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.FinancialPeriodService;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl;
+import org.chorem.lima.entity.FinancialStatementHeader;
+import org.chorem.lima.entity.FinancialStatementHeaderImpl;
import org.chorem.lima.service.LimaServiceFactory;
import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.BorderHighlighter;
import org.jdesktop.swingx.decorator.ColorHighlighter;
import org.jdesktop.swingx.decorator.ComponentAdapter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
@@ -52,52 +58,47 @@
* Constructor, call highlighter
*/
public FinancialStatementReportTable(FinancialStatementReportViewHandler handler) {
-
+ super(handler.getView().modelTable);
this.handler = handler;
model = this.handler.getView().modelTable;
financialPeriodService =
LimaServiceFactory.getInstance().getFinancialPeriodService();
//highlight financial financial transactions
- // addTitle1();
+ colorTitle1();
// addTitle2();
-
+
//Renderer for font
-
- log.debug(getColumnCount());
- /*
FinancialStatementReportTableCellRenderer renderer = new FinancialStatementReportTableCellRenderer();
- for (int i = 1; i <= model.getColumnCount(); i++) {
-
- getColumn(-1).setCellRenderer(renderer);
- //getColumnModel().getColumn(i).setCellRenderer(renderer);
- }*/
+ for (int i = 0; i < getColumnModel().getColumnCount(); i++) {
+ getColumnModel().getColumn(i).setCellRenderer(renderer);
+ }
}
/*
* Color the background row in grey if the month number is even (pair in french)
*/
- protected void addTitle1() {
-/*
+ protected void colorTitle1() {
HighlightPredicate predicate = new HighlightPredicate() {
@Override
public boolean isHighlighted(Component renderer,
ComponentAdapter adapter) {
- ClosedPeriodicEntryBook closedPeriodicEntryBook
- = (ClosedPeriodicEntryBook) model.getElementAt(adapter.row);
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM");
- int month = Integer.parseInt(simpleDateFormat.format(
- closedPeriodicEntryBook.getFinancialPeriod().getBeginDate()));
- // true if month is even
- return ((month % 2)==0);
+ Boolean result = false;
+ FinancialStatementHeader financialStatementHeader = new FinancialStatementHeaderImpl();
+ Object object = model.getElementAt(adapter.row);
+ if (model.getElementAt(adapter.row) instanceof FinancialStatementHeader){
+ financialStatementHeader = (FinancialStatementHeader) object;
+ result = financialStatementHeader.getLevel() == 1;
+ }
+ return result;
}
};
colorTransaction =
new ColorHighlighter(predicate, new Color(222,222,222), null);
- addHighlighter(colorTransaction);*/
+ addHighlighter(colorTransaction);
}
/*
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2010-06-17 11:08:41 UTC (rev 2942)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2010-06-17 16:15:50 UTC (rev 2943)
@@ -37,15 +37,15 @@
public Component getTableCellRendererComponent(JTable table, Object value,
boolean isSelected, boolean hasFocus, int row, int column)
{
- super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
- row, column);
// Get table
- FinancialStatementReportTable financialStatementReportTable = (FinancialStatementReportTable) table;
FinancialStatementReportTableModel financialStatementReportTableModel = (FinancialStatementReportTableModel) table.getModel();
// Récupère le bilan de la ligne
Object object = financialStatementReportTableModel.getElementAt(row);
+ Component cell = super.getTableCellRendererComponent(
+ table, value, isSelected, hasFocus, row, column);
+
// Si le bilan est un soustotal, alors la ligne est en gras
if (object instanceof FinancialStatementHeader){
FinancialStatementHeader financialStatementHeader = (FinancialStatementHeader) object;
@@ -60,9 +60,14 @@
setFont(new Font("Verdana", Font.BOLD, 12));
}
}
+ else {
+ if (column == 0){
+ cell.setFont(new Font("Verdana", Font.ITALIC, 12));
+ }
+ }
// Alignement des cellules
- switch (column) {
+ /* switch (column) {
case 0:
this.setHorizontalAlignment(JLabel.LEFT);
break;
@@ -78,7 +83,7 @@
case 4:
this.setHorizontalAlignment(JLabel.RIGHT);
break;
- }
+ }*/
return this;
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-17 11:08:41 UTC (rev 2942)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-17 16:15:50 UTC (rev 2943)
@@ -127,7 +127,11 @@
FinancialStatementHeader currentRow = (FinancialStatementHeader) result;
switch (column) {
case 0:
- result = currentRow.getLabel();
+ result = "";
+ for (int i = 0; i < currentRow.getLevel(); i++) {
+ result = result+"\t";
+ }
+ result = result+currentRow.getLabel();
break;
case 1:
result = null;
@@ -145,8 +149,12 @@
Double grossAmount = currentRow.getGrossAmount();
Double provisionDeprecationAmount = currentRow.getProvisionDeprecationAmount();
switch (column) {
- case 0:
- result = currentRow.getLabel();
+ case 0:
+ result = "";
+ for (int i = 0; i <= currentRow.getHeaderLevel(); i++) {
+ result = result+"\t";
+ }
+ result = result+currentRow.getLabel();
break;
case 1:
result = grossAmount;
1
0
r2942 - trunk/lima-callao/src/main/java/org/chorem/lima/entity
by fdesbois@users.chorem.org 17 Jun '10
by fdesbois@users.chorem.org 17 Jun '10
17 Jun '10
Author: fdesbois
Date: 2010-06-17 13:08:41 +0200 (Thu, 17 Jun 2010)
New Revision: 2942
Url: http://chorem.org/repositories/revision/lima/2942
Log:
Better usage of lazy initialization for level
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java 2010-06-17 10:03:23 UTC (rev 2941)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java 2010-06-17 11:08:41 UTC (rev 2942)
@@ -2,15 +2,17 @@
public class FinancialStatementHeaderImpl extends FinancialStatementHeaderAbstract{
- protected Integer result;
+ protected Integer level;
@Override
public int getLevel() {
- result = 1;
- if (masterFinancialStatementHeader != null){
- result = masterFinancialStatementHeader.getLevel()+1;
- }
-
- return result;
+ if (level == null) {
+ if (masterFinancialStatementHeader != null){
+ level = masterFinancialStatementHeader.getLevel() + 1;
+ } else {
+ level = 1;
+ }
+ }
+ return level;
}
}
1
0
Author: jpepin
Date: 2010-06-17 12:03:23 +0200 (Thu, 17 Jun 2010)
New Revision: 2941
Url: http://chorem.org/repositories/revision/lima/2941
Log:
Modification mod?\195?\168le : transaction financi?\195?\168re qui appartient ?\195?\160 un journal et non une entr?\195?\169e (sinon journal pas forc?\195?\169ment ?\195?\169quilibr?\195?\169 donc partie double biais?\195?\169, v?\195?\169rification faite aupr?\195?\168s d'un comptable)
Ajout d'une m?\195?\169thode getLevel sur financialStatementHeader afin de r?\195?\169cup?\195?\169rer la profondeur dans l'arbre.
Added:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
Removed:
trunk/lima-business/src/test/java/org/chorem/lima/business/TransactionServiceImplTest.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.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/FinancialTransactionServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java
trunk/lima-callao/src/main/xmi/accounting.properties
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.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/financialtransaction/FinancialTransactionTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java
trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -37,11 +37,13 @@
import org.chorem.lima.entity.EntryDAO;
import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.entity.FinancialTransactionDAO;
import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.entity.FiscalPeriodDAO;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaQuery;
/**
* Defaults rules, if no localized rules classes is instantiated
* this default class contain the strict minimum rules to check the data integrity
@@ -97,51 +99,7 @@
return null;
}
- /**
- * Rules on update entry :
- *
- * Two case :
- * - first, the entry belong to a blocked financialperiod
- * - second, the actual entry belong to a blocked closedPeriodicEntryBook
- * - third, the new choice entrybook belong to a blocked closedPeriodicEntryBook
- */
- @Override
- public void updateEntryRules(Entry entry, Entry entryOld, TopiaContext topiaTransaction) throws LimaException {
- //first case
- if (entry.getFinancialTransaction().getFinancialPeriod().getLocked()){
- throw new LimaBusinessException("1 - Can't update entry : The financial period is blocked");
- }
- try {
-
- FinancialPeriod financialPeriod =
- entry.getFinancialTransaction().getFinancialPeriod();
-
- ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
- LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaTransaction);
-
- //second case
- ClosedPeriodicEntryBook closedPeriodicEntryBook =
- closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
- entryOld.getEntryBook(), financialPeriod);
- if (closedPeriodicEntryBook.getLocked()){
- throw new LimaBusinessException("2 - Can't update entry : financialperiod of this entrybook is closed");
- }
-
- //third case
- ClosedPeriodicEntryBook closedPeriodicEntryBook2 =
- closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
- entry.getEntryBook(), financialPeriod);
-
- // Check 2 & 3 cases
- if (closedPeriodicEntryBook2.getLocked()){
- throw new LimaBusinessException("3 - Can't update entry : financialperiod of this entrybook is closed");
- }
-
- }
- catch (TopiaException eee) {
- doCatch(topiaTransaction, eee, log);
- }
- }
+
/**
* Rules to check before block fiscals periods
@@ -170,15 +128,17 @@
}
}
+ /**
+ * Check if entrybook have financial transaction
+ */
@Override
public void removeEntryBookRules(EntryBook entryBook, TopiaContext topiaTransaction) throws LimaException {
try {
- EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaTransaction);
+ FinancialTransactionDAO financialTransactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction);
// Check if entrybook have entries
- int nbentries = entryDAO.findAllByEntryBook(entryBook).size();
- log.debug(entryDAO.findAllByEntryBook(entryBook).size());
- if (nbentries != 0) {
- throw new LimaBusinessException("Can't delete entryBook with entries");
+ int nbfinancialtransaction = financialTransactionDAO.findAllByEntryBook(entryBook).size();
+ if (nbfinancialtransaction != 0) {
+ throw new LimaBusinessException("Can't delete entryBook with financialtransaction");
}
}
catch (TopiaException ex) {
@@ -228,37 +188,143 @@
}
}
+ /**
+ * Check if all financial transactions of closedperiodicentrybook are equilibrate
+ */
@Override
public void blockClosedPeriodicEntryBookRules(ClosedPeriodicEntryBook closedPeriodicEntryBook, TopiaContext topiaContext)
throws LimaException {
- // TODO Auto-generated method stub
-
+ List<FinancialTransaction> result = null;
+
+ try {
+ FinancialTransactionDAO financialTransactionDAO =
+ LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
+
+ TopiaQuery query = financialTransactionDAO.createQuery("E");
+ query.addWhere("E.amountCredit != E.amountDebit")
+ .addEquals(FinancialTransaction.ENTRY_BOOK,
+ closedPeriodicEntryBook.getEntryBook())
+ .addEquals(FinancialTransaction.FINANCIAL_PERIOD,
+ closedPeriodicEntryBook.getFinancialPeriod());
+ result = financialTransactionDAO.findAllByQuery(query);
+
+ if (result.size()>0){
+ throw new LimaBusinessException("Can't block financialperiod/entrybook contain financialtransaction not equilibrate");
+ }
+ }
+ catch (TopiaException ex) {
+ doCatch(topiaContext, ex, log);
+ }
}
/**
+ * Rules on update entry :
+ *
+ * Two case :
+ * - second, the actual entry belong to a blocked closedPeriodicEntryBook
+ * - third, the new choice entrybook belong to a blocked closedPeriodicEntryBook
+ */
+ @Override
+ public void updateEntryRules(Entry entry, Entry entryOld, TopiaContext topiaTransaction) throws LimaException {
+
+ try {
+
+ FinancialPeriod financialPeriod =
+ entry.getFinancialTransaction().getFinancialPeriod();
+
+ ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
+ LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaTransaction);
+
+ //second case
+ ClosedPeriodicEntryBook closedPeriodicEntryBook =
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ entryOld.getFinancialTransaction().getEntryBook(), financialPeriod);
+ if (closedPeriodicEntryBook.getLocked()){
+ throw new LimaBusinessException("2 - Can't update entry : financialperiod of this entrybook is closed");
+ }
+
+ //third case
+ ClosedPeriodicEntryBook closedPeriodicEntryBook2 =
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ entry.getFinancialTransaction().getEntryBook(), financialPeriod);
+
+ // Check 2 & 3 cases
+ if (closedPeriodicEntryBook2.getLocked()){
+ throw new LimaBusinessException("3 - Can't update entry : financialperiod of this entrybook is closed");
+ }
+
+ }
+ catch (TopiaException eee) {
+ doCatch(topiaTransaction, eee, log);
+ }
+ }
+
+
+ /**
* Check :
- * - if old financialtransaction date are on periodblocked
- * - if new date are on fiscalperiod
- * - new financialtransaction date are on periodunblocked
- * - if all closedperiod are open
+ * 1. if old financialtransaction date are on periodblocked
+ * 2. if new financialtransaction date are on periodblocked
+ * 3. if the actual entrybook belong to a blocked closedPeriodicEntryBook
+ * 4. if the new entrybook belong to a blocked closedPeriodicEntryBook
+ * 5. if date are on fiscal period
+ * 6. if all closedperiod are open
*/
@Override
public void updateFinancialTransactionDateRules(
FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld, TopiaContext topiaContext) throws LimaException {
- //check old financial period locked
- if (financialTransactionOld.getFinancialPeriod().getLocked()){
+ FinancialPeriod financialPeriod = financialTransaction.getFinancialPeriod();
+ FinancialPeriod financialPeriodOld = financialTransactionOld.getFinancialPeriod();
+
+ //1. check old financial period locked
+ if (financialPeriodOld.getLocked()){
throw new LimaBusinessException("The financial period of this transaction is blocked");
}
- //check new financial period locked
- if (financialTransaction.getFinancialPeriod().getLocked()){
+ //2. check new financial period locked
+ if (financialPeriod.getLocked()){
throw new LimaBusinessException("The financial period of the new date is blocked");
}
try {
- //check if date are on fiscal period
+ ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
+ LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
+
+ //3. the actual entrybook belong to a blocked closedPeriodicEntryBook
+ ClosedPeriodicEntryBook closedPeriodicEntryBookOld =
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ financialTransactionOld.getEntryBook(), financialPeriod);
+ if (closedPeriodicEntryBookOld.getLocked()){
+ throw new LimaBusinessException("Can't update financialtransaction : financialperiod of this entrybook is closed");
+ }
+
+ //4. the new entrybook belong to a blocked closedPeriodicEntryBook
+ ClosedPeriodicEntryBook closedPeriodicEntryBook =
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ financialTransaction.getEntryBook(), financialPeriod);
+ if (closedPeriodicEntryBook.getLocked()){
+ throw new LimaBusinessException("Can't update financialtransaction : financialperiod of new entrybook is closed");
+ }
+
+ //5. the actual entrybook belong to a blocked closedPeriodicEntryBook
+ ClosedPeriodicEntryBook closedPeriodicEntryBookOld2 =
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ financialTransactionOld.getEntryBook(), financialPeriodOld);
+ if (closedPeriodicEntryBookOld2.getLocked()){
+ throw new LimaBusinessException("Can't update financialtransaction : the new financialperiod of this entrybook is closed");
+ }
+
+ //6. the new entrybook belong to a blocked closedPeriodicEntryBook
+ ClosedPeriodicEntryBook closedPeriodicEntryBook2 =
+ closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
+ financialTransaction.getEntryBook(), financialPeriodOld);
+ if (closedPeriodicEntryBook2.getLocked()){
+ throw new LimaBusinessException("Can't update financialtransaction : this financialperiod of new entrybook is closed");
+ }
+
+
+ //7. check if date are on fiscal period
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
FiscalPeriod fiscalPeriod =
@@ -275,32 +341,27 @@
throw new LimaBusinessException("The date is after the fiscal period");
}
- //check all entrybook of old and new financial period are blocked
+ /*
+ //6. check all entrybook of old and new financial period are blocked
//FIXME Make this check by topia query ?
List<EntryBook> entryBooks = new ArrayList<EntryBook>();
- List<EntryBook> closedEntryBooks = new ArrayList<EntryBook>();
+ List<EntryBook> newClosedEntryBooks = new ArrayList<EntryBook>();
List<EntryBook> oldClosedEntryBooks = new ArrayList<EntryBook>();
EntryBookDAO entryBookDAO =
LimaCallaoDAOHelper.getEntryBookDAO(topiaContext);
- ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =
- LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
- FinancialPeriod financialPeriod =
- financialTransaction.getFinancialPeriod();
- FinancialPeriod oldFinancialPeriod =
- financialTransactionOld.getFinancialPeriod();
entryBooks = entryBookDAO.findAll();
for (EntryBook entryBook : entryBooks) {
- ClosedPeriodicEntryBook closedPeriodicEntryBook =
+ ClosedPeriodicEntryBook newClosedPeriodicEntryBook =
closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
entryBook, financialPeriod);
ClosedPeriodicEntryBook oldClosedPeriodicEntryBook =
closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(
- entryBook, oldFinancialPeriod);
- if(closedPeriodicEntryBook.getLocked()){
- closedEntryBooks.add(entryBook);
+ entryBook, financialPeriodOld);
+ if(newClosedPeriodicEntryBook.getLocked()){
+ newClosedEntryBooks.add(entryBook);
}
if(oldClosedPeriodicEntryBook.getLocked()){
oldClosedEntryBooks.add(entryBook);
@@ -310,9 +371,9 @@
if (oldClosedEntryBooks.size() >0){
throw new LimaBusinessException("All EntryBook of this financialperiod are not open");
}
- if (closedEntryBooks.size() >0){
+ if (newClosedEntryBooks.size() >0){
throw new LimaBusinessException("All EntryBook of old financialperiod are not open");
- }
+ }*/
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -175,7 +175,7 @@
* Règles de vérification de fermeture d'un exercice, appliquées à la comptabilité française
*/
public void blockFiscalPeriodRules(FiscalPeriod fiscalPeriod, TopiaContext transaction) throws LimaException {
- try{
+ try{
FiscalPeriodDAO fiscalPeriodDAO =
LimaCallaoDAOHelper.getFiscalPeriodDAO(transaction);
@@ -209,20 +209,28 @@
*
* compare there
*/
- public void blockClosedPeriodicEntryBookRules(ClosedPeriodicEntryBook closedPeriodicEntryBook, TopiaContext topiaTransaction)
- throws LimaException {
+ public void blockClosedPeriodicEntryBookRules(ClosedPeriodicEntryBook closedPeriodicEntryBook, TopiaContext topiaTransaction) throws LimaException {
+ super.blockClosedPeriodicEntryBookRules(
+ closedPeriodicEntryBook, topiaTransaction);
+
closedPeriodicEntryBook.getFinancialPeriod();
- List<ClosedPeriodicEntryBook> closedPeriodicEntryBooks = new ArrayList<ClosedPeriodicEntryBook>();
+ List<ClosedPeriodicEntryBook> closedPeriodicEntryBooks =
+ new ArrayList<ClosedPeriodicEntryBook>();
try {
+ log.debug("france check");
+
// Get all closedperiod between for the period and entrybook
Date endDate = closedPeriodicEntryBook.
getFinancialPeriod().getBeginDate();
endDate = DateUtils.addMonths(endDate, -1);
- FiscalPeriodDAO fiscalPeriodDAO = LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaTransaction);
- FiscalPeriod fiscalPeriod = fiscalPeriodDAO.findContainsFinancialPeriod(closedPeriodicEntryBook.getFinancialPeriod());
+ FiscalPeriodDAO fiscalPeriodDAO =
+ LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaTransaction);
+ FiscalPeriod fiscalPeriod =
+ fiscalPeriodDAO.findContainsFinancialPeriod(
+ closedPeriodicEntryBook.getFinancialPeriod());
Date beginDate = fiscalPeriod.getBeginDate();
EntryBook entryBook = closedPeriodicEntryBook.getEntryBook();
@@ -233,9 +241,9 @@
String closedPeriodicEntryBookDateProperty =
TopiaQuery.getProperty(ClosedPeriodicEntryBook.FINANCIAL_PERIOD,
FinancialPeriod.BEGIN_DATE);
- query.add(closedPeriodicEntryBookDateProperty
+ query.addWhere(closedPeriodicEntryBookDateProperty
+" BETWEEN :beginDate AND :endDate")
- .add(ClosedPeriodicEntryBook.ENTRY_BOOK, entryBook)
+ .addEquals(ClosedPeriodicEntryBook.ENTRY_BOOK, entryBook)
.addParam("beginDate", beginDate)
.addParam("endDate", endDate);
@@ -245,7 +253,7 @@
int nbClosedPeriodicEntryBooks = closedPeriodicEntryBooks.size();
// Get all closed between for the period, entrybook and are blocked
- query.add(ClosedPeriodicEntryBook.LOCKED, true);
+ query.addEquals(ClosedPeriodicEntryBook.LOCKED, true);
closedPeriodicEntryBooks.clear();
closedPeriodicEntryBooks.
addAll(closedPeriodicEntryBookDAO.findAllByQuery(query));
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 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -236,7 +236,8 @@
getAllChildrenFinancialStatement((FinancialStatementHeader) child, objects);
}
}
- return objects; }
+ return objects;
+ }
@Override
public List<Object> getChildrenFinancialStatement(FinancialStatementHeader masterFinancialStatementHeader) throws LimaException {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -146,9 +146,9 @@
//IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION
for (FinancialTransaction financialTransaction : financialTransactions) {
+ financialTransaction.getEntryBook();
for (Entry entry : financialTransaction.getEntry()) {
- entry.getEntryBook();
entry.getAccount();
entry.getFinancialTransaction();
entry.getFinancialTransaction().getFinancialPeriod();
@@ -196,9 +196,9 @@
for (FinancialTransaction financialTransaction : result) {
for (Entry entry : financialTransaction.getEntry()) {
- entry.getEntryBook();
entry.getAccount();
entry.getFinancialTransaction();
+ entry.getFinancialTransaction().getEntryBook();
entry.getFinancialTransaction().getFinancialPeriod();
}
}
@@ -264,14 +264,16 @@
if (financialPeriod != null){
financialTransactionOld.setFinancialPeriod(financialPeriod);
}
- accountingRules.updateFinancialTransactionDateRules(
- financialtransaction, financialTransactionOld, topiaContext);
}
+ accountingRules.updateFinancialTransactionDateRules(
+ financialtransaction, financialTransactionOld, topiaContext);
financialTransactionOld.setAmountDebit(
financialtransaction.getAmountDebit());
financialTransactionOld.setAmountCredit(
financialtransaction.getAmountCredit());
+ financialTransactionOld.setEntryBook(
+ financialtransaction.getEntryBook());
transactionDAO.update(financialTransactionOld);
}
catch (TopiaException ex) {
@@ -380,7 +382,6 @@
entryOld.setAmount(entryAmount);
entryOld.setDebit(entryAmountBool);
entryOld.setDescription(entry.getDescription());
- entryOld.setEntryBook(entry.getEntryBook());
entryOld.setFinancialTransaction(entry.getFinancialTransaction());
entryOld.setVoucher(entry.getVoucher());
entryOld.setPosition(entry.getPosition());
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 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -179,7 +179,11 @@
TopiaQuery entriesQuery =
createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
//IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION
- entriesQuery.addLoad(Entry.ENTRY_BOOK, Entry.FINANCIAL_TRANSACTION);
+ entriesQuery.addLoad(Entry.FINANCIAL_TRANSACTION);
+ String loadEntryBookProperty =
+ TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
+ FinancialTransaction.ENTRY_BOOK);
+ entriesQuery.addLoad(loadEntryBookProperty);
reportsDatas.setListEntry(entryDAO.findAllByQuery(entriesQuery));
TopiaQuery amountsQuery =
@@ -241,7 +245,11 @@
TopiaQuery entriesQuery =
createEntryQuery(account, beginDate, endDate, entryDAO, queryAlias);
//IMPORTANT : LOADING ENTRIES AND IS COLUMN FOR NO LAZY EXCEPTION
- entriesQuery.addLoad(Entry.ENTRY_BOOK, Entry.FINANCIAL_TRANSACTION);
+ entriesQuery.addLoad(Entry.FINANCIAL_TRANSACTION);
+ String loadEntryBookProperty =
+ TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
+ FinancialTransaction.ENTRY_BOOK);
+ entriesQuery.addLoad(loadEntryBookProperty);
reportsDatas.setListEntry(entryDAO.findAllByQuery(entriesQuery));
}
@@ -381,9 +389,13 @@
String amountDebitProperty =
TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
FinancialTransaction.AMOUNT_DEBIT);
+ String entryBookProperty =
+ TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION,
+ FinancialTransaction.ENTRY_BOOK);
query
.addWhere(amountCreditProperty+" = "+amountDebitProperty)
- .addEquals(Entry.ENTRY_BOOK, entryBook)
+ //TODO check this
+ .addEquals(entryBookProperty, entryBook)
.addWhere(transactionDateProperty+" BETWEEN :beginDate AND :endDate")
.addParam("beginDate", beginDate)
.addParam("endDate", endDate);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComparator.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -19,7 +19,6 @@
package org.chorem.lima.business.utils;
import java.util.Comparator;
-
import org.chorem.lima.entity.Entry;
public class EntryComparator implements Comparator<Entry>{
Deleted: trunk/lima-business/src/test/java/org/chorem/lima/business/TransactionServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/TransactionServiceImplTest.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/TransactionServiceImplTest.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -1,619 +0,0 @@
-package org.chorem.lima.business;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Tests pour la gestion des transactions
- *
- * Cette classe de test est principale au bon fonctionnement de l'application.
- * Elle centralise au maximum l'ensemble des règles de la couche métier. En effet
- * elle possède le plus de liens avec les autres classes.
- * A partir de la classe de test, nous allons créer plusieurs transactions pour
- * vérifier le bon fonctionnement des classes réunies ensemble.
- *
- * @author Rémi Chapelet
- */
-public class TransactionServiceImplTest {
-
- /** log. */
- private static final Log log = LogFactory
- .getLog(TransactionServiceImplTest.class);
-
- @BeforeClass
- public static void setUpClass() throws Exception {
- LimaConfigTest.getInstance();
- }
-
- /**
- * On nettoie la base de données
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownClass() throws Exception {
- /*LogServiceImpl serviceLog = new LogServiceImpl();
- // Supprime Log
- List<LogDTO> listLog = serviceLog.listeAllLogDTO();
- for (LogDTO logDTO : listLog)
- {
- serviceLog.removeLog(logDTO);
- }*/
-
- }
-
- /**
- * Permet de tester l'ajout d'un timspan
- */
- @Test
- public void createTransactionTest() {
- /*log.info("BEGIN createTransactionTest()");
-
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
-
- // Creation Period & TimeSpan (default period 01/01/2010 -> 31/12/2010)
- TimeSpan timespan = createPeriod(servicePeriod);
-
- // Creation Journal
- Journal journal = createJournal(serviceJournal,"Journal transaction", "jt","description");
-
- // Test creationTransaction avec Journal et TimeSpan
- String transactionId = createTransaction(serviceTransaction, "Facture 6", "description transaction", timespan, journal);
-
- // NETTOYAGE TEST
- removeTransaction(serviceTransaction, transactionId);
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // FIN NETTOYAGE TEST
- */
- }
-
- /**
- * Recherche des transactions.
- */
- @Test
- public void searchTransactionTest() {
- /*log.info("BEGIN searchTransactionTest()");
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
-
- // PREPARATION TEST
- // Default period 01/01/2010 -> 31/12/2010
- TimeSpan timespan = createPeriod(servicePeriod);
- Journal journal = createJournal(serviceJournal,"Journal transaction", "jt","description");
- String transactionId = createTransaction(serviceTransaction, "Facture 6", "description transaction", timespan, journal);
- // FIN PREPARATION TEST
-
- // Recherche de la transaction suivant ce timeSpan.
- List<Transaction> listTransaction = serviceTransaction.searchListTransactionWithTimeSpan(timespan);
- Assert.assertEquals(1,listTransaction.size());
- // On prend le premier élément de la liste de transactions
- Transaction transaction = listTransaction.get(0);
- // Si c'est la bonne transaction
- Assert.assertEquals("Facture 6",transaction.getVoucherRef());
-
- // NETTOYAGE TEST
- removeTransaction(serviceTransaction, transactionId);
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // FIN NETTOYAGE TEST */
- }
-
- /**
- * Permet de tester la recherche d'une transaction avec son identifiant.
- * Ce dernier est une chaine de caractère. Elle a été inscrite dans la variable
- * topiaIdTransaction dans les tests auparavant afin d'éviter les mêmes recherches
- * pour chaque test.
- */
- @Test
- public void searchWithTopiaIdTest() {
- /*log.info("BEGIN searchWithTopiaIdTest()");
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
-
- // PREPARATION TEST
- // Default period 01/01/2010 -> 31/12/2010
- TimeSpan timespan = createPeriod(servicePeriod);
- Journal journal = createJournal(serviceJournal,"Journal transaction", "jt","description");
- String transactionId = createTransaction(serviceTransaction, "Facture 6", "description transaction", timespan, journal);
- // FIN PREPARATION TEST
-
- // Recherche de la transaction avec son identifiant.
- Transaction transaction = serviceTransaction.searchTransactionWithTopiaId(transactionId);
- // Si c'est la bonne transaction
- Assert.assertEquals("Facture 6",transaction.getVoucherRef());
-
- // NETTOYAGE TEST
- removeTransaction(serviceTransaction, transactionId);
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // FIN NETTOYAGE TEST */
- }
-
- /**
- * Recherche d'une transaction, retourner sous format DTO.
- */
- @Test
- public void searchTransactionDTOTest() {
- /*log.info("BEGIN searchTransactionDTOTest()");
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
-
- // PREPARATION TEST
- // Default period 01/01/2010 -> 31/12/2010
- TimeSpan timespan = createPeriod(servicePeriod);
- Journal journal = createJournal(serviceJournal,"Journal transaction", "jt","description");
- String transactionId = createTransaction(serviceTransaction, "Facture 6", "description transaction", timespan, journal);
- // FIN PREPARATION TEST
-
- // Recherche de la transaction à l'aide de son identifiant.
- TransactionDTO transactionDTO = serviceTransaction.searchTransactionDTO(transactionId);
- // Vérifie si la transaction DTO est correcte.
- Assert.assertEquals("Facture 6",transactionDTO.getVoucherRef());
- // Charge le journalDTO à partir de la transactionDTO
- JournalDTO journalDTO = transactionDTO.getJournalDTO();
- Assert.assertEquals("jt",journalDTO.getPrefix()); // Si c'est le bon journal
- // Charge le timespanDTO à partir de la transactionDTO
- TimeSpanDTO timeSpanDTO = transactionDTO.getTimeSpanDTO();
- // debut 1 janvier 2010 - vérifie si c'est la même période
- Date beginTimeSpan = new Date(110,0,1);
- Assert.assertEquals(beginTimeSpan,timeSpanDTO.getBeginTimeSpan());
-
- // NETTOYAGE TEST
- removeTransaction(serviceTransaction, transactionId);
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // FIN NETTOYAGE TEST */
- }
-
- /**
- * Test la modification d'une transaction.
- */
- @Test
- public void modifyTransactionTest() {
- /*log.info("BEGIN modifyTransactionTest()");
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
-
- // PREPARATION TEST
- // Default period 01/01/2010 -> 31/12/2010
- TimeSpan timespan = createPeriod(servicePeriod);
- Journal journal = createJournal(serviceJournal,"Journal transaction", "jt","description");
- String transactionId = createTransaction(serviceTransaction, "Facture 6", "description transaction", timespan, journal);
- TransactionDTO transactionDTO = serviceTransaction.searchTransactionDTO(transactionId);
- // FIN PREPARATION TEST
-
- // On modifie la référence du fichier.
- transactionDTO.setVoucherRef("Nouvelle facture");
- String result = serviceTransaction.modifyTransaction(transactionDTO);
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS,result);
- // On recherche la transaction dans la base de données.
- Transaction transaction = serviceTransaction.searchTransactionWithTopiaId(transactionId);
- Assert.assertEquals("Nouvelle facture",transaction.getVoucherRef());
-
- // NETTOYAGE TEST
- removeTransaction(serviceTransaction, transactionId);
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // FIN NETTOYAGE TEST */
- }
-
- /**
- * Permet de tester l'ajout d'une transaction au format DTO.
- */
- @Test
- public void createTransactionDTOTest() {
- /*log.info("BEGIN createTransactionDTOTest()");
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TimeSpanServiceImpl serviceTimespan = new TimeSpanServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
-
- // PREPARATION TEST
- // Default period 01/01/2010 -> 31/12/2010
- TimeSpan timespan = createPeriod(servicePeriod);
- Journal journal = createJournal(serviceJournal, "Journal transaction",
- "jt", "description");
- String transactionId = createTransaction(serviceTransaction,
- "Facture 6", "description transaction", timespan, journal);
- // FIN PREPARATION TEST
-
- TransactionDTO transactionDTO = new TransactionDTO();
- Date dateTransaction = new Date();
- transactionDTO.setEntryDate(dateTransaction);
- transactionDTO.setVoucherRef("Commande");
- transactionDTO.setDescription("No comment");
- // Il n'y a pas de timeSpan et journal attachés à la transaction
- // ce qui créé une erreur lors de la création
- String result = serviceTransaction.createTransaction(transactionDTO);
- Assert.assertEquals(ServiceHelper.TRANSACTION_NOT_JOURNAL, result);
- // On fournit à transactionDTO un timeSpan valide
- // debut 1 janvier 2010
- Date dateSearch = timespan.getBeginTimeSpan();
- TimeSpanDTO timeSpanDTO = serviceTimespan
- .searchTimeSpanDTOByDate(dateSearch);
- transactionDTO.setTimeSpanDTO(timeSpanDTO);
- // On fournit à transactionDTO un journal NON valide (non présent dans la BDD)
- JournalDTO journalDTO = new JournalDTO();
- journalDTO.setLabel("existe pas");
- transactionDTO.setJournalDTO(journalDTO);
- // Ajout de la transaction avec erreur avec le journalDTO
- result = serviceTransaction.createTransaction(transactionDTO);
- Assert.assertEquals(ServiceHelper.TRANSACTION_NOT_JOURNAL, result);
-
- // Ajout d'un journalDTO valide
- journalDTO = serviceJournal
- .searchJournalDTOWithLabel("Journal transaction");
- transactionDTO.setJournalDTO(journalDTO);
- result = serviceTransaction.createTransaction(transactionDTO);
-
- // Si il renvoie succes et non l'identifiant (à commenter dans la classe correspondante)
-
- //Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS,result);
- // Vérifie le nombre de transactions (égal à deux)
- TimeSpan timeSpan = serviceTimespan.searchTimeSpanByDate(dateSearch);
- List<TransactionDTO> listTransactionDTO = serviceTransaction
- .searchListTransactionDTOWithTimeSpan(timeSpan);
- Assert.assertEquals(2, listTransactionDTO.size());
-
- // pour effacer par la suite les transactions à la fin des tests
- // Vérifie si la 1ière transaction est celle deja inscrite
- transactionDTO = listTransactionDTO.get(0);
- String transactionId2;
- if (transactionDTO.getId().equals(transactionId)) {
- transactionId2 = listTransactionDTO.get(1).getId();
- } else // ??????
- {
- transactionId2 = transactionDTO.getId();
- }
-
- // NETTOYAGE TEST
- removeTransaction(serviceTransaction, transactionId);
- removeTransaction(serviceTransaction, transactionId2);
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // FIN NETTOYAGE TEST */
- }
-
- /**
- * Permet de tester l'ajout d'entrées sur une transaction.
- */
- @Test
- public void addEntryTest() {
- /*log.info("BEGIN addEntryTest()");
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
- AccountServiceImpl serviceAccount = new AccountServiceImpl();
-
- // PREPARATION TEST
- // Default period 01/01/2010 -> 31/12/2010
- TimeSpan timespan = createPeriod(servicePeriod);
- Journal journal = createJournal(serviceJournal, "Journal transaction",
- "jt", "description");
- String transactionId = createTransaction(serviceTransaction,
- "Facture 6", "description transaction", timespan, journal);
- // FIN PREPARATION TEST
-
- // On recherche la transaction dans la base de données.
- Transaction transaction = serviceTransaction
- .searchTransactionWithTopiaId(transactionId);
- // On créé le compte 8 et recherche cet account dans la base de données
- Account account = createAccount(serviceAccount, "8", "Compte essai",
- "0", "actif");
- createAccount(serviceAccount, "81", "Compte essai 81", "8", "actif");
- // Ajout entrée : 300 euros en crédit
- String result = serviceTransaction.addEntry("entree1", "300", false,
- "lettering", "detail", transaction, account);
-
- // Si il renvoie succes et non l'identifiant (à commenter dans la classe correspondante)
-
- //Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS,result);
- // Ajout entrée : 300 euros en débit
- result = serviceTransaction.addEntry("entree2", "300", true,
- "lettering", "detail", transaction, account);
-
- // Si il renvoie succes et non l'identifiant (à commenter dans la classe correspondante)
-
- //Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS,result);
-
- // NETTOYAGE TEST
- // Les entrees sont supprimees avec la transaction (composition)
- removeTransaction(serviceTransaction, transactionId);
- serviceAccount.removeAccount("8");
- serviceAccount.removeAccount("81");
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // N NETTOYAGE TEST */
- }
-
- /**
- * Recherche les entrées suivant la transaction.
- */
- @Test
- public void searchEntryTest() {
- /*log.info("BEGIN searchEntryTest()");
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
- AccountServiceImpl serviceAccount = new AccountServiceImpl();
- EntryServiceImpl serviceEntry = new EntryServiceImpl();
-
- // PREPARATION TEST
- // Default period 01/01/2010 -> 31/12/2010
- TimeSpan timespan = createPeriod(servicePeriod);
- Journal journal = createJournal(serviceJournal, "Journal transaction",
- "jt", "description");
- String transactionId = createTransaction(serviceTransaction,
- "Facture 6", "description transaction", timespan, journal);
- Transaction transaction = serviceTransaction
- .searchTransactionWithTopiaId(transactionId);
- Account account = createAccount(serviceAccount, "8", "Compte essai",
- "0", "actif");
- createAccount(serviceAccount, "81", "Compte essai 81", "8", "actif");
- serviceTransaction.addEntry("entree1", "300", false, "lettering",
- "detail", transaction, account);
- serviceTransaction.addEntry("entree2", "300", true, "lettering",
- "detail", transaction, account);
- // FIN PREPARATION TEST
-
- List<EntryDTO> listEntryDTO = serviceEntry
- .searchEntryDTOWithTransaction(transaction);
- // On doit trouver deux entrées.
- Assert.assertEquals(2, listEntryDTO.size());
-
- // Vérifie pour le DTO si tout est complet
-
- // Prend le premier entry
- AccountDTO accountDTO = listEntryDTO.get(0).getAccountDTO();
- // Trouve le compte 8
- Assert.assertEquals("8", accountDTO.getAccountNumber());
- // Trouve le compte 81
- accountDTO = accountDTO.getAccountChildDTO().get(0);
- Assert.assertEquals("81", accountDTO.getAccountNumber());
-
- // NETTOYAGE TEST
- removeTransaction(serviceTransaction, transactionId);
- serviceAccount.removeAccount("8");
- serviceAccount.removeAccount("81");
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // FIN NETTOYAGE TEST */
- }
-
- /**
- * Permet de tester la modification d'une entrée comptable.
- */
- @Test
- public void modifyEntry() {
- /*log.info("BEGIN modifyEntry()");
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
- AccountServiceImpl serviceAccount = new AccountServiceImpl();
- EntryServiceImpl serviceEntry = new EntryServiceImpl();
-
- // PREPARATION TEST
- // Default period 01/01/2010 -> 31/12/2010
- TimeSpan timespan = createPeriod(servicePeriod);
- Journal journal = createJournal(serviceJournal, "Journal transaction",
- "jt", "description");
- String transactionId = createTransaction(serviceTransaction,
- "Facture 6", "description transaction", timespan, journal);
- Transaction transaction = serviceTransaction
- .searchTransactionWithTopiaId(transactionId);
- Account account = createAccount(serviceAccount, "8", "Compte essai",
- "0", "actif");
- serviceTransaction.addEntry("entree1", "300", false, "lettering",
- "detail", transaction, account);
- serviceTransaction.addEntry("entree2", "300", true, "lettering",
- "detail", transaction, account);
- // FIN PREPARATION TEST
-
- // Recherche les deux entry en format DTO
- List<EntryDTO> listEntryDTO = serviceEntry
- .searchEntryDTOWithTransaction(transaction);
- Assert.assertEquals(2, listEntryDTO.size());
- Assert.assertTrue(listEntryDTO.size() > 0);
- // Premier DTO
- EntryDTO entryDTO = listEntryDTO.get(0);
- entryDTO.setAmount("800");
- String result = serviceTransaction.modifyEntry(entryDTO);
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS, result);
- // Second DTO
- entryDTO = listEntryDTO.get(1);
- entryDTO.setAmount("800");
-
- // Modification de l'entrée dans la bdd.
- result = serviceTransaction.modifyEntry(entryDTO);
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS, result);
- // Vérifie que les deux DTO ont bien été modifiés.
- listEntryDTO = serviceEntry.searchEntryDTOWithTransaction(transaction);
- entryDTO = listEntryDTO.get(0);
- Assert.assertEquals("800,00", entryDTO.getAmount());
-
- // NETTOYAGE TEST
- removeTransaction(serviceTransaction, transactionId);
- serviceAccount.removeAccount("8");
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // FIN NETTOYAGE TEST */
- }
-
- /**
- * Test la suppression d'une entry.
- */
- @Test
- public void removeEntryTest() {
- /*log.info("BEGIN removeEntryTest()");
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
- AccountServiceImpl serviceAccount = new AccountServiceImpl();
- EntryServiceImpl serviceEntry = new EntryServiceImpl();
-
- // PREPARATION TEST
- // Default period 01/01/2010 -> 31/12/2010
- TimeSpan timespan = createPeriod(servicePeriod);
- Journal journal = createJournal(serviceJournal, "Journal transaction",
- "jt", "description");
- String transactionId = createTransaction(serviceTransaction,
- "Facture 6", "description transaction", timespan, journal);
- Transaction transaction = serviceTransaction
- .searchTransactionWithTopiaId(transactionId);
- Account account = createAccount(serviceAccount, "8", "Compte essai",
- "0", "actif");
- serviceTransaction.addEntry("entree1", "300", false, "lettering",
- "detail", transaction, account);
- serviceTransaction.addEntry("entree2", "300", true, "lettering",
- "detail", transaction, account);
- // FIN PREPARATION TEST
-
- List<EntryDTO> listEntryDTO = serviceEntry
- .searchEntryDTOWithTransaction(transaction);
- // Prend le premier DTO
- EntryDTO entryDTO = listEntryDTO.get(0);
- // Supprime cette entrée
- String result = serviceTransaction.removeEntry(entryDTO.getId());
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS, result);
- // Recherche dans la base de données les entrys
- listEntryDTO = serviceEntry.searchEntryDTOWithTransaction(transaction);
- // Trouve un seul entry DTO
- Assert.assertEquals(1, listEntryDTO.size());
-
- // NETTOYAGE TEST
- removeTransaction(serviceTransaction, transactionId);
- serviceAccount.removeAccount("8");
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // FIN NETTOYAGE TEST */
- }
-
- /**
- * Test la suppression d'une transaction et ses entrées.
- */
- @Test
- public void removeTransactionTest() {
- /*log.info("BEGIN removeEntryTest()");
- PeriodServiceImpl servicePeriod = new PeriodServiceImpl();
- TransactionServiceImpl serviceTransaction = new TransactionServiceImpl();
- JournalServiceImpl serviceJournal = new JournalServiceImpl();
- AccountServiceImpl serviceAccount = new AccountServiceImpl();
- EntryServiceImpl serviceEntry = new EntryServiceImpl();
-
- // PREPARATION TEST
- // Default period 01/01/2010 -> 31/12/2010
- TimeSpan timespan = createPeriod(servicePeriod);
- Journal journal = createJournal(serviceJournal, "Journal transaction",
- "jt", "description");
- String transactionId = createTransaction(serviceTransaction,
- "Facture 6", "description transaction", timespan, journal);
- Transaction transaction = serviceTransaction
- .searchTransactionWithTopiaId(transactionId);
- Account account = createAccount(serviceAccount, "8", "Compte essai",
- "0", "actif");
- serviceTransaction.addEntry("entree1", "300", false, "lettering",
- "detail", transaction, account);
- // FIN PREPARATION TEST
-
- // Supprime cette transaction
- String result = serviceTransaction.removeTransaction(transactionId);
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS, result);
- // Recherche dans la base de données les entrys
- transaction = serviceTransaction
- .searchTransactionWithTopiaId(transactionId);
- List<EntryDTO> listEntryDTO = serviceEntry
- .searchEntryDTOWithTransaction(transaction);
- Assert.assertEquals(0, listEntryDTO.size());
-
- // NETTOYAGE TEST
- serviceAccount.removeAccount("8");
- removeJournals(serviceJournal);
- removePeriod(servicePeriod);
- // FIN NETTOYAGE TEST */
- }
-
- /*
- private TimeSpan createPeriod(PeriodServiceImpl servicePeriod) {
- /*TimeSpanServiceImpl serviceTimespan = new TimeSpanServiceImpl();
- // debut 1 janvier 2010
- Date beginTimeSpan = new Date(110, 0, 1);
- // fin 31 décembre 2010
- Date endTimeSpan = new Date(110, 11, 31);
- // Création période avec son découpage sur 12 mois
- String result = servicePeriod.createPeriod(beginTimeSpan, endTimeSpan,
- false);
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS, result);
- // Recherche du timespan 1 janv au 31 janv 2010
- //Date dateSearch = new Date(110,0,1);
- TimeSpan timespan = serviceTimespan.searchTimeSpanByDate(beginTimeSpan);
- return timespan;
- }
-
- private void removePeriod(PeriodServiceImpl servicePeriod) {
- // Supprime Period & TimeSpan
- Date d = new Date(110, 0, 1);
- PeriodDTO periodDTO = servicePeriod.searchPeriodDTOWithDate(d);
- servicePeriod.removePeriod(periodDTO);
- }
-
- private Journal createJournal(JournalServiceImpl serviceJournal,
- String label, String prefix, String description) {
- // Création Journal
- String result = serviceJournal
- .createJournal(label, prefix, description);
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS, result);
- // Recherche du journal pour l'ajouter dans la transaction
- Journal journal = serviceJournal.searchJournalWithLabel(label);
- Assert.assertNotNull(journal);
- return journal;
- }
-
- private void removeJournals(JournalServiceImpl serviceJournal) {
- // Supprime Journal
- List<JournalDTO> listJournal = serviceJournal.getAllJournal();
- for (JournalDTO journalDTO : listJournal) {
- serviceJournal.removeJournal(journalDTO);
- }
- }
-
- private String createTransaction(TransactionServiceImpl serviceTransaction,
- String voucherRef, String description, TimeSpan timespan,
- Journal journal) {
- // Création d'une transaction
- String transactionId = serviceTransaction
- .createTransaction(timespan.getBeginTimeSpan(), voucherRef,
- description, timespan, journal);
-
- // Si il renvoie succes et non l'identifiant (à commenter dans la classe correspondante)
-
- //Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS,result);
- Assert.assertFalse(transactionId.equals(ServiceHelper.RESPOND_ERROR));
- log.debug("RESULT createTransaction : " + transactionId);
- return transactionId;
- }
-
- private void removeTransaction(TransactionServiceImpl serviceTransaction,
- String transactionId) {
- String result = serviceTransaction.removeTransaction(transactionId);
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS, result);
- }
-
- private Account createAccount(AccountServiceImpl serviceAccount,
- String accountNumber, String label, String masterAccountNumber,
- String type) {
- serviceAccount.createAccount(accountNumber, label, masterAccountNumber,
- type);
- Account account = serviceAccount.searchAccount(accountNumber);
- Assert.assertEquals(accountNumber, account.getAccountNumber());
- return account;
- }*/
-}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementHeaderImpl.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -0,0 +1,16 @@
+package org.chorem.lima.entity;
+
+public class FinancialStatementHeaderImpl extends FinancialStatementHeaderAbstract{
+
+ protected Integer result;
+
+ @Override
+ public int getLevel() {
+ result = 1;
+ if (masterFinancialStatementHeader != null){
+ result = masterFinancialStatementHeader.getLevel()+1;
+ }
+
+ return result;
+ }
+}
Modified: trunk/lima-callao/src/main/xmi/accounting.properties
===================================================================
--- trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-17 10:03:23 UTC (rev 2941)
@@ -6,6 +6,7 @@
org.chorem.lima.entity.FiscalPeriod.attribute.financialPeriod.tagvalue.lazy=false
org.chorem.lima.entity.FinancialStatementHeader.attribute.subFinancialStatementHeaders.tagvalue.lazy=false
org.chorem.lima.entity.FinancialStatementHeader.attribute.financialStatementMovement.tagvalue.lazy=false
+org.chorem.lima.entity.FinancialStatementHeader.attribute.masterFinancialStatementHeader.tagvalue.lazy=false
#model.tagvalue.dbSchema=Callao
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTableModel.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -138,8 +138,8 @@
format(currentRow.getFinancialTransaction().getTransactionDate());
break;
case 1:
- if (currentRow.getEntryBook() != null){
- result = currentRow.getEntryBook().getCode();
+ if (currentRow.getFinancialTransaction().getEntryBook() != null){
+ result = currentRow.getFinancialTransaction().getEntryBook().getCode();
}
else {
result = null;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodView.jaxx 2010-06-17 10:03:23 UTC (rev 2941)
@@ -16,7 +16,6 @@
##% -->
<Table>
-
<FinancialPeriodViewHandler id="handler" javaBean="new FinancialPeriodViewHandler(this)" />
<org.chorem.lima.ui.financialperiod.FinancialPeriodTableModel id="modelFinancialPeriodTable"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -67,7 +67,7 @@
treeTableModel =
(FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
- FinancialStatementHeader newFinancialStatementHeader = new FinancialStatementHeaderImpl();
+ FinancialStatementHeader newFinancialStatementHeader = (FinancialStatementHeader) new FinancialStatementHeaderImpl();
FinancialStatementHeaderForm financialStatementHeaderForm = new FinancialStatementHeaderForm(view);
financialStatementHeaderForm.setHeader(newFinancialStatementHeader);
// jaxx constructor don't call super() ?
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx 2010-06-17 10:03:23 UTC (rev 2941)
@@ -21,7 +21,7 @@
<Boolean id="addState" javaBean='true'/>
<script>
- <![CDATA[
+ <![CDATA[
protected void performCancel() {
setHeader(null);
dispose();
@@ -41,17 +41,6 @@
onRemoveUpdate='getHeader().setLabel(getDescriptionTextField().getText())' />
</cell>
</row>
- <row>
- <cell fill="horizontal">
- <JLabel text="lima.financialstatement.style"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="styleTextField" text="{getHeader().getStyle()}"/>
- <javax.swing.text.Document javaBean="getStyleTextField().getDocument()"
- onInsertUpdate='getHeader().setStyle(getStyleTextField().getText())'
- onRemoveUpdate='getHeader().setStyle(getStyleTextField().getText())' />
- </cell>
- </row>
<row>
<cell fill="none">
<JButton text="lima.common.ok" onActionPerformed="dispose()"/>
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -0,0 +1,132 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.ui.financialstatementreport;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.text.SimpleDateFormat;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.ClosedPeriodicEntryBook;
+import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl;
+import org.chorem.lima.service.LimaServiceFactory;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.decorator.ColorHighlighter;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+
+public class FinancialStatementReportTable extends JXTable {
+
+ private static final Log log =
+ LogFactory.getLog(FinancialStatementReportTableModel.class);
+
+ protected FinancialStatementReportViewHandler handler;
+
+ protected FinancialStatementReportTableModel model;
+
+ protected FinancialPeriodService financialPeriodService;
+
+ private Highlighter colorTransaction;
+
+ /*
+ * Constructor, call highlighter
+ */
+ public FinancialStatementReportTable(FinancialStatementReportViewHandler handler) {
+
+ this.handler = handler;
+ model = this.handler.getView().modelTable;
+ financialPeriodService =
+ LimaServiceFactory.getInstance().getFinancialPeriodService();
+
+ //highlight financial financial transactions
+ // addTitle1();
+ // addTitle2();
+
+ //Renderer for font
+
+ log.debug(getColumnCount());
+ /*
+ FinancialStatementReportTableCellRenderer renderer = new FinancialStatementReportTableCellRenderer();
+ for (int i = 1; i <= model.getColumnCount(); i++) {
+
+ getColumn(-1).setCellRenderer(renderer);
+ //getColumnModel().getColumn(i).setCellRenderer(renderer);
+ }*/
+
+ }
+
+ /*
+ * Color the background row in grey if the month number is even (pair in french)
+ */
+ protected void addTitle1() {
+/*
+
+
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ ClosedPeriodicEntryBook closedPeriodicEntryBook
+ = (ClosedPeriodicEntryBook) model.getElementAt(adapter.row);
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM");
+ int month = Integer.parseInt(simpleDateFormat.format(
+ closedPeriodicEntryBook.getFinancialPeriod().getBeginDate()));
+ // true if month is even
+ return ((month % 2)==0);
+ }
+ };
+ colorTransaction =
+ new ColorHighlighter(predicate, new Color(222,222,222), null);
+ addHighlighter(colorTransaction);*/
+ }
+
+ /*
+ * Color the font in red if period are closed
+ */
+ protected void addTitle2() {
+ /* HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ ClosedPeriodicEntryBook closedPeriodicEntryBook =
+ new ClosedPeriodicEntryBookImpl();
+ ClosedPeriodicEntryBook selectedClosedPeriodicEntryBook =
+ (ClosedPeriodicEntryBook) model.getElementAt(adapter.row);
+ // true if locked
+ try {
+ closedPeriodicEntryBook =
+ financialPeriodService.getClosedPeriodicEntryBook(
+ selectedClosedPeriodicEntryBook.getEntryBook(),
+ selectedClosedPeriodicEntryBook.getFinancialPeriod());
+ } catch (LimaException eee) {
+ log.debug("Can't get closePeriodicEntryBook",eee);
+ }
+ return (closedPeriodicEntryBook.getLocked());
+ }
+ };
+ colorTransaction =
+ new ColorHighlighter(predicate, null, new Color(222,0,0));
+ addHighlighter(colorTransaction);*/
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTable.java
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableCellRenderer.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -0,0 +1,86 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.ui.financialstatementreport;
+
+import javax.swing.table.*;
+import javax.swing.*;
+
+import org.chorem.lima.entity.FinancialStatementHeader;
+
+import java.awt.*;
+
+
+/**
+ * Permet de modifier l'apparence du tableau pour le bilan à l'actif
+ * @author Rémi Chapelet
+ */
+
+public class FinancialStatementReportTableCellRenderer extends DefaultTableCellRenderer {
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value,
+ boolean isSelected, boolean hasFocus, int row, int column)
+ {
+ super.getTableCellRendererComponent(table, value, isSelected, hasFocus,
+ row, column);
+
+ // Get table
+ FinancialStatementReportTable financialStatementReportTable = (FinancialStatementReportTable) table;
+ FinancialStatementReportTableModel financialStatementReportTableModel = (FinancialStatementReportTableModel) table.getModel();
+
+ // Récupère le bilan de la ligne
+ Object object = financialStatementReportTableModel.getElementAt(row);
+ // Si le bilan est un soustotal, alors la ligne est en gras
+ if (object instanceof FinancialStatementHeader){
+ FinancialStatementHeader financialStatementHeader = (FinancialStatementHeader) object;
+
+ if (financialStatementHeader.getLevel() == 1)
+ {
+ setFont(new Font("Verdana", Font.BOLD, 14));
+ }
+
+ if (financialStatementHeader.getLevel() == 2)
+ {
+ setFont(new Font("Verdana", Font.BOLD, 12));
+ }
+ }
+
+ // Alignement des cellules
+ switch (column) {
+ case 0:
+ this.setHorizontalAlignment(JLabel.LEFT);
+ break;
+ case 1:
+ this.setHorizontalAlignment(JLabel.RIGHT);
+ break;
+ case 2:
+ this.setHorizontalAlignment(JLabel.RIGHT);
+ break;
+ case 3:
+ this.setHorizontalAlignment(JLabel.RIGHT);
+ break;
+ case 4:
+ this.setHorizontalAlignment(JLabel.RIGHT);
+ break;
+ }
+
+ return this;
+ }
+
+}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -113,6 +113,12 @@
return res;
}
+ public Object getElementAt(int row){
+
+ Object currentRow = cacheDataList.get(row);
+ return currentRow;
+ }
+
@Override
public Object getValueAt(int row, int column) {
Object result = cacheDataList.get(row);
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 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx 2010-06-17 10:03:23 UTC (rev 2941)
@@ -80,11 +80,11 @@
<row>
<cell fill="both" weightx="1" weighty="1" columns="7">
<JScrollPane>
- <org.jdesktop.swingx.JXTable id="table" rowHeight="24"
- model="{getModelTable()}"
- highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
- columnControlVisible="true"/>
+ <org.chorem.lima.ui.financialstatementreport.FinancialStatementReportTable
+ id="table" rowHeight="24"
+ constructorParams="getHandler()" model="{getModelTable()}"
+ selectionMode="{ListSelectionModel.SINGLE_INTERVAL_SELECTION}"
+ columnControlVisible="true" />
<javax.swing.ListSelectionModel javaBean="getTable().getSelectionModel()"/>
</JScrollPane>
</cell>
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 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -24,6 +24,7 @@
import org.chorem.lima.beans.BalanceTrial;
import org.chorem.lima.business.FinancialTransactionService;
import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.ui.financialperiod.FinancialPeriodView;
/**
@@ -87,4 +88,8 @@
}*/
}
+ public FinancialStatementReportView getView() {
+ return view;
+ }
+
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionTableModel.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -252,10 +252,15 @@
result = currentRow.getTransactionDate();
break;
case 1:
- result = null; // voucher
+ if (currentRow.getEntryBook() != null){
+ result = currentRow.getEntryBook().getCode();
+ }
+ else {
+ result = null;
+ }
break;
case 2:
- result = null; //entrybook
+ result = null; //voucher
break;
case 3:
result = null; // account
@@ -284,12 +289,7 @@
result = null; // date
break;
case 1 : // entry book
- if (currentEntry.getEntryBook() != null){
- result = currentEntry.getEntryBook().getCode();
- }
- else {
- result = null;
- }
+ result = null;
break;
case 2:
result = currentEntry.getVoucher();
@@ -344,11 +344,11 @@
boolean editableCell=false;
Object currentRow = cacheDataList.get(rowIndex);
// cells editable for the entry row, all cells exclude the date
- if ((currentRow instanceof Entry) && !(columnIndex==0)) {
+ if ((currentRow instanceof Entry) && !((columnIndex==0) || (columnIndex==1))) {
editableCell=true;
}
// cells editable for the financialtransaction row, no cells exclude the date
- if ((currentRow instanceof FinancialTransaction) && (columnIndex==0)){
+ if ((currentRow instanceof FinancialTransaction) && ((columnIndex==0) || (columnIndex==1))){
editableCell=true;
}
return editableCell;
@@ -429,6 +429,9 @@
//update
currentFinancialTransaction.setTransactionDate((Date)value);
break;
+ case 1 :
+ currentFinancialTransaction.setEntryBook((EntryBook)value);
+ break;
}
// notify service for modification
try {
@@ -447,9 +450,6 @@
else if (currentRow instanceof Entry) {
Entry currentEntry = (Entry)currentRow;
switch (column) {
- case 1 :
- currentEntry.setEntryBook((EntryBook)value);
- break;
case 2 :
currentEntry.setVoucher((String)value);
break;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -234,7 +234,12 @@
result = currentRow.getTransactionDate();
break;
case 1:
- result = null; // voucher
+ if (currentRow.getEntryBook() != null){
+ result = currentRow.getEntryBook().getCode();
+ }
+ else {
+ result = null;
+ }
break;
case 2:
result = null; //entrybook
@@ -266,12 +271,7 @@
result = null; // date
break;
case 1 : // entry book
- if (currentEntry.getEntryBook() != null){
- result = currentEntry.getEntryBook().getCode();
- }
- else {
- result = null;
- }
+ result = null;
break;
case 2:
result = currentEntry.getVoucher();
@@ -325,11 +325,11 @@
boolean editableCell=false;
Object currentRow = cacheDataList.get(rowIndex);
// cells editable for the entry row, all cells exclude the date
- if ((currentRow instanceof Entry) && !(columnIndex==0)) {
+ if ((currentRow instanceof Entry) && !((columnIndex==0) || (columnIndex==1))) {
editableCell=true;
}
// cells editable for the financialtransaction row, no cells exclude the date
- if ((currentRow instanceof FinancialTransaction) && (columnIndex==0)){
+ if ((currentRow instanceof FinancialTransaction) && ((columnIndex==0) || (columnIndex==1))){
editableCell=true;
}
return editableCell;
@@ -376,6 +376,9 @@
//update
currentFinancialTransaction.setTransactionDate((Date)value);
break;
+ case 1 :
+ currentFinancialTransaction.setEntryBook((EntryBook)value);
+ break;
}
// notify service for modification
try {
@@ -394,9 +397,6 @@
else if (currentRow instanceof Entry) {
Entry currentEntry = (Entry)currentRow;
switch (column) {
- case 1 :
- currentEntry.setEntryBook((EntryBook)value);
- break;
case 2 :
currentEntry.setVoucher((String)value);
break;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ledger/LedgerTableModel.java 2010-06-17 10:03:23 UTC (rev 2941)
@@ -195,8 +195,8 @@
format(currentRow.getFinancialTransaction().getTransactionDate());
break;
case 2:
- if (currentRow.getEntryBook() != null){
- result = currentRow.getEntryBook().getCode();
+ if (currentRow.getFinancialTransaction().getEntryBook() != null){
+ result = currentRow.getFinancialTransaction().getEntryBook().getCode();
}
else { //entrybook
result = null;
@@ -264,7 +264,6 @@
for (ReportsDatas reportsDatas : balanceTrialCache.getReportsDatas()) {
results.add(reportsDatas);
List<Entry> entries = (List<Entry>) reportsDatas.getListEntry();
- log.debug(reportsDatas);
if (entries != null){
Collections.sort(entries, new EntryComparator());
results.addAll(entries);
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-17 10:03:23 UTC (rev 2941)
@@ -328,6 +328,7 @@
lima.status.tr.finalized=Finalized
lima.status.tr.wip=Work in progress
lima.structure=Structure
+lima.style.1=
lima.subledger.accountnumber=
lima.subledger.code=Code
lima.subledger.label=
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 2010-06-15 17:35:55 UTC (rev 2940)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-17 10:03:23 UTC (rev 2941)
@@ -312,6 +312,7 @@
lima.status.tr.finalized=Valid\u00E9e
lima.status.tr.wip=En cours
lima.structure=Structure
+lima.style.1=
lima.subledger.accountnumber=
lima.subledger.code=Code
lima.subledger.label=
1
0
15 Jun '10
Author: jpepin
Date: 2010-06-15 19:35:55 +0200 (Tue, 15 Jun 2010)
New Revision: 2940
Url: http://chorem.org/repositories/revision/lima/2940
Log:
G?\195?\169n?\195?\169ration du bilan et compte de r?\195?\169sultat, ajout m?\195?\169thode de calcul dans le business, ajout affichage dans l'UI.
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.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
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/ReportsHelper.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementViewHandler.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.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/ReportServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx
trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceLocal.java 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountServiceLocal.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -19,8 +19,13 @@
package org.chorem.lima.business;
+import java.util.List;
+
import javax.ejb.Local;
+import org.chorem.lima.entity.Account;
+import org.nuiton.topia.TopiaContext;
+
/**
* Account service.
*
@@ -34,5 +39,6 @@
@Local
public interface AccountServiceLocal extends AccountService{
+ public List<Account> stringToListAccountsWithTransaction(String selectedAccounts, TopiaContext topiaContext) throws LimaException;
}
\ No newline at end of file
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -19,6 +19,7 @@
package org.chorem.lima.business;
+import java.util.Date;
import java.util.List;
import javax.ejb.Remote;
@@ -28,14 +29,16 @@
@Remote
public interface FinancialStatementService {
- void createFinancialStatementHeader(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
- void updateFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
- void removeFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
+ public void createFinancialStatementHeader(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
+ public void updateFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
+ public void removeFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
- void createFinancialStatementMovement(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
- void updateFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
- void removeFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
+ public void createFinancialStatementMovement(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
+ public void updateFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
+ public void removeFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
public List<Object> getChildrenFinancialStatement(FinancialStatementHeader financialStatementHeader) throws LimaException;
- List<Object> getAllChildrenFinancialStatement(FinancialStatementHeader financialStatementHeader, List<Object> objects) throws LimaException, LimaBusinessException;
+ public List<Object> getAllChildrenFinancialStatement(FinancialStatementHeader financialStatementHeader, List<Object> objects) throws LimaException, LimaBusinessException;
+
+ public List<Object> financialStatementReports(Date selectedBeginDate, Date selectedEndDate) throws LimaException;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceLocal.java 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ReportServiceLocal.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -19,9 +19,15 @@
package org.chorem.lima.business;
+import java.util.Date;
+
import javax.ejb.Local;
+import org.chorem.lima.beans.ReportsDatas;
+import org.chorem.lima.entity.Account;
+import org.nuiton.topia.TopiaContext;
+
/**
* Service de generation des rapports.
*
@@ -41,4 +47,6 @@
@Local
public interface ReportServiceLocal extends ReportService {
+ public ReportsDatas generateAccountReportsWithTransaction (Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException;
+
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -22,8 +22,13 @@
import static org.nuiton.i18n.I18n._;
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
+import java.util.StringTokenizer;
+
import javax.ejb.Stateless;
+
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.AccountService;
@@ -369,16 +374,63 @@
commitTransaction(transaction);
}
catch (TopiaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Error during update account", ex);
- }
- throw new LimaException("Can't update account", ex);
+ doCatch(transaction, ex, log);
}
finally {
doFinally(transaction, log);
}
}
+
+ /**
+ * Convert string of extends number to list of accounts
+ * Example '22, 45-48, 67' -> [22, 45, 46, 47, 48, 67]
+ */
+ @Override
+ public List<Account> stringToListAccountsWithTransaction(String selectedAccounts, TopiaContext topiaContext) throws LimaException{
+ List<Account> accounts = new ArrayList<Account>();
+ if (selectedAccounts != null){
+ try {
+ AccountDAO accountDAO =
+ LimaCallaoDAOHelper.getAccountDAO(topiaContext);
+ //Remove Spaces
+ selectedAccounts = StringUtils.deleteWhitespace(selectedAccounts);
+ //use hashset for delete duplicate numbers
+ HashSet<String> accountNumbers = new HashSet<String>();
+ //Split comma
+ StringTokenizer stComma = new StringTokenizer(selectedAccounts, ",");
+ while (stComma.hasMoreTokens()) {
+ String s = stComma.nextToken();
+ if (s.contains("-")){
+ //Split hypen
+ String stringHypen[] = s.split("-");
+ int lowAccount=Integer.parseInt(stringHypen[0]);
+ int highAccount=Integer.parseInt(stringHypen[1]);
+ for (int i=lowAccount; i <= highAccount; i++) {
+ accountNumbers.add(String.valueOf(i));
+ }
+ }
+ else{
+ accountNumbers.add(s);
+ }
+ }
+
+ for (String accountNumber : accountNumbers) {
+ Account accountFilter = accountDAO.findByAccountNumber(accountNumber);
+ //add account if exist
+ if (accountFilter != null){
+ accounts.add(accountFilter);
+ }
+ }
+ }
+ catch (TopiaException ex) {
+ doCatch(topiaContext, ex, log);
+ }
+ }
+
+ return accounts;
+ }
+
protected TopiaContext beginTransaction() throws TopiaException {
// basic check done, make check in database
// TODO move it into JTA
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 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -21,16 +21,24 @@
import static org.nuiton.i18n.I18n._;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
+import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.beans.FinancialStatementAmounts;
+import org.chorem.lima.beans.FinancialStatementAmountsImpl;
+import org.chorem.lima.beans.ReportsDatas;
+import org.chorem.lima.business.AccountServiceLocal;
import org.chorem.lima.business.AccountingRules;
import org.chorem.lima.business.FinancialStatementService;
import org.chorem.lima.business.FinancialStatementServiceLocal;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ReportServiceLocal;
+import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.FinancialStatementHeader;
import org.chorem.lima.entity.FinancialStatementHeaderDAO;
import org.chorem.lima.entity.FinancialStatementMovement;
@@ -52,6 +60,12 @@
protected AccountingRules accountingRules;
+ @EJB
+ AccountServiceLocal accountServiceLocal;
+
+ @EJB
+ ReportServiceLocal reportServiceLocal;
+
public FinancialStatementServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
try {
@@ -215,9 +229,14 @@
@Override
public List<Object> getAllChildrenFinancialStatement(FinancialStatementHeader financialStatementHeader, List<Object> objects) throws LimaException, LimaBusinessException {
- return objects;
- // TODO Auto-generated method stub
- }
+ List<Object> childFinancialStatement = getChildrenFinancialStatement(financialStatementHeader);
+ for (Object child : childFinancialStatement) {
+ objects.add(child);
+ if (child instanceof FinancialStatementHeader){
+ getAllChildrenFinancialStatement((FinancialStatementHeader) child, objects);
+ }
+ }
+ return objects; }
@Override
public List<Object> getChildrenFinancialStatement(FinancialStatementHeader masterFinancialStatementHeader) throws LimaException {
@@ -231,10 +250,13 @@
LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
- TopiaQuery query = financialStatementHeaderDAO.createQuery();
+
+
+ TopiaQuery query = financialStatementHeaderDAO.createQuery();
if (masterFinancialStatementHeader == null){
query.addEquals("masterFinancialStatementHeader", masterFinancialStatementHeader);
}
+ //TODO virer addwhere, garder addEquals
else {
query.addWhere("masterFinancialStatementHeader = :value")
.addParam("value", masterFinancialStatementHeader);
@@ -276,10 +298,7 @@
commitTransaction(transaction);
}
catch (TopiaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Error during update financialStatementHeader", ex);
- }
- throw new LimaException("Can't update financialStatementHeader", ex);
+ doCatch(transaction, ex, log);
}
finally {
doFinally(transaction, log);
@@ -301,16 +320,95 @@
commitTransaction(transaction);
}
catch (TopiaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Error during update financialStatementMovement", ex);
- }
- throw new LimaException("Can't update financialStatementMovement", ex);
+ doCatch(transaction, ex, log);
}
finally {
doFinally(transaction, log);
}
}
+
+ @Override
+ public List<Object> financialStatementReports(Date selectedBeginDate, Date selectedEndDate) throws LimaException {
+ List<Object> result = new ArrayList<Object>();
+ TopiaContext transaction = null;
+ try {
+ transaction = beginTransaction();
+ List<Object> financialStatementList = getAllChildrenFinancialStatement(null, new ArrayList<Object>());
+
+ for (Object object : financialStatementList) {
+ if (object instanceof FinancialStatementMovement){
+ FinancialStatementAmounts financialStatementAmounts = financialStatementMovementAmounts((FinancialStatementMovement) object, selectedBeginDate, selectedEndDate, transaction);
+ result.add(financialStatementAmounts);
+ }
+ else {
+ result.add(object);
+ }
+ }
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+
+ return result;
+ }
+
+ public FinancialStatementAmounts financialStatementMovementAmounts(FinancialStatementMovement financialStatementMovement, Date selectedBeginDate, Date selectedEndDate, TopiaContext topiaContext) throws LimaException{
+ FinancialStatementAmounts financialStatementAmounts = new FinancialStatementAmountsImpl();
+
+ try {
+ String accountsString = financialStatementMovement.getAccounts();
+ List<Account> accountsList = accountServiceLocal.
+ stringToListAccountsWithTransaction(accountsString, topiaContext);
+ Double amount = 0.0;
+ for (Account account : accountsList) {
+ ReportsDatas reportsDatas = reportServiceLocal.generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext);
+ amount += reportsDatas.getAmountSolde();
+ }
+
+ String creditAccountsString = financialStatementMovement.getCreditAccounts();
+ List<Account> creditAccountsList = accountServiceLocal.
+ stringToListAccountsWithTransaction(creditAccountsString, topiaContext);
+ Double creditAmount = 0.0;
+ for (Account account : creditAccountsList) {
+ ReportsDatas reportsDatas = reportServiceLocal.generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext);
+ creditAmount += reportsDatas.getAmountCredit();
+ }
+
+ String debitAccountsString = financialStatementMovement.getDebitAccounts();
+ List<Account> debitAccountsList = accountServiceLocal.
+ stringToListAccountsWithTransaction(debitAccountsString, topiaContext);
+ Double debitAmount = 0.0;
+ for (Account account : debitAccountsList) {
+ ReportsDatas reportsDatas = reportServiceLocal.generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext);
+ debitAmount += reportsDatas.getAmountCredit();
+ }
+
+ String provisionDeprecationAccountsString =
+ financialStatementMovement.getProvisionDeprecationAccounts();
+ List<Account> provisionDeprecationAccountsList = accountServiceLocal.
+ stringToListAccountsWithTransaction(provisionDeprecationAccountsString, topiaContext);
+ Double provisionDeprecationAmount = 0.0;
+ for (Account account : provisionDeprecationAccountsList) {
+ ReportsDatas reportsDatas = reportServiceLocal.generateAccountReportsWithTransaction(account, selectedBeginDate, selectedEndDate, topiaContext);
+ provisionDeprecationAmount += reportsDatas.getAmountSolde();
+ }
+
+ financialStatementAmounts.setGrossAmount(amount+creditAmount+debitAmount);
+ financialStatementAmounts.setLabel(financialStatementMovement.getLabel());
+ financialStatementAmounts.setProvisionDeprecationAmount(provisionDeprecationAmount);
+
+ }
+ catch (LimaException ex) {
+ doCatch(topiaContext, ex, log);
+ }
+
+ return financialStatementAmounts;
+ }
+
protected TopiaContext beginTransaction() throws TopiaException {
// basic check done, make check in database
// TODO move it into JTA
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 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -21,9 +21,8 @@
import java.util.ArrayList;
import java.util.Date;
-import java.util.HashSet;
import java.util.List;
-import java.util.StringTokenizer;
+import javax.ejb.EJB;
import javax.ejb.Stateless;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -32,6 +31,7 @@
import org.chorem.lima.beans.BalanceTrialImpl;
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.beans.ReportsDatasImpl;
+import org.chorem.lima.business.AccountServiceLocal;
import org.chorem.lima.business.LimaConfig;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
@@ -56,6 +56,9 @@
private TopiaContext rootContext;
+ @EJB
+ AccountServiceLocal accountServiceLocal;
+
public ReportServiceImpl() {
LimaConfig config = LimaConfig.getInstance();
try {
@@ -97,7 +100,8 @@
* - for subaccount
* - for a foldaccounts, contains many accounts
*/
- protected ReportsDatas generateAccountReportsWithTransaction (Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException{
+ @Override
+ public ReportsDatas generateAccountReportsWithTransaction (Account account, Date beginDate, Date endDate, TopiaContext topiaContext) throws LimaException{
ReportsDatas reportsDatas = new ReportsDatasImpl();
double credit = 0, debit = 0, solde = 0;
if (account != null){
@@ -422,33 +426,7 @@
}
//build list account from selectedAccounts
else{
- accounts = new ArrayList<Account>();
- //use hashset for delete duplicate numbers
- HashSet<String> accountNumbers = new HashSet<String>();
- //Split comma
- StringTokenizer stComma = new StringTokenizer(selectedAccounts, ",");
- while (stComma.hasMoreTokens()) {
- String s = stComma.nextToken();
- if (s.contains("-")){
- //Split hypen
- String stringHypen[] = s.split("-");
- int lowAccount=Integer.parseInt(stringHypen[0]);
- int highAccount=Integer.parseInt(stringHypen[1]);
- for (int i=lowAccount; i <= highAccount; i++) {
- accountNumbers.add(String.valueOf(i));
- }
- }
- else{
- accountNumbers.add(s);
- }
- }
-
- for (String accountNumber : accountNumbers) {
- Account accountFilter = accountDAO.findByAccountNumber(accountNumber);
- if (accountFilter != null){
- accounts.add(accountFilter);
- }
- }
+ accounts=accountServiceLocal.stringToListAccountsWithTransaction(selectedAccounts, topiaTransaction);
}
for (Account account : accounts) {
ReportsDatas reportsDatas =
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-06-15 17:35:55 UTC (rev 2940)
@@ -145,9 +145,8 @@
<JMenuItem text="lima.reports.entrybooks" onActionPerformed='getHandler().showEntryBookReports(this)'/>
<JMenuItem text="lima.reports.balance" onActionPerformed='getHandler().showBalanceView(this)'/>
<JMenuItem text="lima.reports.ledger" onActionPerformed='getHandler().showLedgerView(this)'/>
- <JMenuItem text="lima.reports" onActionPerformed='getHandler().showReportsView(this)' actionIcon='rapport'/>
- <JMenuItem text="lima.bilan" onActionPerformed='getHandler().showBilanView(this)'/>
- <JMenuItem text="lima.result" onActionPerformed='getHandler().showResultView(this)'/>
+ <JMenuItem text="lima.financialstatementreports" onActionPerformed='getHandler().showFinancialStatementReportsView(this)' actionIcon='rapport'/>
+
</JMenu>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -41,7 +41,8 @@
import org.chorem.lima.ui.entrybooksreports.EntryBooksReportsView;
import org.chorem.lima.ui.financialperiod.FinancialPeriodView;
import org.chorem.lima.ui.fiscalperiod.FiscalPeriodView;
-import org.chorem.lima.ui.financialstatement.FinancialStatementView;
+import org.chorem.lima.ui.financialstatementchart.FinancialStatementChartView;
+import org.chorem.lima.ui.financialstatementreport.FinancialStatementReportView;
import org.chorem.lima.ui.financialtransaction.FinancialTransactionView;
import org.chorem.lima.ui.financialtransaction.LetteringView;
import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedView;
@@ -325,7 +326,7 @@
*/
public void showFinancialStatementView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- FinancialStatementView financialStatementView = new FinancialStatementView(mainView);
+ FinancialStatementChartView financialStatementView = new FinancialStatementChartView(mainView);
mainView.showTab(_("lima.charts.financialstatement"), financialStatementView);
}
@@ -378,16 +379,12 @@
mainView.showTab(_("lima.reports.ledger"), ledgerView);
}
- public void showBilanView(JAXXContext rootContext) {
+ public void showFinancialStatementReportsView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
- // BilanView bilanView = new BilanView(mainView);
- // mainView.showTab(_("lima.tab.bilan"), bilanView);
+ FinancialStatementReportView financialStatementReportView= new FinancialStatementReportView(mainView);
+ mainView.showTab(_("lima.reports.financialstatement"), financialStatementReportView);
}
- public void showClosureTimeSpanView(JAXXContext rootContext) {
- //getClosureView().initBlockForm();
- }
-
public void showImportView(String type) {
/*if (!getImportView(type).isEnabled()) {
getImportView(type).setEnabled(true);
@@ -413,12 +410,6 @@
getSearchView().setVisible(true);*/
}
- public void showReportsView(JAXXContext rootContext) {
- MainView mainView = getUI(rootContext);
- //ReportsView reportsView = new ReportsView(mainView);
- // mainView.showTab(_("lima.tab.reports"), reportsView);
- }
-
public void showResultView(JAXXContext rootContext) {
MainView mainView = getUI(rootContext);
//ResultView resultView = new ResultView(mainView);
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ReportsHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ReportsHelper.java 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ReportsHelper.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -1,86 +0,0 @@
-/* *##% Lima Main
- * Copyright (C) 2008 - 2010 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
- */
-
-package org.chorem.lima.ui;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.Entry;
-import org.chorem.lima.ui.accountsreports.AccountsReportsTableModel;
-
-/**
- * TODO add comment here.
- *
- * @author chatellier
- * @version $Revision: 2864 $
- *
- * Last update : $Date: 2010-04-16 12:26:55 +0200 (ven. 16 avril 2010) $
- * By : $Author: jpepin $
- */
-public class ReportsHelper {
-
- /** log. */
- private static final Log log = LogFactory.getLog(AccountsReportsTableModel.class);
-
- /**
- * Get total credit for entries.
- *
- * @param list entries to calculate
- * @return total credit
- */
- public static double getTotalCredit(List<Entry> entries) {
- double credit = 0;
- for (Entry entry : entries) {
- // TODO EC-20100407 voir si le modele correspond (amount, credit,debit)
- if (!entry.getDebit()) {
- credit += entry.getAmount();
- }
- }
- return credit;
- }
-
- /**
- * Get total debit for entries.
- *
- * @param list entries to calculate
- * @return total debit
- */
- public static double getTotalDebit(List<Entry> entries) {
- double debit = 0;
- for (Entry entry : entries) {
- // TODO EC-20100407 voir si le modele correspond (amount, credit,debit)
- if (entry.getDebit()) {
- debit += entry.getAmount();
- }
- }
- return debit;
- }
-
- /**
- * Return amount of debit - credit
- *
- * @param list entries to calculate
- * @return Solde
- */
- public static double getSolde(List<Entry> entries) {
- double balanced = getTotalDebit(entries) - getTotalCredit(entries);
- return balanced;
- }
-}
Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java (from rev 2939, trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementTreeTableModel.java)
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartTreeTableModel.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -0,0 +1,269 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.ui.financialstatementchart;
+
+import static org.nuiton.i18n.I18n._;
+import java.util.List;
+import javax.swing.tree.TreePath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.FinancialStatementService;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.FinancialStatementHeader;
+import org.chorem.lima.entity.FinancialStatementHeaderImpl;
+import org.chorem.lima.entity.FinancialStatementMovement;
+import org.chorem.lima.service.LimaServiceFactory;
+import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
+
+/**
+ * Tree table model for account edition.
+ *
+ * @author ore
+ * @author chatellier
+ * @version $Revision: 2934 $
+ *
+ * Last update : $Date: 2010-06-08 11:55:04 +0200 (mar., 08 juin 2010) $
+ * By : $Author: jpepin $
+ */
+public class FinancialStatementChartTreeTableModel extends AbstractTreeTableModel {
+
+ /** log. */
+ private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
+
+ /** Account service. */
+ protected final FinancialStatementService financialStatementService;
+
+ /**
+ * Model constructor. Init account service used here.
+ */
+ public FinancialStatementChartTreeTableModel() {
+ //create root for the tree
+ super(new FinancialStatementHeaderImpl());
+ // Gets factory service
+ financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService();
+ }
+
+
+ @Override
+ public int getColumnCount() {
+ return 1;
+ }
+
+ @Override
+ public String getColumnName(int column) {
+ String res = null;
+ switch (column) {
+ case 0:
+ res = _("lima.account.label");
+ break;
+ }
+ return res;
+ }
+
+ @Override
+ public int getChildCount(Object node) {
+ int result = 0;
+ if (node == getRoot()) {
+ try {
+ result = financialStatementService.
+ getChildrenFinancialStatement(null).size();
+ } catch (LimaException eee) {
+ log.debug("Can't count child", eee);
+ }
+ }
+ else {
+ if (node instanceof FinancialStatementHeader){
+ FinancialStatementHeader parentFinancialStatementHeader =
+ (FinancialStatementHeader) node;
+ try {
+ result = financialStatementService.getChildrenFinancialStatement(
+ parentFinancialStatementHeader).size();
+ } catch (LimaException eee) {
+ log.debug("Can't count child", eee);
+ }
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Object getChild(Object parent, int index) {
+ Object result = null;
+ if (parent == getRoot()) {
+ try {
+ List<Object> allObjects =
+ financialStatementService.getChildrenFinancialStatement(null);
+ result = allObjects.get(index);
+ } catch (LimaException eee) {
+ log.debug("Can't get child", eee);
+ }
+ }
+ else {
+ FinancialStatementHeader parentFinancialStatementHeader =
+ (FinancialStatementHeader) parent;
+ try {
+ List<Object> objects = financialStatementService.
+ getChildrenFinancialStatement(parentFinancialStatementHeader);
+ result = objects.get(index);
+ } catch (LimaException eee) {
+ log.debug("Can't get child", eee);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public int getIndexOfChild(Object parent, Object child) {
+ int result = 0;
+
+ if (parent == getRoot()) {
+ try {
+ List<Object> allObjects =
+ financialStatementService.getChildrenFinancialStatement(null);
+ result = allObjects.indexOf(child);
+ } catch (LimaException eee) {
+ log.debug("Can't get index child", eee);
+ }
+ }
+ else {
+ FinancialStatementHeader parentFinancialStatementHeader =
+ (FinancialStatementHeader) parent;
+ try {
+ List<Object> objects = financialStatementService.
+ getChildrenFinancialStatement(parentFinancialStatementHeader);
+ result = objects.indexOf(child);
+ } catch (LimaException eee) {
+ log.debug("Can't get index child", eee);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Object getValueAt(Object node, int column) {
+ Object result = "n/a";
+ if (node instanceof FinancialStatementHeader) {
+ FinancialStatementHeader financialStatementHeader = (FinancialStatementHeader) node;
+ switch (column) {
+ case 0:
+ result = financialStatementHeader.getLabel();
+ break;
+ }
+ }
+ else {
+ FinancialStatementMovement financialStatementMovement = (FinancialStatementMovement) node;
+ switch (column) {
+ case 0:
+ result = financialStatementMovement.getLabel();
+ break;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public boolean isCellEditable(Object node, int column) {
+ return false;
+ }
+
+ @Override
+ public boolean isLeaf(Object node) {
+ return getChildCount(node) == 0;
+ }
+
+ /**
+ * Add FinancialStatementHeader (path can be null).
+ *
+ * @param path
+ * @param account
+ * @throws LimaException
+ */
+ public void addFinancialStatementHeader(TreePath path, FinancialStatementHeader financialStatementHeader) throws LimaException {
+ // Calling account service
+ FinancialStatementHeader parentFinancialStatementHeader =
+ (FinancialStatementHeader) path.getLastPathComponent();
+ if (parentFinancialStatementHeader == getRoot()) {
+ parentFinancialStatementHeader = null;
+ }
+ financialStatementService.createFinancialStatementHeader(
+ parentFinancialStatementHeader, financialStatementHeader);
+ modelSupport.fireTreeStructureChanged(path.getParentPath());
+ }
+
+ /**
+ * Add FinancialStatementMovement (path can't be null).
+ *
+ * @param path
+ * @param account
+ * @throws LimaException
+ */
+ public void addFinancialStatementMovement(TreePath path, FinancialStatementMovement financialStatementMovement) throws LimaException {
+ // Calling account service
+ FinancialStatementHeader parentFinancialStatementHeader =
+ (FinancialStatementHeader) path.getLastPathComponent();
+ if (parentFinancialStatementHeader != getRoot()) {
+ financialStatementService.createFinancialStatementMovement(parentFinancialStatementHeader, financialStatementMovement);
+ modelSupport.fireTreeStructureChanged(path);
+ }
+ }
+
+ /**
+ * Update financialStatementHeader.
+ *
+ * @param path
+ * @param account
+ * @throws LimaException
+ */
+ public void updateFinancialStatement(TreePath path, Object object) throws LimaException {
+
+ int index = getIndexOfChild(
+ path.getParentPath().getLastPathComponent(), object);
+ if (object instanceof FinancialStatementHeader){
+ financialStatementService.updateFinancialStatementHeader((FinancialStatementHeader) object);
+ }
+ else {
+ financialStatementService.updateFinancialStatementMovement((FinancialStatementMovement) object);
+ }
+ modelSupport.fireTreeStructureChanged(path);
+ }
+
+
+
+ /**
+ * Remove financialStatementHeader or financialStatementMovement
+ *
+ * @param path
+ * @param object
+ * @throws LimaException
+ */
+ public void removeFinancialStatementObject(TreePath path, Object object) throws LimaException {
+ // Calling account service
+ int index = getIndexOfChild(
+ path.getParentPath().getLastPathComponent(), object);
+ if (object instanceof FinancialStatementHeader){
+ financialStatementService.removeFinancialStatementHeader((FinancialStatementHeader) object);
+ }
+ else {
+ financialStatementService.removeFinancialStatementMovement((FinancialStatementMovement) object);
+ }
+
+ modelSupport.fireChildRemoved(path.getParentPath(), index, object);
+ }
+
+}
Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx (from rev 2939, trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementView.jaxx)
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartView.jaxx 2010-06-15 17:35:55 UTC (rev 2940)
@@ -0,0 +1,67 @@
+<!-- ##% Lima Swing
+ Copyright (C) 2008 - 2010 CodeLutin
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ ##% -->
+
+<Table>
+
+ <FinancialStatementChartViewHandler id="handler" javaBean="new FinancialStatementChartViewHandler(this)" />
+ <Boolean id="selectedRow" javaBean="false" />
+
+ <script>
+ <![CDATA[
+ //getHandler().init();
+ ]]>
+ </script>
+
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows='4'>
+ <JScrollPane>
+ <org.jdesktop.swingx.JXTreeTable id="treeTable"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
+ treeTableModel="{new org.chorem.lima.ui.financialstatementchart.FinancialStatementChartTreeTableModel()}"
+ highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}" />
+ <javax.swing.ListSelectionModel
+ javaBean="getTreeTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(treeTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ <cell fill="horizontal">
+ <JButton id="addFinancialStatementHeader" text="lima.financialstatement.header.add"
+ onActionPerformed="getHandler().addFinancialStatementHeader()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="addFinancialStatementMovement" text="lima.financialstatement.movement.add"
+ onActionPerformed="getHandler().addFinancialStatementMovement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="updateButton" text="lima.common.update"
+ onActionPerformed="getHandler().updateFinancialStatement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="removeButton" text="lima.common.remove"
+ onActionPerformed="getHandler().removeFinancialStatement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+</Table>
\ No newline at end of file
Copied: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java (from rev 2939, trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementViewHandler.java)
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -0,0 +1,239 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.ui.financialstatementchart;
+
+import static org.nuiton.i18n.I18n._;
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.LimaBusinessException;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.FinancialStatementHeader;
+import org.chorem.lima.entity.FinancialStatementHeaderImpl;
+import org.chorem.lima.entity.FinancialStatementMovement;
+import org.chorem.lima.entity.FinancialStatementMovementImpl;
+import org.chorem.lima.ui.financialstatementchart.FinancialStatementHeaderForm;
+import org.chorem.lima.ui.financialstatementchart.FinancialStatementMovementForm;
+import org.chorem.lima.util.DialogHelper;
+import org.chorem.lima.util.ErrorHelper;
+import org.jdesktop.swingx.JXTreeTable;
+
+/**
+ * Handler associated with account view.
+ *
+ * @author chatellier
+ * @version $Revision: 2934 $
+ *
+ * Last update : $Date: 2010-06-08 11:55:04 +0200 (mar., 08 juin 2010) $
+ * By : $Author: jpepin $
+ */
+public class FinancialStatementChartViewHandler {
+
+ /** log. */
+ private static final Log log = LogFactory.getLog(FinancialStatementChartViewHandler.class);
+
+ protected FinancialStatementChartView view;
+
+ protected JXTreeTable treeTable;
+
+ protected FinancialStatementChartTreeTableModel treeTableModel;
+
+ protected FinancialStatementChartViewHandler(FinancialStatementChartView view) {
+ this.view = view;
+ }
+
+ /**
+ * Add new account with account form.
+ */
+ public void addFinancialStatementHeader() {
+ treeTable = view.getTreeTable();
+ treeTableModel =
+ (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+
+ FinancialStatementHeader newFinancialStatementHeader = new FinancialStatementHeaderImpl();
+ FinancialStatementHeaderForm financialStatementHeaderForm = new FinancialStatementHeaderForm(view);
+ financialStatementHeaderForm.setHeader(newFinancialStatementHeader);
+ // jaxx constructor don't call super() ?
+ financialStatementHeaderForm.setLocationRelativeTo(view);
+ financialStatementHeaderForm.setVisible(true);
+
+ // null == cancel action
+ newFinancialStatementHeader = financialStatementHeaderForm.getHeader();
+ if (newFinancialStatementHeader != null) {
+ // get current selection path
+ TreePath treePath = null;
+ int selectedRow = treeTable.getSelectedRow();
+ if ( selectedRow != -1) {
+ treePath = treeTable.getPathForRow(selectedRow);
+ } else {
+ treePath = new TreePath(treeTableModel.getRoot());
+ }
+
+ // add it
+ try {
+ treeTableModel.addFinancialStatementHeader(treePath, newFinancialStatementHeader);
+ } catch (LimaBusinessException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add financialStatementHeader", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+
+ }
+
+ catch (LimaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add financialStatementHeader", ex);
+ }
+ ErrorHelper.showErrorDialog("Can't add financialStatementHeader", ex);
+ }
+ }
+ };
+
+ public void addFinancialStatementMovement(){
+
+ treeTable = view.getTreeTable();
+ treeTableModel =
+ (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+
+ FinancialStatementMovement newFinancialStatementMovement = new FinancialStatementMovementImpl();
+ FinancialStatementMovementForm financialStatementMovementForm = new FinancialStatementMovementForm(view);
+ financialStatementMovementForm.setMovement(newFinancialStatementMovement);
+ // jaxx constructor don't call super() ?
+ financialStatementMovementForm.setLocationRelativeTo(view);
+ financialStatementMovementForm.setVisible(true);
+ newFinancialStatementMovement=financialStatementMovementForm.getMovement();
+
+ // null == cancel action
+ if (newFinancialStatementMovement != null) {
+ // get current selection path
+ TreePath treePath = null;
+ int selectedRow = view.treeTable.getSelectedRow();
+ treePath = view.treeTable.getPathForRow(selectedRow);
+ // add it
+ try {
+ treeTableModel.
+ addFinancialStatementMovement(treePath, newFinancialStatementMovement);
+ } catch (LimaBusinessException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add FinancialStatementMovement", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+
+ catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add FinancialStatementMovement", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Open account form with selected account.
+ * Verifiy if it's an account or a subledger
+ */
+ public void updateFinancialStatement() {
+
+ treeTable = view.getTreeTable();
+ treeTableModel =
+ (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+
+ // get selected account
+ int selectedRow = view.treeTable.getSelectedRow();
+ TreePath treePath = view.treeTable.getPathForRow(selectedRow); // not null
+ Object selectedObject = treePath.getLastPathComponent();
+ //update Account or update SubLedger
+ if (selectedObject != null) {
+ // get current selection path
+ if ( selectedRow != -1) {
+ treePath = view.treeTable.getPathForRow(selectedRow);
+ } else {
+ treePath = new TreePath(treeTableModel.getRoot());
+ }
+ //test if selectedrow is account or ledger
+ if (selectedObject instanceof FinancialStatementHeader){
+ FinancialStatementHeaderForm financialStatementHeaderForm = new FinancialStatementHeaderForm(view);
+ financialStatementHeaderForm.setHeader((FinancialStatementHeader) selectedObject);
+ // jaxx constructor don't call super() ?
+ financialStatementHeaderForm.setLocationRelativeTo(view);
+ financialStatementHeaderForm.setVisible(true);
+ // null == cancel action
+ selectedObject = financialStatementHeaderForm.getHeader();
+ }
+ // else is a subledger
+ else{
+ FinancialStatementMovementForm financialStatementMovementForm = new FinancialStatementMovementForm(view);
+ financialStatementMovementForm.setMovement((FinancialStatementMovement) selectedObject);
+ // jaxx constructor don't call super() ?
+ financialStatementMovementForm.setLocationRelativeTo(view);
+ financialStatementMovementForm.setVisible(true);
+ // null == cancel action
+ selectedObject = financialStatementMovementForm.getMovement();
+ }
+ //if action confirmed
+ if (selectedObject != null){
+ // update it
+ try {
+ treeTableModel.updateFinancialStatement(treePath, selectedObject);
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add update", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+ }
+ }
+ }
+
+ /**
+ * Ask for user to remove for selected account, and remove it if confirmed.
+ */
+ public void removeFinancialStatement() {
+ treeTable = view.getTreeTable();
+ treeTableModel =
+ (FinancialStatementChartTreeTableModel) treeTable.getTreeTableModel();
+
+ // Any row selected
+ int selectedRow = view.treeTable.getSelectedRow();
+ if ( selectedRow != -1) {
+ int n = JOptionPane.showConfirmDialog(view,
+ _("lima.question.remove.account"),
+ _("lima.question"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+ if (n == JOptionPane.YES_OPTION) {
+ // update view of treetable
+ TreePath treePath = view.treeTable.getPathForRow(selectedRow);
+ Object object = treePath.getLastPathComponent();
+
+ try{
+ treeTableModel.removeFinancialStatementObject(treePath, object);
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't delete account", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+ }
+ }
+ };
+
+}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementHeaderForm.jaxx 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementHeaderForm.jaxx 2010-06-15 17:35:55 UTC (rev 2940)
@@ -41,6 +41,17 @@
onRemoveUpdate='getHeader().setLabel(getDescriptionTextField().getText())' />
</cell>
</row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.style"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="styleTextField" text="{getHeader().getStyle()}"/>
+ <javax.swing.text.Document javaBean="getStyleTextField().getDocument()"
+ onInsertUpdate='getHeader().setStyle(getStyleTextField().getText())'
+ onRemoveUpdate='getHeader().setStyle(getStyleTextField().getText())' />
+ </cell>
+ </row>
<row>
<cell fill="none">
<JButton text="lima.common.ok" onActionPerformed="dispose()"/>
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementTreeTableModel.java 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementTreeTableModel.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -1,269 +0,0 @@
-/* *##% Lima Swing
- * Copyright (C) 2008 - 2010 CodeLutin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * ##%*/
-
-package org.chorem.lima.ui.financialstatement;
-
-import static org.nuiton.i18n.I18n._;
-import java.util.List;
-import javax.swing.tree.TreePath;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.FinancialStatementService;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.entity.FinancialStatementHeader;
-import org.chorem.lima.entity.FinancialStatementHeaderImpl;
-import org.chorem.lima.entity.FinancialStatementMovement;
-import org.chorem.lima.service.LimaServiceFactory;
-import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
-
-/**
- * Tree table model for account edition.
- *
- * @author ore
- * @author chatellier
- * @version $Revision: 2934 $
- *
- * Last update : $Date: 2010-06-08 11:55:04 +0200 (mar., 08 juin 2010) $
- * By : $Author: jpepin $
- */
-public class FinancialStatementTreeTableModel extends AbstractTreeTableModel {
-
- /** log. */
- private static final Log log = LogFactory.getLog(FinancialStatementViewHandler.class);
-
- /** Account service. */
- protected final FinancialStatementService financialStatementService;
-
- /**
- * Model constructor. Init account service used here.
- */
- public FinancialStatementTreeTableModel() {
- //create root for the tree
- super(new FinancialStatementHeaderImpl());
- // Gets factory service
- financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService();
- }
-
-
- @Override
- public int getColumnCount() {
- return 1;
- }
-
- @Override
- public String getColumnName(int column) {
- String res = null;
- switch (column) {
- case 0:
- res = _("lima.account.label");
- break;
- }
- return res;
- }
-
- @Override
- public int getChildCount(Object node) {
- int result = 0;
- if (node == getRoot()) {
- try {
- result = financialStatementService.
- getChildrenFinancialStatement(null).size();
- } catch (LimaException eee) {
- log.debug("Can't count child", eee);
- }
- }
- else {
- if (node instanceof FinancialStatementHeader){
- FinancialStatementHeader parentFinancialStatementHeader =
- (FinancialStatementHeader) node;
- try {
- result = financialStatementService.getChildrenFinancialStatement(
- parentFinancialStatementHeader).size();
- } catch (LimaException eee) {
- log.debug("Can't count child", eee);
- }
- }
- }
- return result;
- }
-
- @Override
- public Object getChild(Object parent, int index) {
- Object result = null;
- if (parent == getRoot()) {
- try {
- List<Object> allObjects =
- financialStatementService.getChildrenFinancialStatement(null);
- result = allObjects.get(index);
- } catch (LimaException eee) {
- log.debug("Can't get child", eee);
- }
- }
- else {
- FinancialStatementHeader parentFinancialStatementHeader =
- (FinancialStatementHeader) parent;
- try {
- List<Object> objects = financialStatementService.
- getChildrenFinancialStatement(parentFinancialStatementHeader);
- result = objects.get(index);
- } catch (LimaException eee) {
- log.debug("Can't get child", eee);
- }
- }
- return result;
- }
-
- @Override
- public int getIndexOfChild(Object parent, Object child) {
- int result = 0;
-
- if (parent == getRoot()) {
- try {
- List<Object> allObjects =
- financialStatementService.getChildrenFinancialStatement(null);
- result = allObjects.indexOf(child);
- } catch (LimaException eee) {
- log.debug("Can't get index child", eee);
- }
- }
- else {
- FinancialStatementHeader parentFinancialStatementHeader =
- (FinancialStatementHeader) parent;
- try {
- List<Object> objects = financialStatementService.
- getChildrenFinancialStatement(parentFinancialStatementHeader);
- result = objects.indexOf(child);
- } catch (LimaException eee) {
- log.debug("Can't get index child", eee);
- }
- }
- return result;
- }
-
- @Override
- public Object getValueAt(Object node, int column) {
- Object result = "n/a";
- if (node instanceof FinancialStatementHeader) {
- FinancialStatementHeader financialStatementHeader = (FinancialStatementHeader) node;
- switch (column) {
- case 0:
- result = financialStatementHeader.getLabel();
- break;
- }
- }
- else {
- FinancialStatementMovement financialStatementMovement = (FinancialStatementMovement) node;
- switch (column) {
- case 0:
- result = financialStatementMovement.getLabel();
- break;
- }
- }
- return result;
- }
-
- @Override
- public boolean isCellEditable(Object node, int column) {
- return false;
- }
-
- @Override
- public boolean isLeaf(Object node) {
- return getChildCount(node) == 0;
- }
-
- /**
- * Add FinancialStatementHeader (path can be null).
- *
- * @param path
- * @param account
- * @throws LimaException
- */
- public void addFinancialStatementHeader(TreePath path, FinancialStatementHeader financialStatementHeader) throws LimaException {
- // Calling account service
- FinancialStatementHeader parentFinancialStatementHeader =
- (FinancialStatementHeader) path.getLastPathComponent();
- if (parentFinancialStatementHeader == getRoot()) {
- parentFinancialStatementHeader = null;
- }
- financialStatementService.createFinancialStatementHeader(
- parentFinancialStatementHeader, financialStatementHeader);
- modelSupport.fireTreeStructureChanged(path.getParentPath());
- }
-
- /**
- * Add FinancialStatementMovement (path can't be null).
- *
- * @param path
- * @param account
- * @throws LimaException
- */
- public void addFinancialStatementMovement(TreePath path, FinancialStatementMovement financialStatementMovement) throws LimaException {
- // Calling account service
- FinancialStatementHeader parentFinancialStatementHeader =
- (FinancialStatementHeader) path.getLastPathComponent();
- if (parentFinancialStatementHeader != getRoot()) {
- financialStatementService.createFinancialStatementMovement(parentFinancialStatementHeader, financialStatementMovement);
- modelSupport.fireTreeStructureChanged(path);
- }
- }
-
- /**
- * Update financialStatementHeader.
- *
- * @param path
- * @param account
- * @throws LimaException
- */
- public void updateFinancialStatement(TreePath path, Object object) throws LimaException {
-
- int index = getIndexOfChild(
- path.getParentPath().getLastPathComponent(), object);
- if (object instanceof FinancialStatementHeader){
- financialStatementService.updateFinancialStatementHeader((FinancialStatementHeader) object);
- }
- else {
- financialStatementService.updateFinancialStatementMovement((FinancialStatementMovement) object);
- }
- modelSupport.fireTreeStructureChanged(path);
- }
-
-
-
- /**
- * Remove financialStatementHeader or financialStatementMovement
- *
- * @param path
- * @param object
- * @throws LimaException
- */
- public void removeFinancialStatementObject(TreePath path, Object object) throws LimaException {
- // Calling account service
- int index = getIndexOfChild(
- path.getParentPath().getLastPathComponent(), object);
- if (object instanceof FinancialStatementHeader){
- financialStatementService.removeFinancialStatementHeader((FinancialStatementHeader) object);
- }
- else {
- financialStatementService.removeFinancialStatementMovement((FinancialStatementMovement) object);
- }
-
- modelSupport.fireChildRemoved(path.getParentPath(), index, object);
- }
-
-}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementView.jaxx 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementView.jaxx 2010-06-15 17:35:55 UTC (rev 2940)
@@ -1,67 +0,0 @@
-<!-- ##% Lima Swing
- Copyright (C) 2008 - 2010 CodeLutin
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- ##% -->
-
-<Table>
-
- <FinancialStatementViewHandler id="handler" javaBean="new FinancialStatementViewHandler(this)" />
- <Boolean id="selectedRow" javaBean="false" />
-
- <script>
- <![CDATA[
- //getHandler().init();
- ]]>
- </script>
-
- <row>
- <cell fill="both" weightx="1" weighty="1" rows='4'>
- <JScrollPane>
- <org.jdesktop.swingx.JXTreeTable id="treeTable"
- selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
- treeTableModel="{new org.chorem.lima.ui.financialstatement.FinancialStatementTreeTableModel()}"
- highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}" />
- <javax.swing.ListSelectionModel
- javaBean="getTreeTable().getSelectionModel()"
- onValueChanged="setSelectedRow(treeTable.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
- <cell fill="horizontal">
- <JButton id="addFinancialStatementHeader" text="lima.add.financialstatementheader"
- onActionPerformed="getHandler().addFinancialStatementHeader()"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="addFinancialStatementMovement" text="lima.add.financialstatementmovement"
- onActionPerformed="getHandler().addFinancialStatementMovement()"
- enabled="{isSelectedRow()}"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="updateButton" text="lima.common.update"
- onActionPerformed="getHandler().updateFinancialStatement()"
- enabled="{isSelectedRow()}"/>
- </cell>
- </row>
- <row>
- <cell fill="horizontal">
- <JButton id="removeButton" text="lima.common.remove"
- onActionPerformed="getHandler().removeFinancialStatement()"
- enabled="{isSelectedRow()}"/>
- </cell>
- </row>
-</Table>
\ No newline at end of file
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementViewHandler.java 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementViewHandler.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -1,237 +0,0 @@
-/* *##% Lima Swing
- * Copyright (C) 2008 - 2010 CodeLutin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * ##%*/
-
-package org.chorem.lima.ui.financialstatement;
-
-import static org.nuiton.i18n.I18n._;
-import javax.swing.JOptionPane;
-import javax.swing.tree.TreePath;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.business.LimaBusinessException;
-import org.chorem.lima.business.LimaException;
-import org.chorem.lima.entity.FinancialStatementHeader;
-import org.chorem.lima.entity.FinancialStatementHeaderImpl;
-import org.chorem.lima.entity.FinancialStatementMovement;
-import org.chorem.lima.entity.FinancialStatementMovementImpl;
-import org.chorem.lima.util.DialogHelper;
-import org.chorem.lima.util.ErrorHelper;
-import org.jdesktop.swingx.JXTreeTable;
-
-/**
- * Handler associated with account view.
- *
- * @author chatellier
- * @version $Revision: 2934 $
- *
- * Last update : $Date: 2010-06-08 11:55:04 +0200 (mar., 08 juin 2010) $
- * By : $Author: jpepin $
- */
-public class FinancialStatementViewHandler {
-
- /** log. */
- private static final Log log = LogFactory.getLog(FinancialStatementViewHandler.class);
-
- protected FinancialStatementView view;
-
- protected JXTreeTable treeTable;
-
- protected FinancialStatementTreeTableModel treeTableModel;
-
- protected FinancialStatementViewHandler(FinancialStatementView view) {
- this.view = view;
- }
-
- /**
- * Add new account with account form.
- */
- public void addFinancialStatementHeader() {
- treeTable = view.getTreeTable();
- treeTableModel =
- (FinancialStatementTreeTableModel) treeTable.getTreeTableModel();
-
- FinancialStatementHeader newFinancialStatementHeader = new FinancialStatementHeaderImpl();
- FinancialStatementHeaderForm financialStatementHeaderForm = new FinancialStatementHeaderForm(view);
- financialStatementHeaderForm.setHeader(newFinancialStatementHeader);
- // jaxx constructor don't call super() ?
- financialStatementHeaderForm.setLocationRelativeTo(view);
- financialStatementHeaderForm.setVisible(true);
-
- // null == cancel action
- newFinancialStatementHeader = financialStatementHeaderForm.getHeader();
- if (newFinancialStatementHeader != null) {
- // get current selection path
- TreePath treePath = null;
- int selectedRow = treeTable.getSelectedRow();
- if ( selectedRow != -1) {
- treePath = treeTable.getPathForRow(selectedRow);
- } else {
- treePath = new TreePath(treeTableModel.getRoot());
- }
-
- // add it
- try {
- treeTableModel.addFinancialStatementHeader(treePath, newFinancialStatementHeader);
- } catch (LimaBusinessException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add financialStatementHeader", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
-
- }
-
- catch (LimaException ex) {
- if (log.isErrorEnabled()) {
- log.error("Can't add financialStatementHeader", ex);
- }
- ErrorHelper.showErrorDialog("Can't add financialStatementHeader", ex);
- }
- }
- };
-
- public void addFinancialStatementMovement(){
-
- treeTable = view.getTreeTable();
- treeTableModel =
- (FinancialStatementTreeTableModel) treeTable.getTreeTableModel();
-
- FinancialStatementMovement newFinancialStatementMovement = new FinancialStatementMovementImpl();
- FinancialStatementMovementForm financialStatementMovementForm = new FinancialStatementMovementForm(view);
- financialStatementMovementForm.setMovement(newFinancialStatementMovement);
- // jaxx constructor don't call super() ?
- financialStatementMovementForm.setLocationRelativeTo(view);
- financialStatementMovementForm.setVisible(true);
- newFinancialStatementMovement=financialStatementMovementForm.getMovement();
-
- // null == cancel action
- if (newFinancialStatementMovement != null) {
- // get current selection path
- TreePath treePath = null;
- int selectedRow = view.treeTable.getSelectedRow();
- treePath = view.treeTable.getPathForRow(selectedRow);
- // add it
- try {
- treeTableModel.
- addFinancialStatementMovement(treePath, newFinancialStatementMovement);
- } catch (LimaBusinessException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add FinancialStatementMovement", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
-
- catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add FinancialStatementMovement", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
- }
- }
-
- /**
- * Open account form with selected account.
- * Verifiy if it's an account or a subledger
- */
- public void updateFinancialStatement() {
-
- treeTable = view.getTreeTable();
- treeTableModel =
- (FinancialStatementTreeTableModel) treeTable.getTreeTableModel();
-
- // get selected account
- int selectedRow = view.treeTable.getSelectedRow();
- TreePath treePath = view.treeTable.getPathForRow(selectedRow); // not null
- Object selectedObject = treePath.getLastPathComponent();
- //update Account or update SubLedger
- if (selectedObject != null) {
- // get current selection path
- if ( selectedRow != -1) {
- treePath = view.treeTable.getPathForRow(selectedRow);
- } else {
- treePath = new TreePath(treeTableModel.getRoot());
- }
- //test if selectedrow is account or ledger
- if (selectedObject instanceof FinancialStatementHeader){
- FinancialStatementHeaderForm financialStatementHeaderForm = new FinancialStatementHeaderForm(view);
- financialStatementHeaderForm.setHeader((FinancialStatementHeader) selectedObject);
- // jaxx constructor don't call super() ?
- financialStatementHeaderForm.setLocationRelativeTo(view);
- financialStatementHeaderForm.setVisible(true);
- // null == cancel action
- selectedObject = financialStatementHeaderForm.getHeader();
- }
- // else is a subledger
- else{
- FinancialStatementMovementForm financialStatementMovementForm = new FinancialStatementMovementForm(view);
- financialStatementMovementForm.setMovement((FinancialStatementMovement) selectedObject);
- // jaxx constructor don't call super() ?
- financialStatementMovementForm.setLocationRelativeTo(view);
- financialStatementMovementForm.setVisible(true);
- // null == cancel action
- selectedObject = financialStatementMovementForm.getMovement();
- }
- //if action confirmed
- if (selectedObject != null){
- // update it
- try {
- treeTableModel.updateFinancialStatement(treePath, selectedObject);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add update", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
- }
- }
- }
-
- /**
- * Ask for user to remove for selected account, and remove it if confirmed.
- */
- public void removeFinancialStatement() {
- treeTable = view.getTreeTable();
- treeTableModel =
- (FinancialStatementTreeTableModel) treeTable.getTreeTableModel();
-
- // Any row selected
- int selectedRow = view.treeTable.getSelectedRow();
- if ( selectedRow != -1) {
- int n = JOptionPane.showConfirmDialog(view,
- _("lima.question.remove.account"),
- _("lima.question"),
- JOptionPane.YES_NO_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- if (n == JOptionPane.YES_OPTION) {
- // update view of treetable
- TreePath treePath = view.treeTable.getPathForRow(selectedRow);
- Object object = treePath.getLastPathComponent();
-
- try{
- treeTableModel.removeFinancialStatementObject(treePath, object);
- } catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't delete account", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
- }
- }
- };
-
-}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -0,0 +1,205 @@
+/*
+ * *##% Lima Main
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
+ */
+
+package org.chorem.lima.ui.financialstatementreport;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import javax.swing.table.AbstractTableModel;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.beans.BalanceTrial;
+import org.chorem.lima.beans.FinancialStatementAmounts;
+import org.chorem.lima.beans.ReportsDatas;
+import org.chorem.lima.business.FinancialStatementService;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.ReportService;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.FinancialStatementHeader;
+import org.chorem.lima.entity.FinancialStatementMovement;
+import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.util.ErrorHelper;
+
+/**
+ * Entry book table model.
+ *
+ * @author ore
+ * @author chatellier
+ * @version $Revision: 2865 $
+ *
+ * Last update : $Date: 2010-04-19 15:19:30 +0200 (lun. 19 avril 2010) $
+ * By : $Author: jpepin $
+ */
+public class FinancialStatementReportTableModel extends AbstractTableModel {
+
+ /** serialVersionUID. */
+ private static final long serialVersionUID = 7578692417919755647L;
+
+ /** log. */
+ private static final Log log = LogFactory.getLog(FinancialStatementReportTableModel.class);
+
+ /** Services. */
+ protected FinancialStatementService financialStatementService;
+
+ /** DatePicker Begin Date. */
+ protected Date selectedBeginDate;
+
+ /** DatePicker EndDate. */
+ protected Date selectedEndDate;
+
+ /** Text field Accounts */
+ protected String selectedAccounts;
+
+ /** data cache */
+ protected List<Object> cacheDataList;
+
+ /**
+ * Constructor.
+ */
+ public FinancialStatementReportTableModel() {
+ financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService();
+ }
+
+ @Override
+ public int getRowCount() {
+ int result = 0;
+ if (cacheDataList != null){
+ result = cacheDataList.size();
+ }
+ return result;
+ }
+
+ @Override
+ public int getColumnCount() {
+ return 4;
+ }
+
+ @Override
+ public String getColumnName(int column) {
+ String res = "n/a";
+ switch (column) {
+ case 0:
+ res = _("lima.table.label");
+ break;
+ case 1:
+ res = _("lima.table.grossamount");
+ break;
+ case 2:
+ res = _("lima.table.provisiondeprecationamount");
+ break;
+ case 3:
+ res = _("lima.table.netamount");
+ break;
+ }
+ return res;
+ }
+
+ @Override
+ public Object getValueAt(int row, int column) {
+ Object result = cacheDataList.get(row);
+ //get entries for the period for the current row
+ if (result instanceof FinancialStatementHeader) {
+ FinancialStatementHeader currentRow = (FinancialStatementHeader) result;
+ switch (column) {
+ case 0:
+ result = currentRow.getLabel();
+ break;
+ case 1:
+ result = null;
+ break;
+ case 2:
+ result = null;
+ break;
+ case 3:
+ result = null;
+ break;
+ }
+ }
+ else {
+ FinancialStatementAmounts currentRow = (FinancialStatementAmounts) result;
+ Double grossAmount = currentRow.getGrossAmount();
+ Double provisionDeprecationAmount = currentRow.getProvisionDeprecationAmount();
+ switch (column) {
+ case 0:
+ result = currentRow.getLabel();
+ break;
+ case 1:
+ result = grossAmount;
+ break;
+ case 2:
+ result = provisionDeprecationAmount;
+ break;
+ case 3:
+ result = grossAmount-provisionDeprecationAmount;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ // Just read, no write
+ return false;
+ }
+
+ public void setBeginDate(Date date){
+ selectedBeginDate = date;
+ }
+
+ public void setEndDate(Date date){
+ selectedEndDate = date;
+ }
+
+ public void setAccountFilter(String accounts) {
+ selectedAccounts = accounts;
+ }
+
+ /**
+ * get all account fot the selected period
+ * @return
+ */
+ public List<Object> getDataList(){
+ List<Object> results = null;
+
+ try {
+ //results = financialStatementService.getAllChildrenFinancialStatement(null, new ArrayList<Object>());
+ results = financialStatementService.financialStatementReports(selectedBeginDate, selectedEndDate);
+ //results = reportService.generateBalanceTrial(selectedBeginDate, selectedEndDate, selectedAccounts, false);
+ }
+ catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.debug("Can't update model", eee);
+ }
+ ErrorHelper.showErrorDialog("Can't get entries list", eee);
+ }
+ return results;
+ }
+
+ public void refresh(){
+ cacheDataList = getDataList();
+ fireTableDataChanged();
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportTableModel.java
___________________________________________________________________
Added: svn:executable
+ *
Added: 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 (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx 2010-06-15 17:35:55 UTC (rev 2940)
@@ -0,0 +1,112 @@
+<!-- ##% Lima Swing
+ Copyright (C) 2008 - 2010 CodeLutin
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ ##% -->
+
+<Table>
+ <FinancialStatementReportViewHandler id="handler" javaBean="new FinancialStatementReportViewHandler(this)" />
+ <Boolean id="selectedRow" javaBean="false" />
+ <org.chorem.lima.ui.financialstatementreport.FinancialStatementReportTableModel id="modelTable"/>
+ <script>
+ <![CDATA[
+
+ import org.chorem.lima.entity.Account;
+ import org.apache.commons.lang.time.DateUtils;
+ import java.util.Calendar;
+
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+
+ getBeginDatePicker().setDate(beginDate);
+ getEndDatePicker().setDate(endDate);
+ getModelTable().setBeginDate(beginDate);
+ getModelTable().setEndDate(endDate);
+
+ void $afterCompleteSetup() {
+ getHandler().refresh();
+ }
+
+
+ ]]>
+ </script>
+ <row weightx="1" weighty="0" anchor="center">
+ <cell anchor="west">
+ <JButton text="lima.refresh" onActionPerformed="getHandler().refresh()"/>
+ </cell>
+ <cell anchor="east">
+ <JLabel id="beginCalendarPanelLabel" text="lima.accountsreports.begincalendar"/>
+ </cell>
+ <cell anchor="west">
+ <org.jdesktop.swingx.JXDatePicker id="beginDatePicker"
+ onActionPerformed="getModelTable().setBeginDate(beginDatePicker.getDate());
+ getHandler().refresh()" />
+ </cell>
+ <cell anchor="east">
+ <JLabel id="endCalendarPanelLabel" text="lima.accountsreports.endcalendar"/>
+ </cell>
+ <cell anchor="west">
+ <org.jdesktop.swingx.JXDatePicker id="endDatePicker"
+ onActionPerformed="getModelTable().setEndDate(endDatePicker.getDate());
+ getHandler().refresh()"/>
+ </cell>
+ <cell anchor="east">
+ <JTextField id="accountFilter"/>
+ </cell>
+ <cell anchor="west">
+ <JButton text="lima.accountsreports.accountfilter"
+ onActionPerformed="getModelTable().setAccountFilter(accountFilter.getText());
+ getHandler().refresh()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" columns="7">
+ <JScrollPane>
+ <org.jdesktop.swingx.JXTable id="table" rowHeight="24"
+ model="{getModelTable()}"
+ highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
+ columnControlVisible="true"/>
+ <javax.swing.ListSelectionModel javaBean="getTable().getSelectionModel()"/>
+ </JScrollPane>
+ </cell>
+ </row>
+ <row fill="horizontal" anchor="center">
+ <cell>
+ <JLabel text="lima.amountdebit" />
+ </cell>
+ <cell>
+ <JLabel id="amountDebitLabel" />
+ </cell>
+ <cell>
+ <JLabel text="lima.amountcredit"/>
+ </cell>
+ <cell>
+ <JLabel id="amountCreditLabel" />
+ </cell>
+ <cell>
+ <JLabel id="soldeLabel" text="lima.solde"/>
+ </cell>
+ <cell>
+ <JLabel id="amountSoldeLabel"/>
+ </cell>
+ </row>
+</Table>
\ No newline at end of file
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportView.jaxx
___________________________________________________________________
Added: svn:executable
+ *
Added: 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 (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java 2010-06-15 17:35:55 UTC (rev 2940)
@@ -0,0 +1,90 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.ui.financialstatementreport;
+
+import static org.nuiton.i18n.I18n._;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.beans.BalanceTrial;
+import org.chorem.lima.business.FinancialTransactionService;
+import org.chorem.lima.service.LimaServiceFactory;
+
+
+/**
+ * Handler associated with accounts reports view.
+ *
+ * @author chatellier
+ * @version $Revision: 2884 $
+ *
+ * Last update : $Date: 2010-05-06 11:57:19 +0200 (jeu. 06 mai 2010) $
+ * By : $Author: jpepin $
+ */
+public class FinancialStatementReportViewHandler {
+
+ /** log. */
+ private static final Log log =
+ LogFactory.getLog(FinancialStatementReportViewHandler.class);
+
+ protected FinancialStatementReportView view;
+
+ /** service **/
+ protected FinancialTransactionService financialTransactionService;
+
+ protected FinancialStatementReportTableModel model;
+
+ protected FinancialStatementReportViewHandler(FinancialStatementReportView view) {
+ this.view = view;
+ financialTransactionService =
+ LimaServiceFactory.getInstance().getTransactionService();
+ }
+
+ public void refresh(){
+ model = view.getModelTable();
+ model.refresh();
+
+ /**
+ * update the labels credit, debit, solde on the footer
+ * get all entries for all accounts on the selected period
+ *
+ BalanceTrial cacheDataList = model.cacheDataList;
+
+ if (cacheDataList != null){
+ // set amounts credit, debit and solde
+ view.amountCreditLabel.setText(String.valueOf(cacheDataList.getAmountCredit()));
+ view.amountDebitLabel.setText(String.valueOf(cacheDataList.getAmountDebit()));
+ Double amountSolde = cacheDataList.getAmountSolde();
+ view.amountSoldeLabel.setText(String.valueOf(amountSolde));
+
+
+ if (amountSolde == 0){
+ view.soldeLabel.setText(_("lima.solde"));
+ }
+ else {
+ // set label solde: credit or debit
+ if (cacheDataList.getSoldeDebit()) {
+ view.soldeLabel.setText(_("lima.soldedebit"));
+ }
+ else {
+ view.soldeLabel.setText(_("lima.soldecredit"));
+ }
+ }
+ }*/
+ }
+
+}
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementreport/FinancialStatementReportViewHandler.java
___________________________________________________________________
Added: svn:executable
+ *
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-15 17:35:55 UTC (rev 2940)
@@ -168,8 +168,12 @@
lima.financialstatement.accounts=
lima.financialstatement.creditaccounts=
lima.financialstatement.debitaccounts=
+lima.financialstatement.header.add=
lima.financialstatement.label=
+lima.financialstatement.movement.add=
lima.financialstatement.provisiondeprecationaccounts=
+lima.financialstatement.style=
+lima.financialstatementreports=
lima.find.transaction=Find transaction
lima.fiscalperiod.addFiscalPeriod=
lima.fiscalperiod.block=
@@ -302,6 +306,7 @@
lima.reports.accounts=Edit account
lima.reports.balance=Balance
lima.reports.entrybooks=Edit entrybook
+lima.reports.financialstatement=
lima.reports.ledger=Ledger
lima.response.no=No
lima.response.yes=Yes
@@ -344,6 +349,10 @@
lima.tab.search.result=Search result
lima.tab.subledgers=
lima.tab.transaction=Transaction
+lima.table.grossamount=
+lima.table.label=
+lima.table.netamount=
+lima.table.provisiondeprecationamount=
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=About Lima...
lima.to=To
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 2010-06-09 17:27:20 UTC (rev 2939)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-15 17:35:55 UTC (rev 2940)
@@ -34,8 +34,7 @@
lima.action.normalscreen=Ecran normal
lima.action.normalscreen.tip=Revenir en \u00E9cran normal
lima.add.entry=Ajouter entr\u00E9e
-lima.add.financialstatementheader=
-lima.add.financialstatementmovement=
+lima.add.financialstatement.movement.add=Mouvement
lima.add.lettering=
lima.add.transaction=Ajouter transaction
lima.all=Tous
@@ -167,8 +166,12 @@
lima.financialstatement.accounts=
lima.financialstatement.creditaccounts=
lima.financialstatement.debitaccounts=
+lima.financialstatement.header.add=Regrouprement
lima.financialstatement.label=
+lima.financialstatement.movement.add=
lima.financialstatement.provisiondeprecationaccounts=
+lima.financialstatement.style=
+lima.financialstatementreports=
lima.find.transaction=Rechercher transaction
lima.fiscalperiod.addFiscalPeriod=Nouvel exercice
lima.fiscalperiod.block=Cloturer un exercice
@@ -287,6 +290,7 @@
lima.reports.accounts=Edition compte
lima.reports.balance=Balance
lima.reports.entrybooks=Edition journal
+lima.reports.financialstatement=
lima.reports.ledger=Grand Livre
lima.response.no=Non
lima.response.yes=Oui
@@ -318,6 +322,10 @@
lima.tab.home=Accueil
lima.tab.reports=
lima.tab.result=
+lima.table.grossamount=
+lima.table.label=
+lima.table.netamount=
+lima.table.provisiondeprecationamount=
lima.title=Lutin Invoice Monitoring and Accounting
lima.title.about=A propos de Lima...
lima.to=A
1
0
Author: jpepin
Date: 2010-06-09 19:27:20 +0200 (Wed, 09 Jun 2010)
New Revision: 2939
Url: http://chorem.org/repositories/revision/lima/2939
Log:
Ajout syst?\195?\168me de stockage du plan de g?\195?\169n?\195?\169ration pour le bilan et le compte de r?\195?\169sultat. Nouveau service FinancialStatementService, et nouvelle vue dans l'UI avec ajout, modification, suppression.
Added:
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementHeaderForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementMovementForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementViewHandler.java
Removed:
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/DateUtil.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryFinancialTransactionComparator.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryFinancialTransactionDateComparator.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/NumberUtil.java
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.properties
trunk/lima-callao/src/main/xmi/accounting.zargo
trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementService.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -0,0 +1,41 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import java.util.List;
+
+import javax.ejb.Remote;
+import org.chorem.lima.entity.FinancialStatementHeader;
+import org.chorem.lima.entity.FinancialStatementMovement;
+
+@Remote
+public interface FinancialStatementService {
+
+ void createFinancialStatementHeader(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
+ void updateFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
+ void removeFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException;
+
+ void createFinancialStatementMovement(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
+ void updateFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
+ void removeFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException;
+
+ public List<Object> getChildrenFinancialStatement(FinancialStatementHeader financialStatementHeader) throws LimaException;
+ List<Object> getAllChildrenFinancialStatement(FinancialStatementHeader financialStatementHeader, List<Object> objects) throws LimaException, LimaBusinessException;
+}
Added: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceLocal.java (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialStatementServiceLocal.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -0,0 +1,27 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business;
+
+import javax.ejb.Local;
+
+@Local
+public interface FinancialStatementServiceLocal extends FinancialStatementService {
+
+}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -46,7 +46,7 @@
* Permet d'implémenter le Plan Comptable Général.
* Un compte ne peut être supprimé si il contient des écritures comptables.
* Un compte peut devenir père et avoir des comptes fils. Chaque compte créé doit
- * renseigné si il appartient à un compte père avec le numéro de compte père.
+ * renseigner si il appartient à un compte père avec le numéro de compte père.
*
* @author Rémi Chapelet
*/
@@ -307,13 +307,10 @@
// Check rules for subaccount if have entries
accountingRules.removeAccountRules(account, transaction);
accountDAO.delete(subAccount);
- log.debug(subAccount);
}
}
// remove account
- accountDAO.delete(account);
- log.debug(account);
-
+ accountDAO.delete(account);
//commit
commitTransaction(transaction);
Added: 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 (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialStatementServiceImpl.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -0,0 +1,334 @@
+/* *##% Lima Business
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*
+ */
+
+package org.chorem.lima.business.ejb;
+
+import static org.nuiton.i18n.I18n._;
+import java.util.ArrayList;
+import java.util.List;
+import javax.ejb.Stateless;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.AccountingRules;
+import org.chorem.lima.business.FinancialStatementService;
+import org.chorem.lima.business.FinancialStatementServiceLocal;
+import org.chorem.lima.business.LimaBusinessException;
+import org.chorem.lima.business.LimaConfig;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.FinancialStatementHeader;
+import org.chorem.lima.entity.FinancialStatementHeaderDAO;
+import org.chorem.lima.entity.FinancialStatementMovement;
+import org.chorem.lima.entity.FinancialStatementMovementDAO;
+import org.chorem.lima.entity.LimaCallaoDAOHelper;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaContextFactory;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.TopiaNotFoundException;
+import org.nuiton.topia.framework.TopiaQuery;
+
+@Stateless
+public class FinancialStatementServiceImpl extends AbstractLimaService implements FinancialStatementService, FinancialStatementServiceLocal{
+
+ private static final Log log =
+ LogFactory.getLog(AccountServiceImpl.class);
+
+ private TopiaContext rootContext;
+
+ protected AccountingRules accountingRules;
+
+ public FinancialStatementServiceImpl() {
+ LimaConfig config = LimaConfig.getInstance();
+ try {
+ rootContext = TopiaContextFactory.getContext(config.getOptions());
+ } catch (TopiaNotFoundException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't init topia context", ex);
+ }
+ }
+ accountingRules = config.getAccountingRules();
+ }
+
+ @Override
+ public void createFinancialStatementHeader(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException {
+
+ TopiaContext transaction = null;
+ try {
+ transaction = beginTransaction();
+
+ // check if FinancialStatementHeader label already exist
+ FinancialStatementHeaderDAO financialStatementHeaderDAO =
+ LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
+
+ FinancialStatementHeader existFinancialStatementHeader =
+ financialStatementHeaderDAO.findByLabel(financialStatementHeader.getLabel());
+
+ if (existFinancialStatementHeader != null) {
+ throw new LimaBusinessException(_(
+ "An financialStatement already exists with this label : %s",
+ financialStatementHeader.getLabel()));
+ }
+
+ financialStatementHeaderDAO.create(financialStatementHeader);
+
+ // check if parent account exist;
+ if (masterFinancialStatementHeader != null) {
+ masterFinancialStatementHeader.addSubFinancialStatementHeaders(financialStatementHeader);
+ financialStatementHeaderDAO.update(masterFinancialStatementHeader);
+ }
+
+ commitTransaction(transaction);
+ }
+ catch (Exception ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+ }
+
+ @Override
+ public void createFinancialStatementMovement(FinancialStatementHeader masterFinancialStatementHeader, FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException {
+
+ TopiaContext transaction = null;
+ try {
+ transaction = beginTransaction();
+
+ // check if FinancialStatementMovement label already exist
+ FinancialStatementMovementDAO financialStatementMovementDAO =
+ LimaCallaoDAOHelper.getFinancialStatementMovementDAO(transaction);
+ FinancialStatementHeaderDAO financialStatementHeaderDAO =
+ LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
+
+ FinancialStatementMovement existFinancialStatementMovement =
+ financialStatementMovementDAO.findByLabel(financialStatementMovement.getLabel());
+
+ if (existFinancialStatementMovement != null) {
+ throw new LimaBusinessException(_(
+ "An financialStatement already exists with this label : %s",
+ financialStatementMovement.getLabel()));
+ }
+
+ // check if masterFinancialStatementHeader exist;
+ if (masterFinancialStatementHeader != null) {
+ //create it
+ financialStatementMovementDAO.create(financialStatementMovement);
+ //update master
+ masterFinancialStatementHeader.addFinancialStatementMovement(financialStatementMovement);
+ financialStatementHeaderDAO.update(masterFinancialStatementHeader);
+ }
+
+ commitTransaction(transaction);
+ }
+ catch (Exception ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+
+ }
+
+ @Override
+ public void removeFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException {
+
+ TopiaContext transaction = null;
+ try {
+ transaction = beginTransaction();
+ FinancialStatementHeaderDAO financialStatementHeaderDAO =
+ LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
+
+ //get all subFinancialStatementHeader and FinancialStatementMovement
+ List<Object> objects = getAllChildrenFinancialStatement(financialStatementHeader, new ArrayList<Object>());
+
+ //if FinancialStatementHeader have subFinancialStatementHeader
+ if (objects.size() > 0){
+ for (Object object : objects) {
+ if (object instanceof FinancialStatementHeader){
+ financialStatementHeaderDAO.delete((FinancialStatementHeader) object);
+ }
+ else {
+ //remove financial statement movement
+ removeFinancialStatementMovementWithTransaction((FinancialStatementMovement) object, transaction);
+ }
+ }
+ }
+ // remove account
+ financialStatementHeaderDAO.delete(financialStatementHeader);
+
+ //commit
+ commitTransaction(transaction);
+
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+
+ }
+
+ @Override
+ public void removeFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException {
+ TopiaContext transaction = null;
+ try {
+ transaction = beginTransaction();
+ removeFinancialStatementMovementWithTransaction(financialStatementMovement, transaction);
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+ }
+
+
+ public void removeFinancialStatementMovementWithTransaction(FinancialStatementMovement financialStatementMovement, TopiaContext topiaContext) throws LimaException, LimaBusinessException {
+ try{
+ FinancialStatementMovementDAO financialStatementMovementDAO =
+ LimaCallaoDAOHelper.getFinancialStatementMovementDAO(topiaContext);
+ financialStatementMovementDAO.delete(financialStatementMovement);
+ //commit
+ commitTransaction(topiaContext);
+ }
+ catch (TopiaException ex) {
+ doCatch(topiaContext, ex, log);
+ }
+ }
+
+ @Override
+ public List<Object> getAllChildrenFinancialStatement(FinancialStatementHeader financialStatementHeader, List<Object> objects) throws LimaException, LimaBusinessException {
+ return objects;
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ public List<Object> getChildrenFinancialStatement(FinancialStatementHeader masterFinancialStatementHeader) throws LimaException {
+ List<Object> objects = new ArrayList<Object>();
+
+ TopiaContext transaction = null;
+ try {
+ transaction = beginTransaction();
+
+ FinancialStatementHeaderDAO financialStatementHeaderDAO =
+ LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
+
+
+ TopiaQuery query = financialStatementHeaderDAO.createQuery();
+ if (masterFinancialStatementHeader == null){
+ query.addEquals("masterFinancialStatementHeader", masterFinancialStatementHeader);
+ }
+ else {
+ query.addWhere("masterFinancialStatementHeader = :value")
+ .addParam("value", masterFinancialStatementHeader);
+ }
+ objects.addAll(financialStatementHeaderDAO.findAllByQuery(query));
+
+ if (objects.isEmpty()){
+ FinancialStatementMovementDAO financialStatementMovementDAO =
+ LimaCallaoDAOHelper.getFinancialStatementMovementDAO(transaction);
+ TopiaQuery query2 = financialStatementMovementDAO.createQuery();
+ if (masterFinancialStatementHeader != null){
+ query2.addWhere("financialStatementHeader = :value")
+ .addParam("value", masterFinancialStatementHeader);
+ }
+ objects.addAll(financialStatementMovementDAO.findAllByQuery(query2));
+ }
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+ return objects;
+ }
+
+ @Override
+ public void updateFinancialStatementHeader(FinancialStatementHeader financialStatementHeader) throws LimaException, LimaBusinessException {
+ TopiaContext transaction = null;
+ try {
+ transaction = beginTransaction();
+
+ // DAO
+ FinancialStatementHeaderDAO financialStatementHeaderDAO =
+ LimaCallaoDAOHelper.getFinancialStatementHeaderDAO(transaction);
+ //update
+ financialStatementHeaderDAO.update(financialStatementHeader);
+ //commit
+ commitTransaction(transaction);
+ }
+ catch (TopiaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Error during update financialStatementHeader", ex);
+ }
+ throw new LimaException("Can't update financialStatementHeader", ex);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+ }
+
+ @Override
+ public void updateFinancialStatementMovement(FinancialStatementMovement financialStatementMovement) throws LimaException, LimaBusinessException {
+ TopiaContext transaction = null;
+ try {
+ transaction = beginTransaction();
+
+ // DAO
+ FinancialStatementMovementDAO financialStatementMovementDAO =
+ LimaCallaoDAOHelper.getFinancialStatementMovementDAO(transaction);
+ //update
+ financialStatementMovementDAO.update(financialStatementMovement);
+ //commit
+ commitTransaction(transaction);
+ }
+ catch (TopiaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Error during update financialStatementMovement", ex);
+ }
+ throw new LimaException("Can't update financialStatementMovement", ex);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+ }
+
+ protected TopiaContext beginTransaction() throws TopiaException {
+ // basic check done, make check in database
+ // TODO move it into JTA
+ TopiaContext topiaTransaction;
+ topiaTransaction = rootContext.beginTransaction();
+ log.trace("beginTransaction"+topiaTransaction);
+ return topiaTransaction;
+ }
+
+ protected void commitTransaction(TopiaContext topiaTransaction) throws TopiaException {
+ try {
+ topiaTransaction.commitTransaction();
+ } catch (TopiaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Error during commit context", eee);
+ }
+ throw eee;
+ }
+ }
+
+}
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 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -20,15 +20,11 @@
package org.chorem.lima.business.ejb;
import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.StringTokenizer;
-
import javax.ejb.Stateless;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -40,16 +36,11 @@
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
import org.chorem.lima.business.ReportServiceLocal;
-import org.chorem.lima.business.utils.EntryComparator;
-import org.chorem.lima.business.utils.EntryFinancialTransactionComparator;
-import org.chorem.lima.business.utils.EntryFinancialTransactionDateComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountDAO;
-import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryDAO;
-import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.nuiton.topia.TopiaContext;
@@ -425,7 +416,6 @@
//Remove Spaces
selectedAccounts = StringUtils.deleteWhitespace(selectedAccounts);
- log.debug(selectedAccounts);
//if no filter account
if (selectedAccounts == null || selectedAccounts.equals("")){
accounts = accountDAO.findAllSubAccounts();
@@ -433,7 +423,8 @@
//build list account from selectedAccounts
else{
accounts = new ArrayList<Account>();
- List<String> accountNumbers = new ArrayList<String>();
+ //use hashset for delete duplicate numbers
+ HashSet<String> accountNumbers = new HashSet<String>();
//Split comma
StringTokenizer stComma = new StringTokenizer(selectedAccounts, ",");
while (stComma.hasMoreTokens()) {
@@ -451,9 +442,6 @@
accountNumbers.add(s);
}
}
- // remove duplicate numbers
- HashSet<String> hashSet = new HashSet<String>(accountNumbers);
- accountNumbers = new ArrayList<String>(hashSet);
for (String accountNumber : accountNumbers) {
Account accountFilter = accountDAO.findByAccountNumber(accountNumber);
@@ -461,7 +449,6 @@
accounts.add(accountFilter);
}
}
- log.debug(accounts);
}
for (Account account : accounts) {
ReportsDatas reportsDatas =
Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/DateUtil.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/DateUtil.java 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/DateUtil.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -1,185 +0,0 @@
-/**
- * *##% Callao DateUtil
- * Copyright (C) 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
- */
-
-package org.chorem.lima.business.utils;
-
-import java.util.Date;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-import org.apache.commons.logging.LogFactory;
-
-
-/**
- * Cette classe permet de manipuler des dates.
- * @author Rémi Chapelet
- *
- * @deprecated since 0.4.0, use commons lang or nuiton dateutils
- */
-public class DateUtil {
-
- /** log */
- private static final org.apache.commons.logging.Log log = LogFactory.getLog(DateUtil.class);
-
-
- /**
- * Initialise la date d'entrée le premier du mois à minuit.
- * Exemple : 15 janvier 2009, alors date de sortie 1 Janvier 2009 00h00m00s
- * @param d date
- * @return
- */
- public Date InitDateFirstDayMonth (Date d)
- {
- Date date_result = new Date(d.getYear(),d.getMonth(),1,0,0,0);
- return date_result;
- }
-
- /**
- * Permet de retourner la date de fin de mois. Si on lui donne la date
- * 5 Janv 2000, elle retourne alors 31 Jan 2000.
- * @param d date de référence
- * @return la date du fin de mois
- */
- public Date InitDateEndDayMonth (Date d)
- {
- Calendar c = new GregorianCalendar (d.getYear()+1900,d.getMonth(),d.getDate());
- // Calcul le dernier jour du mois, prend en compte les années bixestiles
- Integer maxDay = c.getActualMaximum(Calendar.DAY_OF_MONTH);
- //Date dateEnd = new Date(d.getYear(),d.getMonth(),maxDay,23,59,59);
- Calendar dateEnd = new GregorianCalendar (d.getYear()+1900,d.getMonth(),maxDay,23,59,59);
- Date result = dateEnd.getTime();
- return result;
- }
-
- /**
- * Permet de comparer deux dates. Si d1 est plus grande que d2, alors true
- * @param d1 Date 1
- * @param d2 Date 2
- * @return
- */
- public boolean DateGreatThan (Date d1, Date d2)
- {
- boolean result = false;
- long diff = d1.getTime() - d2.getTime();
- if (diff > 0 )
- {
- result=true;
- }
- return result;
- }
-
- /**
- * Permet de calculer le nombre de mois entre les deux dates.
- * @param d1 date 1
- * @param d2 date 2
- * @return
- */
- public int numberOfMonths (Date d1, Date d2)
- {
- GregorianCalendar gc1 = new GregorianCalendar();
- gc1.setTime(d1);
- GregorianCalendar gc2 = new GregorianCalendar();
- gc2.setTime(d2);
- int number_months = 0;
- gc1.add(GregorianCalendar.MONTH, 1);
- while(gc1.compareTo(gc2)<=0) {
- number_months++;
- gc1.add(GregorianCalendar.MONTH, 1);
- }
- return number_months;
- }
-
- /**
- * Permet de renvoyer la date précédente à celle donnée en paramètre.
- * Exemple : d = 17 avril 2000, return 16 avril 2000
- * @param d
- * @return
- */
- public Date previousDay(Date d)
- {
- Calendar c = new GregorianCalendar (d.getYear()+1900,d.getMonth(),d.getDate(),23,59,59);
- // Calcul le jour précédent
- c.add(Calendar.DATE, -1);
- Date result = c.getTime();
- return result;
- }
-
- /**
- * Permet de copier une date.
- * @param d
- * @return
- */
- public Date copyDate (Date d)
- {
- Date date_result = new Date(d.getYear(),d.getMonth(),d.getDay(),d.getHours(),d.getMinutes(),d.getSeconds());
- return date_result;
- }
-
- /**
- * Implémentation de compareTO. Si il y a besoin, il est possible de la modifier.
- * @param d1
- * @param d2
- * @return
- */
- public int compareDate(Date d1, Date d2)
- {
- return d1.compareTo(d2);
- }
-
- /**
- * Permet de renvoyer vrai si une date d donnée est entre deux dates.
- * @param d date se trouvant ou non dans la période
- * @param dateBegin date de début de période
- * @param dateEnd date de fin de période
- * @return
- */
- public boolean betweenDate (Date d, Date dateBegin, Date dateEnd)
- {
- boolean result = false;
- if ( ( (compareDate(d,dateBegin) == 0) || (compareDate(d,dateBegin) == 1) )
- && ( (compareDate(d,dateEnd) == 0) || (compareDate(d,dateEnd) == -1) ) )
- {
- result = true;
- }
- return result;
- }
-
- /**
- * Permet de découper une date dans un tableau.
- * Indices :
- * 0 : année
- * 1 : mois
- * 2 : jour
- * @param d
- * @return
- */
- public String[] arrayDate (Date d)
- {
- String dateTab[] = new String[3];
- // année
- dateTab[0] = Integer.toString(d.getYear()+1900);
- // mois
- dateTab[1] = Integer.toString(d.getMonth());
- // jour
- dateTab[2] = Integer.toString(d.getDate());
- return dateTab;
- }
-
-
-}
Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryFinancialTransactionComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryFinancialTransactionComparator.java 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryFinancialTransactionComparator.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -1,32 +0,0 @@
-/* *##% Lima Swing
- * Copyright (C) 2008 - 2010 CodeLutin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * ##%*/
-
-package org.chorem.lima.business.utils;
-
-import java.util.Comparator;
-
-import org.chorem.lima.entity.Entry;
-
-public class EntryFinancialTransactionComparator implements Comparator<Entry>{
-
- @Override
- public int compare(Entry o1, Entry o2) {
- return o1.getFinancialTransaction().getTopiaId().compareTo(o2.getFinancialTransaction().getTopiaId());
- }
-
-}
Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryFinancialTransactionDateComparator.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryFinancialTransactionDateComparator.java 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryFinancialTransactionDateComparator.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -1,33 +0,0 @@
-/* *##% Lima Swing
- * Copyright (C) 2008 - 2010 CodeLutin
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- * ##%*/
-
-package org.chorem.lima.business.utils;
-
-import java.util.Comparator;
-
-import org.chorem.lima.entity.Entry;
-
-public class EntryFinancialTransactionDateComparator implements Comparator<Entry>{
-
- @Override
- public int compare(Entry o1, Entry o2) {
- return o1.getFinancialTransaction().getTransactionDate()
- .compareTo(o2.getFinancialTransaction().getTransactionDate());
- }
-
-}
Deleted: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/NumberUtil.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/NumberUtil.java 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/NumberUtil.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -1,103 +0,0 @@
-/**
- * *##% Callao NumberUtil
- * Copyright (C) 2009 CodeLutin
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Lesser Public License for more details.
- *
- * You should have received a copy of the GNU General Lesser Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*
- */
-
-package org.chorem.lima.business.utils;
-
-
-import java.text.NumberFormat;
-import java.text.ParseException;
-import java.util.Locale;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Cette classe permet de manipuler des nombres.
- * Elle est utilisée essentiellement au niveau des entrées comptables afin de
- * formater tous les nombres suivant la norme comptabilité choisie.
- * @author Rémi Chapelet
- *
- * @deprecated since 0.4.0, use {@link NumberFormat} directly
- */
-public class NumberUtil {
-
- /** log */
- private static final Log log = LogFactory.getLog(NumberUtil.class);
-
- public static NumberFormat numberFormat;
-
- public static final String format = "%0$10.2f";
-
-
- /**
- * Instancie la classe NumberFormat. Elle va permettre d'apporter des méthodes
- * pour manipuler les chaines de caractères et les nombres.
- * On doit définir la variable locale.
- * @return
- */
- public static NumberFormat getNumberFormat() {
- if (numberFormat == null) {
- numberFormat = NumberFormat.getNumberInstance(Locale.FRENCH);
- }
- return numberFormat;
- }
-
- /**
- * Format la chaine de caractère en nombre.
- * @param amount
- */
- public Double formatNumber (String amount)
- {
- Double numberDouble;
- try {
- Number number = getNumberFormat().parse(amount);
- numberDouble = number.doubleValue();
- } catch (ParseException e) {
- throw new RuntimeException(e);
- }
- return numberDouble;
- }
-
-
- /**
- * Formate un nombre sous format Double en renvoyant en chaîne de caractère.
- * Il utilise la variable "format" pour définir le formatage ainsi que la
- * variable locale.
- * @param number
- * @return
- */
- public String format(double number)
- {
- return String.format(Locale.FRENCH, format, number).trim();
- }
-
- /**
- * Formate un nombre sous format String.
- * @param theDouble
- * @return
- */
- public String format(String amount)
- {
- return format(formatNumber(amount));
- }
-
-
-
-
-}
\ No newline at end of file
Modified: trunk/lima-callao/src/main/xmi/accounting.properties
===================================================================
--- trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-callao/src/main/xmi/accounting.properties 2010-06-09 17:27:20 UTC (rev 2939)
@@ -4,6 +4,9 @@
org.chorem.lima.entity.Account.attribute.subLedgers.tagvalue.lazy=false
org.chorem.lima.entity.FinancialTransaction.attribute.financialPeriod.tagvalue.lazy=false
org.chorem.lima.entity.FiscalPeriod.attribute.financialPeriod.tagvalue.lazy=false
+org.chorem.lima.entity.FinancialStatementHeader.attribute.subFinancialStatementHeaders.tagvalue.lazy=false
+org.chorem.lima.entity.FinancialStatementHeader.attribute.financialStatementMovement.tagvalue.lazy=false
+
#model.tagvalue.dbSchema=Callao
model.tagvalue.String=text
\ No newline at end of file
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/service/LimaServiceFactory.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -34,6 +34,7 @@
import org.chorem.lima.business.AccountService;
import org.chorem.lima.business.EntryBookService;
import org.chorem.lima.business.FinancialPeriodService;
+import org.chorem.lima.business.FinancialStatementService;
import org.chorem.lima.business.FiscalPeriodService;
import org.chorem.lima.business.RecordService;
import org.chorem.lima.business.FinancialTransactionService;
@@ -235,9 +236,8 @@
/**
- * Get record service.
+ * Get report service.
*
- * @return record service proxy
*/
public ReportService getReportService() {
@@ -256,6 +256,24 @@
}
/**
+ * Get financial statement service.
+ *
+ */
+ public FinancialStatementService getFinancialStatementService() {
+
+ String lookupName = "FinancialStatementServiceImplRemote";
+ FinancialStatementService ejbHome = null;
+ try {
+ ejbHome = (FinancialStatementService)ctx.lookup(lookupName);
+ } catch (NamingException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't lookup for service : " + lookupName, eee);
+ }
+ }
+ return ejbHome;
+ }
+
+ /**
* Get record service.
*
* @return record service proxy
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2010-06-09 17:27:20 UTC (rev 2939)
@@ -122,6 +122,7 @@
actionIcon='journal'/>
<JMenuItem text="lima.charts.fiscalyear" onActionPerformed='getHandler().showFiscalPeriodView(this)'/>
<JMenuItem text="lima.charts.financialperiod" onActionPerformed='getHandler().showFinancialPeriodView(this)'/>
+ <JMenuItem text="lima.charts.financialstatement" onActionPerformed='getHandler().showFinancialStatementView(this)'/>
</JMenu>
<JMenu text="lima.entries">
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -41,6 +41,7 @@
import org.chorem.lima.ui.entrybooksreports.EntryBooksReportsView;
import org.chorem.lima.ui.financialperiod.FinancialPeriodView;
import org.chorem.lima.ui.fiscalperiod.FiscalPeriodView;
+import org.chorem.lima.ui.financialstatement.FinancialStatementView;
import org.chorem.lima.ui.financialtransaction.FinancialTransactionView;
import org.chorem.lima.ui.financialtransaction.LetteringView;
import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedView;
@@ -319,6 +320,16 @@
}
/**
+ * Show financial statement view to generate balance sheet and income statement
+ * @param rootContext
+ */
+ public void showFinancialStatementView(JAXXContext rootContext) {
+ MainView mainView = getUI(rootContext);
+ FinancialStatementView financialStatementView = new FinancialStatementView(mainView);
+ mainView.showTab(_("lima.charts.financialstatement"), financialStatementView);
+ }
+
+ /**
* Show account table report to view an account on a period
* @param rootContext
*/
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -81,6 +81,8 @@
if ( selectedRow != -1) {
treePath = view.getAccountsTreeTable().getPathForRow(selectedRow);
} else {
+ //FIXME Get root created on model with Impl()
+ //Can best not create root in model, and verify if root is null ?
treePath = new TreePath(accountsTreeTableModel.getRoot());
}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementHeaderForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementHeaderForm.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementHeaderForm.jaxx 2010-06-09 17:27:20 UTC (rev 2939)
@@ -0,0 +1,53 @@
+<!-- ##% Lima Swing
+ Copyright (C) 2008 - 2010 CodeLutin
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ ##% -->
+
+<JDialog modal="true">
+
+ <org.chorem.lima.entity.FinancialStatementHeader id="header" javaBean='null'/>
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
+ <![CDATA[
+ protected void performCancel() {
+ setHeader(null);
+ dispose();
+ }
+ ]]>
+ </script>
+
+ <Table>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField" text="{getHeader().getLabel()}"/>
+ <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getHeader().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getHeader().setLabel(getDescriptionTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementHeaderForm.jaxx
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementMovementForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementMovementForm.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementMovementForm.jaxx 2010-06-09 17:27:20 UTC (rev 2939)
@@ -0,0 +1,98 @@
+<!-- ##% Lima Swing
+ Copyright (C) 2008 - 2010 CodeLutin
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ ##% -->
+
+<JDialog modal="true">
+
+ <org.chorem.lima.entity.FinancialStatementMovement id="movement" javaBean='null'/>
+
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
+ <![CDATA[
+ protected void performCancel() {
+ setMovement(null);
+ dispose();
+ }
+ ]]>
+ </script>
+
+ <Table>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField" text="{getMovement().getLabel()}"/>
+ <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getMovement().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getMovement().setLabel(getDescriptionTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.accounts"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="accountsTextField" text="{getMovement().getAccounts()}"/>
+ <javax.swing.text.Document javaBean="getAccountsTextField().getDocument()"
+ onInsertUpdate='getMovement().setAccounts(getAccountsTextField().getText())'
+ onRemoveUpdate='getMovement().setAccounts(getAccountsTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.creditaccounts"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="debitAccountsTextField" text="{getMovement().getDebitAccounts()}"/>
+ <javax.swing.text.Document javaBean="getDebitAccountsTextField().getDocument()"
+ onInsertUpdate='getMovement().setDebitAccounts(getDebitAccountsTextField().getText())'
+ onRemoveUpdate='getMovement().setDebitAccounts(getDebitAccountsTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.debitaccounts"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="creditAccountsTextField" text="{getMovement().getCreditAccounts()}"/>
+ <javax.swing.text.Document javaBean="getCreditAccountsTextField().getDocument()"
+ onInsertUpdate='getMovement().setCreditAccounts(getCreditAccountsTextField().getText())'
+ onRemoveUpdate='getMovement().setCreditAccounts(getCreditAccountsTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.financialstatement.provisiondeprecationaccounts"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="provisionDeprecationAccountsTextField" text="{getMovement().getProvisionDeprecationAccounts()}"/>
+ <javax.swing.text.Document javaBean="getProvisionDeprecationAccountsTextField().getDocument()"
+ onInsertUpdate='getMovement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())'
+ onRemoveUpdate='getMovement().setProvisionDeprecationAccounts(getProvisionDeprecationAccountsTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementMovementForm.jaxx
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementTreeTableModel.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementTreeTableModel.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -0,0 +1,269 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.ui.financialstatement;
+
+import static org.nuiton.i18n.I18n._;
+import java.util.List;
+import javax.swing.tree.TreePath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.FinancialStatementService;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.FinancialStatementHeader;
+import org.chorem.lima.entity.FinancialStatementHeaderImpl;
+import org.chorem.lima.entity.FinancialStatementMovement;
+import org.chorem.lima.service.LimaServiceFactory;
+import org.jdesktop.swingx.treetable.AbstractTreeTableModel;
+
+/**
+ * Tree table model for account edition.
+ *
+ * @author ore
+ * @author chatellier
+ * @version $Revision: 2934 $
+ *
+ * Last update : $Date: 2010-06-08 11:55:04 +0200 (mar., 08 juin 2010) $
+ * By : $Author: jpepin $
+ */
+public class FinancialStatementTreeTableModel extends AbstractTreeTableModel {
+
+ /** log. */
+ private static final Log log = LogFactory.getLog(FinancialStatementViewHandler.class);
+
+ /** Account service. */
+ protected final FinancialStatementService financialStatementService;
+
+ /**
+ * Model constructor. Init account service used here.
+ */
+ public FinancialStatementTreeTableModel() {
+ //create root for the tree
+ super(new FinancialStatementHeaderImpl());
+ // Gets factory service
+ financialStatementService = LimaServiceFactory.getInstance().getFinancialStatementService();
+ }
+
+
+ @Override
+ public int getColumnCount() {
+ return 1;
+ }
+
+ @Override
+ public String getColumnName(int column) {
+ String res = null;
+ switch (column) {
+ case 0:
+ res = _("lima.account.label");
+ break;
+ }
+ return res;
+ }
+
+ @Override
+ public int getChildCount(Object node) {
+ int result = 0;
+ if (node == getRoot()) {
+ try {
+ result = financialStatementService.
+ getChildrenFinancialStatement(null).size();
+ } catch (LimaException eee) {
+ log.debug("Can't count child", eee);
+ }
+ }
+ else {
+ if (node instanceof FinancialStatementHeader){
+ FinancialStatementHeader parentFinancialStatementHeader =
+ (FinancialStatementHeader) node;
+ try {
+ result = financialStatementService.getChildrenFinancialStatement(
+ parentFinancialStatementHeader).size();
+ } catch (LimaException eee) {
+ log.debug("Can't count child", eee);
+ }
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Object getChild(Object parent, int index) {
+ Object result = null;
+ if (parent == getRoot()) {
+ try {
+ List<Object> allObjects =
+ financialStatementService.getChildrenFinancialStatement(null);
+ result = allObjects.get(index);
+ } catch (LimaException eee) {
+ log.debug("Can't get child", eee);
+ }
+ }
+ else {
+ FinancialStatementHeader parentFinancialStatementHeader =
+ (FinancialStatementHeader) parent;
+ try {
+ List<Object> objects = financialStatementService.
+ getChildrenFinancialStatement(parentFinancialStatementHeader);
+ result = objects.get(index);
+ } catch (LimaException eee) {
+ log.debug("Can't get child", eee);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public int getIndexOfChild(Object parent, Object child) {
+ int result = 0;
+
+ if (parent == getRoot()) {
+ try {
+ List<Object> allObjects =
+ financialStatementService.getChildrenFinancialStatement(null);
+ result = allObjects.indexOf(child);
+ } catch (LimaException eee) {
+ log.debug("Can't get index child", eee);
+ }
+ }
+ else {
+ FinancialStatementHeader parentFinancialStatementHeader =
+ (FinancialStatementHeader) parent;
+ try {
+ List<Object> objects = financialStatementService.
+ getChildrenFinancialStatement(parentFinancialStatementHeader);
+ result = objects.indexOf(child);
+ } catch (LimaException eee) {
+ log.debug("Can't get index child", eee);
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public Object getValueAt(Object node, int column) {
+ Object result = "n/a";
+ if (node instanceof FinancialStatementHeader) {
+ FinancialStatementHeader financialStatementHeader = (FinancialStatementHeader) node;
+ switch (column) {
+ case 0:
+ result = financialStatementHeader.getLabel();
+ break;
+ }
+ }
+ else {
+ FinancialStatementMovement financialStatementMovement = (FinancialStatementMovement) node;
+ switch (column) {
+ case 0:
+ result = financialStatementMovement.getLabel();
+ break;
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public boolean isCellEditable(Object node, int column) {
+ return false;
+ }
+
+ @Override
+ public boolean isLeaf(Object node) {
+ return getChildCount(node) == 0;
+ }
+
+ /**
+ * Add FinancialStatementHeader (path can be null).
+ *
+ * @param path
+ * @param account
+ * @throws LimaException
+ */
+ public void addFinancialStatementHeader(TreePath path, FinancialStatementHeader financialStatementHeader) throws LimaException {
+ // Calling account service
+ FinancialStatementHeader parentFinancialStatementHeader =
+ (FinancialStatementHeader) path.getLastPathComponent();
+ if (parentFinancialStatementHeader == getRoot()) {
+ parentFinancialStatementHeader = null;
+ }
+ financialStatementService.createFinancialStatementHeader(
+ parentFinancialStatementHeader, financialStatementHeader);
+ modelSupport.fireTreeStructureChanged(path.getParentPath());
+ }
+
+ /**
+ * Add FinancialStatementMovement (path can't be null).
+ *
+ * @param path
+ * @param account
+ * @throws LimaException
+ */
+ public void addFinancialStatementMovement(TreePath path, FinancialStatementMovement financialStatementMovement) throws LimaException {
+ // Calling account service
+ FinancialStatementHeader parentFinancialStatementHeader =
+ (FinancialStatementHeader) path.getLastPathComponent();
+ if (parentFinancialStatementHeader != getRoot()) {
+ financialStatementService.createFinancialStatementMovement(parentFinancialStatementHeader, financialStatementMovement);
+ modelSupport.fireTreeStructureChanged(path);
+ }
+ }
+
+ /**
+ * Update financialStatementHeader.
+ *
+ * @param path
+ * @param account
+ * @throws LimaException
+ */
+ public void updateFinancialStatement(TreePath path, Object object) throws LimaException {
+
+ int index = getIndexOfChild(
+ path.getParentPath().getLastPathComponent(), object);
+ if (object instanceof FinancialStatementHeader){
+ financialStatementService.updateFinancialStatementHeader((FinancialStatementHeader) object);
+ }
+ else {
+ financialStatementService.updateFinancialStatementMovement((FinancialStatementMovement) object);
+ }
+ modelSupport.fireTreeStructureChanged(path);
+ }
+
+
+
+ /**
+ * Remove financialStatementHeader or financialStatementMovement
+ *
+ * @param path
+ * @param object
+ * @throws LimaException
+ */
+ public void removeFinancialStatementObject(TreePath path, Object object) throws LimaException {
+ // Calling account service
+ int index = getIndexOfChild(
+ path.getParentPath().getLastPathComponent(), object);
+ if (object instanceof FinancialStatementHeader){
+ financialStatementService.removeFinancialStatementHeader((FinancialStatementHeader) object);
+ }
+ else {
+ financialStatementService.removeFinancialStatementMovement((FinancialStatementMovement) object);
+ }
+
+ modelSupport.fireChildRemoved(path.getParentPath(), index, object);
+ }
+
+}
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementView.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementView.jaxx 2010-06-09 17:27:20 UTC (rev 2939)
@@ -0,0 +1,67 @@
+<!-- ##% Lima Swing
+ Copyright (C) 2008 - 2010 CodeLutin
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ ##% -->
+
+<Table>
+
+ <FinancialStatementViewHandler id="handler" javaBean="new FinancialStatementViewHandler(this)" />
+ <Boolean id="selectedRow" javaBean="false" />
+
+ <script>
+ <![CDATA[
+ //getHandler().init();
+ ]]>
+ </script>
+
+ <row>
+ <cell fill="both" weightx="1" weighty="1" rows='4'>
+ <JScrollPane>
+ <org.jdesktop.swingx.JXTreeTable id="treeTable"
+ selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
+ treeTableModel="{new org.chorem.lima.ui.financialstatement.FinancialStatementTreeTableModel()}"
+ highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}" />
+ <javax.swing.ListSelectionModel
+ javaBean="getTreeTable().getSelectionModel()"
+ onValueChanged="setSelectedRow(treeTable.getSelectedRow() != -1)"/>
+ </JScrollPane>
+ </cell>
+ <cell fill="horizontal">
+ <JButton id="addFinancialStatementHeader" text="lima.add.financialstatementheader"
+ onActionPerformed="getHandler().addFinancialStatementHeader()"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="addFinancialStatementMovement" text="lima.add.financialstatementmovement"
+ onActionPerformed="getHandler().addFinancialStatementMovement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="updateButton" text="lima.common.update"
+ onActionPerformed="getHandler().updateFinancialStatement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="removeButton" text="lima.common.remove"
+ onActionPerformed="getHandler().removeFinancialStatement()"
+ enabled="{isSelectedRow()}"/>
+ </cell>
+ </row>
+</Table>
\ No newline at end of file
Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementView.jaxx
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementViewHandler.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatement/FinancialStatementViewHandler.java 2010-06-09 17:27:20 UTC (rev 2939)
@@ -0,0 +1,237 @@
+/* *##% Lima Swing
+ * Copyright (C) 2008 - 2010 CodeLutin
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ##%*/
+
+package org.chorem.lima.ui.financialstatement;
+
+import static org.nuiton.i18n.I18n._;
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.LimaBusinessException;
+import org.chorem.lima.business.LimaException;
+import org.chorem.lima.entity.FinancialStatementHeader;
+import org.chorem.lima.entity.FinancialStatementHeaderImpl;
+import org.chorem.lima.entity.FinancialStatementMovement;
+import org.chorem.lima.entity.FinancialStatementMovementImpl;
+import org.chorem.lima.util.DialogHelper;
+import org.chorem.lima.util.ErrorHelper;
+import org.jdesktop.swingx.JXTreeTable;
+
+/**
+ * Handler associated with account view.
+ *
+ * @author chatellier
+ * @version $Revision: 2934 $
+ *
+ * Last update : $Date: 2010-06-08 11:55:04 +0200 (mar., 08 juin 2010) $
+ * By : $Author: jpepin $
+ */
+public class FinancialStatementViewHandler {
+
+ /** log. */
+ private static final Log log = LogFactory.getLog(FinancialStatementViewHandler.class);
+
+ protected FinancialStatementView view;
+
+ protected JXTreeTable treeTable;
+
+ protected FinancialStatementTreeTableModel treeTableModel;
+
+ protected FinancialStatementViewHandler(FinancialStatementView view) {
+ this.view = view;
+ }
+
+ /**
+ * Add new account with account form.
+ */
+ public void addFinancialStatementHeader() {
+ treeTable = view.getTreeTable();
+ treeTableModel =
+ (FinancialStatementTreeTableModel) treeTable.getTreeTableModel();
+
+ FinancialStatementHeader newFinancialStatementHeader = new FinancialStatementHeaderImpl();
+ FinancialStatementHeaderForm financialStatementHeaderForm = new FinancialStatementHeaderForm(view);
+ financialStatementHeaderForm.setHeader(newFinancialStatementHeader);
+ // jaxx constructor don't call super() ?
+ financialStatementHeaderForm.setLocationRelativeTo(view);
+ financialStatementHeaderForm.setVisible(true);
+
+ // null == cancel action
+ newFinancialStatementHeader = financialStatementHeaderForm.getHeader();
+ if (newFinancialStatementHeader != null) {
+ // get current selection path
+ TreePath treePath = null;
+ int selectedRow = treeTable.getSelectedRow();
+ if ( selectedRow != -1) {
+ treePath = treeTable.getPathForRow(selectedRow);
+ } else {
+ treePath = new TreePath(treeTableModel.getRoot());
+ }
+
+ // add it
+ try {
+ treeTableModel.addFinancialStatementHeader(treePath, newFinancialStatementHeader);
+ } catch (LimaBusinessException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add financialStatementHeader", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+
+ }
+
+ catch (LimaException ex) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add financialStatementHeader", ex);
+ }
+ ErrorHelper.showErrorDialog("Can't add financialStatementHeader", ex);
+ }
+ }
+ };
+
+ public void addFinancialStatementMovement(){
+
+ treeTable = view.getTreeTable();
+ treeTableModel =
+ (FinancialStatementTreeTableModel) treeTable.getTreeTableModel();
+
+ FinancialStatementMovement newFinancialStatementMovement = new FinancialStatementMovementImpl();
+ FinancialStatementMovementForm financialStatementMovementForm = new FinancialStatementMovementForm(view);
+ financialStatementMovementForm.setMovement(newFinancialStatementMovement);
+ // jaxx constructor don't call super() ?
+ financialStatementMovementForm.setLocationRelativeTo(view);
+ financialStatementMovementForm.setVisible(true);
+ newFinancialStatementMovement=financialStatementMovementForm.getMovement();
+
+ // null == cancel action
+ if (newFinancialStatementMovement != null) {
+ // get current selection path
+ TreePath treePath = null;
+ int selectedRow = view.treeTable.getSelectedRow();
+ treePath = view.treeTable.getPathForRow(selectedRow);
+ // add it
+ try {
+ treeTableModel.
+ addFinancialStatementMovement(treePath, newFinancialStatementMovement);
+ } catch (LimaBusinessException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add FinancialStatementMovement", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+
+ catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add FinancialStatementMovement", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+ }
+ }
+
+ /**
+ * Open account form with selected account.
+ * Verifiy if it's an account or a subledger
+ */
+ public void updateFinancialStatement() {
+
+ treeTable = view.getTreeTable();
+ treeTableModel =
+ (FinancialStatementTreeTableModel) treeTable.getTreeTableModel();
+
+ // get selected account
+ int selectedRow = view.treeTable.getSelectedRow();
+ TreePath treePath = view.treeTable.getPathForRow(selectedRow); // not null
+ Object selectedObject = treePath.getLastPathComponent();
+ //update Account or update SubLedger
+ if (selectedObject != null) {
+ // get current selection path
+ if ( selectedRow != -1) {
+ treePath = view.treeTable.getPathForRow(selectedRow);
+ } else {
+ treePath = new TreePath(treeTableModel.getRoot());
+ }
+ //test if selectedrow is account or ledger
+ if (selectedObject instanceof FinancialStatementHeader){
+ FinancialStatementHeaderForm financialStatementHeaderForm = new FinancialStatementHeaderForm(view);
+ financialStatementHeaderForm.setHeader((FinancialStatementHeader) selectedObject);
+ // jaxx constructor don't call super() ?
+ financialStatementHeaderForm.setLocationRelativeTo(view);
+ financialStatementHeaderForm.setVisible(true);
+ // null == cancel action
+ selectedObject = financialStatementHeaderForm.getHeader();
+ }
+ // else is a subledger
+ else{
+ FinancialStatementMovementForm financialStatementMovementForm = new FinancialStatementMovementForm(view);
+ financialStatementMovementForm.setMovement((FinancialStatementMovement) selectedObject);
+ // jaxx constructor don't call super() ?
+ financialStatementMovementForm.setLocationRelativeTo(view);
+ financialStatementMovementForm.setVisible(true);
+ // null == cancel action
+ selectedObject = financialStatementMovementForm.getMovement();
+ }
+ //if action confirmed
+ if (selectedObject != null){
+ // update it
+ try {
+ treeTableModel.updateFinancialStatement(treePath, selectedObject);
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add update", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+ }
+ }
+ }
+
+ /**
+ * Ask for user to remove for selected account, and remove it if confirmed.
+ */
+ public void removeFinancialStatement() {
+ treeTable = view.getTreeTable();
+ treeTableModel =
+ (FinancialStatementTreeTableModel) treeTable.getTreeTableModel();
+
+ // Any row selected
+ int selectedRow = view.treeTable.getSelectedRow();
+ if ( selectedRow != -1) {
+ int n = JOptionPane.showConfirmDialog(view,
+ _("lima.question.remove.account"),
+ _("lima.question"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+ if (n == JOptionPane.YES_OPTION) {
+ // update view of treetable
+ TreePath treePath = view.treeTable.getPathForRow(selectedRow);
+ Object object = treePath.getLastPathComponent();
+
+ try{
+ treeTableModel.removeFinancialStatementObject(treePath, object);
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't delete account", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+ }
+ }
+ };
+
+}
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-09 17:27:20 UTC (rev 2939)
@@ -34,6 +34,8 @@
lima.action.normalscreen.tip=Open ui in normal screen
lima.add=Add
lima.add.entry=Add an entry
+lima.add.financialstatementheader=
+lima.add.financialstatementmovement=
lima.add.lettering=Add a letter
lima.add.transaction=Add a transaction
lima.all=All
@@ -62,6 +64,7 @@
lima.charts.account=Accounts chart
lima.charts.entrybook=EntryBooks chart
lima.charts.financialperiod=Financial Periods
+lima.charts.financialstatement=
lima.charts.fiscalyear=Fiscal Years
lima.close=Closed
lima.closure=Closure
@@ -162,6 +165,11 @@
lima.filter.starts.with=Starts with
lima.financialperiod.block=
lima.financialperiod.management=
+lima.financialstatement.accounts=
+lima.financialstatement.creditaccounts=
+lima.financialstatement.debitaccounts=
+lima.financialstatement.label=
+lima.financialstatement.provisiondeprecationaccounts=
lima.find.transaction=Find transaction
lima.fiscalperiod.addFiscalPeriod=
lima.fiscalperiod.block=
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 2010-06-08 17:35:17 UTC (rev 2938)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-09 17:27:20 UTC (rev 2939)
@@ -34,6 +34,8 @@
lima.action.normalscreen=Ecran normal
lima.action.normalscreen.tip=Revenir en \u00E9cran normal
lima.add.entry=Ajouter entr\u00E9e
+lima.add.financialstatementheader=
+lima.add.financialstatementmovement=
lima.add.lettering=
lima.add.transaction=Ajouter transaction
lima.all=Tous
@@ -61,6 +63,7 @@
lima.charts.account=Plan comptable
lima.charts.entrybook=Journaux
lima.charts.financialperiod=P\u00E9riodes comptables
+lima.charts.financialstatement=
lima.charts.fiscalyear=Exercices
lima.close=Ferm\u00E9
lima.closure=Cloture
@@ -161,6 +164,11 @@
lima.filter.starts.with=Commence par
lima.financialperiod.block=Cloturer une p\u00E9riode
lima.financialperiod.management=
+lima.financialstatement.accounts=
+lima.financialstatement.creditaccounts=
+lima.financialstatement.debitaccounts=
+lima.financialstatement.label=
+lima.financialstatement.provisiondeprecationaccounts=
lima.find.transaction=Rechercher transaction
lima.fiscalperiod.addFiscalPeriod=Nouvel exercice
lima.fiscalperiod.block=Cloturer un exercice
1
0