Author: jpepin Date: 2010-05-31 15:11:26 +0200 (Mon, 31 May 2010) New Revision: 2917 Url: http://chorem.org/repositories/revision/lima/2917 Log: Calcul des montants des transactions financi?\195?\168res dans le business Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.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/FinancialPeriodServiceImpl.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-callao/src/main/xmi/accounting.zargo trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountService.java 2010-05-31 13:11:26 UTC (rev 2917) @@ -46,7 +46,7 @@ * @param account account * @throws LimaException */ - void createAccount(Account masterAccount, Account account) throws LimaException; + void createAccount(Account masterAccount, Account account) throws LimaException, LimaBusinessException; void createSubLedger(Account masterAccount, Account account) throws LimaException; Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2010-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java 2010-05-31 13:11:26 UTC (rev 2917) @@ -69,7 +69,7 @@ * @throws LimaException */ public void updateEntryRules(Entry entry, Entry entryOld, TopiaContext topiaTransaction) throws LimaException; - + public void updateFinancialTransactionDateRules(FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld, TopiaContext topiaContext) throws LimaException; /** * Financialperiod/entrybook rules * @param financialTransaction Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/FinancialTransactionService.java 2010-05-31 13:11:26 UTC (rev 2917) @@ -73,7 +73,7 @@ void createFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException; - void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException; + void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException, LimaBusinessException; void removeFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException; 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-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2010-05-31 13:11:26 UTC (rev 2917) @@ -20,6 +20,7 @@ package org.chorem.lima.business.accountingrules; import java.util.ArrayList; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -43,6 +44,7 @@ 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; @@ -211,10 +213,13 @@ */ @Override public void checkFinancialPeriodBlockedWithFinancialTransaction(FinancialTransaction financialTransaction, TopiaContext topiaContext) throws LimaException { + //check financial period locked if (financialTransaction.getFinancialPeriod().getLocked()){ throw new LimaBusinessException("The financial period is blocked"); } + //check all entrybook of his financial period are blocked + //FIXME Make this check by topia query ? List<EntryBook> entryBooks = new ArrayList<EntryBook>(); List<EntryBook> closedEntryBooks = new ArrayList<EntryBook>(); try { @@ -269,5 +274,79 @@ // TODO Auto-generated method stub } + + /** + * 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 + */ + @Override + public void updateFinancialTransactionDateRules( + FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld, TopiaContext topiaContext) throws LimaException { + + //check old financial period locked + if (financialTransactionOld.getFinancialPeriod().getLocked()){ + throw new LimaBusinessException("The financial period of this transaction is blocked"); + } + + //check new financial period locked + if (financialTransaction.getFinancialPeriod().getLocked()){ + throw new LimaBusinessException("The financial period of the new date is blocked"); + } + + try { + + //check if date are on fiscal period + FiscalPeriodDAO fiscalPeriodDAO = LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext); + FiscalPeriod fiscalPeriod = fiscalPeriodDAO.findContainsFinancialPeriod(financialTransaction.getFinancialPeriod()); + Date beginDateFiscalPeriod = fiscalPeriod.getBeginDate(); + Date endDateFiscalPeriod = fiscalPeriod.getEndDate(); + Date financialTransactionDate = financialTransaction.getTransactionDate(); + if (financialTransactionDate.before(beginDateFiscalPeriod)){ + throw new LimaBusinessException("The date is before the fiscal period"); + } + if (financialTransactionDate.after(endDateFiscalPeriod)){ + throw new LimaBusinessException("The date is after the fiscal period"); + } + + //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> oldClosedEntryBooks = new ArrayList<EntryBook>(); + EntryBookDAO entryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(topiaContext); + FinancialPeriod financialPeriod = financialTransaction.getFinancialPeriod(); + FinancialPeriod oldFinancialPeriod = financialTransactionOld.getFinancialPeriod(); + entryBooks = entryBookDAO.findAll(); + for (EntryBook entryBook : entryBooks) { + FinancialPeriodService financialPeriodService = + (FinancialPeriodService) map.get(FinancialPeriodService.class); + if (financialPeriodService == null){ + financialPeriodService = new FinancialPeriodServiceImpl(); + } + + if(financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriod).getLocked()){ + closedEntryBooks.add(entryBook); + } + if(financialPeriodService.getClosedPeriodicEntryBook(entryBook, oldFinancialPeriod).getLocked()){ + oldClosedEntryBooks.add(entryBook); + } + } + + if (oldClosedEntryBooks.size() >0){ + throw new LimaBusinessException("All EntryBook of this financialperiod are not open"); + } + if (closedEntryBooks.size() >0){ + throw new LimaBusinessException("All EntryBook of old financialperiod are not open"); + } + + + } + catch (TopiaException eee) { + doCatch(topiaContext, eee, log); + } + } } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java 2010-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AbstractLimaService.java 2010-05-31 13:11:26 UTC (rev 2917) @@ -43,6 +43,9 @@ * @throws LimaException */ protected void doCatch(TopiaContext transaction, Exception cause, Log log) throws LimaException { + if (cause instanceof LimaException){ + throw (LimaException) cause; + } if (transaction != null) { try { transaction.rollbackTransaction(); 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-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917) @@ -119,7 +119,7 @@ commitTransaction(transaction); } - catch (TopiaException ex) { + catch (Exception ex) { doCatch(transaction, ex, log); } finally { Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917) @@ -208,9 +208,12 @@ TopiaQuery query = financialPeriodDAO.createQuery(); if (date != null){ - query.add("beginDate = :value").addParam("value", date); + query.addWhere("beginDate <= :value") + .addWhere("endDate >= :value") + .addParam("value", date); } - financialPeriod = financialPeriodDAO.findByQuery(query); + financialPeriod = financialPeriodDAO.findByQuery(query); + log.debug(financialPeriod); } catch (TopiaException ex) { doCatch(transaction, ex, log); @@ -301,7 +304,7 @@ query.addFrom(FiscalPeriod.class, "F") .addInElements("E." + ClosedPeriodicEntryBook.FINANCIAL_PERIOD, "F."+FiscalPeriod.FINANCIAL_PERIOD) - .add("F."+FiscalPeriod.LOCKED, Boolean.FALSE) + .addEquals("F."+FiscalPeriod.LOCKED, Boolean.FALSE) .addOrder(FiscalPeriod.FINANCIAL_PERIOD, FinancialPeriod.BEGIN_DATE); //IMPORTANT : LOADING ClosedPeriodicEntryBook AND IS COLUMN FOR NO LAZY EXCEPTION 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-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917) @@ -21,7 +21,7 @@ import static org.nuiton.i18n.I18n._; -import java.util.Collections; +import java.util.Date; import java.util.List; import javax.ejb.Stateless; @@ -29,13 +29,10 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.AccountingRules; -import org.chorem.lima.business.LimaBusinessException; import org.chorem.lima.business.LimaConfig; import org.chorem.lima.business.LimaException; import org.chorem.lima.business.FinancialTransactionService; -import org.chorem.lima.business.utils.AccountComparator; import org.chorem.lima.entity.Account; -import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryDAO; @@ -44,7 +41,6 @@ import org.chorem.lima.entity.LimaCallaoDAOHelper; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FinancialTransactionDAO; -import org.hsqldb.lib.Sort; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; import org.nuiton.topia.TopiaException; @@ -69,6 +65,9 @@ private TopiaContext rootContext; protected AccountingRules accountingRules; + + protected FinancialPeriodServiceImpl financialPeriodService = + new FinancialPeriodServiceImpl(); public FinancialTransactionServiceImpl() { LimaConfig config = LimaConfig.getInstance(); @@ -97,8 +96,8 @@ accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction( financialtransaction, topiaContext); - FinancialTransactionDAO financialtransactionDAO = LimaCallaoDAOHelper - .getFinancialTransactionDAO(topiaContext); + FinancialTransactionDAO financialtransactionDAO = + LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext); financialtransactionDAO.create(financialtransaction); @@ -130,7 +129,7 @@ TopiaQuery query = transactionDAO.createQuery(); // entryBook is not visible, but column "entryBook" // exist in transaction table - query.add("entryBook", entryBook); + query.addEquals("entryBook", entryBook); FinancialTransaction result = transactionDAO.findByQuery(query); @@ -152,7 +151,7 @@ EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaTransaction); //TODO marche pas TopiaQuery query = entryDAO.createQuery(); - query.add("account", account); + query.addEquals("account", account); Entry result = entryDAO.findByQuery(query); @@ -208,11 +207,11 @@ TopiaQuery query = transactionDAO.createQuery(); if (entryBook != null) { - query.add("entryBook", entryBook); + query.addEquals("entryBook", entryBook); } if (financialPeriod != null) { - query.add("financialPeriod", financialPeriod); + query.addEquals("financialPeriod", financialPeriod); } financialTransactions = transactionDAO.findAllByQuery(query); @@ -245,7 +244,8 @@ try { topiaContext = beginTransaction(); - FinancialTransactionDAO financialTransactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext); + FinancialTransactionDAO financialTransactionDAO = + LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext); TopiaQuery query = financialTransactionDAO.createQuery("E"); query.add(FinancialTransaction.ENTRY); result = query.execute(); @@ -261,31 +261,65 @@ return result; } + @Override public void updateFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException { - - TopiaContext topiaTransaction = null; - try { - topiaTransaction = beginTransaction(); - - //check if the financial period is blocked - accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction( - financialtransaction, topiaTransaction); - - - FinancialTransactionDAO transactionDAO = - LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); - transactionDAO.update(financialtransaction); - commitTransaction(topiaTransaction); + + TopiaContext topiaContext = null; + try { + topiaContext = beginTransaction(); + updateFinancialTransactionWithTransaction( + financialtransaction, topiaContext); + commitTransaction(topiaContext); } catch (TopiaException ex) { - doCatch(topiaTransaction, ex, log); + doCatch(topiaContext, ex, log); } finally { - doFinally(topiaTransaction, log); + doFinally(topiaContext, log); } } + + public void updateFinancialTransactionWithTransaction(FinancialTransaction financialtransaction, TopiaContext topiaContext) throws LimaException{ + try { + log.debug("updat"); + log.debug(financialtransaction); + FinancialTransactionDAO transactionDAO = + LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext); + FinancialTransaction financialTransactionOld = + transactionDAO.findByTopiaId(financialtransaction.getTopiaId()); + + /* if update date change - 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 + */ + Date oldDate = financialTransactionOld.getTransactionDate(); + Date newDate = financialtransaction.getTransactionDate(); + if (newDate.compareTo(oldDate) != 0){ + financialTransactionOld.setTransactionDate(newDate); + //change financial period + FinancialPeriod financialPeriod = + financialPeriodService.getFinancialPeriodWithDate(newDate); + if (financialPeriod != null){ + financialTransactionOld.setFinancialPeriod(financialPeriod); + } + accountingRules.updateFinancialTransactionDateRules( + financialtransaction, financialTransactionOld, topiaContext); + } + + financialTransactionOld.setAmountDebit( + financialtransaction.getAmountDebit()); + financialTransactionOld.setAmountCredit( + financialtransaction.getAmountCredit()); + transactionDAO.update(financialTransactionOld); + } + catch (TopiaException ex) { + doCatch(topiaContext, ex, log); + } + } @Override public void removeFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException { @@ -301,6 +335,7 @@ FinancialTransactionDAO transactionDAO = LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaTransaction); FinancialTransaction financialTransaction2 = + //patch : conflict object already instanciate transactionDAO.findByTopiaId(financialtransaction.getTopiaId()); transactionDAO.delete(financialTransaction2); commitTransaction(topiaTransaction); @@ -327,9 +362,29 @@ accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction( entry.getFinancialTransaction(), topiaContext); + //get entry amounts + Double entryAmount = entry.getAmount(); + Boolean entryAmountBool = entry.getDebit(); + Double entryDebit = entryAmountBool ? entryAmount : 0; + Double entryCredit = entryAmountBool ? 0 : entryAmount; + + //calculate financial transaction amounts + FinancialTransaction financialTransaction = + entry.getFinancialTransaction(); + Double amountDebit = financialTransaction.getAmountDebit(); + Double amountCredit = financialTransaction.getAmountCredit(); + financialTransaction.setAmountDebit(amountDebit-entryDebit); + financialTransaction.setAmountCredit(amountCredit-entryCredit); + + //update financial transaction + updateFinancialTransactionWithTransaction( + financialTransaction, topiaContext); + EntryDAO entryDAO = LimaCallaoDAOHelper.getEntryDAO(topiaContext); //delete entryDAO.delete(entry); + // updateFinancialTransactionWithTransaction(entry.getFinancialTransaction(), topiaContext) + //commit commitTransaction(topiaContext); } catch (TopiaException ex) { @@ -338,6 +393,8 @@ finally { doFinally(topiaContext, log); } + //update financial transaction + updateFinancialTransaction(entry.getFinancialTransaction()); } @Override @@ -354,17 +411,44 @@ //check rules accountingRules.updateEntryRules(entry, entryOld, topiaContext); + //get new entry amounts + Double entryAmount = entry.getAmount(); + Boolean entryAmountBool = entry.getDebit(); + Double entryDebit = entryAmountBool ? entryAmount : 0; + Double entryCredit = entryAmountBool ? 0 : entryAmount; + + //get old entry amounts + Double entryAmountOld = entryOld.getAmount(); + Boolean entryAmountBoolOld = entryOld.getDebit(); + Double entryDebitOld = entryAmountBoolOld ? entryAmountOld : 0; + Double entryCreditOld = entryAmountBoolOld ? 0 : entryAmountOld; + //TODO PEPIN 20100520 conflict object already instanciate entryOld.setAccount(entry.getAccount()); - entryOld.setAmount(entry.getAmount()); - entryOld.setDebit(entry.getDebit()); + 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()); entryOld.setLettering(entry.getLettering()); - //update + + //calculate financial transaction amounts + FinancialTransaction financialTransaction = + entryOld.getFinancialTransaction(); + Double amountDebit = financialTransaction.getAmountDebit(); + Double amountCredit = financialTransaction.getAmountCredit(); + financialTransaction.setAmountDebit( + amountDebit-entryDebitOld+entryDebit); + financialTransaction.setAmountCredit( + amountCredit-entryCreditOld+entryCredit); + + //update financial transaction + updateFinancialTransactionWithTransaction( + financialTransaction, topiaContext); + + //update entry entryDAO.update(entryOld); commitTransaction(topiaContext); } @@ -375,7 +459,7 @@ doFinally(topiaContext, log); } } - + /** * Création d'une entrée comptable. * La période ne doit PAS être bloquée. 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-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ReportServiceImpl.java 2010-05-31 13:11:26 UTC (rev 2917) @@ -282,8 +282,8 @@ String transactionDateProperty = TopiaQuery.getProperty(Entry.FINANCIAL_TRANSACTION, FinancialTransaction.TRANSACTION_DATE); - query.add(Entry.ENTRY_BOOK, entryBook) - .add(transactionDateProperty+" BETWEEN :beginDate AND :endDate") + query.addEquals(Entry.ENTRY_BOOK, entryBook) + .addWhere(transactionDateProperty+" BETWEEN :beginDate AND :endDate") .addParam("beginDate", beginDate) .addParam("endDate", endDate); /*String orderProperty = Modified: trunk/lima-callao/src/main/xmi/accounting.zargo =================================================================== (Binary files differ) Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2010-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2010-05-31 13:11:26 UTC (rev 2917) @@ -53,16 +53,6 @@ </cell> </row> <row> - <cell fill="horizontal"> - <JLabel text="lima.account.type"/> - </cell> - <cell fill="horizontal"> - <JComboBox id="typeComboBox" model='{new org.chorem.lima.ui.account.model.AccountTypeListModel()}' - selectedItem="{getAccount().getType()}" - onActionPerformed="getAccount().setType((String)getTypeComboBox().getSelectedItem())"/> - </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/account/SubLedgerForm.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2010-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2010-05-31 13:11:26 UTC (rev 2917) @@ -54,17 +54,6 @@ onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())' /> </cell> </row> - <row> - <cell fill="horizontal"> - <JLabel text="lima.account.type"/> - </cell> - <cell fill="horizontal"> - <JComboBox id="typeComboBox" - model='{new org.chorem.lima.ui.account.model.AccountTypeListModel()}' - selectedItem="{getAccount().getType()}" - onActionPerformed="getAccount().setType((String)getTypeComboBox().getSelectedItem())"/> - </cell> - </row> <!-- Lien Fiche contact--> <row> <cell fill="horizontal"> Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java 2010-05-27 17:22:42 UTC (rev 2916) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/table/FinancialTransactionTableModel.java 2010-05-31 13:11:26 UTC (rev 2917) @@ -243,6 +243,8 @@ if (result instanceof FinancialTransaction) { FinancialTransaction currentRow = (FinancialTransaction)result; + Double amountDebit = currentRow.getAmountDebit(); + Double amountCredit = currentRow.getAmountCredit(); switch (column) { case 0: @@ -264,14 +266,13 @@ result = null; // position break; case 6: - result = FinancialTransactionHelper.getDebit(currentRow); + result = amountDebit;//FinancialTransactionHelper.getDebit(currentRow); break; case 7: - result = FinancialTransactionHelper.getCredit(currentRow); + result = amountCredit;//FinancialTransactionHelper.getCredit(currentRow); break; case 8: - result = FinancialTransactionHelper.getDebit(currentRow) - - FinancialTransactionHelper.getCredit(currentRow); + result = amountDebit - amountCredit; break; } } @@ -426,12 +427,17 @@ (FinancialTransaction)currentRow; switch (column) { case 0: - // Truncate the date - format 01-MM-YYYY + //update + currentFinancialTransaction. + setTransactionDate((Date)value); + + /*// Truncate the date - format 01-MM-YYYY Date dateCurrentFinancialTransaction = ((Date)value); dateCurrentFinancialTransaction = DateUtils.truncate( dateCurrentFinancialTransaction, Calendar.MONTH); + //TODO add on rules // Return the begin date of the current financial period Date dateCurrentFinancialPeriod = selectedFinancialPeriod.getBeginDate(); @@ -465,7 +471,7 @@ log.debug("Can't update on the new date"); } } - } + }*/ break; } @@ -511,6 +517,7 @@ } try { financialTransactionService.updateEntry(currentEntry); + } catch (LimaException e) { if (log.isDebugEnabled()){ log.debug("Can't update entry", e);