Author: jpepin Date: 2010-07-07 12:58:46 +0200 (Wed, 07 Jul 2010) New Revision: 2965 Url: http://chorem.org/repositories/revision/lima/2965 Log: Import/Export Debug. Ajout d'une vue pour le rapport d'import/export. Added: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java trunk/lima-swing/src/main/java/org/chorem/lima/util/ReportDialogView.jaxx Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java trunk/lima-callao/src/main/xmi/accounting.zargo trunk/lima-swing/src/main/java/org/chorem/lima/ui/ImportExportHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -37,9 +37,6 @@ import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryBookDAO; -import org.chorem.lima.entity.EntryDAO; -import org.chorem.lima.entity.FinancialPeriod; -import org.chorem.lima.entity.FinancialPeriodDAO; import org.chorem.lima.entity.FinancialStatement; import org.chorem.lima.entity.FinancialStatementDAO; import org.chorem.lima.entity.FinancialTransaction; @@ -68,10 +65,8 @@ LogFactory.getLog(ExportServiceImpl.class); private TopiaContext rootContext; - - protected CSVWriter csvWriter; - - protected SimpleDateFormat sdf; + + private final SimpleDateFormat sdf = new SimpleDateFormat("dd,MM,yyyy HH:mm:ss"); public ExportServiceImpl() { LimaConfig config = LimaConfig.getInstance(); @@ -82,7 +77,6 @@ log.error("Can't init topia context", ex); } } - sdf = new SimpleDateFormat("dd,MM,yyyy HH:mm:ss"); } @@ -93,16 +87,18 @@ public String exportAsCSV() throws LimaException { TopiaContext topiaContext = null; StringWriter out = new StringWriter(); + CSVWriter csvWriter; + try { topiaContext = beginTransaction(); csvWriter = new CSVWriter(out, ';'); - exportAccountsChartAsCSV(topiaContext); - exportEntryBookChartAsCSV(topiaContext); - exportFinancialStatementChartAsCSV(topiaContext); - exportFiscalPeriodAsCSV(topiaContext); - exportClosedPeriodicEntryBooksAsCSV(topiaContext); - exportFinancialTransactionsAndEntriesAsCSV(topiaContext); + exportAccountsChartAsCSV(csvWriter, topiaContext); + exportEntryBookChartAsCSV(csvWriter, topiaContext); + exportFinancialStatementChartAsCSV(csvWriter, topiaContext); + exportFiscalPeriodAsCSV(csvWriter, topiaContext); + exportClosedPeriodicEntryBooksAsCSV(csvWriter, topiaContext); + exportFinancialTransactionsAndEntriesAsCSV(csvWriter, topiaContext); // Write cache in string csvWriter.flush(); csvWriter.close(); @@ -127,11 +123,12 @@ public String exportFinancialStatementChartAsCSV() throws LimaException { TopiaContext topiaContext = null; StringWriter out = new StringWriter(); + CSVWriter csvWriter; try { topiaContext = beginTransaction(); csvWriter = new CSVWriter(out, ';'); - exportFinancialStatementChartAsCSV(topiaContext); + exportFinancialStatementChartAsCSV(csvWriter, topiaContext); // Write cache in file csvWriter.flush(); csvWriter.close(); @@ -155,7 +152,7 @@ * | CreditAccounts | ProvisionDeprecationAccounts | SubAmount * | HeaderAmount | MasterFinancialStatement */ - public void exportFinancialStatementChartAsCSV(TopiaContext topiaContext) throws LimaException { + public void exportFinancialStatementChartAsCSV(CSVWriter csvWriter, TopiaContext topiaContext) throws LimaException { try { String[] nextLine = new String[10]; // Get all Financialstatements @@ -203,11 +200,12 @@ public String exportEntryBookChartAsCSV() throws LimaException { TopiaContext topiaContext = null; StringWriter out = new StringWriter(); + CSVWriter csvWriter; try { topiaContext = beginTransaction(); csvWriter = new CSVWriter(out, ';'); - exportEntryBookChartAsCSV(topiaContext); + exportEntryBookChartAsCSV(csvWriter, topiaContext); // Write cache in file csvWriter.flush(); csvWriter.close(); @@ -229,7 +227,7 @@ * Local methode, export entrybooks from database * Structure : TYPE | Code | Label | Type */ - public void exportEntryBookChartAsCSV(TopiaContext topiaContext) throws LimaException { + public void exportEntryBookChartAsCSV(CSVWriter csvWriter, TopiaContext topiaContext) throws LimaException { try { String[] nextLine = new String[4]; // Get all entrybook @@ -259,10 +257,12 @@ public String exportAccountsChartAsCSV() throws LimaException { TopiaContext topiaContext = null; StringWriter out = new StringWriter(); + CSVWriter csvWriter; + try { topiaContext = beginTransaction(); csvWriter = new CSVWriter(out, ';'); - exportAccountsChartAsCSV(topiaContext); + exportAccountsChartAsCSV(csvWriter, topiaContext); // Write cache in file csvWriter.flush(); csvWriter.close(); @@ -284,7 +284,7 @@ * Local methode, export accounts from database * Structure : TYPE | AccountNumber | Label | ThirdParty | MasteAccount | GeneralLedger */ - public void exportAccountsChartAsCSV(TopiaContext topiaContext) throws LimaException { + public void exportAccountsChartAsCSV(CSVWriter csvWriter, TopiaContext topiaContext) throws LimaException { try { String[] nextLine = new String[6]; // Récupère tous les comptes @@ -325,7 +325,7 @@ * Structure : TYPE | TransactionDate | AmountDebit | AmountCredit * | FinancialPeriod BeginDate | FinancialPeriod EndDate | EntryBook Code */ - public void exportFinancialTransactionsAndEntriesAsCSV(TopiaContext topiaContext) throws LimaException { + public void exportFinancialTransactionsAndEntriesAsCSV(CSVWriter csvWriter, TopiaContext topiaContext) throws LimaException { int numTransaction = 0; // Get all financialtransactions try { @@ -385,7 +385,7 @@ * Local methode, export fiscalperiods from database * Structure : TYPE | BeginDate | EndDate | Locked */ - public void exportFiscalPeriodAsCSV(TopiaContext topiaContext) throws LimaException { + public void exportFiscalPeriodAsCSV(CSVWriter csvWriter, TopiaContext topiaContext) throws LimaException { try { String[] nextLine = new String[5]; // Get all fiscalperiod @@ -413,7 +413,7 @@ * Local methode, export ClosedPeriodicEntryBooks from database * Structure : TYPE | Locked | FinancialPeriod beginDate | FinancialPeriod endDate | EntryBook Code */ - public void exportClosedPeriodicEntryBooksAsCSV(TopiaContext topiaContext) throws LimaException { + public void exportClosedPeriodicEntryBooksAsCSV(CSVWriter csvWriter, TopiaContext topiaContext) throws LimaException { try { String[] nextLine = new String[5]; // Get all fiscalperiod Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -19,6 +19,7 @@ package org.chorem.lima.business.ejb; +import java.util.Collections; import java.util.List; import javax.ejb.Stateless; import org.apache.commons.logging.Log; @@ -28,6 +29,7 @@ import org.chorem.lima.business.FinancialPeriodServiceLocal; import org.chorem.lima.business.LimaConfig; import org.chorem.lima.business.LimaException; +import org.chorem.lima.business.utils.FinancialPeriodComparator; import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO; import org.chorem.lima.entity.ClosedPeriodicEntryBookImpl; @@ -150,6 +152,7 @@ FinancialPeriodDAO financialPeriodDAO = LimaCallaoDAOHelper. getFinancialPeriodDAO(transaction); result = financialPeriodDAO.findAllByLocked(false); + Collections.sort(result, new FinancialPeriodComparator()); } catch (TopiaException ex) { doCatch(transaction, ex, log); Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -84,7 +84,6 @@ import org.nuiton.topia.TopiaException; import org.nuiton.topia.TopiaNotFoundException; import au.com.bytecode.opencsv.CSVReader; -import au.com.bytecode.opencsv.CSVWriter; /** * CSV import export service. @@ -122,27 +121,9 @@ @EJB EntryBookServiceLocal entryBookService; - //Import datas lists - Map<String, AccountImport> accounts; + private final SimpleDateFormat sdf = new SimpleDateFormat("dd,MM,yyyy HH:mm:ss"); - Map<String, FinancialStatementImport> financialStatements; - - List<FiscalPeriod> fiscalPeriods; - - List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks; - - Map<Integer, FinancialTransactionImport> financialTransactions; - - Map<Integer, List<EntryImport>> entries; - - //Utils - - protected CSVWriter csvWriter; - - protected SimpleDateFormat sdf; - - public ImportServiceImpl() { LimaConfig config = LimaConfig.getInstance(); @@ -153,7 +134,6 @@ log.error("Can't init topia context", ex); } } - sdf = new SimpleDateFormat("dd,MM,yyyy HH:mm:ss"); } //################ IMPORT THIRD PART ACCOUNTING SOFTWARE ################ @@ -185,17 +165,17 @@ public String importCSV(String datas) throws LimaException { String result = ""; - accounts = new TreeMap<String, AccountImport>(); + Map<String, AccountImport> accounts = new TreeMap<String, AccountImport>(); - financialStatements = new TreeMap<String, FinancialStatementImport>(); + Map<String, FinancialStatementImport> financialStatements = new TreeMap<String, FinancialStatementImport>(); - fiscalPeriods = new ArrayList<FiscalPeriod>(); + List<FiscalPeriod> fiscalPeriods = new ArrayList<FiscalPeriod>(); - closedPeriodicEntryBooks = new ArrayList<ClosedPeriodicEntryBookImport>(); + List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks = new ArrayList<ClosedPeriodicEntryBookImport>(); - financialTransactions = new HashMap<Integer,FinancialTransactionImport>(); + Map<Integer, FinancialTransactionImport> financialTransactions = new HashMap<Integer,FinancialTransactionImport>(); - entries = new HashMap<Integer, List<EntryImport>>(); + Map<Integer, List<EntryImport>> entries = new HashMap<Integer, List<EntryImport>>(); TopiaContext topiaContext = null; @@ -209,39 +189,39 @@ while ((nextLine = csvReader.readNext()) != null) { String indice = nextLine[0]; if (indice.equals("ACCN")){ - result += importAccountsChartsCSV(nextLine, topiaContext); + result += importAccountsChartsCSV(nextLine, accounts, topiaContext); } else if (indice.equals("ENBK")){ result += importEntryBooksChartCSV(nextLine, topiaContext); } else if (indice.equals("FNST")){ - result += importFinancialsStatementChartCSV(nextLine, topiaContext); + result += importFinancialsStatementChartCSV(nextLine, financialStatements, topiaContext); } else if (indice.equals("FSCP")){ - result += importFiscalPeriodCSV(nextLine, topiaContext); + result += importFiscalPeriodCSV(nextLine, fiscalPeriods, topiaContext); } else if (indice.equals("CPEB")){ - importClosedPeriodicEntryBookCSV(nextLine, topiaContext); + importClosedPeriodicEntryBookCSV(nextLine, closedPeriodicEntryBooks, topiaContext); } else if (indice.equals("FTRC")){ - importFinancialTransactionsCSV(nextLine, topiaContext); + importFinancialTransactionsCSV(nextLine, financialTransactions, topiaContext); } else if (indice.equals("NTRY")){ - importEntriesCSV(nextLine, topiaContext); + importEntriesCSV(nextLine, entries, topiaContext); } } //create accounts - result += createAccounts(topiaContext); + result += createAccounts(accounts, topiaContext); //create financialStatements - result += createFinancialStatements(topiaContext); + result += createFinancialStatements(financialStatements, topiaContext); //create fiscalperiod Collections.sort(fiscalPeriods, new FiscalPeriodComparator()); - result += createFiscalPeriod(topiaContext); + result += createFiscalPeriod(fiscalPeriods, topiaContext); //update closedperiodicentrybooks - result += updateClosedPeriodicEntryBooks(topiaContext); + result += updateClosedPeriodicEntryBooks(closedPeriodicEntryBooks, topiaContext); //create financialtransaction and entries - result += createFinancialTransactionsAndEntries(topiaContext); + result += createFinancialTransactionsAndEntries(financialTransactions, entries, topiaContext); commitTransaction(topiaContext); @@ -301,7 +281,7 @@ String result = ""; //FinancialStatements - financialStatements = + Map<String, FinancialStatementImport> financialStatements = new TreeMap<String, FinancialStatementImport>(); TopiaContext topiaContext = null; @@ -314,12 +294,12 @@ while ((nextLine = csvReader.readNext()) != null) { String indice = nextLine[0]; if (indice.equals("FNST")){ - result += importFinancialsStatementChartCSV(nextLine, topiaContext); + result += importFinancialsStatementChartCSV(nextLine, financialStatements, topiaContext); } } //create financialStatements - result += createFinancialStatements(topiaContext); + result += createFinancialStatements(financialStatements, topiaContext); } catch (TopiaException eeeTE){ doCatch(topiaContext, eeeTE, log); @@ -342,7 +322,7 @@ String result = ""; //Accounts - accounts = + Map<String, AccountImport> accounts = new TreeMap<String, AccountImport>(); TopiaContext topiaContext = null; @@ -356,12 +336,12 @@ while ((nextLine = csvReader.readNext()) != null) { String indice = nextLine[0]; if (indice.equals("ACCN")){ - result += importAccountsChartsCSV(nextLine, topiaContext); + result += importAccountsChartsCSV(nextLine, accounts, topiaContext); } } //create accounts - result += createAccounts(topiaContext); + result += createAccounts(accounts, topiaContext); } catch (TopiaException eeeTE){ doCatch(topiaContext, eeeTE, log); @@ -382,7 +362,7 @@ * Import and create accounts * Structure : TYPE | accountNumber | label | thirdparty | masterAccountNumber | generalLedgerNumber */ - public String importAccountsChartsCSV(String[] nextLine, TopiaContext topiaContext) throws LimaException{ + public String importAccountsChartsCSV(String[] nextLine, Map<String, AccountImport> accounts, TopiaContext topiaContext) throws LimaException{ String result = ""; String accountNumber = nextLine[1]; @@ -423,7 +403,7 @@ * Import and create fiscal period * Structure : TYPE | BeginDate | EndDate | Locked */ - public String importFiscalPeriodCSV(String[] nextLine, TopiaContext topiaContext) throws LimaException { + public String importFiscalPeriodCSV(String[] nextLine, List<FiscalPeriod> fiscalPeriods, TopiaContext topiaContext) throws LimaException { String result =""; try { FiscalPeriodDAO fiscalPeriodDAO = @@ -496,7 +476,7 @@ * Import and create closedperiodicentrybook import * Structure : TYPE | BeginDate | EndDate | Locked */ - public void importClosedPeriodicEntryBookCSV(String[] nextLine, TopiaContext topiaContext) throws LimaException { + public void importClosedPeriodicEntryBookCSV(String[] nextLine, List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks, TopiaContext topiaContext) throws LimaException { String locked = nextLine[1]; String beginDate = nextLine[2]; String endDate = nextLine[3]; @@ -519,7 +499,7 @@ * Structure : TYPE | label | header | accounts | debitAccount | creditAccount * | provisitionDeprecationAccounts | subAmount | headerAmount | masterFinancialStatement */ - public String importFinancialsStatementChartCSV(String[] nextLine, TopiaContext topiaContext) throws LimaException { + public String importFinancialsStatementChartCSV(String[] nextLine, Map<String, FinancialStatementImport> financialStatements, TopiaContext topiaContext) throws LimaException { String result = ""; String label = nextLine[1]; @@ -533,7 +513,6 @@ String masterFinancialStatement = nextLine[9]; try { - FinancialStatementDAO financialStatementDAO = LimaCallaoDAOHelper.getFinancialStatementDAO(topiaContext); @@ -574,7 +553,7 @@ * Structue : TYPE | NumTransac | TransactionDate | AmountDebit | AmountCredit * | FinancialPeriod BeginDate | FinancialPeriod EndDate | EntryBook Code */ - public void importFinancialTransactionsCSV(String[] nextLine, TopiaContext topiaContext) throws LimaException { + public void importFinancialTransactionsCSV(String[] nextLine, Map<Integer, FinancialTransactionImport> financialTransactions, TopiaContext topiaContext) throws LimaException { int num = new Integer(nextLine[1]); FinancialTransactionImport financialTransactionImport = new FinancialTransactionImportImpl(); financialTransactionImport.setDate(nextLine[2]); @@ -594,7 +573,7 @@ * Voucher | Position | FinancialTransaction Date | FinancialTransaction EntryBookCode | * FinancialTransaction AmountDebit | FinancialTransaction AmountCredit */ - public void importEntriesCSV(String[] nextLine, TopiaContext topiaContext) throws LimaException { + public void importEntriesCSV(String[] nextLine, Map<Integer, List<EntryImport>> entries, TopiaContext topiaContext) throws LimaException { int num = new Integer(nextLine[1]); EntryImport entryImport = new EntryImportImpl(); @@ -605,7 +584,7 @@ entryImport.setDetail(nextLine[6]); entryImport.setVoucher(nextLine[7]); entryImport.setPosition(nextLine[8]); - entryImport.setAccount(nextLine[0]); + entryImport.setAccount(nextLine[9]); if (entries.containsKey(num)){ List<EntryImport> entryImports = entries.get(num); @@ -622,7 +601,7 @@ //################ CREATE ENTITY IN DB FOR IMPORT ################ - public String createFinancialStatements(TopiaContext topiaContext) throws LimaException { + public String createFinancialStatements(Map<String, FinancialStatementImport> financialStatements, TopiaContext topiaContext) throws LimaException { String result = ""; try { @@ -684,7 +663,7 @@ return result; } - public String createFiscalPeriod(TopiaContext topiaContext){ + public String createFiscalPeriod(List<FiscalPeriod> fiscalPeriods, TopiaContext topiaContext){ String result = ""; for (FiscalPeriod fiscalPeriod : fiscalPeriods) { //create fiscalPeriod @@ -700,7 +679,7 @@ return result; } - public String createAccounts(TopiaContext topiaContext) throws LimaException { + public String createAccounts(Map<String, AccountImport> accounts, TopiaContext topiaContext) throws LimaException { String result = ""; try { @@ -750,7 +729,7 @@ return result; } - public String updateClosedPeriodicEntryBooks (TopiaContext topiaContext) throws LimaException { + public String updateClosedPeriodicEntryBooks (List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks, TopiaContext topiaContext) throws LimaException { String result=""; try { @@ -794,7 +773,7 @@ return result; } - public String createFinancialTransactionsAndEntries (TopiaContext topiaContext) throws LimaException { + public String createFinancialTransactionsAndEntries (Map<Integer, FinancialTransactionImport> financialTransactions, Map<Integer, List<EntryImport>> entries, TopiaContext topiaContext) throws LimaException { String result = ""; try { EntryBookDAO entryBookDAO = LimaCallaoDAOHelper.getEntryBookDAO(topiaContext); @@ -807,7 +786,8 @@ FinancialTransaction financialTransaction = new FinancialTransactionImpl(); Date dateFinancialTransaction = sdf.parse(financialTransactionImport.getDate()); financialTransaction.setTransactionDate(dateFinancialTransaction); - + financialTransaction.setAmountDebit(new Double(financialTransactionImport.getAmountDebit())); + financialTransaction.setAmountCredit(new Double(financialTransactionImport.getAmountCredit())); EntryBook entryBook = entryBookDAO.findByCode(financialTransactionImport.getCodeEntryBook()); financialTransaction.setEntryBook(entryBook); @@ -828,7 +808,6 @@ entry.setDetail(entryImport.getDetail()); entry.setVoucher(entryImport.getVoucher()); entry.setPosition(entryImport.getPosition()); - log.debug(entry); entryDAO.create(entry); financialTransaction.addEntry(entry); } Added: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java (rev 0) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FinancialPeriodComparator.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -0,0 +1,35 @@ +/* *##% Lima Business + * Copyright (C) 2008 - 2010 CodeLutin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * ##%* + */ + +package org.chorem.lima.business.utils; + +import java.util.Comparator; +import org.chorem.lima.entity.FinancialPeriod; + +public class FinancialPeriodComparator implements Comparator<FinancialPeriod>{ + + /** + * sort by financial begin date + */ + @Override + public int compare(FinancialPeriod o1, FinancialPeriod o2) { + return o1.getBeginDate().compareTo(o2.getBeginDate()); + } + +} Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPeriodComparator.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -25,7 +25,7 @@ public class FiscalPeriodComparator implements Comparator<FiscalPeriod>{ /** - * sort by accout number in lexicographical order + * sort by fiscal begin date */ @Override public int compare(FiscalPeriod o1, FiscalPeriod o2) { Modified: trunk/lima-callao/src/main/xmi/accounting.zargo =================================================================== (Binary files differ) Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/ImportExportHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/ImportExportHandler.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/ImportExportHandler.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -1,5 +1,6 @@ package org.chorem.lima.ui; +import static org.nuiton.i18n.I18n._; import javax.swing.JFileChooser; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -40,7 +41,7 @@ if (chooser.showOpenDialog(view) == JFileChooser.APPROVE_OPTION) { String filePath = chooser.getSelectedFile().getAbsolutePath(); String message = importExport.importFromCsvFile(filePath, ""); - DialogHelper.showMessageDialog(message); + DialogHelper.showReportDialog(message, _("lima.importexport.import"), view); } } else { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -19,17 +19,14 @@ package org.chorem.lima.ui; import static org.nuiton.i18n.I18n._; - import java.awt.Desktop; import java.net.URL; import java.util.Locale; - import jaxx.runtime.JAXXContext; import jaxx.runtime.swing.AboutPanel; import jaxx.runtime.swing.editor.config.ConfigUI; import jaxx.runtime.swing.editor.config.ConfigUIBuilder; import jaxx.runtime.swing.editor.config.model.ConfigUIModel; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaConfig; Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -273,7 +273,7 @@ String filePath = chooser.getSelectedFile().getAbsolutePath(); String message = importExport.importFromCsvFile(filePath, "importAccountsChart"); accountsTreeTableModel.refreshTree(); - DialogHelper.showMessageDialog(message); + DialogHelper.showReportDialog(message, _("lima.importexport.import"), view); } } else { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/entrybook/EntryBookViewHandler.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -166,7 +166,7 @@ String filePath = chooser.getSelectedFile().getAbsolutePath(); String message = importExport.importFromCsvFile(filePath, "importEntryBookChart"); entryBookTableModel.refreshTable(); - DialogHelper.showMessageDialog(message); + DialogHelper.showReportDialog(message, _("lima.importexport.import"), view); } } else { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/financialstatementchart/FinancialStatementChartViewHandler.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -274,7 +274,7 @@ String filePath = chooser.getSelectedFile().getAbsolutePath(); String message = importExport.importFromCsvFile(filePath, "importFinancialStatementsChart"); treeTableModel.refreshTree(); - DialogHelper.showMessageDialog(message); + DialogHelper.showReportDialog(message, _("lima.importexport.import"), view); } } else { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/home/HomeViewHandler.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -2,14 +2,10 @@ import static org.nuiton.i18n.I18n._; import java.awt.Color; -import java.io.IOException; import java.util.List; import javax.swing.JEditorPane; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; -import javax.swing.text.html.HTMLDocument; -import javax.swing.text.html.HTMLFrameHyperlinkEvent; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaContext; @@ -24,7 +20,6 @@ import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.service.LimaServiceFactory; import org.chorem.lima.ui.MainView; -import org.chorem.lima.util.DialogHelper; public class HomeViewHandler implements HyperlinkListener { Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2010-07-07 10:58:46 UTC (rev 2965) @@ -19,8 +19,15 @@ package org.chorem.lima.util; import static org.nuiton.i18n.I18n._; + +import java.awt.Component; + +import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.Resource; @@ -65,8 +72,7 @@ * @param titre * @param type */ - public static void showMessageDialog (String message,String titre,int type) - { + public static void showMessageDialog (String message,String titre,int type) { JFrame f = new JFrame(); f.setIconImage(Resource.getIcon("icons/lima.png").getImage()); JOptionPane.showMessageDialog( @@ -76,4 +82,23 @@ type); f.dispose(); } + + /** + * Permet d'afficher une boite de dialogue avec rapport + * @param message + * @param titre + * @param type + */ + public static void showReportDialog (String message, String title, Component parent) { + ReportDialogView reportDialogView = new ReportDialogView(); + reportDialogView.setIconImage(Resource.getIcon("icons/lima.png").getImage()); + JTextArea textArea = reportDialogView.getTextArea(); + textArea.setText(message); + reportDialogView.setSize(600,400); + reportDialogView.setTitle(title); + reportDialogView.setLocationRelativeTo(parent); + reportDialogView.setVisible(true); + } + + } Added: trunk/lima-swing/src/main/java/org/chorem/lima/util/ReportDialogView.jaxx =================================================================== --- trunk/lima-swing/src/main/java/org/chorem/lima/util/ReportDialogView.jaxx (rev 0) +++ trunk/lima-swing/src/main/java/org/chorem/lima/util/ReportDialogView.jaxx 2010-07-07 10:58:46 UTC (rev 2965) @@ -0,0 +1,41 @@ +<!-- ##% Lima Swing + Copyright (C) 2008 - 2010 CodeLutin + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + ##% --> + +<JDialog modal="true"> + <script> + <![CDATA[ + protected void performOk() { + dispose(); + } + ]]> + </script> + + <Table> + <row weightx="1" weighty="1"> + <cell fill="both"> + <JScrollPane id="scrollPane"> + <JTextArea id="textArea" editable="false"/> + </JScrollPane> + </cell> + </row> + <row anchor="east"> + <cell> + <JButton id="okButton" text="lima.common.ok" onActionPerformed="performOk()"/> + </cell> + </row> + </Table> +</JDialog> \ No newline at end of file Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-en_GB.properties 2010-07-07 10:58:46 UTC (rev 2965) @@ -52,6 +52,7 @@ lima.date=Date lima.debit=Debit lima.description=Description +lima.dialogreport= lima.entries=Entries lima.entries.addtransaction= lima.entries.lettering= Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties =================================================================== --- trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-07-06 16:39:52 UTC (rev 2964) +++ trunk/lima-swing/src/main/resources/i18n/lima-swing-fr_FR.properties 2010-07-07 10:58:46 UTC (rev 2965) @@ -52,6 +52,7 @@ lima.date=Date lima.debit=Debit lima.description=Description +lima.dialogreport= lima.entries=Traitement lima.entries.addtransaction=Saisir des \u00E9critures lima.entries.lettering=Ajouter une lettre