From jpepin@users.chorem.org Tue Jul  6 18:39:52 2010
From: jpepin@users.chorem.org
To: lima-commits@list.chorem.org
Subject: [Lima-commits] r2964 - in trunk: .
	lima-business/src/main/java/org/chorem/lima/business/accountingrules
	lima-business/src/main/java/org/chorem/lima/business/ejb
	lima-business/src/main/java/org/chorem/lima/business/utils
	lima-callao/src/main/xmi	lima-swing/src/main/java/org/chorem/lima/ui/account
	lima-swing/src/main/java/org/chorem/lima/util
Date: Tue, 06 Jul 2010 18:39:52 +0200
Message-ID: <20100706163952.5A20A159FB@nuiton.codelutin.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============6928888797668626575=="

--===============6928888797668626575==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Author: jpepin
Date: 2010-07-06 18:39:52 +0200 (Tue, 06 Jul 2010)
New Revision: 2964

Url: http://chorem.org/repositories/revision/lima/2964

Log:
Import / Export (suite)

Added:
   trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPer=
iodComparator.java
Modified:
   trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrules=
/FranceAccountingRules.java
   trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServi=
ceImpl.java
   trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTr=
ansactionServiceImpl.java
   trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServi=
ceImpl.java
   trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountCo=
mparator.java
   trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryComp=
arator.java
   trunk/lima-callao/src/main/xmi/accounting.zargo
   trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandl=
er.java
   trunk/lima-swing/src/main/java/org/chorem/lima/util/ImportExport.java
   trunk/pom.xml

Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/accounti=
ngrules/FranceAccountingRules.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrule=
s/FranceAccountingRules.java	2010-07-05 17:07:51 UTC (rev 2963)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/accountingrule=
s/FranceAccountingRules.java	2010-07-06 16:39:52 UTC (rev 2964)
@@ -161,6 +161,8 @@
             Date loopDate =3D fiscalPeriod.getBeginDate();
             while(loopDate.before(endDate)){
                 FinancialPeriod financialPeriod =3D new FinancialPeriodImpl(=
);
+                //important for fiscalperiod created from import, it can be =
locked, so financialperiods must be locked
+                financialPeriod.setLocked(fiscalPeriod.getLocked());
                 financialPeriod.setBeginDate(loopDate);
                 loopDate =3D DateUtils.addMonths(loopDate, 1);
                 loopDate =3D DateUtils.truncate(loopDate, Calendar.MONTH);

Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/Expo=
rtServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServ=
iceImpl.java	2010-07-05 17:07:51 UTC (rev 2963)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServ=
iceImpl.java	2010-07-06 16:39:52 UTC (rev 2964)
@@ -101,11 +101,9 @@
 			exportEntryBookChartAsCSV(topiaContext);
 			exportFinancialStatementChartAsCSV(topiaContext);
 			exportFiscalPeriodAsCSV(topiaContext);
-			exportFinancialPeriodAsCSV(topiaContext);
 			exportClosedPeriodicEntryBooksAsCSV(topiaContext);
-			exportFinancialTransactionsAsCSV(topiaContext);
-			exportEntriesAsCSV(topiaContext);
-		    // Write cache in file
+			exportFinancialTransactionsAndEntriesAsCSV(topiaContext);
+		    // Write cache in string
 		    csvWriter.flush();
 		    csvWriter.close();
 		}
@@ -120,7 +118,8 @@
 		}
 		return out.getBuffer().toString();=09
     }
-=09
+
+   =20
     /**
      * Remote methode call from UI.
      */
@@ -148,6 +147,7 @@
 		}
 		return out.getBuffer().toString();
 	}
+
 =09
 	/**
 	 * Local methode, export financialstatements from database
@@ -194,6 +194,7 @@
 		    doCatch(topiaContext, eeeTE, log);
 		}		=09
 	}
+
 =09
     /**
      * Remote methode call from UI.
@@ -249,6 +250,7 @@
             doCatch(topiaContext, eeeTE, log);
 		}
 	}
+
 =09
     /**
      * Remote methode call from UI.
@@ -277,6 +279,7 @@
 		return out.getBuffer().toString();
 	}
=20
+=09
 	/**
 	 * Local methode, export accounts from database
 	 * Structure : TYPE | AccountNumber | Label |=C2=A0ThirdParty |=C2=A0MasteA=
ccount | GeneralLedger
@@ -315,79 +318,68 @@
             doCatch(topiaContext, eeeTE, log);
 		}=09
 	}
+
 =09
 	/**
 	 * Local methode, export financialtransactions from database
-	 * Structue : TYPE | TransactionDate |=C2=A0AmountDebit |=C2=A0AmountCredit
+	 * Structure : TYPE | TransactionDate |=C2=A0AmountDebit |=C2=A0AmountCredit
 	 * 	| FinancialPeriod BeginDate | FinancialPeriod EndDate |=C2=A0EntryBook =
Code
 	 */
-	public void exportFinancialTransactionsAsCSV(TopiaContext topiaContext) thr=
ows LimaException {
-        String[] nextLine =3D new String[7];
+	public void exportFinancialTransactionsAndEntriesAsCSV(TopiaContext topiaCo=
ntext) throws LimaException {
+        int numTransaction =3D 0;
         // Get all financialtransactions
         try {
-	        FinancialTransactionDAO financialTransactionDAO =3D LimaCallaoDAOHe=
lper.getFinancialTransactionDAO(topiaContext);
-	        List<FinancialTransaction> listFinancialTransaction =3D financialTr=
ansactionDAO.findAll();
+	        FinancialTransactionDAO financialTransactionDAO =3D
+	        	LimaCallaoDAOHelper.getFinancialTransactionDAO(topiaContext);
+	        List<FinancialTransaction> listFinancialTransaction =3D
+	        	financialTransactionDAO.findAll();
 	        // For all financialTransaction
 	        for (FinancialTransaction financialTransaction : listFinancialTrans=
action) {
+	            String[] nextLine =3D new String[8];
 	            nextLine[0] =3D "FTRC";
-	            nextLine[1] =3D sdf.format(financialTransaction.getTransactionD=
ate());
-	            nextLine[2] =3D new Double(
-	            		financialTransaction.getAmountDebit()).toString();
+	            nextLine[1] =3D String.valueOf(numTransaction);
+	            nextLine[2] =3D
+	            	sdf.format(financialTransaction.getTransactionDate());
 	            nextLine[3] =3D new Double(
+	            		financialTransaction.getAmountDebit()).toString();
+	            nextLine[4] =3D new Double(
 	            		financialTransaction.getAmountCredit()).toString();
-	            nextLine[4] =3D sdf.format(financialTransaction.getFinancialPer=
iod().
+	            nextLine[5] =3D
+	            	sdf.format(financialTransaction.getFinancialPeriod().
 	            	getBeginDate());
-	            nextLine[5] =3D sdf.format(financialTransaction.getFinancialPer=
iod().
+	            nextLine[6] =3D
+	            	sdf.format(financialTransaction.getFinancialPeriod().
 	            	getEndDate());
-	            nextLine[6] =3D financialTransaction.getEntryBook().getCode();
+	            EntryBook entryBook =3D financialTransaction.getEntryBook();
+	            if (entryBook !=3D null){
+		            nextLine[7] =3D entryBook.getCode();
+	            }
 	            // Ajoute la ligne au fichier
 	            csvWriter.writeNext(nextLine);
+	           =20
+		        nextLine =3D new String[10];
+	            for (Entry entry : financialTransaction.getEntry()) {
+		            nextLine[0] =3D "NTRY";
+		            nextLine[1] =3D String.valueOf(numTransaction);
+		            nextLine[2] =3D entry.getDescription();
+		            nextLine[3] =3D new Double(entry.getAmount()).toString();
+		            nextLine[4] =3D new Boolean(entry.getDebit()).toString();
+		            nextLine[5] =3D entry.getLettering();
+		            nextLine[6] =3D entry.getDetail();
+		            nextLine[7] =3D entry.getVoucher();
+		            nextLine[8] =3D entry.getPosition();
+		            nextLine[9] =3D entry.getAccount().getAccountNumber();
+		            // Ajoute la ligne au fichier
+		            csvWriter.writeNext(nextLine);
+		        }
+	            numTransaction++;
 	        }
         }
 		catch (TopiaException eeeTE){
             doCatch(topiaContext, eeeTE, log);
 		}=09
 	}
-=09
-	/**
-	 * Local methode, export entries from database
-	 * Structure : TYPE | Description | Amount | Debit | Lettering |=C2=A0Detai=
l |=20
-	 * Voucher |=C2=A0Position |=C2=A0FinancialTransaction Date | FinancialTran=
saction Code |
-	 * FinancialTransaction AmountDebit |=C2=A0FinancialTransaction AmountCredit
-	 */
-	public void exportEntriesAsCSV(TopiaContext topiaContext) throws LimaExcept=
ion {
-        try {
-	        String[] nextLine =3D new String[12];
-	        // Get all Entry
-	        EntryDAO entryDAO =3D LimaCallaoDAOHelper.getEntryDAO(topiaContext);
-	        List<Entry> listEntry =3D entryDAO.findAll();
-	        // For all Entry
-	        for (Entry entry : listEntry) {
-	            nextLine[0] =3D "NTRY";
-	            nextLine[1] =3D entry.getDescription();
-	            nextLine[2] =3D new Double(entry.getAmount()).toString();
-	            nextLine[3] =3D new Boolean(entry.getDebit()).toString();
-	            nextLine[4] =3D entry.getLettering();
-	            nextLine[5] =3D entry.getVoucher();
-	            nextLine[6] =3D entry.getPosition();
-	            nextLine[7] =3D entry.getAccount().getAccountNumber();
-	            nextLine[8] =3D sdf.format(entry.getFinancialTransaction().
-	            	getTransactionDate());
-	            nextLine[9] =3D entry.getFinancialTransaction().
-	            	getEntryBook().getCode();
-	            nextLine[10] =3D new Double(entry.getFinancialTransaction()
-	            		.getAmountDebit()).toString();
-	            nextLine[11] =3D new Double(entry.getFinancialTransaction()
-	            		.getAmountCredit()).toString();
=20
-	            // Ajoute la ligne au fichier
-	            csvWriter.writeNext(nextLine);
-	        }
-		}
-		catch (TopiaException eeeTE){
-            doCatch(topiaContext, eeeTE, log);
-		}
-	}
 =09
 	/**
 	 * Local methode, export fiscalperiods from database
@@ -416,40 +408,6 @@
 		}
 	}
 =09
-	/**
-	 * Local methode, export financialperiods from database
-	 * Structure : TYPE | BeginDate | EndDate |=C2=A0Locked | FiscalPeriod begi=
nDate | FiscalPeriod endDate
-	 */
-	public void exportFinancialPeriodAsCSV(TopiaContext topiaContext) throws Li=
maException {
-        try {
-	        String[] nextLine =3D new String[6];
-	        // Get all fiscalperiod
-	        FinancialPeriodDAO financialPeriodDAO =3D
-	        	LimaCallaoDAOHelper.getFinancialPeriodDAO(topiaContext);
-	        List<FinancialPeriod> listFinancialPeriod =3D
-	        	financialPeriodDAO.findAll();
-	       =20
-	        FiscalPeriodDAO fiscalPeriodDAO =3D
-	        	LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
-	       =20
-	        // For all Entry
-	        for (FinancialPeriod financialPeriod : listFinancialPeriod) {
-	            nextLine[0] =3D "FNCP";
-	            nextLine[1] =3D sdf.format(financialPeriod.getBeginDate());
-	            nextLine[2] =3D sdf.format(financialPeriod.getEndDate());
-	            nextLine[3] =3D new Boolean(financialPeriod.getLocked()).toStri=
ng();
-	            FiscalPeriod fiscalPeriod =3D fiscalPeriodDAO.
-	            	findContainsFinancialPeriod(financialPeriod);
-	            nextLine[4] =3D sdf.format(fiscalPeriod.getBeginDate());
-	            nextLine[5] =3D sdf.format(fiscalPeriod.getEndDate());
-	            // Ajoute la ligne au fichier
-	            csvWriter.writeNext(nextLine);
-	        }
-		}
-		catch (TopiaException eeeTE){
-            doCatch(topiaContext, eeeTE, log);
-		}
-	}
 =09
 	/**
 	 * Local methode, export ClosedPeriodicEntryBooks from database
@@ -468,9 +426,11 @@
 	            nextLine[0] =3D "CPEB";
 	            nextLine[1] =3D new Boolean(
 	            		closedPeriodicEntryBook.getLocked()).toString();
-	            nextLine[2] =3D sdf.format(closedPeriodicEntryBook.getFinancial=
Period().
+	            nextLine[2] =3D
+	            	sdf.format(closedPeriodicEntryBook.getFinancialPeriod().
 	            	getBeginDate());
-	            nextLine[3] =3Dsdf.format(closedPeriodicEntryBook.getFinancialP=
eriod().
+	            nextLine[3] =3D
+	            	sdf.format(closedPeriodicEntryBook.getFinancialPeriod().
 	            	getEndDate());
 	            nextLine[4] =3D closedPeriodicEntryBook.getEntryBook().getCode(=
);
 	            // Ajoute la ligne au fichier

Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/Fina=
ncialTransactionServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialT=
ransactionServiceImpl.java	2010-07-05 17:07:51 UTC (rev 2963)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialT=
ransactionServiceImpl.java	2010-07-06 16:39:52 UTC (rev 2964)
@@ -23,8 +23,6 @@
 import java.util.Date;
 import java.util.List;
 import javax.ejb.Stateless;
-import javax.management.Query;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.chorem.lima.business.AccountingRules;
@@ -32,7 +30,6 @@
 import org.chorem.lima.business.FinancialTransactionServiceLocal;
 import org.chorem.lima.business.LimaConfig;
 import org.chorem.lima.business.LimaException;
-import org.chorem.lima.entity.ClosedPeriodicEntryBook;
 import org.chorem.lima.entity.Entry;
 import org.chorem.lima.entity.EntryBook;
 import org.chorem.lima.entity.EntryDAO;
@@ -47,7 +44,6 @@
 import org.nuiton.topia.TopiaException;
 import org.nuiton.topia.TopiaNotFoundException;
 import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.topia.framework.TopiaQuery.Op;
=20
 /**
  * Cette classe permet la cr=C3=A9ation d'une transaction comptable dans l'a=
pplication.
@@ -416,9 +412,7 @@
             entryOld.setAccount(entry.getAccount());
             entryOld.setAmount(entryAmount);
             entryOld.setDebit(entryAmountBool);
-            entryOld.setDescription(entry.getDescription());
             entryOld.setFinancialTransaction(entry.getFinancialTransaction()=
);
-            entryOld.setVoucher(entry.getVoucher());
             entryOld.setPosition(entry.getPosition());
             entryOld.setLettering(entry.getLettering());
            =20

Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/Impo=
rtServiceImpl.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServ=
iceImpl.java	2010-07-05 17:07:51 UTC (rev 2963)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServ=
iceImpl.java	2010-07-06 16:39:52 UTC (rev 2964)
@@ -24,9 +24,12 @@
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.TreeMap;
 import javax.ejb.EJB;
 import javax.ejb.Stateless;
@@ -34,30 +37,44 @@
 import org.apache.commons.logging.LogFactory;
 import org.chorem.lima.beans.AccountImport;
 import org.chorem.lima.beans.AccountImportImpl;
-import org.chorem.lima.beans.FinancialPeriodImport;
-import org.chorem.lima.beans.FinancialPeriodImportImpl;
+import org.chorem.lima.beans.ClosedPeriodicEntryBookImport;
+import org.chorem.lima.beans.ClosedPeriodicEntryBookImportImpl;
+import org.chorem.lima.beans.EntryImport;
+import org.chorem.lima.beans.EntryImportImpl;
 import org.chorem.lima.beans.FinancialStatementImport;
 import org.chorem.lima.beans.FinancialStatementImportImpl;
+import org.chorem.lima.beans.FinancialTransactionImport;
+import org.chorem.lima.beans.FinancialTransactionImportImpl;
 import org.chorem.lima.business.AccountServiceLocal;
 import org.chorem.lima.business.EntryBookServiceLocal;
+import org.chorem.lima.business.FinancialPeriodServiceLocal;
 import org.chorem.lima.business.FinancialStatementServiceLocal;
 import org.chorem.lima.business.FinancialTransactionServiceLocal;
+import org.chorem.lima.business.FiscalPeriodServiceLocal;
 import org.chorem.lima.business.ImportService;
 import org.chorem.lima.business.ImportServiceLocal;
 import org.chorem.lima.business.LimaConfig;
 import org.chorem.lima.business.LimaException;
+import org.chorem.lima.business.utils.FiscalPeriodComparator;
 import org.chorem.lima.entity.Account;
 import org.chorem.lima.entity.AccountDAO;
 import org.chorem.lima.entity.AccountImpl;
+import org.chorem.lima.entity.ClosedPeriodicEntryBook;
+import org.chorem.lima.entity.ClosedPeriodicEntryBookDAO;
+import org.chorem.lima.entity.Entry;
 import org.chorem.lima.entity.EntryBook;
 import org.chorem.lima.entity.EntryBookDAO;
 import org.chorem.lima.entity.EntryBookImpl;
+import org.chorem.lima.entity.EntryDAO;
+import org.chorem.lima.entity.EntryImpl;
 import org.chorem.lima.entity.FinancialPeriod;
 import org.chorem.lima.entity.FinancialPeriodDAO;
-import org.chorem.lima.entity.FinancialPeriodImpl;
 import org.chorem.lima.entity.FinancialStatement;
 import org.chorem.lima.entity.FinancialStatementDAO;
 import org.chorem.lima.entity.FinancialStatementImpl;
+import org.chorem.lima.entity.FinancialTransaction;
+import org.chorem.lima.entity.FinancialTransactionDAO;
+import org.chorem.lima.entity.FinancialTransactionImpl;
 import org.chorem.lima.entity.FiscalPeriod;
 import org.chorem.lima.entity.FiscalPeriodDAO;
 import org.chorem.lima.entity.FiscalPeriodImpl;
@@ -85,10 +102,18 @@
    =20
     private TopiaContext rootContext;
    =20
+    //Services
+   =20
     @EJB
     AccountServiceLocal accountService;
    =20
     @EJB
+    FiscalPeriodServiceLocal fiscalPeriodService;
+   =20
+    @EJB
+    FinancialPeriodServiceLocal financialPeriodService;
+   =20
+    @EJB
     FinancialTransactionServiceLocal financialTransactionService;
=20
     @EJB
@@ -97,9 +122,27 @@
     @EJB
     EntryBookServiceLocal entryBookService;
    =20
+    //Import datas lists
+   =20
+    Map<String, AccountImport> accounts;
+   =20
+    Map<String, FinancialStatementImport> financialStatements;
+   =20
+    List<FiscalPeriod> fiscalPeriods;
+       =20
+    List<ClosedPeriodicEntryBookImport> closedPeriodicEntryBooks;
+   =20
+    Map<Integer, FinancialTransactionImport> financialTransactions;
+   =20
+    Map<Integer, List<EntryImport>> entries;
+   =20
+    //Utils
+   =20
     protected CSVWriter csvWriter;
    =20
     protected SimpleDateFormat sdf;
+   =20
+   =20
=20
     public ImportServiceImpl() {
         LimaConfig config =3D LimaConfig.getInstance();
@@ -115,10 +158,6 @@
=20
 	//################   IMPORT THIRD PART ACCOUNTING SOFTWARE   ##############=
##
    =20
-   =20
-    /*
-     * @see org.chorem.lima.business.ImportExportService#importAsEBPCSV(byte=
[])
-     */
     @Override
     public void importAsEbpCSV(byte[] data) throws LimaException {
        =20
@@ -139,27 +178,26 @@
 =09
 	//################   IMPORT   ################
=20
-=09
+	/**
+	 * Remote methode to call all entities import from UI
+	 */
 	@Override
 	public String importCSV(String datas) throws LimaException {
         String result =3D "";
        =20
-        //Accounts
-        TreeMap<String, AccountImport> accounts =3D
-        	new TreeMap<String, AccountImport>();
+        accounts =3D new TreeMap<String, AccountImport>();
        =20
-        //FinancialStatements
-        TreeMap<String, FinancialStatementImport> financialStatements =3D
-        	new TreeMap<String, FinancialStatementImport>();
+        financialStatements =3D new TreeMap<String, FinancialStatementImport=
>();
        =20
-        //FiscalPeriods
-        List<FiscalPeriod> fiscalPeriods =3D new ArrayList<FiscalPeriod>();
+        fiscalPeriods =3D new ArrayList<FiscalPeriod>();
+               =20
+        closedPeriodicEntryBooks =3D new ArrayList<ClosedPeriodicEntryBookIm=
port>();
        =20
-        //FinancialPeriods
-        List<FinancialPeriodImport> financialPeriodImports =3D
-        	new ArrayList<FinancialPeriodImport>();
+        financialTransactions =3D new HashMap<Integer,FinancialTransactionIm=
port>();
        =20
-
+        entries =3D new HashMap<Integer, List<EntryImport>>();
+      =20
+       =20
         TopiaContext topiaContext =3D null;
         try {
         	topiaContext =3D beginTransaction();
@@ -171,42 +209,42 @@
 	        while ((nextLine =3D csvReader.readNext()) !=3D null) {
                 String indice =3D nextLine[0];
                 if (indice.equals("ACCN")){
-                    accounts =3D importAccountsChartsCSV(
-                    		nextLine, accounts, topiaContext);
+                	result +=3D importAccountsChartsCSV(nextLine, topiaContext);
                 }
                 else if (indice.equals("ENBK")){
-                	result +=3D importEntryBooksChartCSV(
-                			nextLine, topiaContext);
+                	result +=3D importEntryBooksChartCSV(nextLine, topiaContext=
);
                 }
                 else if (indice.equals("FNST")){
-                	financialStatements =3D importFinancialsStatementChartCSV(
-                			nextLine, financialStatements, topiaContext);
+                	result +=3D importFinancialsStatementChartCSV(nextLine, top=
iaContext);
                 }
                 else if (indice.equals("FSCP")){
-                	fiscalPeriods =3D importFiscalPeriodCSV(nextLine, fiscalPer=
iods, topiaContext);
+                	result +=3D importFiscalPeriodCSV(nextLine, topiaContext);
                 }
-                else if (indice.equals("FNCP")){
-                	financialPeriodImports =3D importFinancialPeriodChartCSV(ne=
xtLine, financialPeriodImports, topiaContext);
-                }
                 else if (indice.equals("CPEB")){
-                	//result+=3D
+                	importClosedPeriodicEntryBookCSV(nextLine, topiaContext);
                 }
                 else if (indice.equals("FTRC")){
-                	//result+=3D
+                	importFinancialTransactionsCSV(nextLine, topiaContext);
                 }
                 else if (indice.equals("NTRY")){
-                	//result+=3D
+                	importEntriesCSV(nextLine, topiaContext);
                 }
 	        }
 	       =20
 	        //create accounts
-	        result+=3DcreateAccounts(accounts, topiaContext);
+	        result +=3D createAccounts(topiaContext);
 	        //create financialStatements
-	        result+=3DcreateFinancialStatements(financialStatements, topiaConte=
xt);
+	        result +=3D createFinancialStatements(topiaContext);
 	        //create fiscalperiod
+	        Collections.sort(fiscalPeriods, new FiscalPeriodComparator());
+	        result +=3D createFiscalPeriod(topiaContext);
+	        //update closedperiodicentrybooks
+	        result +=3D updateClosedPeriodicEntryBooks(topiaContext);
+	        //create financialtransaction and entries
+	        result +=3D createFinancialTransactionsAndEntries(topiaContext);
 	       =20
-	        //create financialperiod
-	        result+=3DcreateFinancialPeriod(financialPeriodImports, topiaContex=
t);
+            commitTransaction(topiaContext);
+
         }
 		catch (TopiaException eeeTE){
             doCatch(topiaContext, eeeTE, log);
@@ -220,6 +258,10 @@
 		return result;
 	}
 =09
+=09
+	/**
+	 * Remote methode to call entrybooks import from UI
+	 */
 	@Override
 	public String importEntryBooksChartAsCSV(String datas) throws LimaException{
         String result =3D "";
@@ -234,7 +276,7 @@
 	        while ((nextLine =3D csvReader.readNext()) !=3D null) {
                 String indice =3D nextLine[0];
                 if (indice.equals("ENBK")){
-                	result+=3DimportEntryBooksChartCSV(nextLine, topiaContext);
+                	result +=3D importEntryBooksChartCSV(nextLine, topiaContext=
);
                 }
 	        }
         }
@@ -251,12 +293,15 @@
 	}
=20
 =09
+	/**
+	 * Remote methode to call financialStatements import from UI
+	 */
 	@Override
 	public String importFinancialStatementsChartAsCSV(String datas) throws Lima=
Exception {
         String result =3D "";
        =20
         //FinancialStatements
-        TreeMap<String, FinancialStatementImport> financialStatements =3D
+        financialStatements =3D
         	new TreeMap<String, FinancialStatementImport>();
=20
         TopiaContext topiaContext =3D null;
@@ -269,13 +314,12 @@
 	        while ((nextLine =3D csvReader.readNext()) !=3D null) {
                 String indice =3D nextLine[0];
                 if (indice.equals("FNST")){
-                	financialStatements =3D importFinancialsStatementChartCSV(
-                			nextLine, financialStatements, topiaContext);
+                	result +=3D importFinancialsStatementChartCSV(nextLine, top=
iaContext);
                 }
 	        }
 	       =20
 	        //create financialStatements
-	        result+=3DcreateFinancialStatements(financialStatements, topiaConte=
xt);
+	        result +=3D createFinancialStatements(topiaContext);
         }
 		catch (TopiaException eeeTE){
             doCatch(topiaContext, eeeTE, log);
@@ -290,12 +334,15 @@
 	}
 =09
 =09
+	/**
+	 * Remote methode to call accounts import from UI
+	 */
 	@Override
 	public String importAccountsChartAsCSV(String datas) throws LimaException {
         String result =3D "";
        =20
         //Accounts
-        TreeMap<String, AccountImport> accounts =3D
+        accounts =3D
         	new TreeMap<String, AccountImport>();
=20
         TopiaContext topiaContext =3D null;
@@ -309,13 +356,12 @@
 	        while ((nextLine =3D csvReader.readNext()) !=3D null) {
                 String indice =3D nextLine[0];
                 if (indice.equals("ACCN")){
-                    accounts =3D importAccountsChartsCSV(
-                    		nextLine, accounts, topiaContext);
-                }
+                	result +=3D importAccountsChartsCSV(nextLine, topiaContext);
+                }=09
 	        }
 	       =20
 	        //create accounts
-	        result+=3DcreateAccounts(accounts, topiaContext);
+	        result +=3D createAccounts(topiaContext);
         }
 		catch (TopiaException eeeTE){
             doCatch(topiaContext, eeeTE, log);
@@ -329,7 +375,15 @@
 		return result;
 	}
 =09
-	public TreeMap<String, AccountImport> importAccountsChartsCSV(String[] next=
Line, TreeMap<String, AccountImport> accounts, TopiaContext topiaContext) thr=
ows LimaException{
+=09
+	//################ Import entities an put to lists  ################
+=09
+	/**
+	 * Import and create accounts
+	 * Structure : TYPE | accountNumber | label |=C2=A0thirdparty | masterAccou=
ntNumber |=C2=A0generalLedgerNumber
+	 */
+	public String importAccountsChartsCSV(String[] nextLine, TopiaContext topia=
Context) throws LimaException{
+		String result =3D "";
 	=09
         String accountNumber =3D nextLine[1];
         String label =3D nextLine[2];
@@ -353,16 +407,15 @@
             	// put it in hashset
             	accounts.put(accountNumber, accountImport);
             }
-            /*else {
+            else {
             	result +=3D "FAILED : The account "
             		+ accountNumber + " already exists !\n";
-            }*/
+            }
         }
 		catch (TopiaException eeeTE){
             doCatch(topiaContext, eeeTE, log);
 		}
-	=09
-		return accounts;
+		return result;
 	}
 =09
 =09
@@ -370,8 +423,9 @@
 	 * Import and create fiscal period
 	 * Structure : TYPE | BeginDate | EndDate |=C2=A0Locked
 	 */
-	public List<FiscalPeriod> importFiscalPeriodCSV(String[] nextLine, List<Fis=
calPeriod> fiscalPeriods, TopiaContext topiaContext) throws LimaException {
-        try {
+	public String importFiscalPeriodCSV(String[] nextLine, TopiaContext topiaCo=
ntext) throws LimaException {
+        String result =3D"";
+		try {
             FiscalPeriodDAO fiscalPeriodDAO =3D
             	LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
            =20
@@ -386,6 +440,10 @@
             if (fiscalPeriodDAO.findByNaturalId(beginDate, endDate) =3D=3D n=
ull){
                 fiscalPeriods.add(fiscalPeriod);
             }
+            else {
+            	result +=3D "FAILED : The fiscalperiod "
+            		+ beginDate + "-" + endDate + " already exists !\n";
+            }
         }=20
 		catch (ParseException eeePE) {
 			if(log.isDebugEnabled()){
@@ -395,10 +453,14 @@
 		catch (TopiaException eeeTE){
             doCatch(topiaContext, eeeTE, log);
 		}
-		return fiscalPeriods;
+		return result;
 	}
 =09
 =09
+	/**
+	 * Import and create entrybooks
+	 * Structure : TYPE | Code | Label |=C2=A0Type
+	 */
 	public String importEntryBooksChartCSV(String[] nextLine, TopiaContext topi=
aContext) throws LimaException {
 		String result =3D"";
         try {
@@ -429,9 +491,37 @@
 		return result;
 	}
 =09
+=09
+	/**
+	 * Import and create closedperiodicentrybook import
+	 * Structure : TYPE | BeginDate | EndDate |=C2=A0Locked
+	 */
+	public void importClosedPeriodicEntryBookCSV(String[] nextLine, TopiaContex=
t topiaContext) throws LimaException {		=09
+			String locked =3D nextLine[1];
+            String beginDate =3D nextLine[2];
+            String endDate =3D nextLine[3];
+            String entryBookCode =3D nextLine[4];
+           =20
+			if (new Boolean(locked)){
+				ClosedPeriodicEntryBookImport closedPeriodicEntryBookImport =3D new Clos=
edPeriodicEntryBookImportImpl();
+				closedPeriodicEntryBookImport.setLocked(locked);
+				closedPeriodicEntryBookImport.setBeginDateFinancialPeriod(beginDate);
+				closedPeriodicEntryBookImport.setEndDateFinancialPeriod(endDate);
+				closedPeriodicEntryBookImport.setCodeEntryBook(entryBookCode);
=20
-	public TreeMap<String, FinancialStatementImport> importFinancialsStatementC=
hartCSV(String[] nextLine, TreeMap<String, FinancialStatementImport> financia=
lStatements, TopiaContext topiaContext) throws LimaException {
-
+	            closedPeriodicEntryBooks.add(closedPeriodicEntryBookImport);
+			}
+	}
+=09
+=09
+	/**
+	 * Import and create financialstatement
+	 * Structure : TYPE | label | header |=C2=A0accounts | debitAccount | credi=
tAccount
+	 * | provisitionDeprecationAccounts | subAmount |=C2=A0headerAmount |=C2=A0=
masterFinancialStatement
+	 */
+	public String importFinancialsStatementChartCSV(String[] nextLine, TopiaCon=
text topiaContext) throws LimaException {
+		String result =3D "";
+	=09
         String label =3D nextLine[1];
         String header =3D nextLine[2];
         String accounts =3D nextLine[3];
@@ -467,66 +557,72 @@
             	// put it in hashset
 				financialStatements.put(label, financialStatementImport);
             }
-            /*else {
+            else {
             	result +=3D "FAILED : The financialstatement "
             		+ label + " already exists !\n";
-            }*/
+            }
         }
 		catch (TopiaException eeeTE){
             doCatch(topiaContext, eeeTE, log);
 		}
-		return financialStatements;
+		return result;
 	}
+
 =09
 	/**
-	 * Structure : TYPE | BeginDate | EndDate |=C2=A0Locked | FiscalPeriod begi=
nDate | FiscalPeriod endDate
+	 * Import and create financialtransactions
+	 * Structue : TYPE | NumTransac | TransactionDate |=C2=A0AmountDebit |=C2=
=A0AmountCredit
+	 * 	| FinancialPeriod BeginDate | FinancialPeriod EndDate |=C2=A0EntryBook =
Code
 	 */
+	public void importFinancialTransactionsCSV(String[] nextLine, TopiaContext =
topiaContext) throws LimaException {
+            int num =3D new Integer(nextLine[1]);
+            FinancialTransactionImport financialTransactionImport =3D new Fi=
nancialTransactionImportImpl();
+            financialTransactionImport.setDate(nextLine[2]);
+            financialTransactionImport.setAmountDebit(nextLine[3]);
+            financialTransactionImport.setAmountCredit(nextLine[4]);
+            financialTransactionImport.setBeginDateFinancialPeriod(nextLine[=
5]);
+            financialTransactionImport.setEndDateFinancialPeriod(nextLine[6]=
);
+            financialTransactionImport.setCodeEntryBook(nextLine[7]);
+           =20
+            financialTransactions.put(num, financialTransactionImport);
+	}
 =09
-	public List<FinancialPeriodImport> importFinancialPeriodChartCSV(String[] n=
extLine, List<FinancialPeriodImport> financialPeriodImports, TopiaContext top=
iaContext) throws LimaException {
-
-        String beginDate =3D nextLine[1];
-        String endDate =3D nextLine[2];
-        String locked =3D nextLine[3];
-        String beginDateFiscalPeriod =3D nextLine[4];
-        String endDateFiscalPeriod =3D nextLine[5];
-
-        try {
-
-            FinancialPeriodDAO financialPeriodDAO =3D
-            	LimaCallaoDAOHelper.getFinancialPeriodDAO(topiaContext);
+=09
+	/**
+	 * Import and create entries
+	 * Structure : TYPE | NumTransac | Description | Amount | Debit | Lettering=
 |=C2=A0Detail |=20
+	 * Voucher |=C2=A0Position |=C2=A0FinancialTransaction Date | FinancialTran=
saction EntryBookCode |
+	 * FinancialTransaction AmountDebit |=C2=A0FinancialTransaction AmountCredit
+	 */
+	public void importEntriesCSV(String[] nextLine, TopiaContext topiaContext) =
throws LimaException {
+            int num =3D new Integer(nextLine[1]);
            =20
-            //if exist, skip
-            if (financialPeriodDAO.findByNaturalId(sdf.parse(beginDate), sdf=
.parse(endDate)) =3D=3D null){
-            	//create it
-            	FinancialPeriodImport financialPeriodImport =3D
-            		new FinancialPeriodImportImpl();
-            	financialPeriodImport.setBeginDate(beginDate);
-            	financialPeriodImport.setEndDate(endDate);
-            	financialPeriodImport.setBeginDateFiscalPeriod(beginDateFiscalP=
eriod);
-            	financialPeriodImport.setEndDateFiscalPeriod(endDateFiscalPerio=
d);
-            	financialPeriodImport.setLocked(locked);
-            =09
-            	// put it in list
-            	financialPeriodImports.add(financialPeriodImport);
+            EntryImport entryImport =3D new EntryImportImpl();
+            entryImport.setDescription(nextLine[2]);
+            entryImport.setAmount(nextLine[3]);
+            entryImport.setDebit(nextLine[4]);
+            entryImport.setLettering(nextLine[5]);
+            entryImport.setDetail(nextLine[6]);
+            entryImport.setVoucher(nextLine[7]);
+            entryImport.setPosition(nextLine[8]);
+            entryImport.setAccount(nextLine[0]);
+           =20
+            if (entries.containsKey(num)){
+            	List<EntryImport> entryImports =3D entries.get(num);
+            	entryImports.add(entryImport);
             }
-        }
-		catch (ParseException eeePE) {
-			if(log.isDebugEnabled()){
-				log.debug("Can't parse date", eeePE);
-			}
-		}
-		catch (TopiaException eeeTE){
-            doCatch(topiaContext, eeeTE, log);
-		}
-
-		return financialPeriodImports;
+            else {
+            	List<EntryImport> entryImports =3D new ArrayList<EntryImport>();
+            	entryImports.add(entryImport);
+                entries.put(num, entryImports);
+            }
 	}
 =09
 =09
 	//################  CREATE ENTITY IN DB FOR IMPORT   ################
 =09
 =09
-	public String createFinancialStatements(TreeMap<String, FinancialStatementI=
mport> financialStatements, TopiaContext topiaContext) throws LimaException {
+	public String createFinancialStatements(TopiaContext topiaContext) throws L=
imaException {
         String result =3D "";
         try {
         =09
@@ -588,49 +684,23 @@
         return result;
 	}
 =09
-	public String createFinancialPeriod(List<FinancialPeriodImport> financialPe=
riodImports, TopiaContext topiaContext) throws LimaException{
+	public String createFiscalPeriod(TopiaContext topiaContext){
 		String result =3D "";
-		try {
-			FiscalPeriodDAO fiscalPeriodDAO =3D
-				LimaCallaoDAOHelper.getFiscalPeriodDAO(topiaContext);
-			FinancialPeriodDAO financialPeriodDAO =3D
-				LimaCallaoDAOHelper.getFinancialPeriodDAO(topiaContext);
-		=09
-			for (FinancialPeriodImport financialPeriodImport : financialPeriodImports=
) {
-				//create financialPeriod
-				FinancialPeriod financialPeriod =3D new FinancialPeriodImpl();
-				Date beginDate =3D sdf.parse(financialPeriodImport.getBeginDate());
-				Date endDate =3D sdf.parse(financialPeriodImport.getEndDate());
-				financialPeriod.setBeginDate(beginDate);
-				financialPeriod.setEndDate(endDate);
-				financialPeriod.setLocked(new Boolean(financialPeriodImport.getLocked())=
);
-				financialPeriodDAO.create(financialPeriod);
-			=09
-				//add to fiscalperiod
-				Date beginDateFiscalPeriod =3D
-					sdf.parse(financialPeriodImport.getBeginDateFiscalPeriod());
-				Date endDateFiscalPeriod =3D
-					sdf.parse(financialPeriodImport.getEndDateFiscalPeriod());
-				FiscalPeriod fiscalPeriod =3D
-					fiscalPeriodDAO.findByNaturalId(beginDateFiscalPeriod, endDateFiscalPer=
iod);
-				fiscalPeriod.addFinancialPeriod(financialPeriod);
-			=09
-            	result +=3D "SUCCESS : The financialPeriod " +
-            	financialPeriodImport.getBeginDate()+"-"+financialPeriodImport.=
getEndDate() + " is created ! \n";
+			for (FiscalPeriod fiscalPeriod : fiscalPeriods) {
+				//create fiscalPeriod
+				try {
+					fiscalPeriodService.createFiscalPeriod(fiscalPeriod);
+	            	result +=3D "SUCCESS : The fiscalPeriod " +
+	            	fiscalPeriod.getBeginDate()+"-"+fiscalPeriod.getEndDate() + " =
is created ! \n";
+				}
+				catch (LimaException eee){
+		        	result +=3D "FAILED : "+eee+" \n";
+				}
 			}
-		}
-		catch (ParseException eeePE) {
-			if(log.isDebugEnabled()){
-				log.debug("Can't parse date", eeePE);
-			}
-		}
-		catch (TopiaException eeeTE){
-            doCatch(topiaContext, eeeTE, log);
-		}
 		return result;
 	}
-=09
-	public String createAccounts(TreeMap<String, AccountImport> accounts, Topia=
Context topiaContext) throws LimaException {
+
+	public String createAccounts(TopiaContext topiaContext) throws LimaExceptio=
n {
         String result =3D "";
=20
         try {
@@ -680,7 +750,101 @@
 		return result;
 	}
=20
-  =20
+	public String updateClosedPeriodicEntryBooks (TopiaContext topiaContext) th=
rows LimaException {
+		String result=3D"";
+	=09
+		try {
+			FinancialPeriodDAO financialPeriodDAO =3D
+				LimaCallaoDAOHelper.getFinancialPeriodDAO(topiaContext);
+			EntryBookDAO entryBookDAO =3D
+				LimaCallaoDAOHelper.getEntryBookDAO(topiaContext);
+			ClosedPeriodicEntryBookDAO closedPeriodicEntryBookDAO =3D
+				LimaCallaoDAOHelper.getClosedPeriodicEntryBookDAO(topiaContext);
+			for (ClosedPeriodicEntryBookImport closedPeriodicEntryBookImport : closed=
PeriodicEntryBooks) {
+				//update closedPeriodicEntryBook
+					Date beginDateFinancialPeriod =3D
+						sdf.parse(closedPeriodicEntryBookImport.getBeginDateFinancialPeriod());
+					Date endDateFinancialPeriod =3D
+						sdf.parse(closedPeriodicEntryBookImport.getEndDateFinancialPeriod());
+					FinancialPeriod financialPeriod =3D
+						financialPeriodDAO.findByNaturalId(beginDateFinancialPeriod, endDateFi=
nancialPeriod);
+					String codeEntryBook =3D closedPeriodicEntryBookImport.getCodeEntryBook=
();
+					EntryBook entryBook =3D entryBookDAO.findByCode(codeEntryBook);
+					ClosedPeriodicEntryBook closedPeriodicEntryBook =3D
+						closedPeriodicEntryBookDAO.findbyEntryBookAndFinancialPeriod(entryBook=
, financialPeriod);
+					try {
+						financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntr=
yBook);
+						result +=3D "SUCCESS : The blockClosedPeriodicEntryBook " +
+		            	beginDateFinancialPeriod + "-" + endDateFinancialPeriod + ", =
" +
+		            	codeEntryBook + " is updated ! \n";
+					}
+					catch (LimaException eee){
+			        	result +=3D "FAILED : "+eee+" \n";
+					}
+			}
+		}
+		catch (TopiaException eeeTE){
+            doCatch(topiaContext, eeeTE, log);
+		}
+		catch (ParseException eeePE) {
+			if(log.isDebugEnabled()){
+				log.debug("Can't parse date", eeePE);
+			}
+		}
+		return result;
+	}
+
+	public String createFinancialTransactionsAndEntries (TopiaContext topiaCont=
ext) throws LimaException {
+		String result =3D "";
+		try {
+			EntryBookDAO entryBookDAO =3D LimaCallaoDAOHelper.getEntryBookDAO(topiaCo=
ntext);
+			EntryDAO entryDAO =3D LimaCallaoDAOHelper.getEntryDAO(topiaContext);
+			FinancialPeriodDAO financialPeriodDAO =3D LimaCallaoDAOHelper.getFinancia=
lPeriodDAO(topiaContext);
+			FinancialTransactionDAO financialTransactionDAO =3D LimaCallaoDAOHelper.g=
etFinancialTransactionDAO(topiaContext);
+			AccountDAO accountDAO =3D LimaCallaoDAOHelper.getAccountDAO(topiaContext);
+			for (int num : financialTransactions.keySet()) {
+				FinancialTransactionImport financialTransactionImport =3D financialTrans=
actions.get(num);
+				FinancialTransaction financialTransaction =3D new FinancialTransactionIm=
pl();
+				Date dateFinancialTransaction =3D sdf.parse(financialTransactionImport.g=
etDate());
+				financialTransaction.setTransactionDate(dateFinancialTransaction);
+			=09
+				EntryBook entryBook =3D entryBookDAO.findByCode(financialTransactionImpo=
rt.getCodeEntryBook());
+				financialTransaction.setEntryBook(entryBook);
+			=09
+				FinancialPeriod financialPeriod =3D financialPeriodDAO.findByDate(dateFi=
nancialTransaction);
+			=09
+				financialTransactionDAO.create(financialTransaction);
+				financialPeriod.addFinancialTransaction(financialTransaction);
+			=09
+				List<EntryImport> entryImports =3D entries.get(num);
+				for (EntryImport entryImport : entryImports) {
+					Entry entry =3D new EntryImpl();
+					Account account =3D accountDAO.findByAccountNumber(entryImport.getAccou=
nt());
+					entry.setAccount(account);
+					entry.setDescription(entryImport.getDescription());
+					entry.setAmount(new Double(entryImport.getAmount()));
+					entry.setDebit(new Boolean(entryImport.getDebit()));
+					entry.setLettering(entryImport.getLettering());
+					entry.setDetail(entryImport.getDetail());
+					entry.setVoucher(entryImport.getVoucher());
+					entry.setPosition(entryImport.getPosition());
+					log.debug(entry);
+					entryDAO.create(entry);
+					financialTransaction.addEntry(entry);
+				}
+			}
+		}
+		catch (TopiaException eeeTE){
+            doCatch(topiaContext, eeeTE, log);
+		}
+		catch (ParseException eeePE) {
+			if(log.isDebugEnabled()){
+				log.debug("Can't parse date", eeePE);
+			}
+		}
+		return result;
+	}
+=09
     protected TopiaContext beginTransaction() throws TopiaException {
         // basic check done, make check in database
         // TODO move it into JTA
@@ -689,4 +853,15 @@
         log.trace("beginTransaction"+topiaTransaction);
         return topiaTransaction;
     }
+   =20
+    protected void commitTransaction(TopiaContext topiaTransaction) throws T=
opiaException {
+        try {
+            topiaTransaction.commitTransaction();
+        } catch (TopiaException eee) {
+            if (log.isErrorEnabled()) {
+                log.error("Error during commit context", eee);
+            }
+            throw eee;
+        }
+    }
 }

Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/Ac=
countComparator.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountC=
omparator.java	2010-07-05 17:07:51 UTC (rev 2963)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/AccountC=
omparator.java	2010-07-06 16:39:52 UTC (rev 2964)
@@ -1,4 +1,4 @@
-/* *##% Lima Swing
+/* *##% Lima Business
  * Copyright (C) 2008 - 2010 CodeLutin
  *
  * This program is free software; you can redistribute it and/or
@@ -14,7 +14,8 @@
  * 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, US=
A.
- * ##%*/
+ * ##%*
+ */
=20
 package org.chorem.lima.business.utils;
=20

Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/En=
tryComparator.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryCom=
parator.java	2010-07-05 17:07:51 UTC (rev 2963)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/EntryCom=
parator.java	2010-07-06 16:39:52 UTC (rev 2964)
@@ -1,4 +1,4 @@
-/* *##% Lima Swing
+/* *##% Lima Business
  * Copyright (C) 2008 - 2010 CodeLutin
  *
  * This program is free software; you can redistribute it and/or
@@ -14,7 +14,8 @@
  * 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, US=
A.
- * ##%*/
+ * ##%*
+ */
=20
 package org.chorem.lima.business.utils;
=20

Added: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/Fisca=
lPeriodComparator.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPe=
riodComparator.java	                        (rev 0)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/FiscalPe=
riodComparator.java	2010-07-06 16:39:52 UTC (rev 2964)
@@ -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, US=
A.
+ * ##%*
+ */
+
+package org.chorem.lima.business.utils;
+
+import java.util.Comparator;
+import org.chorem.lima.entity.FiscalPeriod;
+
+public class FiscalPeriodComparator implements Comparator<FiscalPeriod>{
+
+    /**
+     * sort by accout number in lexicographical order
+     */
+    @Override
+    public int compare(FiscalPeriod o1, FiscalPeriod o2) {
+        return o1.getBeginDate().compareTo(o2.getBeginDate());
+    }
+
+}

Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
(Binary files differ)

Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountVi=
ewHandler.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHand=
ler.java	2010-07-05 17:07:51 UTC (rev 2963)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHand=
ler.java	2010-07-06 16:39:52 UTC (rev 2964)
@@ -25,7 +25,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.chorem.lima.business.AccountService;
-import org.chorem.lima.business.ImportService;
 import org.chorem.lima.business.LimaBusinessException;
 import org.chorem.lima.business.LimaException;
 import org.chorem.lima.entity.Account;

Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/ImportExport.ja=
va
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/ImportExport.java	201=
0-07-05 17:07:51 UTC (rev 2963)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/ImportExport.java	201=
0-07-06 16:39:52 UTC (rev 2964)
@@ -19,7 +19,10 @@
=20
 package org.chorem.lima.util;
=20
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -95,8 +98,8 @@
 		String result =3D "";
 	    byte[] buffer =3D new byte[(int) new File(path).length()];
 	    try {
-	    	FileReader f =3D new FileReader(new File(path));
-		    f.read();
+			BufferedInputStream f =3D new BufferedInputStream(new FileInputStream(pat=
h));
+			f.read(buffer);
 		   =20
 		    if (importMethode.equals("importEntryBookChart")){
 		    	result =3D importService.importEntryBooksChartAsCSV(new String(buffer=
));
@@ -118,7 +121,7 @@
 	    	}
 	    }
 	   =20
-	    return result;	   =20
+	    return result;
 	}
 =09
     public static ImportExport getInstance() {

Modified: trunk/pom.xml
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/pom.xml	2010-07-05 17:07:51 UTC (rev 2963)
+++ trunk/pom.xml	2010-07-06 16:39:52 UTC (rev 2964)
@@ -248,8 +248,6 @@
     <properties>
         <platform>chorem.org</platform>
         <projectId>lima</projectId>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEnc=
oding>
=20
         <!-- customized libs version -->
         <nuiton-utils.version>1.3.2-SNAPSHOT</nuiton-utils.version>


--===============6928888797668626575==--


