Lima-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
July 2012
- 5 participants
- 74 discussions
r3486 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business-api/src/main/java/org/chorem/lima/business/api lima-callao/src/main/java/org/chorem/lima/entity lima-swing/src/main/java/org/chorem/lima/ui/lettering
by mallon@users.chorem.org 03 Jul '12
by mallon@users.chorem.org 03 Jul '12
03 Jul '12
Author: mallon
Date: 2012-07-03 16:36:31 +0200 (Tue, 03 Jul 2012)
New Revision: 3486
Url: http://chorem.org/repositories/revision/lima/3486
Log:
- Interface, via jaxx, r?\195?\169alis?\195?\169e;
- Chargement du tableau des ?\195?\169critures, ?\195?\160 l'ouverture, selon les deux dates par d?\195?\169faut, le compte et le filtre sur le lettrage;
- Mod?\195?\168le d'UI cr?\195?\169?\195?\169 : gestion de l'affichage des composants en cours;
- Chargement de la date et du journal, auparavant absents, de chaque ?\195?\169criture dans le tableau;
- Affichage selon le compte et les dates s?\195?\169lectionn?\195?\169es;
- Affichage par d?\195?\169faut des non-lettr?\195?\169es et du compte 4;
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.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-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
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-07-03 11:54:09 UTC (rev 3485)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-07-03 14:36:31 UTC (rev 3486)
@@ -1,7 +1,7 @@
/*
* #%L
* Lima business
- *
+ *
* $Id$
* $HeadURL$
* %%
@@ -9,15 +9,15 @@
* %%
* 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
+ * 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
+ *
+ * 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%
@@ -42,7 +42,6 @@
import org.chorem.lima.business.api.EntryBookService;
import org.chorem.lima.business.api.FinancialPeriodService;
import org.chorem.lima.business.api.FinancialTransactionService;
-import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.business.api.OptionsService;
import org.chorem.lima.business.api.ReportService;
import org.chorem.lima.entity.Account;
@@ -72,7 +71,7 @@
@EJB
protected FinancialPeriodService financialPeriodService;
-
+
@EJB
protected ReportService reportService;
@@ -119,6 +118,42 @@
return financialTransactions;
}
+ /** Find the last three letters used
+ * and increment them
+ * */
+ @Override
+ public String getNewLetters() throws LimaException {
+ String lastActualLetters = "";
+ List<Entry> entries = new ArrayList<Entry>();
+
+ try {
+ EntryDAO entryDAO = getDaoHelper().getEntryDAO();
+ lastActualLetters = entryDAO.findLetters().get(0);
+ } catch (Exception ex) {
+ throw new LimaException("Can't get new letters", ex);
+ }
+
+ String nextThirdLetter ="A";
+ String nextSecondLetter = "A";
+ String nextFirstLetter = "A";
+
+ if (lastActualLetters.length() > 2 && lastActualLetters.charAt(2) != 'Z'){
+ nextThirdLetter = incrementLetter(2, lastActualLetters);
+ }else if (lastActualLetters.length() > 1 && lastActualLetters.charAt(1) != 'Z'){
+ nextSecondLetter = incrementLetter(1, lastActualLetters);
+ }else if (lastActualLetters.charAt(0) != 'Z'){
+ nextFirstLetter = incrementLetter(0, lastActualLetters);
+ }
+
+ return nextFirstLetter + nextSecondLetter + nextThirdLetter;
+ }
+
+ /**Increment letter alphabetically*/
+ protected String incrementLetter(int indiceLetter, String lastActualLetters){
+ int valueLetter = lastActualLetters.charAt(indiceLetter);
+ return String.valueOf( (char) (valueLetter + 1));
+ }
+
/**
* Return the list of all financial transaction of a financial period.
*/
@@ -127,7 +162,7 @@
FinancialPeriod period) throws LimaException {
return getAllFinancialTransactions(period, null);
}
-
+
/**
* Return the list of all financial transaction of a fiscal period.
*/
@@ -155,7 +190,7 @@
try {
FinancialTransactionDAO transactionDAO = getDaoHelper().getFinancialTransactionDAO();
-
+
if (entryBook != null) {
financialTransactions = transactionDAO.findAllByDates(financialPeriod.getBeginDate(),
financialPeriod.getEndDate(), entryBook);
@@ -229,31 +264,31 @@
*/
@Override
public void updateFinancialTransaction(FinancialTransaction financialTransaction) throws LimaException {
-
+
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
try {
-
+
//FIXME mallon 22/06/2012 : Revoir l'utilisation du rattachement à la session et celle des deux objets 'financialTransactionOld'
//et 'financialTransaction'
FinancialTransactionDAO transactionDAO = getDaoHelper().getFinancialTransactionDAO();
FinancialTransaction financialTransactionOld = transactionDAO.findByTopiaId(financialTransaction.getTopiaId());
- accountingRules.updateFinancialTransactionDateRules(financialTransaction, financialTransactionOld);
-
- Date financialTransactionOldDate = financialTransactionOld.getTransactionDate();
- Date financialTransactionDate = financialTransaction.getTransactionDate();
-
+ accountingRules.updateFinancialTransactionDateRules(financialTransaction, financialTransactionOld);
+
+ Date financialTransactionOldDate = financialTransactionOld.getTransactionDate();
+ Date financialTransactionDate = financialTransaction.getTransactionDate();
+
if (log.isDebugEnabled()) {
- log.debug("Date de la transaction (Old) : " + financialTransactionOldDate);
+ log.debug("Date de la transaction (Old) : " + financialTransactionOldDate);
}
if (log.isDebugEnabled()) {
- log.debug("Date de la transaction (New) : " + financialTransactionDate);
+ log.debug("Date de la transaction (New) : " + financialTransactionDate);
}
-
+
financialTransactionOld.setEntryBook(financialTransaction.getEntryBook());
financialTransactionOld.setTransactionDate(financialTransactionDate);
-
+
transactionDAO.update(financialTransactionOld);
} catch (TopiaException ex) {
throw new LimaException("Can't update financial transaction", ex);
@@ -272,11 +307,11 @@
accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialTransaction);
try {
-
+
FinancialTransactionDAO transactionDAO = getDaoHelper().getFinancialTransactionDAO();
FinancialTransaction financialTransactionOld = transactionDAO.findByTopiaId(financialTransaction.getTopiaId());
transactionDAO.delete(financialTransactionOld);
-
+
} 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-07-03 11:54:09 UTC (rev 3485)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-07-03 14:36:31 UTC (rev 3486)
@@ -1,7 +1,7 @@
/*
* #%L
* Lima business
- *
+ *
* $Id$
* $HeadURL$
* %%
@@ -9,15 +9,15 @@
* %%
* 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
+ * 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
+ *
+ * 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%
@@ -59,7 +59,6 @@
import org.chorem.lima.entity.AccountImpl;
import org.chorem.lima.entity.ClosedPeriodicEntryBook;
import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO;
-import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl;
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.EntryImpl;
@@ -131,11 +130,11 @@
// udpate
result = fiscalPeriodDAO.update(result);
-
+
} catch (TopiaException ex) {
throw new LimaException("Can't create period", ex);
}
-
+
return result;
}
@@ -157,7 +156,7 @@
return result;
}
-
+
/**
* return all blocked fiscal periods.
*/
@@ -194,12 +193,6 @@
return result;
}
- public String findLastActualLetters() throws LimaException {
- List<FiscalPeriod> fiscalPeriods = getAllUnblockedFiscalPeriods();
-
- return null;
- }
-
@Override
public FiscalPeriod getLastFiscalPeriod() throws LimaException {
FiscalPeriod result = null;
@@ -216,7 +209,7 @@
return result;
}
-
+
/**
* to block a fiscal period
* <p/>
@@ -342,7 +335,7 @@
while (itr.hasNext()) {
lastFPeriod = itr.next();
}
-
+
if (lastFPeriod.getLocked()) {
throw new LimaBusinessException(_("lima-business.fiscalperiod.previousfiscalperiodalreadyblocked"));
}
@@ -411,7 +404,7 @@
//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)) {
- //close accounts by removing amounts from all class 1 to 5 accounts
+ //close accounts by removing amounts from all class 1 to 5 accounts
Entry beginEntry = new EntryImpl();
beginEntry.setDescription(_("lima-business.financialtransaction.retainedearnings.description") + " (" + calendar.get(Calendar.YEAR) + ")");
beginEntry.setVoucher(_("lima-business.financialtransaction.retainedearnings.voucher"));
@@ -462,33 +455,33 @@
*/
public void deleteFiscalPeriod(FiscalPeriod fiscalPeriod)
throws LimaException {
-
+
AccountingRules accountingRules = LimaConfig.getInstance().getAccountingRules();
- try {
+ try {
try {
//get entities with DAO
- FiscalPeriodDAO fiscalPeriodDAO = getDaoHelper().getFiscalPeriodDAO();
-
- // re-attach entities to current session
- FiscalPeriod localFiscalPeriod = fiscalPeriodDAO.findByTopiaId(fiscalPeriod.getTopiaId());
-
+ FiscalPeriodDAO fiscalPeriodDAO = getDaoHelper().getFiscalPeriodDAO();
+
+ // re-attach entities to current session
+ FiscalPeriod localFiscalPeriod = fiscalPeriodDAO.findByTopiaId(fiscalPeriod.getTopiaId());
+
//check rules
- accountingRules.deleteFiscalPeriodRules(localFiscalPeriod);
-
+ accountingRules.deleteFiscalPeriodRules(localFiscalPeriod);
+
//all "ClosedPeriodicEntryBooks" for the fiscal period
ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO = getDaoHelper().getClosedPeriodicEntryBookDAO();
- List<ClosedPeriodicEntryBook> closedPeriodicEntryBookDAOList = closedPeriodicEntryBookDAO.findAllClosedPeriodicEntryBooksFromFiscalPeriod(localFiscalPeriod);
-
+ List<ClosedPeriodicEntryBook> closedPeriodicEntryBookDAOList = closedPeriodicEntryBookDAO.findAllClosedPeriodicEntryBooksFromFiscalPeriod(localFiscalPeriod);
+
//delete closedPeriodicEntryBook before fiscal period
for (ClosedPeriodicEntryBook closedPeriodicEntryBook : closedPeriodicEntryBookDAOList) {
// fix : ObjectDeletedException: deleted object would be re-saved by cascade (Need to delete association between entryBook and financial period via closedPeriodEntityBook)
closedPeriodicEntryBook.getEntryBook().removeFinancialPeriodClosedPeriodicEntryBook(closedPeriodicEntryBook);
- closedPeriodicEntryBookDAO.delete(closedPeriodicEntryBook);
- }
-
- fiscalPeriodDAO.delete(localFiscalPeriod);
-
+ closedPeriodicEntryBookDAO.delete(closedPeriodicEntryBook);
+ }
+
+ fiscalPeriodDAO.delete(localFiscalPeriod);
+
} catch (TopiaException ex) {
throw new LimaException("Can't find fiscal period", ex);
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java 2012-07-03 11:54:09 UTC (rev 3485)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java 2012-07-03 14:36:31 UTC (rev 3486)
@@ -1,7 +1,7 @@
/*
* #%L
* Lima business
- *
+ *
* $Id$
* $HeadURL$
* %%
@@ -9,15 +9,15 @@
* %%
* 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
+ * 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
+ *
+ * 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%
@@ -25,6 +25,9 @@
package org.chorem.lima.business.api;
+import java.util.Date;
+import java.util.List;
+
import org.chorem.lima.beans.FinancialTransactionSearch;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.Entry;
@@ -33,9 +36,6 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.FiscalPeriod;
-import java.util.Date;
-import java.util.List;
-
/**
* Transaction service.
*
@@ -55,7 +55,7 @@
void removeFinancialTransaction(FinancialTransaction financialtransaction) throws LimaException;
- List<FinancialTransaction> getAllFinancialTransactions(FinancialPeriod period) throws LimaException;
+ List<FinancialTransaction> getAllFinancialTransactions(FinancialPeriod period) throws LimaException;
List<FinancialTransaction> getAllFinancialTransactions(Date beginDate, Date endDate) throws LimaException;
@@ -66,7 +66,7 @@
List<FinancialTransaction> getAllFinancialTransactionsBalanced(FiscalPeriod fiscalPeriod) throws LimaException;
List<FinancialTransaction> getAllFinancialTransactions(FiscalPeriod period) throws LimaException;
-
+
List<Object> searchFinancialTransaction(FinancialTransactionSearch financialTransactionSearch) throws LimaException;
Entry createEntry(Entry entry) throws LimaException;
@@ -74,4 +74,6 @@
void updateEntry(Entry entry) throws LimaException;
void removeEntry(Entry entry) throws LimaException;
+
+ String getNewLetters() throws LimaException;
}
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java 2012-07-03 11:54:09 UTC (rev 3485)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java 2012-07-03 14:36:31 UTC (rev 3486)
@@ -1,7 +1,7 @@
/*
* #%L
* Lima business
- *
+ *
* $Id$
* $HeadURL$
* %%
@@ -9,15 +9,15 @@
* %%
* 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
+ * 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
+ *
+ * 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%
@@ -25,12 +25,12 @@
package org.chorem.lima.business.api;
+import java.util.List;
+
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FiscalPeriod;
-import java.util.List;
-
/**
* Fiscal period service.
*
@@ -53,12 +53,10 @@
FiscalPeriod createFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
FiscalPeriod blockFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
-
+
void deleteFiscalPeriod(FiscalPeriod fiscalPeriod) throws LimaException;
void addRetainedEarnings(FiscalPeriod fiscalPeriod,
boolean newyear,
EntryBook entryBook) throws LimaException;
-
- String findLastActualLetters()throws LimaException;
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-03 11:54:09 UTC (rev 3485)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/EntryDAOImpl.java 2012-07-03 14:36:31 UTC (rev 3486)
@@ -1,7 +1,7 @@
/*
* #%L
* Lima callao
- *
+ *
* $Id$
* $HeadURL$
* %%
@@ -9,15 +9,15 @@
* %%
* 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
+ * 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
+ *
+ * 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%
@@ -35,7 +35,7 @@
/**
* Requete generique qui recupere les entrees equilibrées portant entre
* deux dates.
- *
+ *
* @param account account
* @param beginDate begin date
* @param endDate end date
@@ -54,12 +54,12 @@
/**
* Query for find entries for accountsreports and balancereports
* Just exact and balanced transaction are calculated.
- *
+ *
* @param account account
* @param beginDate begin date
* @param endDate end date
* @return entries
- * @throws TopiaException
+ * @throws TopiaException
*/
public List<Entry> findAllEntryOfBalancedTransaction(Account account,
Date beginDate, Date endDate) throws TopiaException {
@@ -76,12 +76,12 @@
/**
* Retourne la somme des entrées des transaction equilibrées entre
* deux dates pour un compte donné.
- *
+ *
* @param account account
* @param beginDate bebin date
* @param endDate end date
* @return list boolean,int (une ligne pour le debit true, une ligne pour le credit)
- * @throws TopiaException
+ * @throws TopiaException
*/
public List<Object[]> getDebitCreditOfBalancedTransaction(Account account,
Date beginDate, Date endDate) throws TopiaException {
@@ -90,7 +90,7 @@
// concerne le compte
" AND E.account = :account" +
" GROUP BY E.debit";
-
+
List<Object[]> result = context.findAll(query, "beginDate", beginDate,
"endDate", endDate, "account", account);
return result;
@@ -99,11 +99,11 @@
/**
* Retourne les entrees des transaction equlibrées entre deux dates pour
* un journal.
- *
+ *
* @param entryBook entry book
* @param beginDate begin date
* @param endDate end date
- * @throws TopiaException
+ * @throws TopiaException
*/
public List<Entry> findAllEntryOfBalancedTransaction(EntryBook entryBook, Date beginDate,
Date endDate) throws TopiaException {
@@ -117,16 +117,24 @@
"endDate", endDate, "entryBook", entryBook);
return entries;
}
-
+
+ public List<String> findLetters() throws TopiaException{
+ String query = "Select E.LETTERING FROM " + Entry.class.getName() + " E" +
+ " order by E.LETTERING desc";
+
+ List<String> letters = context.findAll(query);
+ return letters;
+ }
+
/**
* Retourne la somme des entrées des transaction equilibrées entre
* deux dates pour un journal donné.
- *
+ *
* @param entryBook entry book
* @param beginDate bebin date
* @param endDate end date
* @return list boolean,int (une ligne pour le debit true, une ligne pour le credit)
- * @throws TopiaException
+ * @throws TopiaException
*/
public List<Object[]> getDebitCreditOfBalancedTransaction(EntryBook entryBook,
Date beginDate, Date endDate) throws TopiaException {
@@ -135,20 +143,20 @@
// concerne le journal
" AND E.financialTransaction.entryBook = :entryBook" +
" GROUP BY E.debit";
-
+
List<Object[]> result = context.findAll(query, "beginDate", beginDate,
"endDate", endDate, "entryBook", entryBook);
return result;
}
-
+
/**
* Retourne les entrees des transaction entre deux dates pour
* un journal.
- *
+ *
* @param entryBook entry book
* @param beginDate begin date
* @param endDate end date
- * @throws TopiaException
+ * @throws TopiaException
*/
public List<Entry> findAllEntryOfTransaction(EntryBook entryBook, Date beginDate,
Date endDate) throws TopiaException {
@@ -163,16 +171,16 @@
"endDate", endDate, "entryBook", entryBook);
return entries;
}
-
+
/**
* Retourne la somme des entrées des transaction entre
* deux dates pour un journal donné.
- *
+ *
* @param entryBook entry book
* @param beginDate bebin date
* @param endDate end date
* @return list boolean,int (une ligne pour le debit true, une ligne pour le credit)
- * @throws TopiaException
+ * @throws TopiaException
*/
public List<Object[]> getDebitCreditOfTransaction(EntryBook entryBook,
Date beginDate, Date endDate) throws TopiaException {
@@ -184,7 +192,7 @@
// concerne le journal
" AND E.financialTransaction.entryBook = :entryBook" +
" GROUP BY E.debit";
-
+
List<Object[]> result = context.findAll(query, "beginDate", beginDate,
"endDate", endDate, "entryBook", entryBook);
return result;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-07-03 11:54:09 UTC (rev 3485)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-07-03 14:36:31 UTC (rev 3486)
@@ -1,7 +1,7 @@
/*
* #%L
* Lima Swing
- *
+ *
* $Id$
* $HeadURL$
* %%
@@ -9,15 +9,15 @@
* %%
* 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
+ * 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
+ *
+ * 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%
@@ -28,8 +28,6 @@
import static org.nuiton.i18n.I18n._;
import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -40,12 +38,8 @@
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.api.FinancialTransactionService;
import org.chorem.lima.business.api.ImportService;
-import org.chorem.lima.business.utils.EntryComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.Entry;
-import org.chorem.lima.entity.EntryBook;
-import org.chorem.lima.entity.FinancialTransaction;
-import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
/**
@@ -77,7 +71,7 @@
/** EndDate. */
protected Date selectedEndDate;
-
+
protected List<Entry> entries;
protected List<Date> datesEntree;
protected List<String> entryBooks;
@@ -93,33 +87,31 @@
*/
public LetteringTableModel() {
/* Services */
- financialTransactionService =
- LimaServiceFactory.getService(
- FinancialTransactionService.class);
+ financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
LimaServiceFactory.addServiceListener(FinancialTransactionService.class,this);
LimaServiceFactory.addServiceListener(ImportService.class, this);
}
-
+
public List<Entry> getEntries(){
return entries;
}
-
+
public void updateEntries(List<Entry> entries,List<Date> datesEntree, List<String> entryBooks) {
-
+
this.entries = entries;
setDate(datesEntree);
setJournal(entryBooks);
- fireTableDataChanged();
+ fireTableDataChanged();
}
-
+
protected void setDate(List<Date> datesEntree){
this.datesEntree=datesEntree;
}
-
+
protected void setJournal(List<String> entryBooks){
this.entryBooks = entryBooks;
}
-
+
public void setSelectedBeginDate(Date date) {
selectedBeginDate = date;
}
@@ -144,7 +136,7 @@
Entry result = entries.get(row);
return result;
}
-
+
@Override
public Class<?> getColumnClass(int column) {
@@ -207,9 +199,9 @@
}
@Override
- public int getRowCount() {
+ public int getRowCount() {
if (entries != null){
- return entries.size();
+ return entries.size();
}
return 0;
}
@@ -252,7 +244,7 @@
*/
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
-
+
return false;
}
@@ -260,24 +252,32 @@
public Object getElementAt(int row) {
return entries.get(row);
}
-
- //add one entry
+
+ /**add one entry*/
public void addEntry(Entry entry) {
entries.add(entry);
int row = entries.indexOf(entry);
fireTableRowsInserted(row, row);
}
- //add a list of Entry
+ /**add a list of Entry*/
public void addEntries(List<Entry> entries) {
for (Entry entry : entries){
addEntry(entry);
- }
+ }
}
-
+
+ /**update selected entries*/
+ public void updateLettersSelectedEntries(int[] entries, String letters) {
+ for (int rowEntry : entries){
+ getEntryAt(rowEntry).setLettering(letters);
+ }
+ fireTableDataChanged();
+ }
+
/** to modifiy letter entry */
- @Override
- public void setValueAt(Object value, int row, int column) {
+ /* @Override
+ public void setValueAt(Object value, int row, int column) {*/
//TODO
/*int financialTransactionRow = 0;
if (cacheDataList != null) {
@@ -300,7 +300,7 @@
//on recharge la liste
fireTableRowsUpdated(financialTransactionRow, getRowCount() - 1);
}*/
- }
+ //}
@Override
public void notifyMethod(String serviceName, String methodeName) {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-03 11:54:09 UTC (rev 3485)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-03 14:36:31 UTC (rev 3486)
@@ -64,12 +64,12 @@
<JPanel id="panelAccountComboBox">
<org.chorem.lima.ui.common.AccountComboBoxModel id="accountComboBoxModel"/>
<JComboBox id="accountComboBox" model="{accountComboBoxModel}"
- renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}"
- onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}"
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
<JButton id="backCount" text="lima.ui.account.buttonback"
- onActionPerformed="handler.back(accountComboBox)"/>
+ onActionPerformed="handler.back(accountComboBox)"/>
<JButton id="nextCount" text="lima.ui.account.buttonnext"
- onActionPerformed="handler.next(accountComboBox)"/>
+ onActionPerformed="handler.next(accountComboBox)"/>
</JPanel>
</cell>
<cell anchor="center" weightx="1">
@@ -81,7 +81,7 @@
</cell>
<cell>
<JXDatePicker id="pickerDebut"
- onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
</cell>
</row>
<row>
@@ -90,7 +90,7 @@
</cell>
<cell>
<JXDatePicker id="pickerFin"
- onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
</cell>
</row>
</Table>
@@ -102,7 +102,7 @@
<row>
<cell>
<JRadioButton id="lettredEntryCheckBox" buttonGroup="letteredCheckGroup"
- onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
</cell>
<cell>
<JLabel text="lima.ui.lettering.checkLettredEntry"/>
@@ -111,7 +111,7 @@
<row>
<cell>
<JRadioButton id="noLettredEntryCheckBox" selected="true" buttonGroup="letteredCheckGroup"
- onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
</cell>
<cell>
<JLabel text="lima.ui.lettering.checkNoLettredEntry"/>
@@ -120,7 +120,7 @@
<row>
<cell>
<JRadioButton id="allCheckBox" buttonGroup="letteredCheckGroup"
- onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
</cell>
<cell>
<JLabel text="lima.ui.lettering.checkAll"/>
@@ -150,11 +150,11 @@
</cell>
<cell fill="horizontal" weightx="0.25">
<JTextField id="debitTexttField" editable="false" text="{getModelUi().getDebit()}"
- focusable="false"/>
+ focusable="false"/>
</cell>
<cell fill="horizontal" weightx="0.25">
<JTextField id="creditTextField" editable="false" text="{getModelUi().getCredit()}"
- focusable="false"/>
+ focusable="false"/>
</cell>
<cell fill="horizontal" weightx="0.25">
<JTextField id="soldeTextField" editable="false" text="{getModelUi().getSolde()}"
@@ -171,10 +171,10 @@
<JPanel id="actionsPanel">
<JButton id="lettered" text="lima.ui.lettering.buttonLettered"
enabled="{getModelUi().isLettrer()}"
- onActionPerformed="handler.lettrer()"/>
+ onActionPerformed="handler.addLetter()"/>
<JButton id="noLettered" text="lima.ui.lettering.buttonNoLettered"
enabled="{getModelUi().isDelettrer()}"
- onActionPerformed="handler.delettrer()"/>
+ onActionPerformed="handler.removeLetter()"/>
</JPanel>
</cell>
</row>
@@ -183,7 +183,8 @@
<JScrollPane>
<LetteringTable
id="table" sortable="false" rowHeight="22"
- constructorParams="getTableModel()"
+ constructorParams="getTableModel()"
+ selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION}"
selectionModel="{modelUi}"
/>
</JScrollPane>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-03 11:54:09 UTC (rev 3485)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-03 14:36:31 UTC (rev 3486)
@@ -1,7 +1,7 @@
/*
* #%L
* Lima Swing
- *
+ *
* $Id$
* $HeadURL$
* %%
@@ -9,15 +9,15 @@
* %%
* 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
+ * 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
+ *
+ * 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%
@@ -88,21 +88,21 @@
public LetteringViewHandler(LetteringView view) {
this.view = view;
-
+
financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class);
fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
accountService = LimaServiceFactory.getService(AccountService.class);
financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
entryBookService = LimaServiceFactory.getService(EntryBookService.class);
- }
-
+ }
+
/**
* Init all combo box in view.
*/
- public void init() {
+ public void init() {
loadComboAndRows();
LetteringModelUI modelUi = view.getModelUi();
- modelUi.addPropertyChangeListener(LetteringModelUI.SELECTED_ENTRY_PROPERTY, new PropertyChangeListener() {
+ modelUi.addPropertyChangeListener(LetteringModelUI.SELECTED_ENTRY_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
LetteringModelUI modelUiPropChange = (LetteringModelUI)evt.getSource();
@@ -110,59 +110,59 @@
loadCurrentSelection(modelUiPropChange, selectedEntry);
}
});
-
+
}
-
+
public void loadComboAndRows(){
log.debug("loadComboAndRows");
-
+
List<Account> allAccounts = accountService.getAllAccounts();
- view.getAccountComboBoxModel().setObjects(allAccounts);
-
+ view.getAccountComboBoxModel().setObjects(allAccounts);
+
log.debug("loadComboAndRows");
-
+
if (!allAccounts.isEmpty()) {
-
+
view.getAccountComboBox().setSelectedItem(allAccounts.get(0));
- }
-
+ }
+
if (log.isDebugEnabled()) {
log.debug("1er item comptes : " + allAccounts.get(0));
}
-
- //By default, we have the beginning of the fiscal period (Or of current
+
+ //By default, we have the beginning of the fiscal period (Or of current
//date if no fiscal period) and the end of the current date
FiscalPeriod fiscalPeriod = fiscalPeriodService.getLastFiscalPeriod();
Date defaultDateBegFiscalPeriod;
-
+
Calendar calendar = Calendar.getInstance();
int dernierJourMoisCourant = calendar.getActualMaximum(Calendar.DATE);
int premierJourMoisCourant = calendar.getActualMinimum(Calendar.DATE);
-
+
if (fiscalPeriod != null){
defaultDateBegFiscalPeriod = fiscalPeriodService.getLastFiscalPeriod().getBeginDate();
}else{
- defaultDateBegFiscalPeriod = DateUtils.setDays(new Date(), premierJourMoisCourant);
- }
-
- Date defaultDateEndCurrent = DateUtils.setDays(new Date(), dernierJourMoisCourant);
-
+ defaultDateBegFiscalPeriod = DateUtils.setDays(new Date(), premierJourMoisCourant);
+ }
+
+ Date defaultDateEndCurrent = DateUtils.setDays(new Date(), dernierJourMoisCourant);
+
if (log.isDebugEnabled()) {
log.debug("Date de debut : " + defaultDateBegFiscalPeriod);
log.debug("Date de fin : " + defaultDateEndCurrent);
}
-
+
view.getPickerDebut().setDate(defaultDateBegFiscalPeriod);
view.getPickerFin().setDate(defaultDateEndCurrent);
-
+
log.debug("Val select letter : " + view.getLetteredCheckGroup().getSelectedButton().getName());
-
+
//Load entry with the default dates, default account 4 and with no letter
updateAllEntries(defaultDateBegFiscalPeriod, defaultDateEndCurrent, view.getAccountComboBoxModel().getSelectedItem(), view.getLetteredCheckGroup().getSelectedButton().getName());
}
-
+
protected List<Entry> findAllEntries(Date selectedBeginDate, Date selectedEndDate, Object compte, String filtreLettre){
-
+
List<Entry> entries = new ArrayList<Entry>();
List<Entry> entriesAccount = new ArrayList<Entry>();
if (selectedBeginDate != null && selectedEndDate != null) {
@@ -176,7 +176,7 @@
log.debug("entry.getLettering() : " + entry.getLettering());
log.debug("name radioButton : " + filtreLettre);
//0 for lettered, 1 for no-lettered and 2 for all entries
- if (compte.equals(entry.getAccount()) && ( (filtreLettre.equals("noLettredEntryCheckBox") & entry.getLettering() == null))
+ if (compte.equals(entry.getAccount()) && ( (filtreLettre.equals("noLettredEntryCheckBox") & entry.getLettering() == null))
|| (filtreLettre.equals("lettredEntryCheckBox") & entry.getLettering() != null) || filtreLettre.equals("allCheckBox")){
entriesAccount.add(entry);
}
@@ -187,41 +187,41 @@
}
return entries;
}
-
+
public void updateAllEntries(Date selectedBeginDate, Date selectedEndDate, Object compte, String filtreLettre) {
-
+
if (selectedBeginDate != null && selectedEndDate != null){
log.debug("updateAllEntries");
List<Entry> entries = findAllEntries(selectedBeginDate, selectedEndDate, compte, filtreLettre);
List<String> journalEntrees = new ArrayList<String>();
List<Date> datesEntree = new ArrayList<Date>();
-
+
for (Entry entry : entries){
datesEntree.add(entry.getFinancialTransaction().getTransactionDate());
journalEntrees.add(entry.getFinancialTransaction().getEntryBook().getLabel());
}
-
+
view.getTableModel().updateEntries(entries, datesEntree, journalEntrees);
}
}
-
+
public void loadCurrentSelection(LetteringModelUI modelUi, Entry selectedEntry){
financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
-
+
boolean enableLettring = false;
- boolean enableDelettring = false;
-
- if (selectedEntry != null){
+ boolean enableDelettring = false;
+
+ if (selectedEntry != null){
modelUi.setDebit(selectedEntry.getDebit() ? selectedEntry.getAmount() : BigDecimal.ZERO);
modelUi.setCredit(selectedEntry.getDebit() ? BigDecimal.ZERO : selectedEntry.getAmount());
-
+
if (modelUi.getDebit().equals("0")){
modelUi.setSolde(modelUi.getCredit());
}else{
modelUi.setSolde(modelUi.getDebit());
}
- modelUi.setSolde(modelUi.getSolde());
- if (selectedEntry.getLettering() != null && ! selectedEntry.getLettering().isEmpty()){
+ modelUi.setSolde(modelUi.getSolde());
+ if (selectedEntry.getLettering() != null && ! selectedEntry.getLettering().isEmpty()){
enableDelettring = true;
}else{
enableLettring = true;
@@ -230,28 +230,10 @@
modelUi.setLettrer(enableLettring);
modelUi.setDelettrer(enableDelettring);
}
-
- /**Add a group of three letters to n entries*/
- public void lettrer(){
-
-
- int[] entrieSelected = view.getTable().getSelectedRows();
- for (int rowEntry : entrieSelected){
- view.getTableModel().getEntryAt(rowEntry);
-
- }
-
- //String lastActualLetters = fiscalPeriodService.findLastActualLetters();
- }
-
- /**Remove a group of three letters to n entries*/
- public void delettrer(List<Entry> entries){
-
- }
-
+
/**
* Select previous value in combo box.
- *
+ *
* @param comboBox combo box
*/
public void back(JComboBox comboBox) {
@@ -264,7 +246,7 @@
/**
* Select next value in combo box.
- *
+ *
* @param comboBox combo box
*/
public void next(JComboBox comboBox) {
@@ -275,7 +257,7 @@
comboBox.setSelectedIndex(row + 1);
}
}
-
+
public void setBeginDate(Date date) {
view.getTableModel().setSelectedBeginDate(date);
}
@@ -284,49 +266,14 @@
view.getTableModel().setSelectedEndDate(date);
}
+ /**Add a group of three letters to n entries*/
public void addLetter() {
- /*Boolean valid = true;
-
- table = view.getTable();
- tableModel = view.getTableModel();
-
- AddLetterForm addLetterForm = new AddLetterForm();
- JTextField newLetterTextField = addLetterForm.getNewLetterTextField();
-
- try {
- letter = financialTransactionService.getNewLetter();
- newLetterTextField.setText(letter.getCode());
- } catch (LimaException eee) {
- log.error("Can't get new letter", eee);
- }
-
- addLetterForm.setLocationRelativeTo(view);
- addLetterForm.setVisible(true);
-
- //false = cancel Action
- if (addLetterForm.validOk) {
- Object object = addLetterForm.getRadioButtons().getSelectedValue();
- if (!(Boolean) object) {
- JComboBox comboBox = addLetterForm.getLetterListComboBox();
- Object selectedObject = comboBox.getSelectedItem();
- if (selectedObject instanceof Letter) {
- letter = (Letter) selectedObject;
- } else {
- DialogHelper.showMessageDialog(_("lima.entries.lettering.noletterselected"));
- valid = false;
- }
- }
- if (valid) {
- //addLetters
- int[] rows = table.getSelectedRows();
- for (int i : rows) {
- tableModel.setLetter(i, letter);
- }
- tableModel.refresh();
- }
- }*/
+ String newLetters = financialTransactionService.getNewLetters();
+ int[] entrieSelected = view.getTable().getSelectedRows();
+ view.getTableModel().updateLettersSelectedEntries(entrieSelected, newLetters);
}
+ /**Remove a group of three letters to n entries*/
public void removeLetter() {
//TODO
//removeLetters
@@ -336,7 +283,7 @@
}
view.getTableModel().updateRows();*/
}
-
+
@Override
public void notifyMethod(String serviceName, String methodeName) {
}
1
0
Author: mallon
Date: 2012-07-03 13:54:09 +0200 (Tue, 03 Jul 2012)
New Revision: 3485
Url: http://chorem.org/repositories/revision/lima/3485
Log:
- Interface, via jaxx, r?\195?\169alis?\195?\169e;
- Chargement du tableau des ?\195?\169critures, ?\195?\160 l'ouverture, selon les deux dates par d?\195?\169faut, le compte et le filtre sur le lettrage;
- Mod?\195?\168le d'UI cr?\195?\169?\195?\169 : gestion de l'affichage des composants en cours;
- Chargement de la date et du journal, auparavant absents, de chaque ?\195?\169criture dans le tableau;
- Affichage selon le compte et les dates s?\195?\169lectionn?\195?\169es;
- Affichage par d?\195?\169faut des ?\195?\169critures non-lettr?\195?\169es et du compte 4;
Added:
trunk/lima-callao/src/main/java/org/chorem/lima/beans/
trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodOpenClose.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java
Removed:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
Modified:
trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.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/FinancialTransactionServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountComboBoxModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
trunk/lima-swing/src/main/resources/log4j.properties
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -42,6 +42,8 @@
import org.chorem.lima.business.utils.AccountComparator;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountDAO;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.entity.FiscalPeriodDAO;
import org.nuiton.topia.TopiaException;
/**
@@ -154,11 +156,11 @@
AccountDAO accountDAO = getDaoHelper().getAccountDAO();
accountsList = accountDAO.findAll();
Collections.sort(accountsList, new AccountComparator());
-
+
} catch (Exception ex) {
throw new LimaException("Can't get all accounts", ex);
}
-
+
return accountsList;
}
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-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -42,6 +42,7 @@
import org.chorem.lima.business.api.EntryBookService;
import org.chorem.lima.business.api.FinancialPeriodService;
import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.FiscalPeriodService;
import org.chorem.lima.business.api.OptionsService;
import org.chorem.lima.business.api.ReportService;
import org.chorem.lima.entity.Account;
@@ -71,7 +72,7 @@
@EJB
protected FinancialPeriodService financialPeriodService;
-
+
@EJB
protected ReportService reportService;
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-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -157,8 +157,7 @@
return result;
}
-
-
+
/**
* return all blocked fiscal periods.
*/
@@ -195,6 +194,12 @@
return result;
}
+ public String findLastActualLetters() throws LimaException {
+ List<FiscalPeriod> fiscalPeriods = getAllUnblockedFiscalPeriods();
+
+ return null;
+ }
+
@Override
public FiscalPeriod getLastFiscalPeriod() throws LimaException {
FiscalPeriod result = null;
Modified: trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java
===================================================================
--- trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -59,4 +59,6 @@
void addRetainedEarnings(FiscalPeriod fiscalPeriod,
boolean newyear,
EntryBook entryBook) throws LimaException;
+
+ String findLastActualLetters()throws LimaException;
}
Added: trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodOpenClose.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodOpenClose.java (rev 0)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/beans/FiscalPeriodOpenClose.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -0,0 +1,26 @@
+package org.chorem.lima.beans;
+
+import org.apache.commons.lang3.tuple.Pair;
+
+public class FiscalPeriodOpenClose extends Pair<Object, Object>{
+
+ @Override
+ public Object setValue(Object value) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getLeft() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Object getRight() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountComboBoxModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountComboBoxModel.java 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/common/AccountComboBoxModel.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -37,4 +37,21 @@
/** serialVersionUID. */
private static final long serialVersionUID = 6991293987668268456L;
+
+ /*By default, selection of the account 4*/
+ @Override
+ public Object getElementAt(int index) {
+ if (getSelectedItem() == null){
+ int indexAccountFour = 0;
+ for (Account compte : objects){
+ if (compte.getAccountNumber().equals("4")){
+ indexAccountFour = objects.indexOf(compte);
+ break;
+ }
+ }
+ setSelectedItem(objects.get(indexAccountFour));
+ return objects.get(indexAccountFour);
+ }
+ return objects.get(index);
+ }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionView.jaxx 2012-07-03 11:54:09 UTC (rev 3485)
@@ -26,6 +26,7 @@
<import>
javax.swing.ListSelectionModel
+ javax.swing.DefaultListSelectionModel
org.chorem.lima.entity.FiscalPeriod
org.chorem.lima.entity.FinancialPeriod
org.chorem.lima.entity.EntryBook
@@ -33,6 +34,13 @@
</import>
<FinancialTransactionViewHandler id="handler" constructorParams="this"/>
+
+ <ListSelectionModel
+ id='selectionModel'
+ initializer="new DefaultListSelectionModel()"
+ selectionMode='{ListSelectionModel.SINGLE_SELECTION}'
+ onValueChanged="setSelectedRow(financialTransactionTable.getSelectedRow() != -1)"/>
+
<Boolean id="selectedRow" javaBean="false"/>
<script>
@@ -105,11 +113,8 @@
<FinancialTransactionTable
id="financialTransactionTable" sortable="false" rowHeight="22"
constructorParams='handler'
- model='{financialTransactionTableModel}'
- selectionMode='{ListSelectionModel.SINGLE_SELECTION}'/>
- <ListSelectionModel
- initializer="financialTransactionTable.getSelectionModel()"
- onValueChanged="setSelectedRow(financialTransactionTable.getSelectedRow() != -1)"/>
+ selectionModel='{selectionModel}'
+ model='{financialTransactionTableModel}'/>
</JScrollPane>
</cell>
</row>
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringModelUI.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -0,0 +1,172 @@
+package org.chorem.lima.ui.lettering;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import java.math.BigDecimal;
+
+import javax.swing.DefaultListSelectionModel;
+
+import org.chorem.lima.entity.Entry;
+import org.eclipse.jetty.util.log.Log;
+
+public class LetteringModelUI extends DefaultListSelectionModel{
+
+ public static final String SELECTED_ENTRY_PROPERTY = "selectedEntry";
+
+ public static final String DEBIT_PROPERTY = "debit";
+
+ public static final String CREDIT_PROPERTY = "credit";
+
+ public static final String SOLDE_PROPERTY = "solde";
+
+ public static final String LETTRER_PROPERTY = "lettrer";
+
+ public static final String DELETTRER_PROPERTY = "delettrer";
+
+ public static final String TEXTENABLE_PROPERTY = "textEnable";
+
+ private static final long serialVersionUID = 1L;
+
+ protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+
+ protected LetteringTableModel model;
+
+ protected Entry selectedEntry;
+ protected BigDecimal debit;
+ protected BigDecimal credit;
+ protected String solde;
+ protected boolean lettrer;
+ protected boolean delettrer;
+ protected BigDecimal debitTotal;
+ protected BigDecimal creditTotal;
+
+ public BigDecimal getDebitTotal() {
+ return debitTotal;
+ }
+
+ public void setDebitTotal(BigDecimal debitTotal) {
+ this.debitTotal = debitTotal;
+ }
+
+ public BigDecimal getCreditTotal() {
+ return creditTotal;
+ }
+
+ public void setCreditTotal(BigDecimal creditTotal) {
+ this.creditTotal = creditTotal;
+ }
+
+ public String getSoldeTotal() {
+ return soldeTotal;
+ }
+
+ public void setSoldeTotal(String soldeTotal) {
+ this.soldeTotal = soldeTotal;
+ }
+
+ protected String soldeTotal;
+
+ public Entry getSelectedEntry() {
+ return selectedEntry;
+ }
+
+ public void setSelectedEntry(Entry selectedEntry) {
+ Entry oldSelectedEntry = getSelectedEntry();
+ this.selectedEntry = selectedEntry;
+ firePropertyChange(SELECTED_ENTRY_PROPERTY, oldSelectedEntry, selectedEntry);
+ }
+
+ public boolean isLettrer() {
+ return lettrer;
+ }
+
+ public void setLettrer(boolean lettrer) {
+ boolean oldLettrer = isLettrer();
+ this.lettrer = lettrer;
+ firePropertyChange(LETTRER_PROPERTY, oldLettrer, lettrer);
+ }
+
+ public boolean isDelettrer() {
+ return delettrer;
+ }
+
+ public void setDelettrer(boolean delettrer) {
+ boolean oldLettrer = isLettrer();
+ this.delettrer = delettrer;
+ firePropertyChange(LETTRER_PROPERTY, oldLettrer, delettrer);
+ }
+
+ public LetteringModelUI(LetteringTableModel model) {
+ this.model = model;
+ }
+
+ public String getDebit() {
+ if (debit == null){
+ return "0";
+ }
+ return String.valueOf(debit);
+ }
+
+ public void setDebit(BigDecimal debit) {
+ BigDecimal oldDebit = BigDecimal.valueOf(Double.valueOf(getDebit()));
+ this.debit = debit;
+ firePropertyChange(DEBIT_PROPERTY, oldDebit, debit);
+ }
+
+ public String getCredit() {
+ if (credit == null){
+ return "0";
+ }
+ return String.valueOf(credit);
+ }
+
+ public void setCredit(BigDecimal credit) {
+ BigDecimal oldCredit = BigDecimal.valueOf(Double.valueOf(getCredit()));
+ this.credit = credit;
+ firePropertyChange(CREDIT_PROPERTY, oldCredit, credit);
+ }
+
+ public String getSolde() {
+ if (solde == null){
+ return "0";
+ }
+ return solde;
+ }
+
+ public void setSolde(String solde) {
+ String oldSolde = getSolde();
+ this.solde = solde;
+ firePropertyChange(SOLDE_PROPERTY, oldSolde, solde);
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(listener);
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ pcs.addPropertyChangeListener(propertyName, listener);
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(listener);
+ }
+
+ public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ pcs.removePropertyChangeListener(propertyName, listener);
+ }
+
+ protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
+ pcs.firePropertyChange(propertyName, oldValue, newValue);
+ }
+
+ @Override
+ public void setSelectionInterval(int row, int column) {
+ super.setSelectionInterval(row, column);
+ setSelectedEntry(model.getEntryAt(row));
+ }
+
+ @Override
+ public int getSelectionMode() {
+ return SINGLE_SELECTION;
+ }
+}
Deleted: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringPeriodSearchPanel.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -1,160 +0,0 @@
-/*
- * #%L
- * Lima :: Swing
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2008 - 2011 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 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%
- */
-package org.chorem.lima.ui.lettering;
-
-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;
-import org.chorem.lima.ui.LimaRendererUtil;
-import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
-import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-import org.jdesktop.swingx.JXDatePicker;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.ListCellRenderer;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Calendar;
-import java.util.Date;
-
-import static org.nuiton.i18n.I18n._;
-
-public class LetteringPeriodSearchPanel extends JPanel {
-
- private static final Log log =
- LogFactory.getLog(LetteringPeriodSearchPanel.class);
-
- protected LetteringViewHandler handler;
-
- public LetteringPeriodSearchPanel(LetteringViewHandler handler) {
- this.handler = handler;
-
- //init date
- refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
- }
-
- public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum) {
-
- switch (comboBoxPeriodEnum) {
- case PERIOD:
- // get begin date
- Calendar calendarBegin = Calendar.getInstance();
- // set begindate to JAN 1 - 0:00.000 of this years
- Date beginDate = calendarBegin.getTime();
- beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
- //handler().setBeginDate(beginDate);
-
- // get end date
- Calendar calendarEnd = Calendar.getInstance();
- Date endDate = calendarEnd.getTime();
- //handler().setEndDate(endDate);
- JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
- final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
- ActionListener beginDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setBeginDate(beginDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setBeginDate(beginDatePicker.getDate());
- beginDatePicker.addActionListener(beginDateActionListener);
-
- JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
- final JXDatePicker endDatePicker = new JXDatePicker(endDate);
- ActionListener endDateActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- handler.setEndDate(endDatePicker.getDate());
- handler.refresh();
- }
- };
- handler.setEndDate(endDatePicker.getDate());
- endDatePicker.addActionListener(endDateActionListener);
- handler.refresh();
-
- removeAll();
- add(beginDateLabel);
- add(beginDatePicker);
- add(endDateLabel);
- add(endDatePicker);
- break;
-
- case FISCAL_PERIOD:
- FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
- ListCellRenderer renderer =
- LimaRendererUtil.newDecoratorListCellRenderer(FiscalPeriod.class);
- final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
- fiscalPeriod.setRenderer(renderer);
- fiscalPeriod.setEditable(false);
- ActionListener fiscalPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
- if (fPeriod != null) {
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
- }
- }
- };
- fiscalPeriod.addActionListener(fiscalPeriodActionListener);
-
- removeAll();
- add(fiscalPeriod);
- break;
-
- case FINANCIAL_PERIOD:
- FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
- renderer =
- LimaRendererUtil.newDecoratorListCellRenderer(FinancialPeriod.class);
- final JComboBox financialPeriod = new JComboBox(financialModel);
- financialPeriod.setRenderer(renderer);
- financialPeriod.setEditable(false);
- ActionListener financialPeriodActionListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
- if (fPeriod != null) {
- handler.setBeginDate(fPeriod.getBeginDate());
- handler.setEndDate(fPeriod.getEndDate());
- handler.refresh();
- }
- }
- };
- financialPeriod.addActionListener(financialPeriodActionListener);
- removeAll();
- add(financialPeriod);
- break;
- }
-
- }
-
-}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTable.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -25,6 +25,13 @@
package org.chorem.lima.ui.lettering;
+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 java.util.Date;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.entity.Account;
@@ -35,21 +42,8 @@
import org.chorem.lima.ui.celleditor.DateTableCellEditor;
import org.chorem.lima.ui.celleditor.EntryBookTableCellEditor;
import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.ColorHighlighter;
-import org.jdesktop.swingx.decorator.ComponentAdapter;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.decorator.Highlighter;
-import java.awt.Color;
-import java.awt.Component;
-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 java.util.Date;
-
/**
* Table des transaction qui ajoute des comportement (keys).
*
@@ -62,19 +56,20 @@
private static final long serialVersionUID = 3133690382049594727L;
/** log. */
- private static final Log log = LogFactory
- .getLog(LetteringTable.class);
+ private static final Log log = LogFactory.getLog(LetteringTable.class);
protected LetteringViewHandler handler;
- private Highlighter colorTransaction;
+ /*private Highlighter colorTransaction;
- private ColorHighlighter colorBalance;
+ private ColorHighlighter colorBalance;*/
- public LetteringTable(LetteringViewHandler handler) {
+ protected LetteringTableModel letteringTableModel;
+
+ public LetteringTable(LetteringTableModel letteringTableModel) {
+ super(letteringTableModel);
+ this.letteringTableModel = letteringTableModel;
- this.handler = handler;
-
addKeyListener(this);
addMouseListener(this);
@@ -91,11 +86,9 @@
setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
//highlight financial financial transactions
- addColorTransaction();
+ /*addColorTransaction();
// highlight unbalanced financial transactions
- addColorNonBalancedTransaction();
-
-
+ addColorNonBalancedTransaction();*/
}
/**
@@ -103,7 +96,7 @@
* afin de bien distinguer les transactions et entrées comptables.
* On récupère la première cellule, on vérifie que c'est une date
*/
- protected void addColorTransaction() {
+ /*protected void addColorTransaction() {
if (colorTransaction != null) {
removeHighlighter(colorTransaction);
}
@@ -117,7 +110,7 @@
colorTransaction =
new ColorHighlighter(predicate, new Color(222, 222, 222), null);
addHighlighter(colorTransaction);
- }
+ }*/
/**
@@ -126,7 +119,7 @@
* On récupère la dernière cellule de la ligne
* et on vérifie si la valeur est différente de 0
*/
- protected void addColorNonBalancedTransaction() {
+ /* protected void addColorNonBalancedTransaction() {
if (colorBalance != null) {
removeHighlighter(colorBalance);
}
@@ -150,7 +143,7 @@
colorTransaction =
new ColorHighlighter(predicate, new Color(255, 198, 209), null);
addHighlighter(colorTransaction);
- }
+ }*/
/**
* for each action combination key are think
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringTableModel.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -45,6 +45,7 @@
import org.chorem.lima.entity.Entry;
import org.chorem.lima.entity.EntryBook;
import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
/**
@@ -66,8 +67,7 @@
private static final long serialVersionUID = 1L;
/** log. */
- private static final Log log = LogFactory
- .getLog(LetteringTableModel.class);
+ private static final Log log = LogFactory.getLog(LetteringTableModel.class);
/** Transaction service. */
protected final FinancialTransactionService financialTransactionService;
@@ -77,10 +77,11 @@
/** EndDate. */
protected Date selectedEndDate;
+
+ protected List<Entry> entries;
+ protected List<Date> datesEntree;
+ protected List<String> entryBooks;
- /** data cache */
- protected List<Object> cacheDataList;
-
/**
* collection
* <p/>
@@ -98,7 +99,27 @@
LimaServiceFactory.addServiceListener(FinancialTransactionService.class,this);
LimaServiceFactory.addServiceListener(ImportService.class, this);
}
-
+
+ public List<Entry> getEntries(){
+ return entries;
+ }
+
+ public void updateEntries(List<Entry> entries,List<Date> datesEntree, List<String> entryBooks) {
+
+ this.entries = entries;
+ setDate(datesEntree);
+ setJournal(entryBooks);
+ fireTableDataChanged();
+ }
+
+ protected void setDate(List<Date> datesEntree){
+ this.datesEntree=datesEntree;
+ }
+
+ protected void setJournal(List<String> entryBooks){
+ this.entryBooks = entryBooks;
+ }
+
public void setSelectedBeginDate(Date date) {
selectedBeginDate = date;
}
@@ -107,85 +128,33 @@
selectedEndDate = date;
}
- /**
- * Le model est une combinaison de Transaction/Entries.
- *
- * @return
- */
- protected List<Object> getDataList() {
- List<Object> results = new ArrayList<Object>();
- if (selectedBeginDate != null && selectedEndDate != null) {
- List<FinancialTransaction> financialtransactions =
- financialTransactionService.getAllFinancialTransactions(
- selectedBeginDate, selectedEndDate);
- for (FinancialTransaction financialtransaction : financialtransactions) {
- results.add(financialtransaction);
- List<Entry> entries = (List<Entry>) financialtransaction.getEntry();
- Collections.sort(entries, new EntryComparator());
- results.addAll(entries);
- }
- }
- return results;
- }
-
- /*public void setLetter(int row, Letter letter) {
- Object currentRow = cacheDataList.get(row);
- if (currentRow instanceof Entry) {
- Entry entry = (Entry) currentRow;
- entry.setLetter(letter);
- try {
- financialTransactionService.updateEntry(entry);
- } catch (LimaException eee) {
- if (log.isDebugEnabled()) {
- log.debug("Can't set letter", eee);
- }
- JFrame f = new JFrame();
- f.setIconImage(Resource.getIcon("icons/lima.png").getImage());
- JOptionPane.showMessageDialog(
- f,
- eee.getMessage(),
- _("lima.common.error"),
- JOptionPane.ERROR_MESSAGE);
- f.dispose();
- }
- }
- }*/
-
public void removeLetter(int row) {
- /*try {
- Object currentRow = cacheDataList.get(row);
- if (currentRow instanceof Entry) {
- Entry entry = (Entry) currentRow;
- financialTransactionService.removeEntryLetter(entry);
- }
- } catch (LimaException eee) {
- log.error("Can't remove letter", eee);
- }*/
+ //TODO
}
- public void refresh() {
- cacheDataList = getDataList();
- fireTableDataChanged();
- }
-
@Override
public int getColumnCount() {
- return 9;
+ return 7;
}
+ public Entry getEntryAt(int row) {
+ if (row == -1) {
+ return null;
+ }
+ Entry result = entries.get(row);
+ return result;
+ }
+
@Override
public Class<?> getColumnClass(int column) {
- Class<?> result = null;
+ Class<?> result = String.class;
switch (column) {
case 0:
result = Date.class;
break;
case 1:
- result = EntryBook.class;
- break;
- case 2:
result = String.class;
break;
case 3:
@@ -195,17 +164,11 @@
result = String.class;
break;
case 5:
- result = String.class;
+ result = BigDecimal.class;
break;
case 6:
result = BigDecimal.class;
break;
- case 7:
- result = BigDecimal.class;
- break;
- case 8:
- result = BigDecimal.class;
- break;
}
return result;
@@ -227,176 +190,116 @@
result = _("lima.table.voucher");
break;
case 3:
- result = _("lima.table.account");
- break;
- case 4:
result = _("lima.table.description");
break;
- case 5:
+ case 4:
result = _("lima.table.letter");
break;
- case 6:
+ case 5:
result = _("lima.table.debit");
break;
- case 7:
+ case 6:
result = _("lima.table.credit");
break;
- case 8:
- result = _("lima.table.balance");
- break;
}
return result;
}
@Override
- public int getRowCount() {
- int result = 0;
-
- if (cacheDataList != null) {
- result = cacheDataList.size();
+ public int getRowCount() {
+ if (entries != null){
+ return entries.size();
}
-
- return result;
+ return 0;
}
@Override
public Object getValueAt(int row, int column) {
Object result = null;
- // just prevent too much result
- if (cacheDataList != null) {
- result = cacheDataList.get(row);
-
- if (result instanceof FinancialTransaction) {
- FinancialTransaction currentRow = (FinancialTransaction) result;
- BigDecimal amountDebit = currentRow.getAmountDebit();
- BigDecimal amountCredit = currentRow.getAmountCredit();
-
- switch (column) {
- case 0:
- result = currentRow.getTransactionDate();
- break;
- case 1:
- if (currentRow.getEntryBook() != null) {
- result = currentRow.getEntryBook().getCode();
- } else {
- result = null;
- }
- break;
- case 2:
- result = null; //voucher
- break;
- case 3:
- result = null; // account
- break;
- case 4:
- result = null; // description
- break;
- case 5:
- result = null; // letter
- break;
- case 6:
- result = amountDebit;
- break;
- case 7:
- result = amountCredit;
- break;
- case 8:
- result = amountDebit.subtract(amountCredit);
- break;
- }
- } else if (result instanceof Entry) {
- Entry currentEntry = (Entry) result;
- switch (column) {
- case 0:
- result = null; // date
- break;
- case 1: // entry book
- result = null;
- break;
- case 2:
- result = currentEntry.getVoucher();
- break;
- case 3: // account
- if (currentEntry.getAccount() != null) {
- result = currentEntry.getAccount().getAccountNumber();
- } else {
- result = null;
- }
- break;
- case 4:
- result = currentEntry.getDescription();
- break;
- case 5:
- result = currentEntry.getLettering();
- break;
- case 6:
- result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
- break;
- case 7:
- result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
- break;
- case 8:
- result = null;
- break;
- }
-
+ if (entries.size() > 0){
+ Entry currentEntry = entries.get(row);
+ switch (column) {
+ case 0:
+ result = datesEntree.get(row); // date
+ break;
+ case 1: // entry book
+ result = entryBooks.get(row);
+ break;
+ case 2:
+ result = currentEntry.getVoucher();
+ break;
+ case 3:
+ result = currentEntry.getDescription();
+ break;
+ case 4:
+ result = currentEntry.getLettering();
+ break;
+ case 5:
+ result = currentEntry.getDebit() ? currentEntry.getAmount() : BigDecimal.ZERO;
+ break;
+ case 6:
+ result = currentEntry.getDebit() ? BigDecimal.ZERO : currentEntry.getAmount();
+ break;
}
}
return result;
}
/**
- * To set cells editable or not
- * different condition for entry or financial transaction
+ * Only cell of "Letter" could be editable
*/
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
- boolean editableCell = false;
- Object currentRow = cacheDataList.get(rowIndex);
- // cells editable for the entry row, all cells exclude the date
- if (currentRow instanceof Entry && columnIndex == 5) {
- editableCell = true;
- }
- return editableCell;
+
+ return false;
}
public Object getElementAt(int row) {
- Object result = null;
- if (cacheDataList != null) {
- result = cacheDataList.get(row);
- }
- return result;
+ return entries.get(row);
}
+
+ //add one entry
+ public void addEntry(Entry entry) {
+ entries.add(entry);
+ int row = entries.indexOf(entry);
+ fireTableRowsInserted(row, row);
+ }
-
+ //add a list of Entry
+ public void addEntries(List<Entry> entries) {
+ for (Entry entry : entries){
+ addEntry(entry);
+ }
+ }
+
/** to modifiy letter entry */
@Override
public void setValueAt(Object value, int row, int column) {
- int financialTransactionRow = 0;
+ //TODO
+ /*int financialTransactionRow = 0;
if (cacheDataList != null) {
Object currentRow = cacheDataList.get(row);
if (currentRow instanceof Entry) {
Entry currentEntry = (Entry) currentRow;
switch (column) {
- case 5:
+ case 4:
currentEntry.setLettering((String) value);
break;
}
- financialTransactionService.updateEntry(currentEntry);
+ financialTransactionService.updateEntry(currentEntry);*/
//update the financial transaction in entire
- financialTransactionRow =
+ /*financialTransactionRow =
getDataList().indexOf(((Entry) currentRow).
- getFinancialTransaction());
- }
+ getFinancialTransaction());*/
+ /* }
//on recharge la liste
- cacheDataList = getDataList();
fireTableRowsUpdated(financialTransactionRow, getRowCount() - 1);
- }
+ }*/
}
@Override
@@ -404,7 +307,7 @@
if (serviceName.contains("FinancialTransaction") ||
methodeName.contains("importEntries") ||
methodeName.contains("importAll")) {
- refresh();
+ fireTableDataChanged();
}
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringView.jaxx 2012-07-03 11:54:09 UTC (rev 3485)
@@ -26,57 +26,167 @@
<Table>
<import>
- javax.swing.ListSelectionModel
+ org.chorem.lima.ui.common.AccountComboBoxModel
+ org.chorem.lima.ui.common.FinancialPeriodComboBoxModel
org.chorem.lima.entity.FiscalPeriod
org.chorem.lima.entity.FinancialPeriod
- org.chorem.lima.enums.ComboBoxDatesEnum
+ javax.swing.ListSelectionModel
+ org.jdesktop.swingx.JXDatePicker;
</import>
+
+ <LetteringViewHandler id="handler" constructorParams="this"/>
+ <LetteringTableModel id="tableModel"/>
+ <LetteringModelUI id='modelUi' constructorParams='tableModel'/>
+
+ <!-- <Boolean id="selectedRow" javaBean="false"/> -->
- <LetteringViewHandler id="handler" javaBean="new LetteringViewHandler(this)"/>
- <Boolean id="selectedRow" javaBean="false"/>
+ <script>
+ <![CDATA[
+ void $afterCompleteSetup() {
+ handler.init();
+ }
+ ]]>
+ </script>
- <row weightx="1" weighty="0" anchor="center">
- <cell fill='both'>
- <Table>
- <row>
- <cell anchor="west">
- <JComboBox id="periodComboBox"
- javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
- onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
- validate(); repaint()"/>
- </cell>
- <cell>
- <LetteringPeriodSearchPanel id='periodSearchPanel'
- constructorParams='handler'/>
- </cell>
- </row>
- </Table>
+ <row>
+ <cell anchor="center" weightx="1" columns="2">
+ <JLabel text="lima.ui.lettering.account" labelFor='{panelAccountComboBox}'/>
+ </cell>
+ <cell anchor="center" weightx="1">
+ <JLabel text="lima.ui.lettering.period" labelFor='{panelFinancialPeriodComboBox}'/>
+ </cell>
+ <cell anchor="center" weightx="1">
+ <JLabel text="lima.ui.lettering.entry" labelFor='{entryPanel}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor="center" weightx="1" columns="2">
+ <JPanel id="panelAccountComboBox">
+ <org.chorem.lima.ui.common.AccountComboBoxModel id="accountComboBoxModel"/>
+ <JComboBox id="accountComboBox" model="{accountComboBoxModel}"
+ renderer="{new org.chorem.lima.ui.common.AccountListRenderer()}"
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ <JButton id="backCount" text="lima.ui.account.buttonback"
+ onActionPerformed="handler.back(accountComboBox)"/>
+ <JButton id="nextCount" text="lima.ui.account.buttonnext"
+ onActionPerformed="handler.next(accountComboBox)"/>
+ </JPanel>
+ </cell>
+ <cell anchor="center" weightx="1">
+ <JPanel id="panelFinancialPeriodComboBox">
+ <Table>
+ <row>
+ <cell>
+ <JLabel text="lima.ui.lettering.beginFinancialPeriod"/>
+ </cell>
+ <cell>
+ <JXDatePicker id="pickerDebut"
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JLabel text="lima.ui.lettering.endFinancialPeriod"/>
+ </cell>
+ <cell>
+ <JXDatePicker id="pickerFin"
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </cell>
+ <cell anchor="center" weightx="1">
+ <JPanel id="entryPanel">
+ <Table>
+ <row>
+ <cell>
+ <JRadioButton id="lettredEntryCheckBox" buttonGroup="letteredCheckGroup"
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ </cell>
+ <cell>
+ <JLabel text="lima.ui.lettering.checkLettredEntry"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton id="noLettredEntryCheckBox" selected="true" buttonGroup="letteredCheckGroup"
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ </cell>
+ <cell>
+ <JLabel text="lima.ui.lettering.checkNoLettredEntry"/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton id="allCheckBox" buttonGroup="letteredCheckGroup"
+ onActionPerformed="handler.updateAllEntries(pickerDebut.getDate(), pickerFin.getDate(), accountComboBox.getSelectedItem(), letteredCheckGroup.getSelectedButton().getName())"/>
+ </cell>
+ <cell>
+ <JLabel text="lima.ui.lettering.checkAll"/>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
+ </cell>
+ </row>
+ <row>
+ <cell anchor="center" weightx="0.25">
+ <JLabel/>
</cell>
- <cell>
- <JButton text="lima.entries.lettering.add"
- onActionPerformed="handler.addLetter()"
- toolTipText="lima.tooltip.lettering"
- enabled="{isSelectedRow()}"/>
+ <cell anchor="center" weightx="0.25">
+ <JLabel text="lima.ui.lettering.selectDebit" labelFor='{debitTexttField}'/>
</cell>
- <cell>
- <JButton text="lima.entries.lettering.remove"
- onActionPerformed="handler.removeLetter()"
- enabled="{isSelectedRow()}"/>
+ <cell anchor="center" weightx="0.25">
+ <JLabel text="lima.ui.lettering.selectCredit" labelFor='{creditTextField}'/>
</cell>
-
+ <cell anchor="center" weightx="0.25">
+ <JLabel text="lima.ui.lettering.selectSolde" labelFor='{soldeTextField}'/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor='center' weightx="0.25">
+ <JLabel text="lima.ui.lettering.selectEntry"/>
+ </cell>
+ <cell fill="horizontal" weightx="0.25">
+ <JTextField id="debitTexttField" editable="false" text="{getModelUi().getDebit()}"
+ focusable="false"/>
+ </cell>
+ <cell fill="horizontal" weightx="0.25">
+ <JTextField id="creditTextField" editable="false" text="{getModelUi().getCredit()}"
+ focusable="false"/>
+ </cell>
+ <cell fill="horizontal" weightx="0.25">
+ <JTextField id="soldeTextField" editable="false" text="{getModelUi().getSolde()}"
+ focusable="false"/>
+ </cell>
+ </row>
+ <row>
+ <cell anchor="center" columns='4'>
+ <JLabel text="lima.ui.lettering.actions" labelFor='{actionsPanel}'/>
+ </cell>
</row>
<row>
- <cell fill="both" weightx="1" weighty="1" rows="3" columns="11">
- <JScrollPane>
- <LetteringTableModel
- id="tableModel"/>
- <LetteringTable
- id="table" sortable="false" rowHeight="22"
- constructorParams="getHandler()" model="{getTableModel()}"
- selectionMode="{ListSelectionModel.MULTIPLE_INTERVAL_SELECTION }"/>
- <ListSelectionModel javaBean="getTable().getSelectionModel()"
- onValueChanged="setSelectedRow(table.getSelectedRow() != -1)"/>
- </JScrollPane>
- </cell>
+ <cell anchor="center" columns='4'>
+ <JPanel id="actionsPanel">
+ <JButton id="lettered" text="lima.ui.lettering.buttonLettered"
+ enabled="{getModelUi().isLettrer()}"
+ onActionPerformed="handler.lettrer()"/>
+ <JButton id="noLettered" text="lima.ui.lettering.buttonNoLettered"
+ enabled="{getModelUi().isDelettrer()}"
+ onActionPerformed="handler.delettrer()"/>
+ </JPanel>
+ </cell>
</row>
+ <row>
+ <cell fill="both" weightx="1" weighty="1" columns="4">
+ <JScrollPane>
+ <LetteringTable
+ id="table" sortable="false" rowHeight="22"
+ constructorParams="getTableModel()"
+ selectionModel="{modelUi}"
+ />
+ </JScrollPane>
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/lettering/LetteringViewHandler.java 2012-07-03 11:54:09 UTC (rev 3485)
@@ -25,16 +25,33 @@
package org.chorem.lima.ui.lettering;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Date;
+import java.util.List;
+import javax.swing.JComboBox;
+
+import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.ServiceListener;
+import org.chorem.lima.business.api.AccountService;
+import org.chorem.lima.business.api.EntryBookService;
+import org.chorem.lima.business.api.FinancialPeriodService;
import org.chorem.lima.business.api.FinancialTransactionService;
+import org.chorem.lima.business.api.FiscalPeriodService;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.Entry;
+import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
-
/**
* Handler associated with financial transaction view.
*
@@ -44,7 +61,7 @@
* Last update : $Date$
* By : $Author$
*/
-public class LetteringViewHandler {
+public class LetteringViewHandler implements ServiceListener{
/** log. */
private static final Log log =
@@ -61,25 +78,210 @@
protected FinancialPeriodComboBoxModel financialPeriodComboBoxModel;
/** Transaction service. */
- protected final FinancialTransactionService financialTransactionService;
+ protected FiscalPeriodService fiscalPeriodService;
+ protected FinancialPeriodService financialPeriodService;
+ protected AccountService accountService;
+ protected FinancialTransactionService financialTransactionService;
+ protected EntryBookService entryBookService;
protected Object clipBoard;
- protected LetteringViewHandler(LetteringView view) {
+ public LetteringViewHandler(LetteringView view) {
this.view = view;
-
- /* Services */
+
+ financialPeriodService = LimaServiceFactory.getService(FinancialPeriodService.class);
+ fiscalPeriodService = LimaServiceFactory.getService(FiscalPeriodService.class);
+ accountService = LimaServiceFactory.getService(AccountService.class);
financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
+ entryBookService = LimaServiceFactory.getService(EntryBookService.class);
+ }
+
+ /**
+ * Init all combo box in view.
+ */
+ public void init() {
+ loadComboAndRows();
+ LetteringModelUI modelUi = view.getModelUi();
+ modelUi.addPropertyChangeListener(LetteringModelUI.SELECTED_ENTRY_PROPERTY, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ LetteringModelUI modelUiPropChange = (LetteringModelUI)evt.getSource();
+ Entry selectedEntry = (Entry)evt.getNewValue();
+ loadCurrentSelection(modelUiPropChange, selectedEntry);
+ }
+ });
+
}
+
+ public void loadComboAndRows(){
+ log.debug("loadComboAndRows");
+
+ List<Account> allAccounts = accountService.getAllAccounts();
+ view.getAccountComboBoxModel().setObjects(allAccounts);
+
+ log.debug("loadComboAndRows");
+
+ if (!allAccounts.isEmpty()) {
+
+ view.getAccountComboBox().setSelectedItem(allAccounts.get(0));
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("1er item comptes : " + allAccounts.get(0));
+ }
+
+ //By default, we have the beginning of the fiscal period (Or of current
+ //date if no fiscal period) and the end of the current date
+ FiscalPeriod fiscalPeriod = fiscalPeriodService.getLastFiscalPeriod();
+ Date defaultDateBegFiscalPeriod;
+
+ Calendar calendar = Calendar.getInstance();
+ int dernierJourMoisCourant = calendar.getActualMaximum(Calendar.DATE);
+ int premierJourMoisCourant = calendar.getActualMinimum(Calendar.DATE);
+
+ if (fiscalPeriod != null){
+ defaultDateBegFiscalPeriod = fiscalPeriodService.getLastFiscalPeriod().getBeginDate();
+ }else{
+ defaultDateBegFiscalPeriod = DateUtils.setDays(new Date(), premierJourMoisCourant);
+ }
+
+ Date defaultDateEndCurrent = DateUtils.setDays(new Date(), dernierJourMoisCourant);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Date de debut : " + defaultDateBegFiscalPeriod);
+ log.debug("Date de fin : " + defaultDateEndCurrent);
+ }
+
+ view.getPickerDebut().setDate(defaultDateBegFiscalPeriod);
+ view.getPickerFin().setDate(defaultDateEndCurrent);
+
+ log.debug("Val select letter : " + view.getLetteredCheckGroup().getSelectedButton().getName());
+
+ //Load entry with the default dates, default account 4 and with no letter
+ updateAllEntries(defaultDateBegFiscalPeriod, defaultDateEndCurrent, view.getAccountComboBoxModel().getSelectedItem(), view.getLetteredCheckGroup().getSelectedButton().getName());
+ }
+
+ protected List<Entry> findAllEntries(Date selectedBeginDate, Date selectedEndDate, Object compte, String filtreLettre){
+
+ List<Entry> entries = new ArrayList<Entry>();
+ List<Entry> entriesAccount = new ArrayList<Entry>();
+ if (selectedBeginDate != null && selectedEndDate != null) {
+ List<FinancialTransaction> financialtransactions =
+ financialTransactionService.getAllFinancialTransactions(selectedBeginDate, selectedEndDate);
+ for (FinancialTransaction financialtransaction : financialtransactions) {
+ entries = (List<Entry>) financialtransaction.getEntry();
+ }
+ if (compte != null){
+ for(Entry entry : entries){
+ log.debug("entry.getLettering() : " + entry.getLettering());
+ log.debug("name radioButton : " + filtreLettre);
+ //0 for lettered, 1 for no-lettered and 2 for all entries
+ if (compte.equals(entry.getAccount()) && ( (filtreLettre.equals("noLettredEntryCheckBox") & entry.getLettering() == null))
+ || (filtreLettre.equals("lettredEntryCheckBox") & entry.getLettering() != null) || filtreLettre.equals("allCheckBox")){
+ entriesAccount.add(entry);
+ }
+ }
+ log.debug("entriesAccount size : " + entriesAccount.size());
+ return entriesAccount;
+ }
+ }
+ return entries;
+ }
+
+ public void updateAllEntries(Date selectedBeginDate, Date selectedEndDate, Object compte, String filtreLettre) {
+
+ if (selectedBeginDate != null && selectedEndDate != null){
+ log.debug("updateAllEntries");
+ List<Entry> entries = findAllEntries(selectedBeginDate, selectedEndDate, compte, filtreLettre);
+ List<String> journalEntrees = new ArrayList<String>();
+ List<Date> datesEntree = new ArrayList<Date>();
+
+ for (Entry entry : entries){
+ datesEntree.add(entry.getFinancialTransaction().getTransactionDate());
+ journalEntrees.add(entry.getFinancialTransaction().getEntryBook().getLabel());
+ }
+
+ view.getTableModel().updateEntries(entries, datesEntree, journalEntrees);
+ }
+ }
+
+ public void loadCurrentSelection(LetteringModelUI modelUi, Entry selectedEntry){
+ financialTransactionService = LimaServiceFactory.getService(FinancialTransactionService.class);
+
+ boolean enableLettring = false;
+ boolean enableDelettring = false;
+
+ if (selectedEntry != null){
+ modelUi.setDebit(selectedEntry.getDebit() ? selectedEntry.getAmount() : BigDecimal.ZERO);
+ modelUi.setCredit(selectedEntry.getDebit() ? BigDecimal.ZERO : selectedEntry.getAmount());
+
+ if (modelUi.getDebit().equals("0")){
+ modelUi.setSolde(modelUi.getCredit());
+ }else{
+ modelUi.setSolde(modelUi.getDebit());
+ }
+ modelUi.setSolde(modelUi.getSolde());
+ if (selectedEntry.getLettering() != null && ! selectedEntry.getLettering().isEmpty()){
+ enableDelettring = true;
+ }else{
+ enableLettring = true;
+ }
+ }
+ modelUi.setLettrer(enableLettring);
+ modelUi.setDelettrer(enableDelettring);
+ }
+
+ /**Add a group of three letters to n entries*/
+ public void lettrer(){
+
+
+ int[] entrieSelected = view.getTable().getSelectedRows();
+ for (int rowEntry : entrieSelected){
+ view.getTableModel().getEntryAt(rowEntry);
+
+ }
+
+ //String lastActualLetters = fiscalPeriodService.findLastActualLetters();
+ }
+
+ /**Remove a group of three letters to n entries*/
+ public void delettrer(List<Entry> entries){
+
+ }
+
+ /**
+ * Select previous value in combo box.
+ *
+ * @param comboBox combo box
+ */
+ public void back(JComboBox comboBox) {
+ int row = comboBox.getSelectedIndex();
+ if (row > 0) {
+ comboBox.setSelectedIndex(row - 1);
+ }
+ }
+
+ /**
+ * Select next value in combo box.
+ *
+ * @param comboBox combo box
+ */
+ public void next(JComboBox comboBox) {
+ int size = comboBox.getModel().getSize();
+ int row = comboBox.getSelectedIndex();
+
+ if (row < size - 1) {
+ comboBox.setSelectedIndex(row + 1);
+ }
+ }
+
public void setBeginDate(Date date) {
- tableModel = view.getTableModel();
- tableModel.setSelectedBeginDate(date);
+ view.getTableModel().setSelectedBeginDate(date);
}
public void setEndDate(Date date) {
- tableModel = view.getTableModel();
- tableModel.setSelectedEndDate(date);
+ view.getTableModel().setSelectedEndDate(date);
}
public void addLetter() {
@@ -126,20 +328,16 @@
}
public void removeLetter() {
-
- table = view.getTable();
- tableModel = view.getTableModel();
-
+ //TODO
//removeLetters
- int[] rows = table.getSelectedRows();
+ /*int[] rows = table.getSelectedRows();
for (int i : rows) {
- tableModel.removeLetter(i);
+ view.getTableModel().removeLetter(i);
}
- tableModel.refresh();
+ view.getTableModel().updateRows();*/
}
-
- public void refresh() {
- tableModel = view.getTableModel();
- tableModel.refresh();
+
+ @Override
+ public void notifyMethod(String serviceName, String methodeName) {
}
}
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 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2012-07-03 11:54:09 UTC (rev 3485)
@@ -196,6 +196,7 @@
lima.table.solde=Solder
lima.table.solde.credit=Credit solde
lima.table.solde.debit=Debit solde
+lima.table.sum=Sums
lima.table.voucher=Voucher
lima.title.about=About Lima...
lima.title.about.description=Open sources accounting software
@@ -204,6 +205,8 @@
lima.ui.account.addaccount=
lima.ui.account.addaccounttitle=
lima.ui.account.base=
+lima.ui.account.buttonback=←
+lima.ui.account.buttonnext=→
lima.ui.account.developed=
lima.ui.account.importtitle=
lima.ui.account.label=
@@ -255,6 +258,8 @@
lima.ui.financialtransaction.titleremoveentry=
lima.ui.financialtransaction.titleremovetransaction=
lima.ui.financialtransaction.voucher=
+lima.ui.fiscalPeriod.buttonback=
+lima.ui.fiscalPeriod.buttonnext=
lima.ui.fiscalperiod.addfiscalperiod.morethan12=
lima.ui.fiscalperiod.addfiscalperiodtitle=
lima.ui.fiscalperiod.block.addretainedearnings=
@@ -262,6 +267,8 @@
lima.ui.fiscalperiod.block.newyear=
lima.ui.fiscalperiod.block.retainedearningstitle=
lima.ui.fiscalperiod.block.title=
+lima.ui.fiscalperiod.buttonback=←
+lima.ui.fiscalperiod.buttonnext=→
lima.ui.fiscalperiod.closed=
lima.ui.fiscalperiod.closure=
lima.ui.fiscalperiod.delete.confirmation=
@@ -314,6 +321,22 @@
lima.ui.importexport.vatstatements=VAT chart
lima.ui.importexport.wait=Job in progress…
lima.ui.importexport.waittitle=
+lima.ui.lettering.account=Accounts
+lima.ui.lettering.actions=Actions
+lima.ui.lettering.beginFinancialPeriod=From
+lima.ui.lettering.buttonAuto=Auto
+lima.ui.lettering.buttonLettered=To Letter
+lima.ui.lettering.buttonNoLettered=To Unletter
+lima.ui.lettering.checkAll=All
+lima.ui.lettering.checkLettredEntry=Lettered
+lima.ui.lettering.checkNoLettredEntry=Unlettered
+lima.ui.lettering.endFinancialPeriod=To
+lima.ui.lettering.entry=Entries
+lima.ui.lettering.period=Periods
+lima.ui.lettering.selectCredit=
+lima.ui.lettering.selectDebit=
+lima.ui.lettering.selectEntry=Actual selection
+lima.ui.lettering.selectSolde=Balance
lima.ui.mainview.title=Lutin Invoice Monitoring and Accounting
lima.ui.opening.accounts=<html><center>Select a default, <br/>import your personnal<br/> or cancel to create your own account chart.</center></html>
lima.ui.opening.close=
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 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2012-07-03 11:54:09 UTC (rev 3485)
@@ -178,7 +178,7 @@
lima.structure=Structure
lima.tab.home=Accueil
lima.table.account=Compte
-lima.table.balance=Balance
+lima.table.balance=Solde
lima.table.credit=Crédit
lima.table.date=Date
lima.table.debit=Débit
@@ -196,6 +196,7 @@
lima.table.solde=Solde
lima.table.solde.credit=Solde crédit
lima.table.solde.debit=Solde débit
+lima.table.sum=Totaux
lima.table.voucher=Pièce comptable
lima.title.about=À propos de Lima...
lima.title.about.description=Logiciel de comptabilité Libre
@@ -204,6 +205,8 @@
lima.ui.account.addaccount=Nouveau compte
lima.ui.account.addaccounttitle=Ajout d'un compte
lima.ui.account.base=Plan comptable de base
+lima.ui.account.buttonback=←
+lima.ui.account.buttonnext=→
lima.ui.account.developed=Plan comptable développé
lima.ui.account.importtitle=Importer
lima.ui.account.label=Libellé
@@ -255,6 +258,8 @@
lima.ui.financialtransaction.titleremoveentry=Suppression
lima.ui.financialtransaction.titleremovetransaction=Suppression
lima.ui.financialtransaction.voucher=Pièce comptable
+lima.ui.fiscalPeriod.buttonback=
+lima.ui.fiscalPeriod.buttonnext=
lima.ui.fiscalperiod.addfiscalperiod.morethan12=La période sélectionnée n'est pas de 12 mois, voulez-vous continuer ?
lima.ui.fiscalperiod.addfiscalperiodtitle=Nouvel exercice
lima.ui.fiscalperiod.block.addretainedearnings=Reporter à nouveau?
@@ -262,6 +267,8 @@
lima.ui.fiscalperiod.block.newyear=Voulez vous créer un nouvel exercice?
lima.ui.fiscalperiod.block.retainedearningstitle=Report à nouveau
lima.ui.fiscalperiod.block.title=Cloture de l'exercice
+lima.ui.fiscalperiod.buttonback=←
+lima.ui.fiscalperiod.buttonnext=→
lima.ui.fiscalperiod.closed=Cloturé
lima.ui.fiscalperiod.closure=Cloture
lima.ui.fiscalperiod.delete.confirmation=Ètes vous sûre de vouloir supprimer cette période ? Cette action est irréversible \!
@@ -314,6 +321,22 @@
lima.ui.importexport.vatstatements=Plan TVA
lima.ui.importexport.wait=Traitement en cours…
lima.ui.importexport.waittitle=Traitement en cours
+lima.ui.lettering.account=Comptes
+lima.ui.lettering.actions=Actions
+lima.ui.lettering.beginFinancialPeriod=De
+lima.ui.lettering.buttonAuto=Auto
+lima.ui.lettering.buttonLettered=Lettrer
+lima.ui.lettering.buttonNoLettered=Délettrer
+lima.ui.lettering.checkAll=Toutes
+lima.ui.lettering.checkLettredEntry=Lettrées
+lima.ui.lettering.checkNoLettredEntry=Non-lettrées
+lima.ui.lettering.endFinancialPeriod=A
+lima.ui.lettering.entry=Ecritures
+lima.ui.lettering.period=Périodes
+lima.ui.lettering.selectCredit=Crédit
+lima.ui.lettering.selectDebit=Débit
+lima.ui.lettering.selectEntry=Sélection courante
+lima.ui.lettering.selectSolde=Solde
lima.ui.mainview.title=Lutin Invoice Monitoring and Accounting
lima.ui.opening.accounts=<html><center>Veuillez sélectionner un plan par défault, <br/>importer un plan personnalisé<br/> ou annuler pour créer votre propre plan.</center></html>
lima.ui.opening.close=Fermer
Modified: trunk/lima-swing/src/main/resources/log4j.properties
===================================================================
--- trunk/lima-swing/src/main/resources/log4j.properties 2012-07-02 15:44:23 UTC (rev 3484)
+++ trunk/lima-swing/src/main/resources/log4j.properties 2012-07-03 11:54:09 UTC (rev 3485)
@@ -41,4 +41,6 @@
log4j.logger.org.chorem.lima.business.ejb=DEBUG
log4j.logger.org.chorem.lima.ui.account=DEBUG
log4j.logger.org.chorem.lima.ui.home=DEBUG
-log4j.logger.org.chorem.lima.business.accountingrules.DefaultAccountingRules=DEBUG
\ No newline at end of file
+log4j.logger.org.chorem.lima.business.accountingrules.DefaultAccountingRules=DEBUG
+log4j.logger.org.chorem.lima.ui.lettering.LetteringViewHandler=DEBUG
+log4j.logger.org.chorem.lima.ui.lettering.LetteringTableModel=DEBUG
\ No newline at end of file
1
0
r3484 - trunk/lima-callao/src/main/java/org/chorem/lima/entity
by echatellier@users.chorem.org 02 Jul '12
by echatellier@users.chorem.org 02 Jul '12
02 Jul '12
Author: echatellier
Date: 2012-07-02 17:44:23 +0200 (Mon, 02 Jul 2012)
New Revision: 3484
Url: http://chorem.org/repositories/revision/lima/3484
Log:
Fix NPE with VAT and BCR plans
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java 2012-07-02 15:36:34 UTC (rev 3483)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java 2012-07-02 15:44:23 UTC (rev 3484)
@@ -65,7 +65,7 @@
if (masterVatStatement == null) {
query += " WHERE masterVatStatement = null";
} else {
- query += "WHERE masterVatStatement = :masterVatStatement";
+ query += " WHERE masterVatStatement = :masterVatStatement";
}
query += " ORDER BY " + VatStatement.TOPIA_CREATE_DATE;
1
0
r3483 - trunk/lima-callao/src/main/java/org/chorem/lima/entity
by echatellier@users.chorem.org 02 Jul '12
by echatellier@users.chorem.org 02 Jul '12
02 Jul '12
Author: echatellier
Date: 2012-07-02 17:36:34 +0200 (Mon, 02 Jul 2012)
New Revision: 3483
Url: http://chorem.org/repositories/revision/lima/3483
Log:
Fix NPE with VAT and BCR plans
Modified:
trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementDAOImpl.java
trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementDAOImpl.java 2012-06-27 12:09:05 UTC (rev 3482)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/FinancialStatementDAOImpl.java 2012-07-02 15:36:34 UTC (rev 3483)
@@ -56,10 +56,21 @@
* @throws TopiaException
*/
public List<FinancialStatement> findChildrenFinancialStatement(FinancialStatement financialStatement) throws TopiaException {
- String query = "FROM " + FinancialStatement.class.getName() +
- " WHERE masterFinancialStatement = :masterFinancialStatement" +
- " ORDER BY " + FinancialStatement.TOPIA_CREATE_DATE;
- List<FinancialStatement> result = context.findAll(query, "masterFinancialStatement", financialStatement);
+ String query = "FROM " + FinancialStatement.class.getName();
+
+ if (financialStatement == null) {
+ query += " WHERE masterFinancialStatement = null";
+ } else {
+ query += " WHERE masterFinancialStatement = :masterFinancialStatement";
+ }
+ query += " ORDER BY " + FinancialStatement.TOPIA_CREATE_DATE;
+
+ List<FinancialStatement> result;
+ if (financialStatement == null) {
+ result = context.findAll(query);
+ } else {
+ result = context.findAll(query, "masterFinancialStatement", financialStatement);
+ }
return result;
}
Modified: trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java
===================================================================
--- trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java 2012-06-27 12:09:05 UTC (rev 3482)
+++ trunk/lima-callao/src/main/java/org/chorem/lima/entity/VatStatementDAOImpl.java 2012-07-02 15:36:34 UTC (rev 3483)
@@ -60,10 +60,21 @@
* @throws TopiaException
*/
public List<VatStatement> getChildrenVatStatement(VatStatement masterVatStatement) throws TopiaException {
- String query = "FROM " + VatStatement.class.getName() +
- " WHERE masterVatStatement = :masterVatStatement" +
- " ORDER BY " + VatStatement.TOPIA_CREATE_DATE;
- List<VatStatement> result = context.findAll(query, "masterVatStatement", masterVatStatement);
+ String query = "FROM " + VatStatement.class.getName();
+
+ if (masterVatStatement == null) {
+ query += " WHERE masterVatStatement = null";
+ } else {
+ query += "WHERE masterVatStatement = :masterVatStatement";
+ }
+
+ query += " ORDER BY " + VatStatement.TOPIA_CREATE_DATE;
+ List<VatStatement> result;
+ if (masterVatStatement == null) {
+ result = context.findAll(query);
+ } else {
+ result = context.findAll(query, "masterVatStatement", masterVatStatement);
+ }
return result;
}
1
0