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>