r3442 - in trunk: lima-business/src/main/java/org/chorem/lima/business/accountingrules lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/java/org/chorem/lima/business/utils lima-business/src/main/resources/i18n lima-callao/src/main/java/org/chorem/lima/entity lima-callao/src/main/xmi lima-swing/src/main/java/org/chorem/lima/ui/accountsreports lima-swing/src/main/java/org/chorem/lima/ui/common lima-swing/src/main/java/org/chorem/lima/ui/financialperiod lima-swing/
Author: echatellier Date: 2012-06-05 16:51:55 +0200 (Tue, 05 Jun 2012) New Revision: 3442 Url: http://chorem.org/repositories/revision/lima/3442 Log: Correction diverses pour la saisie de la comptabilit?\195?\169 Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/package-info.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/ejb/FinancialTransactionServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java trunk/lima-callao/src/main/xmi/accounting.properties trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/IntervalPanel.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.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/DefaultAccountingRules.java 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -227,11 +227,15 @@ } // Check if all financial transactions have EntryBooks - result = financialTransactionDAO.getAllTransactionWithoutEntryBook(); + // FIXME echatellier 20120605 only check in interval defined + // by period to block (not all database) + result = financialTransactionDAO.getAllTransactionWithoutEntryBook(period.getBeginDate(), + period.getEndDate()); // FIMXE echatellier 20120504 unutile de recuperer une liste // entiere juste pour tester l'existence if (result.size() > 0) { - throw new LimaBusinessException(_("lima-business.defaultaccountingrules.missingentrybook")); + FinancialTransaction transaction = result.get(0); + throw new LimaBusinessException(_("lima-business.defaultaccountingrules.missingentrybook", transaction.getTransactionDate())); } } catch (TopiaException ex) { 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 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -240,19 +240,13 @@ @Override public void removeFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException { + // check if the financial period is blocked AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules(); + accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialtransaction); try { - - //check if the financial period is blocked - accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction( - financialtransaction); - FinancialTransactionDAO transactionDAO = getDaoHelper().getFinancialTransactionDAO(); - FinancialTransaction financialTransaction2 = - //patch : conflict object already instanciate - transactionDAO.findByTopiaId(financialtransaction.getTopiaId()); - + transactionDAO.delete(financialtransaction); } catch (Exception ex) { throw new LimaException("Can't remove financial transaction", ex); } Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -70,7 +70,7 @@ /** * Gestion des exercices. - * Un exercice ne peut être supprimée et débloquée après cloture. + * Un exercice ne peut être supprimé et débloqué après cloture. * * @author Rémi Chapelet */ @@ -255,19 +255,27 @@ public void addRetainedEarnings(FiscalPeriod fiscalPeriod, boolean newyear, EntryBook entryBook) throws LimaException { + // re-attach entities to current session + FiscalPeriod localFiscalPeriod = null; + try { + FiscalPeriodDAO fiscalPeriodDAO = getDaoHelper().getFiscalPeriodDAO(); + localFiscalPeriod = fiscalPeriodDAO.findByTopiaId(fiscalPeriod.getTopiaId()); + } catch (TopiaException ex) { + throw new LimaException("Can't find fiscal period", ex); + } + //sets dates // - endRetainedEarnings: last day of the closing year // - beginRetainedEarnings: first open day of the following year -// Date endRetainedEarnings = fiscalPeriod.getBeginDate(); -// Date beginRetainedEarnings = null; + // Date endRetainedEarnings = fiscalPeriod.getBeginDate(); + // Date beginRetainedEarnings = null; //Sets entryBook //search for the entryBook to use using param boolean found = false; List<EntryBook> entryBooksList = entryBookService.getAllEntryBooks(); for (EntryBook entry : entryBooksList) { - if (!found && entry.getCode().equals(entryBook.getCode()) - && entry.getLabel().equals(entryBook.getLabel())) { + if (!found && entry.getCode().equals(entryBook.getCode())) { entryBook = entry; found = true; } @@ -278,8 +286,7 @@ entryBookService.createEntryBook(entryBook); entryBooksList = entryBookService.getAllEntryBooks(); for (EntryBook entry : entryBooksList) { - if (!found && entry.getCode().equals(entryBook.getCode()) - && entry.getLabel().equals(entryBook.getLabel())) { + if (!found && entry.getCode().equals(entryBook.getCode())) { entryBook = entry; found = true; } @@ -323,7 +330,7 @@ } //look for the last financial period from the previous fiscal year - Collection<FinancialPeriod> fperiod = fiscalPeriod.getFinancialPeriod(); + Collection<FinancialPeriod> fperiod = localFiscalPeriod.getFinancialPeriod(); Iterator<FinancialPeriod> itr = fperiod.iterator(); FinancialPeriod lastFPeriod = null; @@ -352,7 +359,7 @@ // - unlocked entrybook // - right code and label if (!found && !cPeriodicEntryBook.getFinancialPeriod().getLocked() - && cPeriodicEntryBook.getFinancialPeriod().getBeginDate().after(fiscalPeriod.getEndDate()) + && cPeriodicEntryBook.getFinancialPeriod().getBeginDate().after(localFiscalPeriod.getEndDate()) && !cPeriodicEntryBook.getLocked() && cPeriodicEntryBook.getEntryBook().getCode().equals(entryBook.getCode()) && cPeriodicEntryBook.getEntryBook().getLabel().equals(entryBook.getLabel())) { @@ -370,7 +377,7 @@ if (lastFPeriod != null) { //Sets the endfinancialTransaction endfinancialTransaction.setEntryBook(entryBook); - endfinancialTransaction.setTransactionDate(fiscalPeriod.getEndDate()); + endfinancialTransaction.setTransactionDate(localFiscalPeriod.getEndDate()); financialTransactionService.createFinancialTransaction(endfinancialTransaction); } @@ -393,18 +400,15 @@ Entry beginEntry; - BalanceTrial results = reportService.generateBalanceTrial(fiscalPeriod.getBeginDate(), fiscalPeriod.getEndDate(), null, false, false); + BalanceTrial results = reportService.generateBalanceTrial(localFiscalPeriod.getBeginDate(), + localFiscalPeriod.getEndDate(), null, false, false); List<ReportsDatas> reportsDatasList = (List<ReportsDatas>) results.getReportsDatas(); - //check if at least one transaction has been reported - boolean transaction = false; - for (ReportsDatas report : reportsDatasList) { //Account class from 1 to 5 and only non zero amount if (Integer.valueOf(report.getAccount().getAccountNumber().substring(0, 1)) < 6 && !report.getAmountSolde().equals(BigDecimal.ZERO)) { - transaction = true; //close accounts by removing amounts from all class 1 to 5 accounts beginEntry = new EntryImpl(); beginEntry.setDescription(_("lima-business.financialtransaction.retainedearnings.description") + " (" + calendar.get(Calendar.YEAR) + ")"); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -35,13 +35,12 @@ private static final long serialVersionUID = 1L; - private static final Log log = - LogFactory.getLog(FinancialPeriodComparator.class); + private static final Log log = LogFactory.getLog(FinancialPeriodComparator.class); @Override public int compare(ClosedPeriodicEntryBook o1, ClosedPeriodicEntryBook o2) { if (o1.getFinancialPeriod().getBeginDate().compareTo(o2.getFinancialPeriod().getBeginDate()) == 0) { - if (o1.getEntryBook().getLabel().compareToIgnoreCase(o2.getEntryBook().getLabel()) == 0) { + if (o1.getEntryBook().getCode().compareToIgnoreCase(o2.getEntryBook().getCode()) == 0) { return o1.getTopiaCreateDate().compareTo(o2.getTopiaCreateDate()); } else { return o1.getEntryBook().getCode().compareToIgnoreCase(o2.getEntryBook().getCode()); Modified: trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties =================================================================== --- trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2012-06-05 14:51:55 UTC (rev 3442) @@ -16,7 +16,7 @@ lima-business.defaultaccountingrules.financialtransactionblocked=La période financière de cette transaction est bloquée lima-business.defaultaccountingrules.invalidaccountnumber=Numéro de compte invalide \: %d lima-business.defaultaccountingrules.missingelements=Impossible de bloquer la période financière / il manque des éléments dans des transactions -lima-business.defaultaccountingrules.missingentrybook=Impossible de bloquer la période financière / il mmanque un journal dans une transaction +lima-business.defaultaccountingrules.missingentrybook=Impossible de bloquer la période financière / il manque un journal dans une transaction (%1$te/%1$tm/%1$tY) lima-business.document.accountnumber=N° Compte lima-business.document.amounts=Totaux lima-business.document.balance=Balance 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 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/ClosedPeriodicEntryBookDAOImpl.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -132,7 +132,7 @@ Date beginDate, Date endDate) throws TopiaException { String query = "FROM " + ClosedPeriodicEntryBook.class.getName() + - " WHERE :begindate <= financialPeriod.beginDate " + + " WHERE :beginDate <= financialPeriod.beginDate " + " AND financialPeriod.beginDate <= :endDate" + " AND entryBook = :entryBook"; return context.find(query, "beginDate", beginDate, "endDate", endDate, "entryBook", entryBook); @@ -152,7 +152,7 @@ Date beginDate, Date endDate) throws TopiaException { String query = "FROM " + ClosedPeriodicEntryBook.class.getName() + - " WHERE :begindate <= financialPeriod.beginDate " + + " WHERE :beginDate <= financialPeriod.beginDate " + " AND financialPeriod.beginDate <= :endDate" + " AND entryBook = :entryBook" + " AND locked = true"; @@ -160,16 +160,17 @@ } /** - * Retourne les ClosedPeriodicEntryBook clos de toutes les exercive encore ouvert. + * Retourne les ClosedPeriodicEntryBook de toutes les exercices encore ouverts. * * @return les ClosedPeriodicEntryBook * @throws TopiaException */ public List<ClosedPeriodicEntryBook> findAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod() throws TopiaException { - String query = "FROM " + ClosedPeriodicEntryBook.class.getName() + " C" + + String query = "SELECT C FROM " + ClosedPeriodicEntryBook.class.getName() + " C" + ", " + FiscalPeriod.class.getName() + " F" + - " WHERE E.financialPeriod IN ELEMENTS (F.financialPeriod)" + - " ORDER BY E.financialPeriod.beginDate"; + " WHERE C.financialPeriod IN ELEMENTS (F.financialPeriod)" + + " AND F.locked = false" + + " ORDER BY C.financialPeriod.beginDate"; List<ClosedPeriodicEntryBook> result = context.find(query); return result; Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java =================================================================== --- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialTransactionDAOImpl.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -223,12 +223,13 @@ /** * Find all transaction without entry book. * - * TODO echatellier 20120425 same method as getAllUnfilledTransaction ? - * - * @return + * @param beginDate begin date + * @param endDate end date + * @return transaction without entry books * @throws TopiaException */ - public List<FinancialTransaction> getAllTransactionWithoutEntryBook() throws TopiaException { + public List<FinancialTransaction> getAllTransactionWithoutEntryBook(Date beginDate, + Date endDate) throws TopiaException { String query = "SELECT T FROM " + FinancialTransaction.class.getName() + " T"+ " LEFT JOIN T.entry AS E" + @@ -237,9 +238,11 @@ " (SELECT sum(amount) FROM " + Entry.class.getName() + " WHERE debit = false AND financialTransaction = T) OR E.account = null" + " OR E.voucher = null OR E.voucher = '' OR E.description = null OR E.description = '')" + - " AND entryBook = null"; - // FIXME echatellier 20120504 doesn't concern a period ? all database ? - List<FinancialTransaction> result = context.find(query); + " AND entryBook = null" + + " AND :beginDate <= T.transactionDate" + + " AND T.transactionDate <= :endDate"; + List<FinancialTransaction> result = context.find(query, "beginDate", + beginDate, "endDate", endDate); return result; } Modified: trunk/lima-callao/src/main/xmi/accounting.properties =================================================================== --- trunk/lima-callao/src/main/xmi/accounting.properties 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-callao/src/main/xmi/accounting.properties 2012-06-05 14:51:55 UTC (rev 3442) @@ -47,6 +47,8 @@ org.chorem.lima.entity.FiscalPeriod.attribute.endDate.tagvalue.notNull=true # lazy +org.chorem.lima.entity.ClosedPeriodicEntryBook.attribute.entryBook.tagvalue.lazy=false +org.chorem.lima.entity.ClosedPeriodicEntryBook.attribute.financialPeriod.tagvalue.lazy=false org.chorem.lima.entity.Entry.attribute.account.tagvalue.lazy=false org.chorem.lima.entity.Entry.attribute.financialTransaction.tagvalue.lazy=false org.chorem.lima.entity.FinancialTransaction.attribute.entry.tagvalue.lazy=false Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/accountsreports/AccountsReportsTable.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -24,27 +24,21 @@ */ package org.chorem.lima.ui.accountsreports; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer; -import org.jdesktop.swingx.JXTable; - import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.math.BigDecimal; +import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer; +import org.jdesktop.swingx.JXTable; + public class AccountsReportsTable extends JXTable implements KeyListener, MouseListener { /** serialVersionUID. */ private static final long serialVersionUID = 6093850347322834480L; - /** log. */ - private static final Log log = LogFactory - .getLog(AccountsReportsTable.class); - public AccountsReportsTable() { addKeyListener(this); Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/IntervalPanel.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/IntervalPanel.java 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/IntervalPanel.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -42,11 +42,8 @@ import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.SwingUtilities; import org.apache.commons.lang3.time.DateUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.enums.ComboBoxDatesEnum; @@ -71,9 +68,6 @@ /** serialVersionUID. */ private static final long serialVersionUID = 5973427750255668999L; - /** log. */ - private static final Log log = LogFactory.getLog(IntervalPanel.class); - protected List<IntervalListener> listeners; protected JComboBox typeComboBox; Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialperiod/FinancialPeriodViewHandler.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -34,7 +34,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.chorem.lima.business.LimaException; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.FinancialPeriodService; import org.chorem.lima.business.api.FiscalPeriodService; Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/package-info.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/package-info.java (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/package-info.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -0,0 +1,26 @@ +/* + * #%L + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 Codelutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * 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, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ +/** + * Structure - Plan BCR. + */ +package org.chorem.lima.ui.financialstatementchart; Property changes on: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/package-info.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL 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 2012-06-05 13:47:53 UTC (rev 3441) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransactionunbalanced/FinancialTransactionUnbalancedTableModel.java 2012-06-05 14:51:55 UTC (rev 3442) @@ -35,8 +35,6 @@ import javax.swing.table.AbstractTableModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.FinancialTransactionService; import org.chorem.lima.business.utils.EntryComparator; @@ -65,10 +63,6 @@ /** serialVersionUID. */ private static final long serialVersionUID = 3914954536809622358L; - /** log. */ - private static final Log log = LogFactory - .getLog(FinancialTransactionUnbalancedTableModel.class); - /** Transaction service. */ protected final FinancialTransactionService financialTransactionService;
participants (1)
-
echatellier@users.chorem.org