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
June 2010
- 4 participants
- 37 discussions
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
r2938 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/ejb lima-callao/src/main/java/org/chorem/lima/entity lima-swing/src/main/java/org/chorem/lima/ui/balance lima-swing/src/main/resources/i18n
by jpepin@users.chorem.org 08 Jun '10
by jpepin@users.chorem.org 08 Jun '10
08 Jun '10
Author: jpepin
Date: 2010-06-08 19:35:17 +0200 (Tue, 08 Jun 2010)
New Revision: 2938
Url: http://chorem.org/repositories/revision/lima/2938
Log:
Fonction de filtre dans la balance pour s?\195?\169lectionner qu'une ?\195?\169tendue de comptes (exemple : '10,21,34-38,47,53-58')
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.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/ReportService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java 2010-06-08 10:14:54 UTC (rev 2937)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ReportService.java 2010-06-08 17:35:17 UTC (rev 2938)
@@ -62,7 +62,7 @@
* @return la balance
* @throws LimaException
*/
- BalanceTrial generateBalanceTrial(Date beginDate, Date endDate, Boolean getEntries) throws LimaException;
+ BalanceTrial generateBalanceTrial(Date beginDate, Date endDate, String selectedAccounts, Boolean getEntries) throws LimaException;
/**
* Generation du grand-livre
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 10:14:54 UTC (rev 2937)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-06-08 17:35:17 UTC (rev 2938)
@@ -23,8 +23,13 @@
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;
import org.chorem.lima.beans.BalanceTrial;
@@ -396,12 +401,14 @@
*
* Calculate the amounts and the solde for all subaccounts
*
+ * Can have string selectedAccounts in params for account filter
+ *
* Boolean Param GetEntries is for get entries in datasreports or not :
* - GetEntries = false for generate balance
* - GetEntries = true for generate ledger
*/
@Override
- public BalanceTrial generateBalanceTrial(Date beginDate, Date endDate, Boolean getEntries) throws LimaException {
+ public BalanceTrial generateBalanceTrial(Date beginDate, Date endDate, String selectedAccounts, Boolean getEntries) throws LimaException {
BalanceTrial balanceTrial = new BalanceTrialImpl();
balanceTrial.setReportsDatas(new ArrayList<ReportsDatas>());
double credit = 0, debit = 0, solde = 0;
@@ -413,7 +420,49 @@
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(topiaTransaction);
//for each account create a balance sheet with a ReportsDatas
- List<Account> accounts = accountDAO.findAllSubAccounts();
+
+ List<Account> accounts =null;
+
+ //Remove Spaces
+ selectedAccounts = StringUtils.deleteWhitespace(selectedAccounts);
+ log.debug(selectedAccounts);
+ //if no filter account
+ if (selectedAccounts == null || selectedAccounts.equals("")){
+ accounts = accountDAO.findAllSubAccounts();
+ }
+ //build list account from selectedAccounts
+ else{
+ accounts = new ArrayList<Account>();
+ List<String> accountNumbers = new ArrayList<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);
+ }
+ }
+ // remove duplicate numbers
+ HashSet<String> hashSet = new HashSet<String>(accountNumbers);
+ accountNumbers = new ArrayList<String>(hashSet);
+
+ for (String accountNumber : accountNumbers) {
+ Account accountFilter = accountDAO.findByAccountNumber(accountNumber);
+ if (accountFilter != null){
+ accounts.add(accountFilter);
+ }
+ }
+ log.debug(accounts);
+ }
for (Account account : accounts) {
ReportsDatas reportsDatas =
generateSubAccountBalanceWithTransaction(account, beginDate,
@@ -457,7 +506,7 @@
*/
@Override
public BalanceTrial generateLedger(Date beginDate, Date endDate) throws LimaException {
- return generateBalanceTrial(beginDate, endDate, true);
+ return generateBalanceTrial(beginDate, endDate, null, true);
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2010-06-08 10:14:54 UTC (rev 2937)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2010-06-08 17:35:17 UTC (rev 2938)
@@ -25,7 +25,6 @@
query.addEquals(ClosedPeriodicEntryBook.FINANCIAL_PERIOD, financialPeriod);
}
return findByQuery(query);
-
}
}
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-08 10:14:54 UTC (rev 2937)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceTableModel.java 2010-06-08 17:35:17 UTC (rev 2938)
@@ -29,6 +29,7 @@
import org.chorem.lima.beans.ReportsDatas;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ReportService;
+import org.chorem.lima.entity.Account;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
@@ -53,12 +54,15 @@
/** Services. */
protected ReportService reportService;
- /** Begin Date. */
+ /** DatePicker Begin Date. */
protected Date selectedBeginDate;
- /** EndDate. */
+ /** DatePicker EndDate. */
protected Date selectedEndDate;
+ /** Text field Accounts */
+ protected String selectedAccounts;
+
/** data cache */
protected BalanceTrial cacheDataList;
@@ -168,6 +172,10 @@
selectedEndDate = date;
}
+ public void setAccountFilter(String accounts) {
+ selectedAccounts = accounts;
+ }
+
/**
* get all account fot the selected period
* @return
@@ -176,7 +184,7 @@
BalanceTrial results = null;
try {
- results = reportService.generateBalanceTrial(selectedBeginDate, selectedEndDate, false);
+ results = reportService.generateBalanceTrial(selectedBeginDate, selectedEndDate, selectedAccounts, false);
}
catch (LimaException eee) {
if (log.isErrorEnabled()) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx 2010-06-08 10:14:54 UTC (rev 2937)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceView.jaxx 2010-06-08 17:35:17 UTC (rev 2938)
@@ -68,9 +68,17 @@
onActionPerformed="getModelBalanceTable().setEndDate(endDatePicker.getDate());
getHandler().refresh()"/>
</cell>
+ <cell anchor="east">
+ <JTextField id="accountFilter"/>
+ </cell>
+ <cell anchor="west">
+ <JButton text="lima.accountsreports.accountfilter"
+ onActionPerformed="getModelBalanceTable().setAccountFilter(accountFilter.getText());
+ getHandler().refresh()"/>
+ </cell>
</row>
<row>
- <cell fill="both" weightx="1" weighty="1" columns="6">
+ <cell fill="both" weightx="1" weighty="1" columns="7">
<JScrollPane>
<org.jdesktop.swingx.JXTable id="balanceTable" rowHeight="24"
model="{getModelBalanceTable()}"
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-06-08 10:14:54 UTC (rev 2937)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/balance/BalanceViewHandler.java 2010-06-08 17:35:17 UTC (rev 2938)
@@ -52,7 +52,6 @@
this.view = view;
financialTransactionService =
LimaServiceFactory.getInstance().getTransactionService();
-
}
public void refresh(){
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 10:14:54 UTC (rev 2937)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-06-08 17:35:17 UTC (rev 2938)
@@ -22,6 +22,7 @@
lima.account.type4=
lima.accountplan=Plan de comptes
lima.accounts=Accounts
+lima.accountsreports.accountfilter=Filter
lima.accountsreports.begincalendar=
lima.accountsreports.endcalendar=
lima.actif=Asset
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 10:14:54 UTC (rev 2937)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-06-08 17:35:17 UTC (rev 2938)
@@ -23,6 +23,7 @@
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
1
0
Author: echatellier
Date: 2010-06-08 12:14:54 +0200 (Tue, 08 Jun 2010)
New Revision: 2937
Url: http://chorem.org/repositories/revision/lima/2937
Log:
Fix main class fqn
Modified:
trunk/lima-swing/pom.xml
Modified: trunk/lima-swing/pom.xml
===================================================================
--- trunk/lima-swing/pom.xml 2010-06-08 10:12:45 UTC (rev 2936)
+++ trunk/lima-swing/pom.xml 2010-06-08 10:14:54 UTC (rev 2937)
@@ -88,7 +88,7 @@
<!-- ************************************************************* -->
<properties>
<!--Main class in JAR -->
- <maven.jar.main.class>org.chorem.lima.Main</maven.jar.main.class>
+ <maven.jar.main.class>org.chorem.lima.LimaMain</maven.jar.main.class>
<redmine.releaseFiles>target/${project.artifactId}-${project.version}-bin.zip,</redmine.releaseFiles>
</properties>
1
0
Author: echatellier
Date: 2010-06-08 12:12:45 +0200 (Tue, 08 Jun 2010)
New Revision: 2936
Url: http://chorem.org/repositories/revision/lima/2936
Log:
Update to openejb stable.
Seams to be a milestone, see http://apache-geronimo.328035.n3.nabble.com/What-should-be-the-openejb-rele… for details.
Modified:
trunk/lima-business/pom.xml
trunk/lima-swing/pom.xml
trunk/pom.xml
Modified: trunk/lima-business/pom.xml
===================================================================
--- trunk/lima-business/pom.xml 2010-06-08 10:06:40 UTC (rev 2935)
+++ trunk/lima-business/pom.xml 2010-06-08 10:12:45 UTC (rev 2936)
@@ -33,7 +33,7 @@
<artifactId>nuiton-utils</artifactId>
</dependency>
<dependency>
- <groupId>org.apache.openejb</groupId>
+ <groupId>org.apache.geronimo.ext.openejb</groupId>
<artifactId>openejb-core</artifactId>
<scope>provided</scope>
</dependency>
Modified: trunk/lima-swing/pom.xml
===================================================================
--- trunk/lima-swing/pom.xml 2010-06-08 10:06:40 UTC (rev 2935)
+++ trunk/lima-swing/pom.xml 2010-06-08 10:12:45 UTC (rev 2936)
@@ -65,13 +65,13 @@
</dependency>
<dependency>
- <groupId>org.apache.openejb</groupId>
+ <groupId>org.apache.geronimo.ext.openejb</groupId>
<artifactId>openejb-core</artifactId>
</dependency>
<!-- for remote mode only -->
<dependency>
- <groupId>org.apache.openejb</groupId>
+ <groupId>org.apache.geronimo.ext.openejb</groupId>
<artifactId>openejb-client</artifactId>
</dependency>
</dependencies>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-08 10:06:40 UTC (rev 2935)
+++ trunk/pom.xml 2010-06-08 10:12:45 UTC (rev 2936)
@@ -122,18 +122,17 @@
<!-- Services -->
<dependency>
- <groupId>org.apache.openejb</groupId>
+ <groupId>org.apache.geronimo.ext.openejb</groupId>
<artifactId>openejb-core</artifactId>
- <!-- 3.1.2 has a startup warning with 1.6.0_u18 -->
- <version>3.1.3-SNAPSHOT</version>
+ <version>3.1.3.0</version>
<scope>compile</scope>
</dependency>
<!-- Mandatory for remote mode (embedded need only core) -->
<dependency>
- <groupId>org.apache.openejb</groupId>
+ <groupId>org.apache.geronimo.ext.openejb</groupId>
<artifactId>openejb-client</artifactId>
- <version>3.1.3-SNAPSHOT</version>
+ <version>3.1.3.0</version>
<scope>compile</scope>
</dependency>
1
0