branch develop updated (1d60b71 -> 56d8305)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository lima. See http://git.chorem.org/lima.git from 1d60b71 fixes #1232 : ne pas clôturer un exercice avec des transactions en erreur new cd3af52 refs #1233 : test du service des comptes + retructuration des initialiseur de test new 391ae16 refs #1233 : test du service des journaux new 89b999b refs #1233 : test du service des périodes fiscales (suppresion des fonctions de service non utilisé) new d54b68d refs #1233 : test du service des transaction + correction et amélioration du code new 47e387f refs #1233 : test du service des exercices new 56d8305 Merge branch 'feature/1233' into develop The 6 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 56d83059fed1161c50f5444cc5ae799d2984baba Merge: 1d60b71 47e387f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Jun 3 11:06:46 2015 +0200 Merge branch 'feature/1233' into develop commit 47e387f493ad938392ecda3e33718500ef8b693b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Jun 3 11:05:30 2015 +0200 refs #1233 : test du service des exercices commit d54b68d4cb2b0c027a332f13b098a2237c05d2c8 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Jun 3 09:44:03 2015 +0200 refs #1233 : test du service des transaction + correction et amélioration du code commit 89b999b2b954938b4f59ee7ff461e7ef86c17d6f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Jun 2 08:56:32 2015 +0200 refs #1233 : test du service des périodes fiscales (suppresion des fonctions de service non utilisé) commit 391ae16b10a4f7645850c16a376e95a4afdfe29c Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Jun 1 15:42:03 2015 +0200 refs #1233 : test du service des journaux commit cd3af5229bbb68615692bb75d8ccf14f03f85a74 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Jun 1 14:51:42 2015 +0200 refs #1233 : test du service des comptes + retructuration des initialiseur de test Summary of changes: .../chorem/lima/business/api/AccountService.java | 5 +- .../lima/business/api/FinancialPeriodService.java | 4 - .../business/api/FinancialTransactionService.java | 6 +- .../lima/business/api/FiscalPeriodService.java | 12 - .../org/chorem/lima/business/AccountingRules.java | 33 +- .../accountingrules/DefaultAccountingRules.java | 151 ++--- .../accountingrules/FranceAccountingRules.java | 3 +- .../lima/business/ejb/AccountServiceImpl.java | 7 +- .../lima/business/ejb/ExportServiceImpl.java | 2 +- .../business/ejb/FinancialPeriodServiceImpl.java | 18 - .../ejb/FinancialTransactionServiceImpl.java | 19 +- .../lima/business/ejb/FiscalPeriodServiceImpl.java | 38 +- .../lima/business/ejb/ImportServiceImpl.java | 14 +- .../lima/entity/FinancialPeriodTopiaDao.java | 14 - .../chorem/lima/entity/FiscalPeriodTopiaDao.java | 24 - .../org/chorem/lima/business/AbstractLimaTest.java | 575 ++----------------- .../lima/business/AccountServiceImplTest.java | 332 ++++++++--- .../lima/business/EntryBookServiceImplTest.java | 148 ++++- .../business/FinancialPeriodServiceImplTest.java | 260 ++++++++- .../FinancialTransactionServiceImplTest.java | 635 ++++++++++++++++++++- .../lima/business/FiscalPeriodServiceImplTest.java | 220 ++++++- .../lima/business/ImportExportServiceTest.java | 31 +- .../lima/business/ReportServiceImplTest.java | 5 +- .../lima/entity/FinancialTransactionDAOTest.java | 5 +- .../chorem/lima/ui/account/AccountViewHandler.java | 12 +- .../ui/common/FinancialTransactionTableModel.java | 6 +- .../FinancialTransactionViewHandler.java | 17 + .../resources/i18n/lima-swing_en_GB.properties | 3 + .../resources/i18n/lima-swing_fr_FR.properties | 4 +- 29 files changed, 1661 insertions(+), 942 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit cd3af5229bbb68615692bb75d8ccf14f03f85a74 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Jun 1 14:51:42 2015 +0200 refs #1233 : test du service des comptes + retructuration des initialiseur de test --- .../chorem/lima/business/api/AccountService.java | 5 +- .../org/chorem/lima/business/AccountingRules.java | 3 +- .../accountingrules/DefaultAccountingRules.java | 8 +- .../accountingrules/FranceAccountingRules.java | 3 +- .../lima/business/ejb/AccountServiceImpl.java | 7 +- .../lima/business/ejb/ImportServiceImpl.java | 4 +- .../org/chorem/lima/business/AbstractLimaTest.java | 502 +-------------------- .../lima/business/AccountServiceImplTest.java | 332 ++++++++++---- .../lima/business/EntryBookServiceImplTest.java | 2 +- .../business/FinancialPeriodServiceImplTest.java | 5 +- .../FinancialTransactionServiceImplTest.java | 5 +- .../lima/business/ImportExportServiceTest.java | 31 +- .../lima/business/ReportServiceImplTest.java | 5 +- .../lima/entity/FinancialTransactionDAOTest.java | 5 +- 14 files changed, 306 insertions(+), 611 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java index 6e1badf..b21482d 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/AccountService.java @@ -47,7 +47,6 @@ public interface AccountService { * Return account count. * * @return account count - * @throws LimaException technical exception */ long getAccountCount(); @@ -91,7 +90,7 @@ public interface AccountService { * @return true if updated or false if created * @throws InvalidAccountNumberException */ - boolean createOrUbdateAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException; + boolean createOrUpdateAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException; /** * Create new account. If {@code masterAccount} is not null, {@code account} @@ -100,7 +99,7 @@ public interface AccountService { * @param account account * @throws LimaException */ - Account createAccount(Account account) throws AlreadyExistAccountException, InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException; + Account createAccount(Account account) throws AlreadyExistAccountException, InvalidAccountNumberException, NotNumberAccountNumberException; Account updateAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException; diff --git a/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java b/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java index ac1b443..c53001e 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java +++ b/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java @@ -31,7 +31,6 @@ import org.chorem.lima.business.exceptions.LockedEntryBookException; import org.chorem.lima.business.exceptions.LockedFinancialPeriodException; import org.chorem.lima.business.exceptions.MoreOneUnlockFiscalPeriodException; import org.chorem.lima.business.exceptions.NoEmptyFiscalPeriodException; -import org.chorem.lima.business.exceptions.NotAllowedLabelException; import org.chorem.lima.business.exceptions.NotBeginNextDayOfLastFiscalPeriodException; import org.chorem.lima.business.exceptions.NotLockedClosedPeriodicEntryBooksException; import org.chorem.lima.business.exceptions.NotNumberAccountNumberException; @@ -64,7 +63,7 @@ public interface AccountingRules { * @param account new account * @throws org.chorem.lima.business.exceptions.LimaException if rule validation fails */ - void createAccountRules(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException; + void createAccountRules(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException; void updateAccountRules(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException; diff --git a/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java b/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java index b6e2be7..1bc2c3e 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java +++ b/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java @@ -36,7 +36,6 @@ import org.chorem.lima.business.exceptions.LockedEntryBookException; import org.chorem.lima.business.exceptions.LockedFinancialPeriodException; import org.chorem.lima.business.exceptions.MoreOneUnlockFiscalPeriodException; import org.chorem.lima.business.exceptions.NoEmptyFiscalPeriodException; -import org.chorem.lima.business.exceptions.NotAllowedLabelException; import org.chorem.lima.business.exceptions.NotBeginNextDayOfLastFiscalPeriodException; import org.chorem.lima.business.exceptions.NotLockedClosedPeriodicEntryBooksException; import org.chorem.lima.business.exceptions.NotNumberAccountNumberException; @@ -93,14 +92,11 @@ public class DefaultAccountingRules implements AccountingRules { * Rules to check before create accounts. */ @Override - public void createAccountRules(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException { + public void createAccountRules(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException { // Check if the numberaccount is not blank - if (StringUtils.isBlank(account.getAccountNumber())) { + if (StringUtils.isBlank(account.getAccountNumber()) || account.getAccountNumber().contains("\\")) { throw new InvalidAccountNumberException(account.getAccountNumber()); } - if (account.getAccountNumber().contains("\\")){ - throw new NotAllowedLabelException(account.getAccountNumber()); - } } diff --git a/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java b/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java index 2b2ae1a..eeffbb1 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java +++ b/lima-business/src/main/java/org/chorem/lima/business/accountingrules/FranceAccountingRules.java @@ -31,7 +31,6 @@ import org.chorem.lima.business.exceptions.InvalidAccountNumberException; import org.chorem.lima.business.exceptions.LastUnlockedFiscalPeriodException; import org.chorem.lima.business.exceptions.MoreOneUnlockFiscalPeriodException; import org.chorem.lima.business.exceptions.NoEmptyFiscalPeriodException; -import org.chorem.lima.business.exceptions.NotAllowedLabelException; import org.chorem.lima.business.exceptions.NotBeginNextDayOfLastFiscalPeriodException; import org.chorem.lima.business.exceptions.NotLockedClosedPeriodicEntryBooksException; import org.chorem.lima.business.exceptions.NotNumberAccountNumberException; @@ -66,7 +65,7 @@ public class FranceAccountingRules extends DefaultAccountingRules { * Règles de vérification de la création du PCG, appliquées à la comptabilité française. */ @Override - public void createAccountRules(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException { + public void createAccountRules(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException { super.createAccountRules(account); validFranceAccountingRules(account); diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java index fa33638..29055f7 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java @@ -69,7 +69,7 @@ public class AccountServiceImpl extends AbstractLimaService implements AccountSe } @Override - public boolean createOrUbdateAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException { + public boolean createOrUpdateAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException { // check if account number already exist AccountTopiaDao accountDao = getDaoHelper().getAccountDao(); @@ -91,7 +91,7 @@ public class AccountServiceImpl extends AbstractLimaService implements AccountSe * @throws LimaException */ @Override - public Account createAccount(Account account) throws AlreadyExistAccountException, InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException { + public Account createAccount(Account account) throws AlreadyExistAccountException, InvalidAccountNumberException, NotNumberAccountNumberException { // check if account number already exist AccountTopiaDao accountDao = getDaoHelper().getAccountDao(); @@ -105,7 +105,7 @@ public class AccountServiceImpl extends AbstractLimaService implements AccountSe return result; } - protected Account createNewAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException { + protected Account createNewAccount(Account account) throws InvalidAccountNumberException, NotNumberAccountNumberException { // check rules before create the account AccountingRules accountingRules = LimaBusinessConfig.getInstance().getAccountingRules(); accountingRules.createAccountRules(account); @@ -129,6 +129,7 @@ public class AccountServiceImpl extends AbstractLimaService implements AccountSe AccountTopiaDao accountDao = getDaoHelper().getAccountDao(); while (account == null && accountNumber.length() > 1) { + accountNumber = accountNumber.substring(0, accountNumber.length() - 1); account = accountDao.forAccountNumberEquals(accountNumber).findUniqueOrNull(); } return account; diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java index b66e798..5f116a3 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java @@ -165,7 +165,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ boolean updated; for (Account account : accounts) { try { - updated = accountService.createOrUbdateAccount(account); + updated = accountService.createOrUpdateAccount(account); if (updated) { result.increaseUpdated(); } else { @@ -827,7 +827,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ for (Account account : accounts) { boolean updated = false; try { - updated = accountService.createOrUbdateAccount(account); + updated = accountService.createOrUpdateAccount(account); } catch (InvalidAccountNumberException | NotNumberAccountNumberException | NotAllowedLabelException e) { result.addException(e); } diff --git a/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java b/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java index 9550225..210f6c4 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java @@ -38,9 +38,12 @@ import org.chorem.lima.business.api.IdentityService; import org.chorem.lima.business.api.ImportService; import org.chorem.lima.business.api.ReportService; import org.chorem.lima.business.api.VatStatementService; +import org.chorem.lima.business.exceptions.AlreadyExistAccountException; +import org.chorem.lima.business.exceptions.InvalidAccountNumberException; +import org.chorem.lima.business.exceptions.NotAllowedLabelException; +import org.chorem.lima.business.exceptions.NotNumberAccountNumberException; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountImpl; -import org.chorem.lima.entity.AccountTopiaDao; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryBookImpl; @@ -51,7 +54,6 @@ import org.chorem.lima.entity.FiscalPeriod; import org.chorem.lima.entity.FiscalPeriodImpl; import org.chorem.lima.entity.LimaCallaoEntityEnum; import org.chorem.lima.entity.LimaCallaoTopiaApplicationContext; -import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext; import org.hibernate.cfg.Environment; import org.junit.After; import org.junit.Before; @@ -209,10 +211,12 @@ public abstract class AbstractLimaTest { /** * Create a basic account plan. * - * @throws org.chorem.lima.business.exceptions.LimaException - * @throws java.text.ParseException + * @throws org.chorem.lima.business.exceptions.AlreadyExistAccountException + * @throws org.chorem.lima.business.exceptions.NotAllowedLabelException + * @throws org.chorem.lima.business.exceptions.InvalidAccountNumberException + * @throws org.chorem.lima.business.exceptions.NotNumberAccountNumberException */ - protected void initTestWithAccounts() throws Exception { + protected void createAccounts() throws AlreadyExistAccountException, NotAllowedLabelException, InvalidAccountNumberException, NotNumberAccountNumberException { // creation d'un plan compatble de test Account classFinancier = new AccountImpl(); @@ -252,486 +256,12 @@ public abstract class AbstractLimaTest { } /** - * Create a basic account plan. - * - * @throws org.chorem.lima.business.exceptions.LimaException - * @throws java.text.ParseException - */ - protected void initTestDefaultAccounts() throws Exception { - LimaCallaoTopiaPersistenceContext tcontext = context.newPersistenceContext(); - AccountTopiaDao accountTopiaDao = tcontext.getAccountDao(); - - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1", Account.PROPERTY_LABEL, "COMPTES DE CAPITAUX"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2", Account.PROPERTY_LABEL, "COMPTES D'IMMOBILISATIONS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "3", Account.PROPERTY_LABEL, "COMPTES DE STOCKS ET D'EN-COURS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4", Account.PROPERTY_LABEL, "COMPTES DE TIERS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5", Account.PROPERTY_LABEL, "COMPTES FINANCIERS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6", Account.PROPERTY_LABEL, "COMPTES DE CHARGES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "7", Account.PROPERTY_LABEL, "COMPTES DE PRODUITS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "8", Account.PROPERTY_LABEL, "COMPTES SPECIAUX"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "10", Account.PROPERTY_LABEL, "REPORT A NOUVEAU (solde créditeur ou débiteur)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "11", Account.PROPERTY_LABEL, "RESULTAT NET DE L'EXERCICE (bénéfice ou perte)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "12", Account.PROPERTY_LABEL, "PROVISIONS REGLEMENTEES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "13", Account.PROPERTY_LABEL, "PROVlSlONS POUR RISQUES ET CHARGES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "14", Account.PROPERTY_LABEL, "EMPRUNTS ET DETTES ASSIMILEES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "15", Account.PROPERTY_LABEL, "IMMOBlLlSATIONS CORPORELLES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "16", Account.PROPERTY_LABEL, "IMMOBILlSATlONS EN COURS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "17", Account.PROPERTY_LABEL, "AUTRES IMMOBILISATIONS FINANCIERES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "20", Account.PROPERTY_LABEL, "MATIERES PREMIERES (et fournitures)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "21", Account.PROPERTY_LABEL, "AUTRES APPROVISIONNEMENTS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "23", Account.PROPERTY_LABEL, "EN-COURS DE PRODUCTION DE BIENS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "26", Account.PROPERTY_LABEL, "EN-COURS DE PRODUCTION DE SERVICES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "27", Account.PROPERTY_LABEL, "STOCKS DE PRODUITS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "28", Account.PROPERTY_LABEL, "STOCKS DE MARCHANDISES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "29", Account.PROPERTY_LABEL, "SECURITE SOCIALE ET AUTRES ORGANISMES SOCIAUX"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "31", Account.PROPERTY_LABEL, "DEBITEURS ET CREDITEURS DIVERS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "32", Account.PROPERTY_LABEL, "COMPTES TRANSITOIRES OU D'ATTENTE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "33", Account.PROPERTY_LABEL, "VALEURS MOBILIERES DE PLACEMENT"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "34", Account.PROPERTY_LABEL, "BANQUES; ETABLISSEMENTS FINANCIERS ET ASSIMILES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "35", Account.PROPERTY_LABEL, "CAISSE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "37", Account.PROPERTY_LABEL, "REGIES D'AVANCES ET ACCREDITIFS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "39", Account.PROPERTY_LABEL, "VIREMENTS INTERNES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "40", Account.PROPERTY_LABEL, "ACHATS (sauf 603)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "41", Account.PROPERTY_LABEL, "Services extérieurs"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "42", Account.PROPERTY_LABEL, "Autres services extérieurs"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "43", Account.PROPERTY_LABEL, "IMPOTS; TAXES ET VERSEMENTS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44", Account.PROPERTY_LABEL, "AUTRES CHARGES DE GESTION COURANTE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "45", Account.PROPERTY_LABEL, "CHARGES FINANCIERES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "46", Account.PROPERTY_LABEL, "CHARGES EXCEPTIONNELLES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "47", Account.PROPERTY_LABEL, "PRODUCTION IMMOBILISEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "48", Account.PROPERTY_LABEL, "SUBVENTlONS D'EXPLOITATION"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "49", Account.PROPERTY_LABEL, "AUTRES PRODUITS DE GESTION COURANTE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "50", Account.PROPERTY_LABEL, "PRODUITS FINANCIERS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "51", Account.PROPERTY_LABEL, "PRODUITS EXCEPTIONNELS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "52", Account.PROPERTY_LABEL, "REPRISES SUR AMORTISSEMENTS ET PROVISIONS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "53", Account.PROPERTY_LABEL, "TRANSFERTS DE CHARGES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "54", Account.PROPERTY_LABEL, "ENGAGEMENTS HORS BILAN"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "58", Account.PROPERTY_LABEL, "RESULTAT EN INSTANCE D'AFFECTATION"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "59", Account.PROPERTY_LABEL, "BILAN"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "60", Account.PROPERTY_LABEL, "Capital"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "61", Account.PROPERTY_LABEL, "Ecarts de réévaluation"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "62", Account.PROPERTY_LABEL, "Compte de l'exploitant"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "63", Account.PROPERTY_LABEL, "Résultat de l'exercice (bénéfice)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "64", Account.PROPERTY_LABEL, "Résultat de l'exercice (perte)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "65", Account.PROPERTY_LABEL, "Amortissements dérogatoires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "66", Account.PROPERTY_LABEL, "Provision spéciale de réévaluation"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "67", Account.PROPERTY_LABEL, "Plus-values réinvesties"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68", Account.PROPERTY_LABEL, "Autres provisions réglementées"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "69", Account.PROPERTY_LABEL, "Provisions pour risques"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "70", Account.PROPERTY_LABEL, "Autres emprunts obligataires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "71", Account.PROPERTY_LABEL, "Emprunts auprès des établissements de crédit"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "72", Account.PROPERTY_LABEL, "Primes de remboursement des obligations"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "74", Account.PROPERTY_LABEL, "Dettes rattachées a des participations (groupe)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "75", Account.PROPERTY_LABEL, "Frais détablissement"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "76", Account.PROPERTY_LABEL, "Frais de recherche et de développement"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "77", Account.PROPERTY_LABEL, "Concessions et droits similaires; brevets; licences; marques"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "78", Account.PROPERTY_LABEL, "Droit au bail"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "79", Account.PROPERTY_LABEL, "Fonds commercial"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "80", Account.PROPERTY_LABEL, "Autres immobilisations incorporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "88", Account.PROPERTY_LABEL, "Dépôts et cautionnements versés"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "89", Account.PROPERTY_LABEL, "Amortissements des immobilisations incorporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "101", Account.PROPERTY_LABEL, "Amortissements des immobilisations corporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "104", Account.PROPERTY_LABEL, "Provisions pour dépréciation des immobilisations incorporell"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "105", Account.PROPERTY_LABEL, "Provisions pour dépréciation des immobilisations corporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "106", Account.PROPERTY_LABEL, "Provisions pour dépréciation des participations et créances"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "107", Account.PROPERTY_LABEL, "Provisions pour dépréciation des autres immobilisations fina"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "108", Account.PROPERTY_LABEL, "Provisions pour dépréciation des matières premières (et four"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "109", Account.PROPERTY_LABEL, "Provisions pour dépréciation des autres approvisionnements"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "110", Account.PROPERTY_LABEL, "Provisions pour dépréciation des encours de production de bi"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "119", Account.PROPERTY_LABEL, "Provisions pour dépréciation des en-cours de production de s"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "120", Account.PROPERTY_LABEL, "Provisions pour dépréciation des stocks de produits"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "129", Account.PROPERTY_LABEL, "Provisions pour dépréciation des stocks de marchandises"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "131", Account.PROPERTY_LABEL, "Personnel - Rémunérations dues"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "138", Account.PROPERTY_LABEL, "Personnel - Charges à payer et produits à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "139", Account.PROPERTY_LABEL, "Sécurité sociale"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "142", Account.PROPERTY_LABEL, "Autres organismes sociaux"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "143", Account.PROPERTY_LABEL, "Etat - Impôts sur les bénéfices"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "144", Account.PROPERTY_LABEL, "Etat - Taxes sur le chiffre d'affaires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "145", Account.PROPERTY_LABEL, "Obligations cautionnées"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "146", Account.PROPERTY_LABEL, "Autres impôts; taxes et versements assimilés"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "147", Account.PROPERTY_LABEL, "Associés - Comptes courants"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "148", Account.PROPERTY_LABEL, "Créances sur cessions d'immobilisations"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "151", Account.PROPERTY_LABEL, "Compte d'attente"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "153", Account.PROPERTY_LABEL, "Charges à repartir sur plusieurs exercices"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "154", Account.PROPERTY_LABEL, "Charges constatées d'avance"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "155", Account.PROPERTY_LABEL, "Produits constatés d'avance"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "156", Account.PROPERTY_LABEL, "Provisions pour dépréciation des comptes de clients"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "157", Account.PROPERTY_LABEL, "Provisions pour dépréciation des comptes de débiteurs divers"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "158", Account.PROPERTY_LABEL, "Valeurs à I'encaissement"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "161", Account.PROPERTY_LABEL, "Banques"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "163", Account.PROPERTY_LABEL, "Autres organismes financiers"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "164", Account.PROPERTY_LABEL, "Concours bancaires courant"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "165", Account.PROPERTY_LABEL, "Caisse siège social"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "166", Account.PROPERTY_LABEL, "Virements internes"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "167", Account.PROPERTY_LABEL, "Provisions pour dépréciation des valeurs mobilières de place"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "168", Account.PROPERTY_LABEL, "Achats stockés - Matières premières (et fournitures)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "169", Account.PROPERTY_LABEL, "VARIATION DES STOCKS (approvisionnements et marchandises)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "171", Account.PROPERTY_LABEL, "Achat de materiel; equipement et travaux"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "174", Account.PROPERTY_LABEL, "Achats non stockes de matières et fournitures"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "178", Account.PROPERTY_LABEL, "Achats de marchandises"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "201", Account.PROPERTY_LABEL, "Frais accessoires d'achat"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "203", Account.PROPERTY_LABEL, "Rabais; remises et ristournes obtenus sur achats"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "205", Account.PROPERTY_LABEL, "Sous-traitance générale"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "206", Account.PROPERTY_LABEL, "Redevances de crédit-bail"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "207", Account.PROPERTY_LABEL, "Locations"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "208", Account.PROPERTY_LABEL, "Charges locatives et de copropriété"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "211", Account.PROPERTY_LABEL, "Entretien et réparations"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "212", Account.PROPERTY_LABEL, "Primes d'assurance"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "213", Account.PROPERTY_LABEL, "Personnel extérieur à l'entreprise"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "214", Account.PROPERTY_LABEL, "Rémunérations intermédiaires et honoraires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "215", Account.PROPERTY_LABEL, "Publicité; publications; relations publiques"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "218", Account.PROPERTY_LABEL, "Transports de biens et transports collectifs du personnel"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "231", Account.PROPERTY_LABEL, "Déplacements; missions et réceptions"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "232", Account.PROPERTY_LABEL, "Frais postaux et frais de télécommunications"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "237", Account.PROPERTY_LABEL, "Services bancaires et assimiles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "238", Account.PROPERTY_LABEL, "Impôts; taxes et versements assimiles sur rémunérations (aut"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "261", Account.PROPERTY_LABEL, "Autres impôts taxes et versements assimiles (administration"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "266", Account.PROPERTY_LABEL, "Rémunération du travail de l'exploitant"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "267", Account.PROPERTY_LABEL, "Charges de sécurité sociale et de prévoyance"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "268", Account.PROPERTY_LABEL, "Redevances pour concessions; brevets; licences; marques; pro"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "269", Account.PROPERTY_LABEL, "Pertes sur créances irrécouvrables"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "271", Account.PROPERTY_LABEL, "Quote-part de résultat sur opérations faites en commun"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "272", Account.PROPERTY_LABEL, "Escomptes accordés"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "273", Account.PROPERTY_LABEL, "Valeurs comptables des éléments d'actif cédés"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "274", Account.PROPERTY_LABEL, "Dotations aux amort. - Charges d'exploitation"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "275", Account.PROPERTY_LABEL, "Dotations aux amortissements et aux provisions - Charges fin"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "276", Account.PROPERTY_LABEL, "Dotations aux amortissements et aux provisions - Charges exc"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "279", Account.PROPERTY_LABEL, "Participation des salaries aux fruits de l'expansion"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "280", Account.PROPERTY_LABEL, "Impôts sur les bénéfices"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "281", Account.PROPERTY_LABEL, "Imposition forfaitaire annuelle des sociétés"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "290", Account.PROPERTY_LABEL, "Produits - Reports en arrière des déficits"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "291", Account.PROPERTY_LABEL, "Ventes de produits finis"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "293", Account.PROPERTY_LABEL, "Prestations de services"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "296", Account.PROPERTY_LABEL, "Ventes de marchandises"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "297", Account.PROPERTY_LABEL, "Produits des activités annexes"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "311", Account.PROPERTY_LABEL, "Rabais; remises et ristournes accordées par l'entreprise"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "312", Account.PROPERTY_LABEL, "VARIATION DES STOCKS (en-cours de production; produits)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "317", Account.PROPERTY_LABEL, "Immobilisations incorporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "321", Account.PROPERTY_LABEL, "Produits divers de gestion courante"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "322", Account.PROPERTY_LABEL, "Escomptes obtenus"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "326", Account.PROPERTY_LABEL, "Produits des cessions éléments d'actif"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "331", Account.PROPERTY_LABEL, "Reprises sur amortissements et provisions (à inscrire dans l"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "335", Account.PROPERTY_LABEL, "Reprises sur provisions a inscrire dans les produits financi"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "341", Account.PROPERTY_LABEL, "Reprises sur provisions (à inscrire dans les produits except"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "345", Account.PROPERTY_LABEL, "Transfert de charges d'exploitation"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "351", Account.PROPERTY_LABEL, "Engagements donnés par l'entreprise"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "355", Account.PROPERTY_LABEL, "Engagements reçus par l'entreprise"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "358", Account.PROPERTY_LABEL, "Contrepartie des engagements"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "371", Account.PROPERTY_LABEL, "Réserve légale"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "372", Account.PROPERTY_LABEL, "Réserves indisponibles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "391", Account.PROPERTY_LABEL, "Réserves statutaires ou contractuelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "392", Account.PROPERTY_LABEL, "Réserves réglementes"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "393", Account.PROPERTY_LABEL, "Autres réserves"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "394", Account.PROPERTY_LABEL, "Provisions pour charges sociales et fiscales sur congés à pa"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "395", Account.PROPERTY_LABEL, "Matériel industriel (1)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "397", Account.PROPERTY_LABEL, "Matériel de transport"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "400", Account.PROPERTY_LABEL, "Matériel de bureau et matériel informatique"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "401", Account.PROPERTY_LABEL, "Frais établissement (même ventilation que celle du compte 20"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "403", Account.PROPERTY_LABEL, "Constructions même ventilation que celle du compte 213)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "404", Account.PROPERTY_LABEL, "Installations techniques; matériel et outillage industriels"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "405", Account.PROPERTY_LABEL, "Dettes provisionnées pour congés à payer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "408", Account.PROPERTY_LABEL, "Autres charges à payer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "409", Account.PROPERTY_LABEL, "Obligataires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "410", Account.PROPERTY_LABEL, "tva cee"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "411", Account.PROPERTY_LABEL, "Taxes sur le chiffre d'affaires déductibles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "413", Account.PROPERTY_LABEL, "Produits à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "416", Account.PROPERTY_LABEL, "Reglement par chèques"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "417", Account.PROPERTY_LABEL, "Réglement par CB"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "418", Account.PROPERTY_LABEL, "Réglement par LCR"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "419", Account.PROPERTY_LABEL, "Réglement en especes"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "421", Account.PROPERTY_LABEL, "Intérêts courus à payer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "422", Account.PROPERTY_LABEL, "Crédit de mobilisation de créances commerciales (CMCC)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "424", Account.PROPERTY_LABEL, "Mobilisation de créances nées à létranger"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "425", Account.PROPERTY_LABEL, "Fournitures consommables"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "426", Account.PROPERTY_LABEL, "Variation des stocks de matières premières (et fournitures)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "427", Account.PROPERTY_LABEL, "Variation des stocks de marchandises"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "428", Account.PROPERTY_LABEL, "Achat marchandise CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "431", Account.PROPERTY_LABEL, "Achats en francise"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "437", Account.PROPERTY_LABEL, "Malis sur emballages"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "438", Account.PROPERTY_LABEL, "Honoraires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "441", Account.PROPERTY_LABEL, "Commissions et frais sur émission d'emprunts"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "442", Account.PROPERTY_LABEL, "Frais sur effets (commissions d'endos...)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "443", Account.PROPERTY_LABEL, "Participation des employeurs à l'effort de construction"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "444", Account.PROPERTY_LABEL, "Contribution sociale de solidarité à la charge des sociétés"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445", Account.PROPERTY_LABEL, "Congés payes"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "446", Account.PROPERTY_LABEL, "Indemnités et avantages divers"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "447", Account.PROPERTY_LABEL, "Cotisations à l'URSSAF"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "451", Account.PROPERTY_LABEL, "Cotisations aux caisses de retraites"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "455", Account.PROPERTY_LABEL, "Cotisations aux ASSEDIC"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "456", Account.PROPERTY_LABEL, "Intérêts des emprunts et dettes"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "457", Account.PROPERTY_LABEL, "Intérêts des comptes courants et des dépôts créditeurs"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "458", Account.PROPERTY_LABEL, "Intérêts bancaires et sur opérations de financement (escompt"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "462", Account.PROPERTY_LABEL, "Intérêts des obligations cautionnées"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "464", Account.PROPERTY_LABEL, "Pertes de change ou de conversion"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "465", Account.PROPERTY_LABEL, "Dotations aux amortissements sur immobilisations incorporell"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "467", Account.PROPERTY_LABEL, "Dotations aux amortissements des charges d'exploitation à ré"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "468", Account.PROPERTY_LABEL, "Dotations aux provisions pour risques et charges d'exploitat"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "470", Account.PROPERTY_LABEL, "Dotations aux amortissements des primes de remboursement des"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "476", Account.PROPERTY_LABEL, "Dotation aux provisions pour dépréciation des éléments finan"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "477", Account.PROPERTY_LABEL, "Dotations aux amortissements exceptionnels sur immobilisatio"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "478", Account.PROPERTY_LABEL, "Ports et frais accessoires factures"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "481", Account.PROPERTY_LABEL, "Bonis sur reprises d'emballages consignes"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "486", Account.PROPERTY_LABEL, "Autres produits activités annexes (cessions d'approvisionnem"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "487", Account.PROPERTY_LABEL, "Variation des en-cours de production de biens"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "488", Account.PROPERTY_LABEL, "Variation des en-cours de production de services"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "491", Account.PROPERTY_LABEL, "Variation des stocks de produits"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "495", Account.PROPERTY_LABEL, "Gains de change ou de conversion"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "496", Account.PROPERTY_LABEL, "Reprises sur provisions pour dépréciation des éléments finan"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "501", Account.PROPERTY_LABEL, "Sur emprunts auprès des établissements de crédit"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "502", Account.PROPERTY_LABEL, "TVA à décaisser"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "503", Account.PROPERTY_LABEL, "TVA sur immobilisations"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "504", Account.PROPERTY_LABEL, "TVA sur autres bien et services"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "505", Account.PROPERTY_LABEL, "Crédit de TVA à reporter"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "506", Account.PROPERTY_LABEL, "Taxes assimilées à la TVA"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "507", Account.PROPERTY_LABEL, "TVA collectée"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "508", Account.PROPERTY_LABEL, "Taxes assimilées à la TVA"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "509", Account.PROPERTY_LABEL, "Remboursement de taxes sur le chiffre d'affaires demandé"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "511", Account.PROPERTY_LABEL, "TVA récupérée d'avance"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "512", Account.PROPERTY_LABEL, "Taxes sur le chiffre d'affaires sur factures non parvenues"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "514", Account.PROPERTY_LABEL, "Taxes sur le chiffre d'affaires sur factures à établir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "515", Account.PROPERTY_LABEL, "Achats stockés - Matières premières France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "516", Account.PROPERTY_LABEL, "Achats stockés - Matières premières CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "517", Account.PROPERTY_LABEL, "Frais accessoires d'achat France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "518", Account.PROPERTY_LABEL, "Frais accessoires d'achat CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "519", Account.PROPERTY_LABEL, "Dotations aux amort. immobilisations incorporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "530", Account.PROPERTY_LABEL, "Dotations provisions dépréc. immos incorporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "540", Account.PROPERTY_LABEL, "Dotations provisions dépréc. immos corporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "580", Account.PROPERTY_LABEL, "Stocks et en-cours"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "590", Account.PROPERTY_LABEL, "Créances"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "601", Account.PROPERTY_LABEL, "Amortissements dérogatoires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "602", Account.PROPERTY_LABEL, "Ventes de produits finis France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "603", Account.PROPERTY_LABEL, "Ventes de produits finis CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "604", Account.PROPERTY_LABEL, "Prestations de services France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "605", Account.PROPERTY_LABEL, "Prestations de services CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "606", Account.PROPERTY_LABEL, "Ventes de marchandises France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "607", Account.PROPERTY_LABEL, "Ventes de marchandises CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "608", Account.PROPERTY_LABEL, "Compte créé pendant import"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "609", Account.PROPERTY_LABEL, "Reprises prov. dépréc. immos incorporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "611", Account.PROPERTY_LABEL, "Reprises prov. dépréc. immos corporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "612", Account.PROPERTY_LABEL, "Stocks et en-cours"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "613", Account.PROPERTY_LABEL, "Créances"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "614", Account.PROPERTY_LABEL, "Reprises sur provisions - Amort. dérogatoires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "615", Account.PROPERTY_LABEL, "achat cee"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "616", Account.PROPERTY_LABEL, "TVA sur autres bien et services 19.6 Débit France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "617", Account.PROPERTY_LABEL, "TVA sur autres bien et services 19.6 Débit CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "618", Account.PROPERTY_LABEL, "TVA sur autres bien et services 5.5 Débit France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "619", Account.PROPERTY_LABEL, "TVA sur autres bien et services 5.5 Débit CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "621", Account.PROPERTY_LABEL, "TVA sur autres bien et services 19.6 Encais. France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "622", Account.PROPERTY_LABEL, "TVA sur autres bien et services 19.6 Encais. CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "623", Account.PROPERTY_LABEL, "TVA sur autres bien et services 5.5 Encais. France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "624", Account.PROPERTY_LABEL, "TVA sur autres bien et services 5.5 Encais. CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "625", Account.PROPERTY_LABEL, "TVA Collectée 19.6 Débit France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "626", Account.PROPERTY_LABEL, "TVA Collectée 19.6 Débit CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "627", Account.PROPERTY_LABEL, "TVA"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "628", Account.PROPERTY_LABEL, "TVA Collectée 5.5 Débit France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "629", Account.PROPERTY_LABEL, "TVA Collectée 5.5 Débit CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "631", Account.PROPERTY_LABEL, "TVA Collectée 19.6 Encais. France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "633", Account.PROPERTY_LABEL, "TVA Collectée 19.6 Encais. CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "635", Account.PROPERTY_LABEL, "TVA Collectée 5.5 Encais. France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "637", Account.PROPERTY_LABEL, "TVA Collectée 5.5 Encais. CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "641", Account.PROPERTY_LABEL, "Capital"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "644", Account.PROPERTY_LABEL, "Capital non amorti"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "645", Account.PROPERTY_LABEL, "Ecarts de réévaluation"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "646", Account.PROPERTY_LABEL, "Réserve légale"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "647", Account.PROPERTY_LABEL, "réserve légale"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "648", Account.PROPERTY_LABEL, "Réserves indisponibles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "651", Account.PROPERTY_LABEL, "Réserves statutaires ou contractuelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "653", Account.PROPERTY_LABEL, "Réserves réglementes"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "654", Account.PROPERTY_LABEL, "Autres réserves"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "655", Account.PROPERTY_LABEL, "Compte de l'exploitant"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "658", Account.PROPERTY_LABEL, "report a nouveau"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "661", Account.PROPERTY_LABEL, "Résultat de l'exercice (bénéfice)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "664", Account.PROPERTY_LABEL, "Résultat de l'exercice (perte)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "665", Account.PROPERTY_LABEL, "Amortissements dérogatoires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "667", Account.PROPERTY_LABEL, "Provision spéciale de réévaluation"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "668", Account.PROPERTY_LABEL, "Plus-values réinvesties"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "671", Account.PROPERTY_LABEL, "Autres provisions réglementées"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "672", Account.PROPERTY_LABEL, "Provisions pour risques"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "675", Account.PROPERTY_LABEL, "Provision pour litige"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "678", Account.PROPERTY_LABEL, "Provisions pour charges sociales et fiscales sur congés à pa"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "681", Account.PROPERTY_LABEL, "Autres emprunts obligataires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "686", Account.PROPERTY_LABEL, "Emprunts auprès des établissements de crédit"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "687", Account.PROPERTY_LABEL, "Sur emprunts auprès des établissements de crédit"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "691", Account.PROPERTY_LABEL, "Primes de remboursement des obligations"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "695", Account.PROPERTY_LABEL, "Dettes rattachées a des participations (groupe)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "696", Account.PROPERTY_LABEL, "Frais détablissement"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "697", Account.PROPERTY_LABEL, "Frais de recherche et de développement"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "698", Account.PROPERTY_LABEL, "Concessions et droits similaires; brevets; licences; marques"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "699", Account.PROPERTY_LABEL, "Droit au bail"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "701", Account.PROPERTY_LABEL, "Fonds commercial"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "702", Account.PROPERTY_LABEL, "Autres immobilisations incorporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "703", Account.PROPERTY_LABEL, "Matériel industriel (1)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "704", Account.PROPERTY_LABEL, "Matériel de transport"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "705", Account.PROPERTY_LABEL, "Matériel de bureau et matériel informatique"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "706", Account.PROPERTY_LABEL, "MATERIEL INFORMATIQUE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "707", Account.PROPERTY_LABEL, "Autres titres"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "708", Account.PROPERTY_LABEL, "PRET AUX SALARIES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "709", Account.PROPERTY_LABEL, "Dépôts et cautionnements versés"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "713", Account.PROPERTY_LABEL, "Créances sur Titres Immo."); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "721", Account.PROPERTY_LABEL, "Amortissements des immobilisations incorporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "722", Account.PROPERTY_LABEL, "Frais établissement (même ventilation que celle du compte 20"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "740", Account.PROPERTY_LABEL, "Amortissements des immobilisations corporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "751", Account.PROPERTY_LABEL, "Constructions même ventilation que celle du compte 213)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "752", Account.PROPERTY_LABEL, "Installations techniques; matériel et outillage industriels"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "753", Account.PROPERTY_LABEL, "AMORTISSEMENT MATERIEL"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "754", Account.PROPERTY_LABEL, "Provisions pour dépréciation des immobilisations incorporell"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "755", Account.PROPERTY_LABEL, "Provisions pour dépréciation des immobilisations corporelles"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "758", Account.PROPERTY_LABEL, "Provisions pour dépréciation des participations et créances"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "761", Account.PROPERTY_LABEL, "Provisions pour dépréciation des autres immobilisations fina"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "762", Account.PROPERTY_LABEL, "Provisions pour dépréciation des matières premières (et four"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "763", Account.PROPERTY_LABEL, "Provisions pour dépréciation des autres approvisionnements"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "764", Account.PROPERTY_LABEL, "Provisions pour dépréciation des encours de production de bi"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "765", Account.PROPERTY_LABEL, "Provisions pour dépréciation des en-cours de production de s"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "766", Account.PROPERTY_LABEL, "Provisions pour dépréciation des stocks de produits"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "767", Account.PROPERTY_LABEL, "Provisions pour dépréciation des stocks de marchandises"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "768", Account.PROPERTY_LABEL, "Fournisseurs divers"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "771", Account.PROPERTY_LABEL, "NF Poussin Benjamin"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "772", Account.PROPERTY_LABEL, "NF Thimel Arnaud"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "775", Account.PROPERTY_LABEL, "NF Ruchaud Julien"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "777", Account.PROPERTY_LABEL, "Mutuelle du Mans"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "778", Account.PROPERTY_LABEL, "SFR"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "781", Account.PROPERTY_LABEL, "Free Telecom"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "786", Account.PROPERTY_LABEL, "April"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "787", Account.PROPERTY_LABEL, "CM-CIC Epargne Salariale"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "791", Account.PROPERTY_LABEL, "ECAC -Troadec"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "796", Account.PROPERTY_LABEL, "Fournisseurs facture à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "801", Account.PROPERTY_LABEL, "Facture à Emettre"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "802", Account.PROPERTY_LABEL, "Personnel - Rémunérations dues"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "809", Account.PROPERTY_LABEL, "Regul Mutuelle à recupérer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "890", Account.PROPERTY_LABEL, "Personnel - Charges à payer et produits à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "891", Account.PROPERTY_LABEL, "Dettes provisionnées pour congés à payer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1061", Account.PROPERTY_LABEL, "Intéressement à verser aux salariés"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1062", Account.PROPERTY_LABEL, "Personnel -autres charges a payer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1063", Account.PROPERTY_LABEL, "Urssaf"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1064", Account.PROPERTY_LABEL, "Urssaf-csg-crds-forfait social"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1068", Account.PROPERTY_LABEL, "retraite"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1391", Account.PROPERTY_LABEL, "Pôle Emploi"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1398", Account.PROPERTY_LABEL, "Retraite ARRCO"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1671", Account.PROPERTY_LABEL, "Retraite Cadre AGIRC"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1674", Account.PROPERTY_LABEL, "Mutuelle"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "1675", Account.PROPERTY_LABEL, "Prévoyance"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2761", Account.PROPERTY_LABEL, "charges sociales sur congés à payer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2768", Account.PROPERTY_LABEL, "Autres charges à payer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2801", Account.PROPERTY_LABEL, "URSSAF à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2803", Account.PROPERTY_LABEL, "Subventions d'expoitation"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2805", Account.PROPERTY_LABEL, "Etat - Impôts sur les bénéfices"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2807", Account.PROPERTY_LABEL, "Crédit Impot Recherche à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2808", Account.PROPERTY_LABEL, "IS à payer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2811", Account.PROPERTY_LABEL, "Crédit Impot Recherche à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2812", Account.PROPERTY_LABEL, "Crédit Impot Intéressement"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2813", Account.PROPERTY_LABEL, "Etat - Taxes sur le chiffre d'affaires"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2814", Account.PROPERTY_LABEL, "TVA à décaisser"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2815", Account.PROPERTY_LABEL, "TVA à décaisser 20%"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2818", Account.PROPERTY_LABEL, "TVA sur immobilisations"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2905", Account.PROPERTY_LABEL, "TVA sur immobilisations 20%"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2906", Account.PROPERTY_LABEL, "TVA sur autres bien et services"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2907", Account.PROPERTY_LABEL, "TVA/ABS 2;1%"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2908", Account.PROPERTY_LABEL, "TVA sur autres bien et services 5.5 Débit France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2911", Account.PROPERTY_LABEL, "TVA sur autres biens et services 20%"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2931", Account.PROPERTY_LABEL, "Crédit de TVA à reporter"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2932", Account.PROPERTY_LABEL, "Crédit de TVA à reporter 20%"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2961", Account.PROPERTY_LABEL, "Taxes assimilées à la TVA"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2966", Account.PROPERTY_LABEL, "TVA collectée"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2967", Account.PROPERTY_LABEL, "TVA Collectée 20%"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2968", Account.PROPERTY_LABEL, "TVA encaissée"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2971", Account.PROPERTY_LABEL, "TVA encaissée 20%"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2972", Account.PROPERTY_LABEL, "Taxes assimilées à la TVA"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2973", Account.PROPERTY_LABEL, "TVA A REGUL"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2974", Account.PROPERTY_LABEL, "Remboursement de taxes sur le chiffre d'affaires demandé"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2975", Account.PROPERTY_LABEL, "TVA récupérée d'avance"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "2976", Account.PROPERTY_LABEL, "Taxes sur le chif d'af sur factures non parvenues"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4081", Account.PROPERTY_LABEL, "Taxes sur le chiffre d'affaires sur factures à établir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4084", Account.PROPERTY_LABEL, "Obligations cautionnées"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4088", Account.PROPERTY_LABEL, "Autres TVA à déduire"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4091", Account.PROPERTY_LABEL, "Autres impôts; taxes et versements assimilés"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4096", Account.PROPERTY_LABEL, "ETAT CHARGES A PAYER"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4097", Account.PROPERTY_LABEL, "Etat charges a payer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4098", Account.PROPERTY_LABEL, "TAXE PRO"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4191", Account.PROPERTY_LABEL, "Etat charges à payer formation prof"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4196", Account.PROPERTY_LABEL, "Impôt dégrevements à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4197", Account.PROPERTY_LABEL, "Associés - Comptes courants"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4198", Account.PROPERTY_LABEL, "compte REGNIER"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4282", Account.PROPERTY_LABEL, "compte POUSSIN"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4284", Account.PROPERTY_LABEL, "compte PINEAU"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4286", Account.PROPERTY_LABEL, "Créances sur cessions d'immobilisations"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4287", Account.PROPERTY_LABEL, "Subvention Oseo à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4452", Account.PROPERTY_LABEL, "Débiteurs et crediteurs divers"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4455", Account.PROPERTY_LABEL, "Produits à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4456", Account.PROPERTY_LABEL, "Compte d'attente"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4457", Account.PROPERTY_LABEL, "Compte d'attente"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4458", Account.PROPERTY_LABEL, "Charges à repartir sur plusieurs exercices"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4686", Account.PROPERTY_LABEL, "Charges constatées d'avance"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "4687", Account.PROPERTY_LABEL, "Produits constatés d'avance"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5111", Account.PROPERTY_LABEL, "Provisions pour dépréciation des comptes de clients"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5112", Account.PROPERTY_LABEL, "Provisions pour dépréciation des comptes de débiteurs divers"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5113", Account.PROPERTY_LABEL, "VMP - Actions"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5114", Account.PROPERTY_LABEL, "CAT Tonic 60"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5121", Account.PROPERTY_LABEL, "Valeurs à I'encaissement"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "5122", Account.PROPERTY_LABEL, "Banques"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6022", Account.PROPERTY_LABEL, "CAT TONIC 60"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6026", Account.PROPERTY_LABEL, "Autres organismes financiers"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6031", Account.PROPERTY_LABEL, "Intérêts courus à payer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6032", Account.PROPERTY_LABEL, "Concours bancaires courant"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6091", Account.PROPERTY_LABEL, "Crédit de mobilisation de créances commerciales (CMCC)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6092", Account.PROPERTY_LABEL, "Mobilisation de créances nées à létranger"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6094", Account.PROPERTY_LABEL, "TONIC 60- Intérets courus à recevoir"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6095", Account.PROPERTY_LABEL, "Caisse siège social"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6096", Account.PROPERTY_LABEL, "Virements internes"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6097", Account.PROPERTY_LABEL, "Provisions pour dépréciation des valeurs mobilières de place"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6098", Account.PROPERTY_LABEL, "Achats stockés - Matières premières (et fournitures)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6371", Account.PROPERTY_LABEL, "ACHATS MATERIELS INFORMATIQUES"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6411", Account.PROPERTY_LABEL, "Achats stockés - Matières premières France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6412", Account.PROPERTY_LABEL, "Achats stockés - Matières premières CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6413", Account.PROPERTY_LABEL, "Fournitures consommables"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6414", Account.PROPERTY_LABEL, "achat carburant"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6451", Account.PROPERTY_LABEL, "Fourniture de magasin"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6452", Account.PROPERTY_LABEL, "Fourniture de bureau"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6453", Account.PROPERTY_LABEL, "Frais postaux"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6454", Account.PROPERTY_LABEL, "Emballages"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "6688", Account.PROPERTY_LABEL, "VARIATION DES STOCKS (approvisionnements et marchandises)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "7133", Account.PROPERTY_LABEL, "Variation des stocks de matières premières (et fournitures)"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "7134", Account.PROPERTY_LABEL, "Variation des stocks de marchandises"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "7135", Account.PROPERTY_LABEL, "Prestations de services"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "7688", Account.PROPERTY_LABEL, "achat matériel informatique"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "27682", Account.PROPERTY_LABEL, "Achats non stockes de matières et fournitures"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "27684", Account.PROPERTY_LABEL, "éléctricité"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "27685", Account.PROPERTY_LABEL, "gaz"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "27688", Account.PROPERTY_LABEL, "Repas"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44551", Account.PROPERTY_LABEL, "Petit équipement"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44562", Account.PROPERTY_LABEL, "frais d'aménagement"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44566", Account.PROPERTY_LABEL, "Fournitures de bureau"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44567", Account.PROPERTY_LABEL, "CARBURANTS"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44571", Account.PROPERTY_LABEL, "Achats de marchandises"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44583", Account.PROPERTY_LABEL, "achats divers"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44584", Account.PROPERTY_LABEL, "Achats de marchandises France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44586", Account.PROPERTY_LABEL, "Achats de marchandises CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "44587", Account.PROPERTY_LABEL, "Frais accessoires d'achat"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68111", Account.PROPERTY_LABEL, "Frais accessoires d'achat France"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68112", Account.PROPERTY_LABEL, "Frais accessoires d'achat CEE"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68161", Account.PROPERTY_LABEL, "Rabais; remises et ristournes obtenus sur achats"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68162", Account.PROPERTY_LABEL, "RRR sur prestations de services"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "68725", Account.PROPERTY_LABEL, "Sous-traitance générale"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "78161", Account.PROPERTY_LABEL, "Redevances de crédit-bail"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "78162", Account.PROPERTY_LABEL, "Locations"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "78725", Account.PROPERTY_LABEL, "loyer"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445661", Account.PROPERTY_LABEL, "Location informatique"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445662", Account.PROPERTY_LABEL, "location mobilière"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445664", Account.PROPERTY_LABEL, "Malis sur emballages"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445665", Account.PROPERTY_LABEL, "Charges locatives et de copropriété"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445711", Account.PROPERTY_LABEL, "Entretien et réparations"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445712", Account.PROPERTY_LABEL, "Entretien et réparations sur biens immo"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445714", Account.PROPERTY_LABEL, "entretien locaux"); - accountTopiaDao.create(Account.PROPERTY_ACCOUNT_NUMBER, "445715", Account.PROPERTY_LABEL, "Primes d'assurance"); - tcontext.commit(); - } - - /** * Create some EntryBooks. * * @throws org.chorem.lima.business.exceptions.LimaException * @throws java.text.ParseException */ - protected void initTestWithEntryBooks() throws Exception { + protected void createEntryBooks() throws Exception { // creation d'un journal EntryBook journalDesVentes = new EntryBookImpl(); journalDesVentes.setLabel("Journal des ventes"); @@ -756,14 +286,7 @@ public abstract class AbstractLimaTest { * @throws org.chorem.lima.business.exceptions.LimaException * @throws java.text.ParseException */ - protected void initTestWithFiscalPeriod() throws Exception { - initTestWithAccounts(); - - // creation d'un journal - EntryBook journalDesVentes = new EntryBookImpl(); - journalDesVentes.setLabel("Journal des ventes"); - journalDesVentes.setCode("jdv"); - entryBookService.createEntryBook(journalDesVentes); + protected void createFiscalPeriod() throws Exception { // creation d'un exercice fiscal FiscalPeriod fiscalPeriod = new FiscalPeriodImpl(); @@ -776,9 +299,8 @@ public abstract class AbstractLimaTest { * Create FinancialTransaction with 2 entries * @throws Exception */ - protected void initTestWithFinancialTransaction() throws Exception { + protected void createFinancialTransaction() throws Exception { - initTestWithFiscalPeriod(); Account accountVmpVae = accountService.getAccountByNumber("511"); EntryBook journalDesVentes = entryBookService.getEntryBookByCode("jdv"); diff --git a/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java index 01505fe..9cf9a7a 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java @@ -22,7 +22,11 @@ package org.chorem.lima.business; +import org.chorem.lima.business.exceptions.AlreadyExistAccountException; +import org.chorem.lima.business.exceptions.InvalidAccountNumberException; import org.chorem.lima.business.exceptions.LimaException; +import org.chorem.lima.business.exceptions.NotAllowedLabelException; +import org.chorem.lima.business.exceptions.NotNumberAccountNumberException; import org.chorem.lima.business.exceptions.UsedAccountException; import org.chorem.lima.entity.Account; import org.chorem.lima.entity.AccountImpl; @@ -30,6 +34,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import java.util.Iterator; import java.util.List; /** @@ -46,15 +51,164 @@ public class AccountServiceImplTest extends AbstractLimaTest { @Before public void initTest() throws Exception { - initTestWithAccounts(); + createAccounts(); + } + + @Test + public void getAccountCountTest() { + Assert.assertEquals(7, accountService.getAccountCount()); + } + + @Test + public void getMasterAccountCountTest() { + Account master = accountService.getMasterAccount("501"); + Assert.assertNotNull(master); + Assert.assertEquals("50", master.getAccountNumber()); + + master = accountService.getMasterAccount("5"); + Assert.assertNull(master); + } + + @Test + public void getAccountByNumberTest() { + Account account = accountService.getAccountByNumber("501"); + Assert.assertNotNull(account); + Assert.assertEquals("501", account.getAccountNumber()); + Assert.assertEquals("Parts dans des entreprises liées", account.getLabel()); + + account = accountService.getAccountByNumber("753"); + Assert.assertNull(account); + } + + /** + * Permet de tester la méthode recherchant tous les comptes. + * + * @throws LimaException + */ + @Test + public void getAllAccountTest() throws LimaException { + List<Account> listAccount = accountService.getAllAccounts(); + Assert.assertEquals(7, listAccount.size()); + + Iterator<Account> iterator = listAccount.iterator(); + + Account account = iterator.next(); + Assert.assertEquals("5", account.getAccountNumber()); + Assert.assertEquals("Comptes financiers", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("50", account.getAccountNumber()); + Assert.assertEquals("Valeurs mobilières de placement", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("501", account.getAccountNumber()); + Assert.assertEquals("Parts dans des entreprises liées", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("502", account.getAccountNumber()); + Assert.assertEquals("Actions propres", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("51", account.getAccountNumber()); + Assert.assertEquals("Banques établissements financiers et assimilés", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("511", account.getAccountNumber()); + Assert.assertEquals("Valeurs à l'encaissement", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("512", account.getAccountNumber()); + Assert.assertEquals("Banques", account.getLabel()); + } + + /** + * Find all leaf account. + * + * @throws LimaException + */ + @Test + public void getAllLeafAccountTest() throws LimaException { + List<Account> listAccount = accountService.getAllLeafAccounts(); + Iterator<Account> iterator = listAccount.iterator(); + + Account account = iterator.next(); + Assert.assertEquals("501", account.getAccountNumber()); + Assert.assertEquals("Parts dans des entreprises liées", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("502", account.getAccountNumber()); + Assert.assertEquals("Actions propres", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("511", account.getAccountNumber()); + Assert.assertEquals("Valeurs à l'encaissement", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("512", account.getAccountNumber()); + Assert.assertEquals("Banques", account.getLabel()); + } + + /** + * Test get all subaccounts. + * + * @throws LimaException + */ + @Test + public void getAllSubAccountsTest() throws LimaException { + Account parent = accountService.getAccountByNumber("50"); + List<Account> listAccount = accountService.getAllSubAccounts(parent); + Assert.assertEquals(2, listAccount.size()); + + Iterator<Account> iterator = listAccount.iterator(); + + Account account = iterator.next(); + Assert.assertEquals("501", account.getAccountNumber()); + Assert.assertEquals("Parts dans des entreprises liées", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("502", account.getAccountNumber()); + Assert.assertEquals("Actions propres", account.getLabel()); + + parent = accountService.getAccountByNumber("501"); + listAccount = accountService.getAllSubAccounts(parent); + Assert.assertEquals(0, listAccount.size()); + } + + + + @Test + public void createOrUbdateAccountTest() throws InvalidAccountNumberException, NotNumberAccountNumberException, NotAllowedLabelException { + Account account = new AccountImpl(); + account.setAccountNumber("503"); + account.setLabel("VMP - Actions"); + boolean updated = accountService.createOrUpdateAccount(account); + Assert.assertFalse(updated); + Assert.assertEquals(8, accountService.getAccountCount()); + account = accountService.getAccountByNumber("503"); + Assert.assertNotNull(account); + Assert.assertEquals("503", account.getAccountNumber()); + Assert.assertEquals("VMP - Actions", account.getLabel()); + + account = new AccountImpl(); + account.setAccountNumber("502"); + account.setLabel("Actions propres MAJ"); + updated = accountService.createOrUpdateAccount(account); + Assert.assertTrue(updated); + Assert.assertEquals(8, accountService.getAccountCount()); + account = accountService.getAccountByNumber("502"); + Assert.assertEquals("Actions propres MAJ", account.getLabel()); } /** * Création d'un compte dans le plan comptable. - * @throws org.chorem.lima.business.exceptions.LimaException + * + * @throws org.chorem.lima.business.exceptions.AlreadyExistAccountException + * @throws org.chorem.lima.business.exceptions.NotAllowedLabelException + * @throws org.chorem.lima.business.exceptions.InvalidAccountNumberException + * @throws org.chorem.lima.business.exceptions.NotNumberAccountNumberException */ @Test - public void createAccountTest() throws LimaException { + public void createAccountTest() throws AlreadyExistAccountException, NotAllowedLabelException, InvalidAccountNumberException, NotNumberAccountNumberException { Account myAccount = new AccountImpl(); myAccount.setAccountNumber("2"); myAccount.setLabel("Comptes d'immobilisations"); @@ -64,10 +218,13 @@ public class AccountServiceImplTest extends AbstractLimaTest { /** * Création d'un compte dans le plan comptable (echec duplication). * - * @throws LimaException + * @throws org.chorem.lima.business.exceptions.AlreadyExistAccountException + * @throws org.chorem.lima.business.exceptions.NotAllowedLabelException + * @throws org.chorem.lima.business.exceptions.InvalidAccountNumberException + * @throws org.chorem.lima.business.exceptions.NotNumberAccountNumberException */ - @Test(expected = LimaException.class) - public void createAccountEchecTest() throws LimaException { + @Test(expected = AlreadyExistAccountException.class) + public void createAccountFailAlreadyExistTest() throws AlreadyExistAccountException, NotAllowedLabelException, InvalidAccountNumberException, NotNumberAccountNumberException { Account myAccount = new AccountImpl(); myAccount.setAccountNumber("5"); myAccount.setLabel("Comptes de capitaux"); @@ -75,50 +232,38 @@ public class AccountServiceImplTest extends AbstractLimaTest { } /** - * Création d'un compte dans le plan comptable. - * - * Le test ne doit pas echoué avec les regles par defaut, mais peut echouer - * suivant certaines autres regles. - * - * @throws LimaException + * Création d'un compte dans le plan comptable (echec numéro de compte non valide). + * + * @throws org.chorem.lima.business.exceptions.AlreadyExistAccountException + * @throws org.chorem.lima.business.exceptions.NotAllowedLabelException + * @throws org.chorem.lima.business.exceptions.InvalidAccountNumberException + * @throws org.chorem.lima.business.exceptions.NotNumberAccountNumberException */ - @Test - public void testCreateAccountWrongNumber() throws LimaException { + @Test(expected = InvalidAccountNumberException.class) + public void createAccountFailInvalidAccountNumberTest() throws AlreadyExistAccountException, NotAllowedLabelException, InvalidAccountNumberException, NotNumberAccountNumberException { Account myAccount = new AccountImpl(); - myAccount.setAccountNumber("42"); // erreur de compte (4) - myAccount.setLabel("Comptes de tiers"); + myAccount.setAccountNumber(""); + myAccount.setLabel("Comptes de capitaux"); accountService.createAccount(myAccount); } /** - * Permet de tester l'ajout des comptes sous format DTO. La grande différence - * entre la création classique, l'applicaion va enregistrer tous les comptes - * enfants. - * @throws LimaException + * Création d'un compte dans le plan comptable (echec duplication). + * + * @throws org.chorem.lima.business.exceptions.AlreadyExistAccountException + * @throws org.chorem.lima.business.exceptions.NotAllowedLabelException + * @throws org.chorem.lima.business.exceptions.InvalidAccountNumberException + * @throws org.chorem.lima.business.exceptions.NotNumberAccountNumberException */ - @Test - public void createAccountWithChildTest() throws LimaException { - // Création des comptes - Account classCharges = new AccountImpl(); - classCharges.setAccountNumber("6"); - classCharges.setLabel("Comptes de charges"); - accountService.createAccount(classCharges); - - Account accountAchat = new AccountImpl(); - accountAchat.setAccountNumber("60"); - accountAchat.setLabel("Achats (sauf 603)"); - accountService.createAccount(accountAchat); + @Test(expected = NotNumberAccountNumberException.class) + public void createAccountFailNotNumberAccountNumberTest() throws AlreadyExistAccountException, NotAllowedLabelException, InvalidAccountNumberException, NotNumberAccountNumberException { + Account myAccount = new AccountImpl(); + myAccount.setAccountNumber("CINQ"); + myAccount.setLabel("Comptes de capitaux"); + accountService.createAccount(myAccount); + } - Account accountSe = new AccountImpl(); - accountSe.setAccountNumber("61"); - accountSe.setLabel("Services extérieurs"); - accountService.createAccount(accountSe); - Account accountVs = new AccountImpl(); - accountVs.setAccountNumber("603"); - accountVs.setLabel("Variations des stocks (approvisionnements et marchandises)"); - accountService.createAccount(accountVs); - } /** * Permet de tester l'ajout des comptes sous format DTO. La grande différence @@ -140,54 +285,15 @@ public class AccountServiceImplTest extends AbstractLimaTest { accountService.createAccount(accountVmp); } - /** - * Recherche d'un compte dans le plan comptable à partir d'un numéro de - * compte. - * @throws LimaException - */ - @Test - public void searchAccountTest() throws LimaException { - // On recherche le compte 5 Comptes financiers - Account result = accountService.getAccountByNumber("5"); - Assert.assertEquals("Comptes financiers", result.getLabel()); - } - - /** - * Permet de tester la méthode recherchant tous les comptes. - * - * @throws LimaException - */ - @Test - public void getAllAccountTest() throws LimaException { - List<Account> listAccount = accountService.getAllAccounts(); - Assert.assertEquals(7, listAccount.size()); - } - - /** - * Find all leaf account. - * - * @throws LimaException - */ - @Test - public void getAllLeafAccountTest() throws LimaException { - List<Account> listAccount = accountService.getAllLeafAccounts(); - Assert.assertEquals(4, listAccount.size()); - } - - /** - * Test get all subaccounts. - * - * @throws LimaException - */ @Test - public void getAllSubAccountsTest() throws LimaException { - Account parent = accountService.getAccountByNumber("50"); - List<Account> listAccount = accountService.getAllSubAccounts(parent); - Assert.assertEquals(2, listAccount.size()); - - parent = accountService.getAccountByNumber("501"); - listAccount = accountService.getAllSubAccounts(parent); - Assert.assertEquals(0, listAccount.size()); + public void updateAccountTest() throws NotNumberAccountNumberException, InvalidAccountNumberException { + Account account = new AccountImpl(); + account.setAccountNumber("502"); + account.setLabel("Actions propres MAJ"); + accountService.updateAccount(account); + Assert.assertEquals(7, accountService.getAccountCount()); + account = accountService.getAccountByNumber("502"); + Assert.assertEquals("Actions propres MAJ", account.getLabel()); } /** @@ -203,14 +309,41 @@ public class AccountServiceImplTest extends AbstractLimaTest { accountService.removeAccount(accountToRemove); // Il ne doit rester que 6 compte - Assert.assertEquals(6, accountService.getAllAccounts().size()); + List<Account> listAccount = accountService.getAllAccounts(); + Assert.assertEquals(6, listAccount.size()); + + Iterator<Account> iterator = listAccount.iterator(); + + Account account = iterator.next(); + Assert.assertEquals("5", account.getAccountNumber()); + Assert.assertEquals("Comptes financiers", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("501", account.getAccountNumber()); + Assert.assertEquals("Parts dans des entreprises liées", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("502", account.getAccountNumber()); + Assert.assertEquals("Actions propres", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("51", account.getAccountNumber()); + Assert.assertEquals("Banques établissements financiers et assimilés", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("511", account.getAccountNumber()); + Assert.assertEquals("Valeurs à l'encaissement", account.getLabel()); + + account = iterator.next(); + Assert.assertEquals("512", account.getAccountNumber()); + Assert.assertEquals("Banques", account.getLabel()); } /** * On souhaite supprimer le compte 422, ce dernier n'existe pas. La * suppression ne peut s'effectuer. * - * @throws LimaException + * @throws UsedAccountException */ @Test(expected = Exception.class) public void removeUnexistedAccountTest() throws UsedAccountException { @@ -220,8 +353,25 @@ public class AccountServiceImplTest extends AbstractLimaTest { accountService.removeAccount(account4); } + /** + * On souhaite supprimer le compte 501, ce dernier est utilisé dans une ecriture. La + * suppression ne peut s'effectuer. + * + * @throws UsedAccountException + */ + @Test(expected = UsedAccountException.class) + public void removeUsedAccountTest() throws Exception { + createEntryBooks(); + createFiscalPeriod(); + createFinancialTransaction(); + Account account = accountService.getAccountByNumber("511"); + accountService.removeAccount(account); + } + + + @Test - public void testStringToListAccounts() throws Exception { + public void testStringToListAccounts() { List<Account> accounts = accountService.stringToListAccounts("50..511"); Assert.assertEquals(5, accounts.size()); diff --git a/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java index 104b357..abf3005 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java @@ -50,7 +50,7 @@ public class EntryBookServiceImplTest extends AbstractLimaTest { @Before public void initTest() throws Exception { - initTestWithEntryBooks(); + createEntryBooks(); } /** diff --git a/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java index 581b4cd..e699b7c 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java @@ -51,7 +51,10 @@ public class FinancialPeriodServiceImplTest extends AbstractLimaTest { */ @Test public void blockClosedPeriodicEntryBookTest() throws Exception { - initTestWithFinancialTransaction(); + createAccounts(); + createEntryBooks(); + createFiscalPeriod(); + createFinancialTransaction(); // find one closed to close LimaCallaoTopiaPersistenceContext tcontext = context.newPersistenceContext(); diff --git a/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java index f25568e..c44ea97 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java @@ -54,7 +54,10 @@ public class FinancialTransactionServiceImplTest extends AbstractLimaTest { @Before public void initTest() throws Exception { - initTestWithFinancialTransaction(); + createAccounts(); + createEntryBooks(); + createFiscalPeriod(); + createFinancialTransaction(); } /** diff --git a/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java b/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java index 8e342c6..d76cd5e 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/ImportExportServiceTest.java @@ -72,7 +72,9 @@ public class ImportExportServiceTest extends AbstractLimaTest { @Test public void testExportImportAccounts() throws Exception { - initTestWithFiscalPeriod(); + createAccounts(); + createEntryBooks(); + createFiscalPeriod(); // make sure they are some accounts. List<Account> accounts = accountService.getAllAccounts(); Assert.assertTrue(accountService.getAllAccounts().size() > 0); @@ -124,7 +126,8 @@ public class ImportExportServiceTest extends AbstractLimaTest { @Test public void testExportImportEntryBooks() throws Exception { - initTestWithEntryBooks(); + createAccounts(); + createEntryBooks(); String tmpDir = System.getProperty("java.io.tmpdir")+"/"; ImportExportResults export = exportService.exportEntryBooksAsCSV(Charset.defaultCharset().name()); @@ -159,7 +162,10 @@ public class ImportExportServiceTest extends AbstractLimaTest { @Test public void testExportImportEntries() throws Exception { - initTestWithFinancialTransaction(); + createAccounts(); + createEntryBooks(); + createFiscalPeriod(); + createFinancialTransaction(); List<FinancialTransaction> financialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("April 4, 2012"),df.parse("December 31, 2012")); List<Entry> entries = Lists.newArrayList(); @@ -213,7 +219,9 @@ public class ImportExportServiceTest extends AbstractLimaTest { @Test public void testExportImportFiscalPeriodsAsCSV() throws Exception { - initTestWithFiscalPeriod(); + createAccounts(); + createEntryBooks(); + createFiscalPeriod(); String tmpDir = System.getProperty("java.io.tmpdir")+"/"; String export = exportService.exportFiscalPeriodsAsCSV(Charset.defaultCharset().name()).getExportResults().get(0).getExportData(); @@ -246,7 +254,11 @@ public class ImportExportServiceTest extends AbstractLimaTest { @Test public void exportImportAllAsCSVTest() throws Exception { - initTestWithFinancialTransaction(); + createAccounts(); + createEntryBooks(); + createFiscalPeriod(); + createFinancialTransaction(); + Identity identity = new IdentityImpl(); identity.setName("Code Lutin"); identity.setAddress("12 Avenue Jules Verne"); @@ -471,6 +483,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { for (String accountNumber : accountNumbers) { Account account = new AccountImpl(); account.setAccountNumber(accountNumber); + account.setLabel("Account " + accountNumber); accountService.createAccount(account); } @@ -479,6 +492,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { for (String accountNumber : _31JanuaryFTaccountNumbers) { Account account = new AccountImpl(); account.setAccountNumber(accountNumber); + account.setLabel("Account " + accountNumber); _31JanuaryFTaccounts.add(accountService.createAccount(account)); } @@ -538,7 +552,10 @@ public class ImportExportServiceTest extends AbstractLimaTest { @Test public void testExportImportEntriesEbp() throws Exception { - initTestWithFinancialTransaction(); + createAccounts(); + createEntryBooks(); + createFiscalPeriod(); + createFinancialTransaction(); List<FinancialTransaction> financialTransactions = financialTransactionService.getAllFinancialTransactions(df.parse("April 4, 2012"),df.parse("December 31, 2012")); List<Entry> entries = Lists.newArrayList(); @@ -613,7 +630,7 @@ public class ImportExportServiceTest extends AbstractLimaTest { entryBookStream = ImportExportServiceTest.class.getResourceAsStream("/ebp/journaux.txt"); entriesStream = ImportExportServiceTest.class.getResourceAsStream("/ebp/ecritures.txt"); - importService.importAccountFromEbp(IOUtils.toString(accountStream, "ISO-8859-1")); + ImportExportResults importExportResults = importService.importAccountFromEbp(IOUtils.toString(accountStream, "ISO-8859-1")); importService.importEntryBookFromEbp(IOUtils.toString(entryBookStream, "ISO-8859-1")); importService.importEntriesFromEbp(IOUtils.toString(entriesStream, "ISO-8859-1")); } diff --git a/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java index 36b376b..6851851 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/ReportServiceImplTest.java @@ -48,7 +48,10 @@ public class ReportServiceImplTest extends AbstractLimaTest { @Before public void initTest() throws Exception { - initTestWithFinancialTransaction(); + createAccounts(); + createEntryBooks(); + createFiscalPeriod(); + createFinancialTransaction(); } /** diff --git a/lima-business/src/test/java/org/chorem/lima/entity/FinancialTransactionDAOTest.java b/lima-business/src/test/java/org/chorem/lima/entity/FinancialTransactionDAOTest.java index a77eda6..1ea0b63 100644 --- a/lima-business/src/test/java/org/chorem/lima/entity/FinancialTransactionDAOTest.java +++ b/lima-business/src/test/java/org/chorem/lima/entity/FinancialTransactionDAOTest.java @@ -54,7 +54,10 @@ public class FinancialTransactionDAOTest extends AbstractLimaTest { @Test public void testFindAllUnbalancedTransactions() throws Exception { - initTestWithFinancialTransaction(); + createAccounts(); + createEntryBooks(); + createFiscalPeriod(); + createFinancialTransaction(); FinancialPeriod financialPeriod = financialPeriodService.getAllFinancialPeriods().get(0); EntryBook journalDesVentes = entryBookService.getEntryBookByCode("jdv"); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 391ae16b10a4f7645850c16a376e95a4afdfe29c Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Mon Jun 1 15:42:03 2015 +0200 refs #1233 : test du service des journaux --- .../lima/business/EntryBookServiceImplTest.java | 146 +++++++++++++++++---- 1 file changed, 119 insertions(+), 27 deletions(-) diff --git a/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java index abf3005..8455e99 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java @@ -22,19 +22,17 @@ package org.chorem.lima.business; +import org.chorem.lima.business.exceptions.AlreadyExistEntryBookException; import org.chorem.lima.business.exceptions.LimaException; import org.chorem.lima.business.exceptions.UsedEntryBookException; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryBookImpl; -import org.chorem.lima.entity.FinancialTransaction; -import org.chorem.lima.entity.FinancialTransactionImpl; -import org.chorem.lima.entity.FiscalPeriod; -import org.chorem.lima.entity.FiscalPeriodImpl; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import java.text.ParseException; +import java.util.Iterator; +import java.util.List; /** * Tests pour la gestion des journaux. @@ -53,6 +51,104 @@ public class EntryBookServiceImplTest extends AbstractLimaTest { createEntryBooks(); } + @Test + public void getEntryBookByCodeTest() { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + Assert.assertNotNull(entryBook); + Assert.assertEquals("jdv", entryBook.getCode()); + Assert.assertEquals("Journal des ventes", entryBook.getLabel()); + + entryBook = entryBookService.getEntryBookByCode("XXX"); + Assert.assertNull(entryBook); + } + + @Test + public void getAllEntryBooksTest() throws LimaException { + List<EntryBook> allEntryBooks = entryBookService.getAllEntryBooks(); + + Assert.assertEquals(3, allEntryBooks.size()); + + Iterator<EntryBook> iterator = allEntryBooks.iterator(); + + EntryBook entryBook = iterator.next(); + Assert.assertEquals("JRN", entryBook.getCode()); + Assert.assertEquals("MyJournal", entryBook.getLabel()); + + entryBook = iterator.next(); + Assert.assertEquals("jda", entryBook.getCode()); + Assert.assertEquals("Journal des achats", entryBook.getLabel()); + + entryBook = iterator.next(); + Assert.assertEquals("jdv", entryBook.getCode()); + Assert.assertEquals("Journal des ventes", entryBook.getLabel()); + } + + @Test + public void createNewEntryBookTest() { + EntryBook newEntryBook = entryBookService.createNewEntryBook(); + Assert.assertNull(newEntryBook.getCode()); + Assert.assertNull(newEntryBook.getLabel()); + + List<EntryBook> allEntryBooks = entryBookService.getAllEntryBooks(); + + Assert.assertEquals(3, allEntryBooks.size()); + Assert.assertFalse(allEntryBooks.contains(newEntryBook)); + } + + @Test + public void createOrUpdateEntryBookTest() { + EntryBook entryBook = new EntryBookImpl(); + entryBook.setCode("jdm"); + entryBook.setLabel("journal des machins"); + boolean updated = entryBookService.createOrUpdateEntryBook(entryBook); + Assert.assertFalse(updated); + Assert.assertEquals(4, entryBookService.getAllEntryBooks().size()); + entryBook = entryBookService.getEntryBookByCode("jdm"); + Assert.assertNotNull(entryBook); + Assert.assertEquals("jdm", entryBook.getCode()); + Assert.assertEquals("journal des machins", entryBook.getLabel()); + + entryBook = new EntryBookImpl(); + entryBook.setCode("jdv"); + entryBook.setLabel("journal des ventes bis"); + updated = entryBookService.createOrUpdateEntryBook(entryBook); + Assert.assertTrue(updated); + Assert.assertEquals(4, entryBookService.getAllEntryBooks().size()); + entryBook = entryBookService.getEntryBookByCode("jdv"); + Assert.assertNotNull(entryBook); + Assert.assertEquals("jdv", entryBook.getCode()); + Assert.assertEquals("journal des ventes bis", entryBook.getLabel()); + } + + @Test + public void createEntryBookTest() throws AlreadyExistEntryBookException { + + EntryBook entryBook = new EntryBookImpl(); + entryBook.setCode("jdm"); + entryBook.setLabel("journal des machins"); + + entryBook = entryBookService.createEntryBook(entryBook); + Assert.assertEquals("jdm", entryBook.getCode()); + Assert.assertEquals("journal des machins", entryBook.getLabel()); + + List<EntryBook> allEntryBooks = entryBookService.getAllEntryBooks(); + + Assert.assertEquals(4, allEntryBooks.size()); + Assert.assertTrue(allEntryBooks.contains(entryBook)); + } + + @Test(expected = AlreadyExistEntryBookException.class) + public void createEntryBookFailAlreadyExistTest() throws AlreadyExistEntryBookException { + + EntryBook entryBook = new EntryBookImpl(); + entryBook.setCode("jdv"); + entryBook.setLabel("journal des ventes bis"); + + entryBookService.createEntryBook(entryBook); + } + + /** * Permet de tester la modification d'un journal suivant son préfixe. * @@ -60,7 +156,6 @@ public class EntryBookServiceImplTest extends AbstractLimaTest { */ @Test public void modifyJournalTest() throws LimaException { - entryBookService.getAllEntryBooks(); EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); Assert.assertNotNull(entryBook); Assert.assertEquals(JOURNAL_DES_VENTES, entryBook.getLabel()); @@ -79,21 +174,10 @@ public class EntryBookServiceImplTest extends AbstractLimaTest { * @throws LimaException */ @Test(expected=UsedEntryBookException.class) - public void deleteUsedEntryBook() throws LimaException, ParseException { + public void deleteUsedEntryBook() throws Exception { + createFiscalPeriod(); + createFinancialTransaction(); EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); - Assert.assertNotNull(entryBook); - - // make transaction used - // creation d'un exercice fiscal - FiscalPeriod fiscalPeriod = new FiscalPeriodImpl(); - fiscalPeriod.setBeginDate(df.parse("January 1, 2012")); - fiscalPeriod.setEndDate(df.parse("December 31, 2012")); - fiscalPeriodService.createFiscalPeriod(fiscalPeriod); - - FinancialTransaction financialTransaction = new FinancialTransactionImpl(); - financialTransaction.setTransactionDate(df.parse("January 1, 2012")); - financialTransaction.setEntryBook(entryBook); - financialTransactionService.createFinancialTransaction(financialTransaction); entryBookService.removeEntryBook(entryBook); } @@ -107,14 +191,22 @@ public class EntryBookServiceImplTest extends AbstractLimaTest { @Test public void deleteNonUsedEntryBookTest() throws LimaException { - EntryBook myEntryBook = new EntryBookImpl(); - myEntryBook.setCode("JRN2"); - myEntryBook.setLabel("MyJournal"); - myEntryBook = entryBookService.createEntryBook(myEntryBook); - int nbEntryBooks = entryBookService.getAllEntryBooks().size(); - entryBookService.removeEntryBook(myEntryBook); + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + entryBookService.removeEntryBook(entryBook); + List<EntryBook> allEntryBooks = entryBookService.getAllEntryBooks(); + + Assert.assertEquals(2, allEntryBooks.size()); - Assert.assertEquals(nbEntryBooks -1, entryBookService.getAllEntryBooks().size()); + Iterator<EntryBook> iterator = allEntryBooks.iterator(); + + entryBook = iterator.next(); + Assert.assertEquals("JRN", entryBook.getCode()); + Assert.assertEquals("MyJournal", entryBook.getLabel()); + + entryBook = iterator.next(); + Assert.assertEquals("jda", entryBook.getCode()); + Assert.assertEquals("Journal des achats", entryBook.getLabel()); } } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 89b999b2b954938b4f59ee7ff461e7ef86c17d6f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Tue Jun 2 08:56:32 2015 +0200 refs #1233 : test du service des périodes fiscales (suppresion des fonctions de service non utilisé) --- .../lima/business/api/FinancialPeriodService.java | 4 - .../business/ejb/FinancialPeriodServiceImpl.java | 18 -- .../lima/entity/FinancialPeriodTopiaDao.java | 14 -- .../org/chorem/lima/business/AbstractLimaTest.java | 71 +++--- .../business/FinancialPeriodServiceImplTest.java | 263 +++++++++++++++++++-- .../chorem/lima/ui/account/AccountViewHandler.java | 12 +- 6 files changed, 290 insertions(+), 92 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialPeriodService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialPeriodService.java index 031192e..3b078dd 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialPeriodService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialPeriodService.java @@ -45,8 +45,6 @@ import java.util.List; public interface FinancialPeriodService { - List<FinancialPeriod> getUnblockedFinancialPeriods(); - ClosedPeriodicEntryBook getClosedPeriodicEntryBook(EntryBook entryBook, FinancialPeriod financialPeriod); @@ -62,6 +60,4 @@ public interface FinancialPeriodService { List<FinancialPeriod> getFinancialPeriods(Date beginDate, Date endDate); - - FinancialPeriod getFinancialPeriodByNaturalIds(Date beginDate, Date endDate); } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java index 8e62747..cabbf73 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialPeriodServiceImpl.java @@ -62,16 +62,6 @@ public class FinancialPeriodServiceImpl extends AbstractLimaService implements F return result; } - /** @return all unblocked financial period */ - @Override - public List<FinancialPeriod> getUnblockedFinancialPeriods() { - - FinancialPeriodTopiaDao financialPeriodTopiaDao = getDaoHelper().getFinancialPeriodDao(); - List<FinancialPeriod>result = financialPeriodTopiaDao.findAllUnlockedOrderByBeginDate(); - - return result; - } - /** @return all financial period from a fiscal period */ @Override public List<FinancialPeriod> getFinancialPeriods(Date beginDate, Date endDate) { @@ -82,14 +72,6 @@ public class FinancialPeriodServiceImpl extends AbstractLimaService implements F return result; } - public FinancialPeriod getFinancialPeriodByNaturalIds(Date beginDate, Date endDate) { - - FinancialPeriodTopiaDao financialPeriodTopiaDao = getDaoHelper().getFinancialPeriodDao(); - FinancialPeriod result = financialPeriodTopiaDao.findByNaturalId(beginDate, endDate); - - return result; - } - @Override public ClosedPeriodicEntryBook blockClosedPeriodicEntryBook(ClosedPeriodicEntryBook closedPeriodicEntryBook) throws UnbalancedFinancialTransactionsException, UnfilledEntriesException, WithoutEntryBookFinancialTransactionsException, NotLockedClosedPeriodicEntryBooksException { AccountingRules accountingRules = LimaBusinessConfig.getInstance().getAccountingRules(); diff --git a/lima-business/src/main/java/org/chorem/lima/entity/FinancialPeriodTopiaDao.java b/lima-business/src/main/java/org/chorem/lima/entity/FinancialPeriodTopiaDao.java index 9582a70..e951ade 100644 --- a/lima-business/src/main/java/org/chorem/lima/entity/FinancialPeriodTopiaDao.java +++ b/lima-business/src/main/java/org/chorem/lima/entity/FinancialPeriodTopiaDao.java @@ -77,19 +77,5 @@ public class FinancialPeriodTopiaDao extends AbstractFinancialPeriodTopiaDao<Fin return financialPeriod; } - - /** - * Retourne toutes les periodes ordonnées par date de debut de periode. - * - * @return all period ordered - */ - public List<FinancialPeriod> findAllUnlockedOrderByBeginDate() { - - List<FinancialPeriod> financialPeriod = forLockedEquals(false) - .setOrderByArguments(FinancialPeriod.PROPERTY_BEGIN_DATE) - .findAll(); - - return financialPeriod; - } } diff --git a/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java b/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java index 210f6c4..6ddf862 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/AbstractLimaTest.java @@ -65,6 +65,7 @@ import java.io.File; import java.io.IOException; import java.math.BigDecimal; import java.text.DateFormat; +import java.util.Date; import java.util.Locale; import java.util.Properties; import java.util.UUID; @@ -301,32 +302,48 @@ public abstract class AbstractLimaTest { */ protected void createFinancialTransaction() throws Exception { - Account accountVmpVae = accountService.getAccountByNumber("511"); - EntryBook journalDesVentes = entryBookService.getEntryBookByCode("jdv"); - - FinancialTransaction transaction1 = new FinancialTransactionImpl(); - transaction1.setTransactionDate(df.parse("April 4, 2012")); - transaction1.setEntryBook(journalDesVentes); - transaction1 = financialTransactionService.createFinancialTransaction(transaction1); - - Entry tr1Entry1 = new EntryImpl(); - tr1Entry1.setAmount(BigDecimal.valueOf(42.0)); - tr1Entry1.setAccount(accountVmpVae); - tr1Entry1.setFinancialTransaction(transaction1); - tr1Entry1.setDescription("test desc"); - tr1Entry1.setVoucher("voucher"); - tr1Entry1 = financialTransactionService.createEntry(tr1Entry1); - - Entry tr1Entry2 = new EntryImpl(); - tr1Entry2.setAmount(BigDecimal.valueOf(42.0)); - tr1Entry2.setDebit(true); - tr1Entry2.setAccount(accountVmpVae); - tr1Entry2.setFinancialTransaction(transaction1); - tr1Entry2.setDescription("test desc"); - tr1Entry2.setVoucher("voucher"); - tr1Entry2 = financialTransactionService.createEntry(tr1Entry2); - - transaction1.setEntry(Lists.newArrayList(tr1Entry1, tr1Entry2)); - financialTransactionService.updateFinancialTransaction(transaction1); + createFinancialTransaction("jdv", df.parse("April 4, 2012"), "511", "501", BigDecimal.valueOf(42.0)); } + + /** + * Create FinancialTransaction with 2 entries + * @throws Exception + */ + protected FinancialTransaction createFinancialTransaction(String entryBookCode, Date date, + String accountDebitNumber, String accountCreditNumber, + BigDecimal amount) throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode(entryBookCode); + Account accountDebit = accountService.getAccountByNumber(accountDebitNumber); + Account accountCredit = accountService.getAccountByNumber(accountCreditNumber); + + FinancialTransaction transaction = new FinancialTransactionImpl(); + transaction.setTransactionDate(date); + transaction.setEntryBook(entryBook); + transaction = financialTransactionService.createFinancialTransaction(transaction); + + Entry entry1 = new EntryImpl(); + entry1.setAmount(amount); + entry1.setDebit(true); + entry1.setAccount(accountDebit); + entry1.setFinancialTransaction(transaction); + entry1.setDescription("test desc"); + entry1.setVoucher("voucher"); + entry1 = financialTransactionService.createEntry(entry1); + + Entry entry2 = new EntryImpl(); + entry2.setAmount(amount); + entry2.setDebit(false); + entry2.setAccount(accountCredit); + entry2.setFinancialTransaction(transaction); + entry2.setDescription("test desc"); + entry2.setVoucher("voucher"); + entry2 = financialTransactionService.createEntry(entry2); + + transaction.setEntry(Lists.newArrayList(entry1, entry2)); + financialTransactionService.updateFinancialTransaction(transaction); + + return transaction; + } + } diff --git a/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java index e699b7c..5da0a81 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/FinancialPeriodServiceImplTest.java @@ -22,12 +22,24 @@ package org.chorem.lima.business; +import org.chorem.lima.business.exceptions.NotLockedClosedPeriodicEntryBooksException; +import org.chorem.lima.business.exceptions.UnbalancedFinancialTransactionsException; +import org.chorem.lima.business.exceptions.UnfilledEntriesException; import org.chorem.lima.entity.ClosedPeriodicEntryBook; -import org.chorem.lima.entity.ClosedPeriodicEntryBookTopiaDao; -import org.chorem.lima.entity.LimaCallaoTopiaPersistenceContext; +import org.chorem.lima.entity.Entry; +import org.chorem.lima.entity.EntryBook; +import org.chorem.lima.entity.FinancialPeriod; +import org.chorem.lima.entity.FinancialTransaction; +import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.entity.FiscalPeriodImpl; import org.junit.Assert; +import org.junit.Before; import org.junit.Test; +import org.nuiton.util.DateUtil; +import java.math.BigDecimal; +import java.text.ParseException; +import java.util.Iterator; import java.util.List; /** @@ -44,6 +56,54 @@ import java.util.List; */ public class FinancialPeriodServiceImplTest extends AbstractLimaTest { + @Before + public void initTest() throws Exception { + createAccounts(); + createEntryBooks(); + createFiscalPeriod(); + } + + @Test + public void getClosedPeriodicEntryBookTest() throws ParseException { + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + List<FinancialPeriod> periods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, periods.get(0)); + + Assert.assertNotNull(closedPeriodicEntryBook); + Assert.assertEquals(entryBook, closedPeriodicEntryBook.getEntryBook()); + Assert.assertEquals(periods.get(0), closedPeriodicEntryBook.getFinancialPeriod()); + Assert.assertFalse(closedPeriodicEntryBook.isLocked()); + } + + @Test + public void getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriodTest() throws Exception { + + List<ClosedPeriodicEntryBook> closedPeriodicEntryBooks = financialPeriodService.getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod(); + + Assert.assertEquals(36, closedPeriodicEntryBooks.size()); + + // creation d'un exercice fiscal + FiscalPeriod fiscalPeriod = new FiscalPeriodImpl(); + fiscalPeriod.setBeginDate(df.parse("January 1, 2013")); + fiscalPeriod.setEndDate(df.parse("December 31, 2013")); + fiscalPeriodService.createFiscalPeriod(fiscalPeriod); + + closedPeriodicEntryBooks = financialPeriodService.getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod(); + + Assert.assertEquals(72, closedPeriodicEntryBooks.size()); + + List<FiscalPeriod> fiscalPeriods = fiscalPeriodService.getAllFiscalPeriods(); + + fiscalPeriodService.blockFiscalPeriod(fiscalPeriods.get(0)); + + closedPeriodicEntryBooks = financialPeriodService.getAllClosedPeriodicEntryBooksFromUnblockedFiscalPeriod(); + + Assert.assertEquals(36, closedPeriodicEntryBooks.size()); + } + + /** * Test de la fermeture d'une periode comptable pour un journal donné. * @@ -51,28 +111,183 @@ public class FinancialPeriodServiceImplTest extends AbstractLimaTest { */ @Test public void blockClosedPeriodicEntryBookTest() throws Exception { - createAccounts(); - createEntryBooks(); - createFiscalPeriod(); - createFinancialTransaction(); - - // find one closed to close - LimaCallaoTopiaPersistenceContext tcontext = context.newPersistenceContext(); - ClosedPeriodicEntryBookTopiaDao dao = tcontext.getClosedPeriodicEntryBookDao(); - List<ClosedPeriodicEntryBook> closedPeriodics = dao.findAll(); - tcontext.close(); - ClosedPeriodicEntryBook closedPeriodic = closedPeriodics.get(0); - - // block it - Assert.assertFalse(closedPeriodic.isLocked()); - financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodic); - - // check it's blocked - tcontext = context.newPersistenceContext(); - dao = tcontext.getClosedPeriodicEntryBookDao(); - closedPeriodic = dao.findAll().get(0); - tcontext.close(); - Assert.assertFalse(closedPeriodic.isLocked()); + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + List<FinancialPeriod> periods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, periods.get(0)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + + closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, periods.get(0)); + + Assert.assertTrue(closedPeriodicEntryBook.isLocked()); } + @Test(expected = UnbalancedFinancialTransactionsException.class) + public void blockClosedPeriodicEntryBookFailUnbalanceTest() throws Exception { + + FinancialTransaction transaction = createFinancialTransaction("jdv", df.parse("January 4, 2012"), "511", "501", BigDecimal.valueOf(42.0)); + + Entry entry = transaction.getEntry().iterator().next(); + entry.setAmount(BigDecimal.valueOf(12)); + + financialTransactionService.updateEntry(entry); + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + List<FinancialPeriod> periods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, periods.get(0)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + } + + @Test(expected = UnfilledEntriesException.class) + public void blockClosedPeriodicEntryBookFailUnfilledEntriesTest() throws Exception { + + FinancialTransaction transaction = createFinancialTransaction("jdv", df.parse("January 4, 2012"), "511", "501", BigDecimal.valueOf(42.0)); + + Entry entry = transaction.getEntry().iterator().next(); + entry.setDescription(""); + + financialTransactionService.updateEntry(entry); + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + List<FinancialPeriod> periods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, periods.get(0)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + } + + @Test(expected = Exception.class) + public void blockClosedPeriodicEntryBookFailNoEntryBoockTest() throws Exception { + + FinancialTransaction transaction = createFinancialTransaction("jdv", df.parse("January 4, 2012"), "511", "501", BigDecimal.valueOf(42.0)); + + transaction.setEntryBook(null); + + financialTransactionService.updateFinancialTransaction(transaction); + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + List<FinancialPeriod> periods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, periods.get(0)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + } + + @Test(expected = NotLockedClosedPeriodicEntryBooksException.class) + public void blockClosedPeriodicEntryBookFailNoLockedPréviousTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + List<FinancialPeriod> periods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, periods.get(4)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + } + + @Test + public void getAllFinancialPeriodsTest() throws Exception { + + // creation d'un exercice fiscal + FiscalPeriod fiscalPeriod = new FiscalPeriodImpl(); + fiscalPeriod.setBeginDate(df.parse("January 1, 2013")); + fiscalPeriod.setEndDate(df.parse("December 31, 2013")); + fiscalPeriodService.createFiscalPeriod(fiscalPeriod); + + List<FiscalPeriod> fiscalPeriods = fiscalPeriodService.getAllFiscalPeriods(); + + fiscalPeriodService.blockFiscalPeriod(fiscalPeriods.get(0)); + + + List<FinancialPeriod> periods = financialPeriodService.getAllFinancialPeriods(); + + Assert.assertEquals(24, periods.size()); + + Iterator<FinancialPeriod> iterator = periods.iterator(); + + FinancialPeriod period; + period = iterator.next(); + Assert.assertEquals(df.parse("January 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("January 31, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("February 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("February 29, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("March 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("March 31, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("April 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("April 30, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("May 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("May 31, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("June 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("June 30, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("July 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("July 31, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("August 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("August 31, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("September 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("September 30, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("October 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("October 31, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("November 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("November 30, 2012")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("December 1, 2012"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("December 31, 2012")), period.getEndDate()); + + period = iterator.next(); + Assert.assertEquals(df.parse("January 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("January 31, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("February 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("February 28, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("March 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("March 31, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("April 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("April 30, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("May 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("May 31, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("June 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("June 30, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("July 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("July 31, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("August 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("August 31, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("September 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("September 30, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("October 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("October 31, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("November 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("November 30, 2013")), period.getEndDate()); + period = iterator.next(); + Assert.assertEquals(df.parse("December 1, 2013"), period.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(df.parse("December 31, 2013")), period.getEndDate()); + } + + } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java index d4e683f..9680deb 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java @@ -25,18 +25,17 @@ package org.chorem.lima.ui.account; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.chorem.lima.LimaSwingConfig; +import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.business.ServiceListener; import org.chorem.lima.business.api.AccountService; import org.chorem.lima.business.api.ImportService; import org.chorem.lima.business.exceptions.AlreadyExistAccountException; import org.chorem.lima.business.exceptions.InvalidAccountNumberException; -import org.chorem.lima.business.exceptions.NotAllowedLabelException; import org.chorem.lima.business.exceptions.NotNumberAccountNumberException; import org.chorem.lima.business.exceptions.UsedAccountException; import org.chorem.lima.entity.Account; import org.chorem.lima.enums.AccountsChartEnum; import org.chorem.lima.enums.ImportExportEnum; -import org.chorem.lima.business.LimaServiceFactory; import org.chorem.lima.ui.importexport.ImportExport; import org.chorem.lima.util.ErrorHelper; import org.jdesktop.swingx.JXTreeTable; @@ -45,7 +44,12 @@ import org.jdesktop.swingx.treetable.DefaultTreeTableModel; import org.jdesktop.swingx.treetable.MutableTreeTableNode; import org.jdesktop.swingx.treetable.TreeTableNode; -import javax.swing.*; +import javax.swing.AbstractAction; +import javax.swing.ActionMap; +import javax.swing.InputMap; +import javax.swing.JComponent; +import javax.swing.JOptionPane; +import javax.swing.KeyStroke; import javax.swing.tree.TreePath; import java.awt.event.ActionEvent; import java.awt.event.InputEvent; @@ -284,8 +288,6 @@ public class AccountViewHandler implements ServiceListener { errorHelper.showErrorMessage(t("lima.account.add.error.InvalidAccountNumber", e.getAccountNumber())); } catch (NotNumberAccountNumberException e) { errorHelper.showErrorMessage(t("lima.account.error.notNumberAccountNumber", e.getAccountNumber())); - } catch (NotAllowedLabelException e) { - errorHelper.showErrorMessage(t("lima.error.notAllowedLabel", e.getLabel())); } finally { dialog.dispose(); } -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit d54b68d4cb2b0c027a332f13b098a2237c05d2c8 Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Jun 3 09:44:03 2015 +0200 refs #1233 : test du service des transaction + correction et amélioration du code --- .../business/api/FinancialTransactionService.java | 6 +- .../org/chorem/lima/business/AccountingRules.java | 30 +- .../accountingrules/DefaultAccountingRules.java | 143 ++--- .../ejb/FinancialTransactionServiceImpl.java | 19 +- .../lima/business/ejb/FiscalPeriodServiceImpl.java | 4 +- .../lima/business/ejb/ImportServiceImpl.java | 8 +- .../FinancialTransactionServiceImplTest.java | 631 +++++++++++++++++++++ .../ui/common/FinancialTransactionTableModel.java | 6 +- .../FinancialTransactionViewHandler.java | 17 + .../resources/i18n/lima-swing_en_GB.properties | 3 + .../resources/i18n/lima-swing_fr_FR.properties | 4 +- 11 files changed, 743 insertions(+), 128 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java index c53130b..d268005 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/FinancialTransactionService.java @@ -63,10 +63,10 @@ public interface FinancialTransactionService { Entry createNewEntry(); FinancialTransaction createFinancialTransaction(FinancialTransaction financialtransaction) - throws LockedFinancialPeriodException, LockedEntryBookException; + throws AfterLastFiscalPeriodException, BeforeFirstFiscalPeriodException, LockedFinancialPeriodException, LockedEntryBookException; FinancialTransaction createFinancialTransaction(FinancialTransaction financialtransaction, Boolean validAccountingRules) - throws LockedFinancialPeriodException, LockedEntryBookException; + throws AfterLastFiscalPeriodException, BeforeFirstFiscalPeriodException, LockedFinancialPeriodException, LockedEntryBookException; void updateFinancialTransaction(FinancialTransaction financialtransaction) throws AfterLastFiscalPeriodException, BeforeFirstFiscalPeriodException, LockedFinancialPeriodException, LockedEntryBookException; @@ -92,7 +92,7 @@ public interface FinancialTransactionService { Entry createEntry(Entry entry) throws LockedFinancialPeriodException, LockedEntryBookException; - void updateEntry(Entry entry) throws LockedEntryBookException; + void updateEntry(Entry entry) throws LockedEntryBookException, LockedFinancialPeriodException; void removeEntry(Entry entry) throws LockedFinancialPeriodException, LockedEntryBookException; diff --git a/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java b/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java index c53001e..169c77b 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java +++ b/lima-business/src/main/java/org/chorem/lima/business/AccountingRules.java @@ -92,26 +92,24 @@ public interface AccountingRules { void deleteFiscalPeriodRules(FiscalPeriod fiscalPeriod) throws NoEmptyFiscalPeriodException; - /** - * Entry rules - * - * @param entry - * @throws org.chorem.lima.business.exceptions.LockedEntryBookException - */ - void updateEntryRules(Entry entry, Entry entryOld) throws LockedEntryBookException; - void updateFinancialTransactionDateRules(FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld) + void createFinancialTransactionRules(FinancialTransaction financialTransaction) + throws BeforeFirstFiscalPeriodException, AfterLastFiscalPeriodException, + LockedFinancialPeriodException, LockedEntryBookException; + + void updateFinancialTransactionRules(FinancialTransaction financialTransaction, FinancialTransaction financialTransactionOld) throws BeforeFirstFiscalPeriodException, AfterLastFiscalPeriodException, LockedFinancialPeriodException, LockedEntryBookException; - /** - * Financialperiod/entrybook rules - * - * @param financialTransaction - * @throws LockedFinancialPeriodException, LockedEntryBookException - */ - void checkFinancialPeriodBlockedWithFinancialTransaction(FinancialTransaction financialTransaction) throws LockedFinancialPeriodException, LockedEntryBookException; + void deleteFinancialTransactionRules(FinancialTransaction financialTransaction) + throws LockedFinancialPeriodException, LockedEntryBookException; - /** + void createEntryRules(Entry entry) throws LockedFinancialPeriodException, LockedEntryBookException; + + void updateEntryRules(Entry entry, Entry entryOld) throws LockedFinancialPeriodException, LockedEntryBookException; + + void deleteEntryRules(Entry entry) throws LockedFinancialPeriodException, LockedEntryBookException; + + /** * Check if a financial period can be closed. * * @param closedPeriodicEntryBook diff --git a/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java b/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java index 1bc2c3e..7488063 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java +++ b/lima-business/src/main/java/org/chorem/lima/business/accountingrules/DefaultAccountingRules.java @@ -161,30 +161,6 @@ public class DefaultAccountingRules implements AccountingRules { } /** - * check if financial period of a financial transaction is blocked - * check if entrybook of his financial period are locked - */ - @Override - public void checkFinancialPeriodBlockedWithFinancialTransaction(FinancialTransaction financialTransaction) throws LockedFinancialPeriodException, LockedEntryBookException { - - //check financial period locked - FinancialPeriodTopiaDao financialPeriodTopiaDao = getDaoHelper().getFinancialPeriodDao(); - FinancialPeriod financialPeriod = financialPeriodTopiaDao.findByDate(financialTransaction.getTransactionDate()); - if (financialPeriod.isLocked()) { - throw new LockedFinancialPeriodException(financialPeriod); - } - - ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao = getDaoHelper().getClosedPeriodicEntryBookDao(); - ClosedPeriodicEntryBook closedPeriodicEntryBook = closedPeriodicEntryBookTopiaDao.forProperties( - ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD, financialPeriod, - ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK, financialTransaction.getEntryBook()).findUnique(); - - if (closedPeriodicEntryBook.isLocked()) { - throw new LockedEntryBookException(closedPeriodicEntryBook); - } - } - - /** * Check if all financial transactions of closedperiodicentrybook are equilibrate * Check if all financial transactions of this closedperiodicentrybook/financialPeriod are well filled in * Check if all financial transactions have EntryBooks @@ -260,54 +236,35 @@ public class DefaultAccountingRules implements AccountingRules { } - /** - * Rules on update entry : - * <p/> - * Two case : - * - second, the actual entry belong to a blocked closedPeriodicEntryBook - * - third, the new choice entrybook belong to a blocked closedPeriodicEntryBook - */ @Override - public void updateEntryRules(Entry entry, Entry entryOld) throws LockedEntryBookException { + public void createFinancialTransactionRules(FinancialTransaction financialTransaction) + throws BeforeFirstFiscalPeriodException, AfterLastFiscalPeriodException, + LockedFinancialPeriodException, LockedEntryBookException { + checkTransactionDate(financialTransaction); + checkTransactionBlock(financialTransaction); - FinancialPeriodTopiaDao financialPeriodTopiaDao = getDaoHelper().getFinancialPeriodDao(); - FinancialPeriod financialPeriod = financialPeriodTopiaDao.findByDate(entry.getFinancialTransaction().getTransactionDate()); + } - ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao = getDaoHelper().getClosedPeriodicEntryBookDao(); + @Override + public void updateFinancialTransactionRules(FinancialTransaction financialTransaction, + FinancialTransaction financialTransactionOld) + throws BeforeFirstFiscalPeriodException, AfterLastFiscalPeriodException, + LockedFinancialPeriodException, LockedEntryBookException { + checkTransactionBlock(financialTransactionOld); + checkTransactionDate(financialTransaction); + checkTransactionBlock(financialTransaction); - if (entryOld != null) { - //second case - ClosedPeriodicEntryBook closedPeriodicEntryBook = - closedPeriodicEntryBookTopiaDao.findByEntryBookAndFinancialPeriod( - entryOld.getFinancialTransaction().getEntryBook(), financialPeriod); - if (closedPeriodicEntryBook.isLocked()) { - throw new LockedEntryBookException(closedPeriodicEntryBook); - } - } + } - //third case - ClosedPeriodicEntryBook closedPeriodicEntryBook2 = - closedPeriodicEntryBookTopiaDao.findByEntryBookAndFinancialPeriod( - entry.getFinancialTransaction().getEntryBook(), financialPeriod); + @Override + public void deleteFinancialTransactionRules(FinancialTransaction financialTransaction) + throws LockedFinancialPeriodException, LockedEntryBookException { + checkTransactionBlock(financialTransaction); - // Check 2 & 3 cases - if (closedPeriodicEntryBook2.isLocked()) { - throw new LockedEntryBookException(closedPeriodicEntryBook2); - } } - - /** - * Check : - * 1. if date are on fiscal period - * 2. if old financialtransaction date are on periodblocked - * 3. if new financialtransaction date are on periodblocked - */ - @Override - public void updateFinancialTransactionDateRules( - FinancialTransaction financialTransaction, - FinancialTransaction financialTransactionOld) - throws BeforeFirstFiscalPeriodException, AfterLastFiscalPeriodException, LockedFinancialPeriodException, LockedEntryBookException { + protected void checkTransactionDate(FinancialTransaction financialTransaction) + throws BeforeFirstFiscalPeriodException, AfterLastFiscalPeriodException { Date financialTransactionDate = financialTransaction.getTransactionDate(); FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao(); @@ -322,7 +279,7 @@ public class DefaultAccountingRules implements AccountingRules { log.debug("Date de transaction modifiée sur l'ui " + financialTransactionDate); log.debug("Date de début du premier exercice : " + beginDateFirstFiscalPeriod); log.debug("Date de fin du dernier exercice : " + endDateLastFiscalPeriod); - } + } //1-date not on a fiscal period if (financialTransactionDate.before(beginDateFirstFiscalPeriod)) { @@ -340,51 +297,53 @@ public class DefaultAccountingRules implements AccountingRules { throw new AfterLastFiscalPeriodException(endDateLastFiscalPeriod); } + } - //date on a fiscal period (and consequently on a financial), now test if financial is open - + protected void checkTransactionBlock(FinancialTransaction financialTransaction) throws LockedFinancialPeriodException, LockedEntryBookException { FinancialPeriodTopiaDao financialPeriodTopiaDao = getDaoHelper().getFinancialPeriodDao(); - FinancialPeriod financialPeriodOld = financialPeriodTopiaDao.findByDate(financialTransactionOld.getTransactionDate()); - - //2. check old financial period locked - if (financialPeriodOld.isLocked()) { - if (log.isDebugEnabled()) { - log.debug("Periode (Old) financière bloquée"); - } - throw new LockedFinancialPeriodException(financialPeriodOld); - } - - //3. check new financial period locked FinancialPeriod financialPeriod = financialPeriodTopiaDao.findByDate(financialTransaction.getTransactionDate()); + if (financialPeriod.isLocked()) { if (log.isDebugEnabled()) { - log.debug("Periode (New) financière bloquée"); + log.debug("Periode financière bloquée"); } throw new LockedFinancialPeriodException(financialPeriod); } ClosedPeriodicEntryBookTopiaDao closedPeriodicEntryBookTopiaDao = getDaoHelper().getClosedPeriodicEntryBookDao(); - ClosedPeriodicEntryBook closedPeriodicEntryBookOld = closedPeriodicEntryBookTopiaDao.forProperties( - ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK, financialTransactionOld.getEntryBook(), - ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD, financialPeriodOld).findUnique(); - if (closedPeriodicEntryBookOld.isLocked()) { - if (log.isDebugEnabled()) { - log.debug("Journal (old) bloquée"); - } - throw new LockedEntryBookException(closedPeriodicEntryBookOld); - } - ClosedPeriodicEntryBook closedPeriodicEntryBook = closedPeriodicEntryBookTopiaDao.forProperties( - ClosedPeriodicEntryBook.PROPERTY_ENTRY_BOOK, financialTransaction.getEntryBook(), - ClosedPeriodicEntryBook.PROPERTY_FINANCIAL_PERIOD, financialPeriod).findUnique(); + ClosedPeriodicEntryBook closedPeriodicEntryBook = + closedPeriodicEntryBookTopiaDao.findByEntryBookAndFinancialPeriod( + financialTransaction.getEntryBook(), financialPeriod); if (closedPeriodicEntryBook.isLocked()) { if (log.isDebugEnabled()) { - log.debug("Journal (new) bloquée"); + log.debug("Journal bloquée"); } throw new LockedEntryBookException(closedPeriodicEntryBook); } } + + + + @Override + public void createEntryRules(Entry entry) throws LockedFinancialPeriodException, LockedEntryBookException { + checkTransactionBlock(entry.getFinancialTransaction()); + + } + + @Override + public void updateEntryRules(Entry entry, Entry entryOld) throws LockedFinancialPeriodException, LockedEntryBookException { + checkTransactionBlock(entry.getFinancialTransaction()); + } + + @Override + public void deleteEntryRules(Entry entry) throws LockedFinancialPeriodException, LockedEntryBookException { + checkTransactionBlock(entry.getFinancialTransaction()); + } + + + } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java index 52e241a..274781a 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/FinancialTransactionServiceImpl.java @@ -102,20 +102,20 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme @Override public FinancialTransaction createFinancialTransaction(FinancialTransaction financialtransaction) - throws LockedFinancialPeriodException, LockedEntryBookException { + throws LockedFinancialPeriodException, LockedEntryBookException, BeforeFirstFiscalPeriodException, AfterLastFiscalPeriodException { FinancialTransaction financialTransaction = createFinancialTransaction(financialtransaction, true); return financialTransaction; } @Override public FinancialTransaction createFinancialTransaction(FinancialTransaction financialtransaction, Boolean validAccountingRules) - throws LockedFinancialPeriodException, LockedEntryBookException { + throws LockedFinancialPeriodException, LockedEntryBookException, BeforeFirstFiscalPeriodException, AfterLastFiscalPeriodException { AccountingRules accountingRules = LimaBusinessConfig.getInstance().getAccountingRules(); if (validAccountingRules) { //check if the financial period is blocked - accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialtransaction); + accountingRules.createFinancialTransactionRules(financialtransaction); } FinancialTransactionTopiaDao financialtransactionTopiaDao = getDaoHelper().getFinancialTransactionDao(); @@ -494,7 +494,7 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme FinancialTransactionTopiaDao transactionTopiaDao = getDaoHelper().getFinancialTransactionDao(); FinancialTransaction financialTransactionOld = transactionTopiaDao.forTopiaIdEquals(financialTransaction.getTopiaId()).findUnique(); - accountingRules.updateFinancialTransactionDateRules(financialTransaction, financialTransactionOld); + accountingRules.updateFinancialTransactionRules(financialTransaction, financialTransactionOld); financialTransactionOld.setEntryBook(financialTransaction.getEntryBook()); financialTransactionOld.setTransactionDate(financialTransaction.getTransactionDate()); @@ -511,7 +511,7 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme // check if the financial period is blocked AccountingRules accountingRules = LimaBusinessConfig.getInstance().getAccountingRules(); - accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialTransaction); + accountingRules.deleteFinancialTransactionRules(financialTransaction); FinancialTransactionTopiaDao transactionTopiaDao = getDaoHelper().getFinancialTransactionDao(); FinancialTransaction financialTransactionOld = transactionTopiaDao.forTopiaIdEquals(financialTransaction.getTopiaId()).findUnique(); @@ -530,8 +530,7 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme AccountingRules accountingRules = LimaBusinessConfig.getInstance().getAccountingRules(); //check if the financial period is blocked - accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction( - entry.getFinancialTransaction()); + accountingRules.createEntryRules(entry); EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); Entry newEntry = entryTopiaDao.create(entry); @@ -543,7 +542,7 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme * update entry, calculate amount of the financial transaction. */ @Override - public void updateEntry(Entry entry) throws LockedEntryBookException { + public void updateEntry(Entry entry) throws LockedEntryBookException, LockedFinancialPeriodException { AccountingRules accountingRules = LimaBusinessConfig.getInstance().getAccountingRules(); @@ -569,10 +568,8 @@ public class FinancialTransactionServiceImpl extends AbstractLimaService impleme AccountingRules accountingRules = LimaBusinessConfig.getInstance().getAccountingRules(); - FinancialTransaction financialTransaction = entry.getFinancialTransaction(); - //check if the financial period is blocked - accountingRules.checkFinancialPeriodBlockedWithFinancialTransaction(financialTransaction); + accountingRules.deleteEntryRules(entry); EntryTopiaDao entryTopiaDao = getDaoHelper().getEntryDao(); Entry entryOld = entryTopiaDao.forTopiaIdEquals(entry.getTopiaId()).findUnique(); diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java index 840ff7d..575f972 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java @@ -34,8 +34,10 @@ 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.ReportService; +import org.chorem.lima.business.exceptions.AfterLastFiscalPeriodException; import org.chorem.lima.business.exceptions.AlreadyExistAccountException; import org.chorem.lima.business.exceptions.AlreadyLockedFiscalPeriodException; +import org.chorem.lima.business.exceptions.BeforeFirstFiscalPeriodException; import org.chorem.lima.business.exceptions.BeginAfterEndFiscalPeriodException; import org.chorem.lima.business.exceptions.InvalidAccountNumberException; import org.chorem.lima.business.exceptions.LastUnlockedFiscalPeriodException; @@ -415,7 +417,7 @@ public class FiscalPeriodServiceImpl extends AbstractLimaService implements Fisc } } - protected FinancialTransaction createFinancialTransaction(EntryBook entryBook, Date transactionDate) throws LockedFinancialPeriodException, LockedEntryBookException { + protected FinancialTransaction createFinancialTransaction(EntryBook entryBook, Date transactionDate) throws LockedFinancialPeriodException, LockedEntryBookException, AfterLastFiscalPeriodException, BeforeFirstFiscalPeriodException { FinancialTransaction endFinancialTransaction = financialTransactionService.createNewFinancialTransaction(); //Sets the endfinancialTransaction endFinancialTransaction.setEntryBook(entryBook); diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java index 5f116a3..95bf43f 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java @@ -53,10 +53,12 @@ import org.chorem.lima.business.ejb.csv.VatStatementModel; import org.chorem.lima.business.ejb.ebp.AccountEBPModel; import org.chorem.lima.business.ejb.ebp.EntryBookEBPModel; import org.chorem.lima.business.ejb.ebp.EntryEBPModel; +import org.chorem.lima.business.exceptions.AfterLastFiscalPeriodException; import org.chorem.lima.business.exceptions.AlreadyExistAccountException; import org.chorem.lima.business.exceptions.AlreadyExistEntryBookException; import org.chorem.lima.business.exceptions.AlreadyExistFinancialStatementException; import org.chorem.lima.business.exceptions.AlreadyExistVatStatementException; +import org.chorem.lima.business.exceptions.BeforeFirstFiscalPeriodException; import org.chorem.lima.business.exceptions.BeginAfterEndFiscalPeriodException; import org.chorem.lima.business.exceptions.ImportEbpException; import org.chorem.lima.business.exceptions.ImportFileException; @@ -278,7 +280,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ // from backup don't check fiscal period close financialTransactionService.createFinancialTransaction(financialTransaction, validAccountingRule); result.increaseCreated(); - } catch (LockedFinancialPeriodException | LockedEntryBookException e) { + } catch (LockedFinancialPeriodException | LockedEntryBookException | BeforeFirstFiscalPeriodException | AfterLastFiscalPeriodException e) { result.addException(e); results.setErrors(true); } @@ -981,7 +983,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ // find financial transactions for entry period and entrybook addEntryToFinancialTransaction(entry, entryEBP.getJournal(), indexedEntryBooks, entryBookFinancialTransactionByDate, dateEcr); - } catch (LockedFinancialPeriodException | LockedEntryBookException | AlreadyExistEntryBookException e) { + } catch (LockedFinancialPeriodException | LockedEntryBookException | AlreadyExistEntryBookException | AfterLastFiscalPeriodException | BeforeFirstFiscalPeriodException e) { result.addException(e); continue; } @@ -1023,7 +1025,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ return entry; } - protected void addEntryToFinancialTransaction(Entry entry, String entryBookCode, Map<String, EntryBook> indexedEntryBooks, Map<EntryBook, Map<Date, FinancialTransaction>> entryBookFinancialTransactionByDate, Date dateEcr) throws LockedFinancialPeriodException, LockedEntryBookException, AlreadyExistEntryBookException { + protected void addEntryToFinancialTransaction(Entry entry, String entryBookCode, Map<String, EntryBook> indexedEntryBooks, Map<EntryBook, Map<Date, FinancialTransaction>> entryBookFinancialTransactionByDate, Date dateEcr) throws LockedFinancialPeriodException, LockedEntryBookException, AlreadyExistEntryBookException, AfterLastFiscalPeriodException, BeforeFirstFiscalPeriodException { EntryBook entryBook = getEntryBook(indexedEntryBooks, entryBookCode); Map<Date, FinancialTransaction> financialTransactionsByDate = entryBookFinancialTransactionByDate.get(entryBook); diff --git a/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java index c44ea97..4f56111 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java @@ -23,22 +23,31 @@ package org.chorem.lima.business; import org.chorem.lima.business.ejb.FinancialTransactionServiceImpl; +import org.chorem.lima.business.exceptions.AfterLastFiscalPeriodException; +import org.chorem.lima.business.exceptions.BeforeFirstFiscalPeriodException; import org.chorem.lima.business.exceptions.LimaException; +import org.chorem.lima.business.exceptions.LockedEntryBookException; +import org.chorem.lima.business.exceptions.LockedFinancialPeriodException; import org.chorem.lima.entity.Account; +import org.chorem.lima.entity.ClosedPeriodicEntryBook; import org.chorem.lima.entity.Entry; import org.chorem.lima.entity.EntryBook; import org.chorem.lima.entity.EntryImpl; +import org.chorem.lima.entity.FinancialPeriod; import org.chorem.lima.entity.FinancialTransaction; import org.chorem.lima.entity.FinancialTransactionImpl; import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.entity.FiscalPeriodImpl; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.nuiton.util.DateUtil; import java.math.BigDecimal; import java.text.ParseException; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.List; /** @@ -60,6 +69,628 @@ public class FinancialTransactionServiceImplTest extends AbstractLimaTest { createFinancialTransaction(); } + @Test + public void createNewFinancialTransactionTest() { + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + Assert.assertNotNull(transaction); + Assert.assertNull(transaction.getEntryBook()); + Assert.assertNull(transaction.getTransactionDate()); + Assert.assertNull(transaction.getEntry()); + + } + + @Test + public void createNewEntryTest() { + + Entry entry = financialTransactionService.createNewEntry(); + + Assert.assertNotNull(entry); + Assert.assertNull(entry.getFinancialTransaction()); + Assert.assertNull(entry.getDescription()); + Assert.assertNull(entry.getDetail()); + Assert.assertNull(entry.getLettering()); + Assert.assertNull(entry.getAccount()); + Assert.assertNull(entry.getLettering()); + Assert.assertNull(entry.getVoucher()); + Assert.assertEquals(BigDecimal.ZERO, entry.getAmount()); + Assert.assertFalse(entry.isDebit()); + + } + + @Test + public void createFinancialTransactionTest() throws Exception { + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBookService.getEntryBookByCode("jdv")); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + FinancialTransaction transactionSave = financialTransactionService.createFinancialTransaction(transaction); + + Assert.assertNotNull(transactionSave); + Assert.assertEquals(transaction.getEntryBook(), transactionSave.getEntryBook()); + Assert.assertEquals(transaction.getTransactionDate(), transactionSave.getTransactionDate()); + Assert.assertTrue(transactionSave.getEntry().isEmpty()); + Assert.assertTrue(transactionSave.isPersisted()); + } + + @Test(expected = LockedFinancialPeriodException.class) + public void createFinancialTransactionFailLockedFinancialPeriodeTest() throws Exception { + + FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0); + + FiscalPeriod nextFiscalPeriod = new FiscalPeriodImpl(); + nextFiscalPeriod.setBeginDate(DateUtil.createDate(01, 01, 2013)); + nextFiscalPeriod.setEndDate(DateUtil.createDate(31, 12, 2013)); + fiscalPeriodService.createFiscalPeriod(nextFiscalPeriod); + + fiscalPeriodService.blockFiscalPeriod(fiscalPeriod); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBookService.getEntryBookByCode("jdv")); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + financialTransactionService.createFinancialTransaction(transaction); + + } + + @Test(expected = LockedEntryBookException.class) + public void createFinancialTransactionFailLockedEntryBookPeriodeTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + List<FinancialPeriod> financialPeriods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriods.get(0)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + financialTransactionService.createFinancialTransaction(transaction); + + } + + @Test(expected = AfterLastFiscalPeriodException.class) + public void createFinancialTransactionFailAfterLastFiscalPeriodeTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2014)); + + financialTransactionService.createFinancialTransaction(transaction); + + } + + @Test(expected = BeforeFirstFiscalPeriodException.class) + public void createFinancialTransactionFailBeforeFirstFiscalPeriodeTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2010)); + + financialTransactionService.createFinancialTransaction(transaction); + + } + + @Test + public void updateFinancialTransactionTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + entryBook = entryBookService.getEntryBookByCode("jda"); + + transaction.setEntryBook(entryBook); + Date date = DateUtil.createDate(15, 01, 2012); + transaction.setTransactionDate(date); + + financialTransactionService.updateFinancialTransaction(transaction); + + List<FinancialTransaction> transactions = financialTransactionService.getAllFinancialTransactions(date, date); + + Assert.assertEquals(1, transactions.size()); + Assert.assertTrue(transactions.contains(transaction)); + } + + @Test(expected = AfterLastFiscalPeriodException.class) + public void updateFinancialTransactionFailAfterLastFiscalPeriodTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + Date date = DateUtil.createDate(15, 01, 2014); + transaction.setTransactionDate(date); + + financialTransactionService.updateFinancialTransaction(transaction); + } + + @Test(expected = BeforeFirstFiscalPeriodException.class) + public void updateFinancialTransactionFailBeforeFirstFiscalPeriodTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + Date date = DateUtil.createDate(15, 01, 2010); + transaction.setTransactionDate(date); + + financialTransactionService.updateFinancialTransaction(transaction); + } + + @Test(expected = LockedFinancialPeriodException.class) + public void updateFinancialTransactionFailLockedFinancialPeriodTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0); + + FiscalPeriod nextFiscalPeriod = new FiscalPeriodImpl(); + nextFiscalPeriod.setBeginDate(DateUtil.createDate(01, 01, 2013)); + nextFiscalPeriod.setEndDate(DateUtil.createDate(31, 12, 2013)); + fiscalPeriodService.createFiscalPeriod(nextFiscalPeriod); + + fiscalPeriodService.blockFiscalPeriod(fiscalPeriod); + + Date date = DateUtil.createDate(15, 01, 2012); + transaction.setTransactionDate(date); + + financialTransactionService.updateFinancialTransaction(transaction); + } + + @Test(expected = LockedEntryBookException.class) + public void updateFinancialTransactionFailLockedEntryBookOrigTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + List<FinancialPeriod> financialPeriods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriods.get(0)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + + entryBook = entryBookService.getEntryBookByCode("jda"); + transaction.setEntryBook(entryBook); + + financialTransactionService.updateFinancialTransaction(transaction); + } + + @Test + public void removeFinancialTransactionTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + Date date = DateUtil.createDate(12, 01, 2012); + transaction.setTransactionDate(date); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + financialTransactionService.removeFinancialTransaction(transaction); + + List<FinancialTransaction> transactions = financialTransactionService.getAllFinancialTransactions(date, date); + + Assert.assertEquals(0, transactions.size()); + } + + @Test(expected = LockedFinancialPeriodException.class) + public void removeFinancialTransactionFailLockedFinancialPeriodTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0); + + FiscalPeriod nextFiscalPeriod = new FiscalPeriodImpl(); + nextFiscalPeriod.setBeginDate(DateUtil.createDate(01, 01, 2013)); + nextFiscalPeriod.setEndDate(DateUtil.createDate(31, 12, 2013)); + fiscalPeriodService.createFiscalPeriod(nextFiscalPeriod); + + fiscalPeriodService.blockFiscalPeriod(fiscalPeriod); + + financialTransactionService.removeFinancialTransaction(transaction); + } + + @Test(expected = LockedEntryBookException.class) + public void removeFinancialTransactionFailLockedEntryBookTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + List<FinancialPeriod> financialPeriods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriods.get(0)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + + financialTransactionService.removeFinancialTransaction(transaction); + } + + @Test + public void createEntryTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + Entry entry = new EntryImpl(); + entry.setAccount(accountService.getAccountByNumber("511")); + entry.setVoucher("Voucher"); + entry.setDebit(true); + entry.setAmount(BigDecimal.valueOf(14.36)); + transaction.addEntry(entry); + + Entry entry1 = financialTransactionService.createEntry(entry); + + Assert.assertTrue(entry1.isPersisted()); + + } + + @Test(expected = LockedFinancialPeriodException.class) + public void createEntryFailLockedFinancialPeriodTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0); + + FiscalPeriod nextFiscalPeriod = new FiscalPeriodImpl(); + nextFiscalPeriod.setBeginDate(DateUtil.createDate(01, 01, 2013)); + nextFiscalPeriod.setEndDate(DateUtil.createDate(31, 12, 2013)); + fiscalPeriodService.createFiscalPeriod(nextFiscalPeriod); + + fiscalPeriodService.blockFiscalPeriod(fiscalPeriod); + + + Entry entry = new EntryImpl(); + entry.setAccount(accountService.getAccountByNumber("511")); + entry.setVoucher("Voucher"); + entry.setDebit(true); + entry.setAmount(BigDecimal.valueOf(14.36)); + transaction.addEntry(entry); + + financialTransactionService.createEntry(entry); + + } + + @Test(expected = LockedEntryBookException.class) + public void createEntryFailLockedEntryBookTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + List<FinancialPeriod> financialPeriods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriods.get(0)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + + Entry entry = new EntryImpl(); + entry.setAccount(accountService.getAccountByNumber("511")); + entry.setVoucher("Voucher"); + entry.setDebit(true); + entry.setAmount(BigDecimal.valueOf(14.36)); + transaction.addEntry(entry); + + financialTransactionService.createEntry(entry); + + } + + @Test + public void updateEntryTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + Date date = DateUtil.createDate(12, 01, 2012); + transaction.setTransactionDate(date); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + Entry entry = new EntryImpl(); + entry.setAccount(accountService.getAccountByNumber("511")); + entry.setVoucher("Voucher"); + entry.setDebit(true); + entry.setAmount(BigDecimal.valueOf(14.36)); + transaction.addEntry(entry); + + Entry entry1 = financialTransactionService.createEntry(entry); + + financialTransactionService.updateFinancialTransaction(transaction); + + entry1.setAccount(accountService.getAccountByNumber("501")); + entry1.setVoucher("VoucherBis"); + entry1.setDebit(true); + entry1.setAmount(BigDecimal.valueOf(15.21)); + + financialTransactionService.updateEntry(entry1); + + FinancialTransaction transactionSave = financialTransactionService.getAllFinancialTransactions(date, date).get(0); + + Assert.assertEquals(1, transactionSave.sizeEntry()); + Entry entrySave = transactionSave.getEntry().iterator().next(); + Assert.assertEquals(entry1, entrySave); + Assert.assertEquals("501", entrySave.getAccount().getAccountNumber()); + Assert.assertEquals("VoucherBis", entrySave.getVoucher()); + Assert.assertEquals(true, entrySave.isDebit()); + Assert.assertEquals(BigDecimal.valueOf(15.21), entrySave.getAmount()); + + } + + @Test(expected = LockedFinancialPeriodException.class) + public void updateEntryFailLockedFinancialPeriodTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + Entry entry = new EntryImpl(); + entry.setAccount(accountService.getAccountByNumber("511")); + entry.setVoucher("Voucher"); + entry.setDebit(true); + entry.setAmount(BigDecimal.valueOf(14.36)); + transaction.addEntry(entry); + + Entry entry1 = financialTransactionService.createEntry(entry); + financialTransactionService.updateFinancialTransaction(transaction); + + + FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0); + + FiscalPeriod nextFiscalPeriod = new FiscalPeriodImpl(); + nextFiscalPeriod.setBeginDate(DateUtil.createDate(01, 01, 2013)); + nextFiscalPeriod.setEndDate(DateUtil.createDate(31, 12, 2013)); + fiscalPeriodService.createFiscalPeriod(nextFiscalPeriod); + + fiscalPeriodService.blockFiscalPeriod(fiscalPeriod); + + entry1.setAccount(accountService.getAccountByNumber("501")); + entry1.setVoucher("VoucherBis"); + entry1.setDebit(true); + entry1.setAmount(BigDecimal.valueOf(15.21)); + + financialTransactionService.updateEntry(entry1); + + } + + @Test(expected = LockedEntryBookException.class) + public void updateEntryFailLockedEntryBookTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + Entry entry1 = new EntryImpl(); + entry1.setAccount(accountService.getAccountByNumber("511")); + entry1.setVoucher("Voucher"); + entry1.setDebit(true); + entry1.setAmount(BigDecimal.valueOf(14.36)); + entry1.setDescription("Description"); + transaction.addEntry(entry1); + + Entry entry2 = new EntryImpl(); + entry2.setAccount(accountService.getAccountByNumber("501")); + entry2.setVoucher("Voucher"); + entry2.setDebit(false); + entry2.setAmount(BigDecimal.valueOf(14.36)); + entry2.setDescription("Description"); + transaction.addEntry(entry2); + + Entry entrySave1 = financialTransactionService.createEntry(entry1); + Entry entrySave2 = financialTransactionService.createEntry(entry2); + financialTransactionService.updateFinancialTransaction(transaction); + + List<FinancialPeriod> financialPeriods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriods.get(0)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + + entrySave1.setAccount(accountService.getAccountByNumber("501")); + entrySave1.setVoucher("VoucherBis"); + entrySave1.setDebit(true); + entrySave1.setAmount(BigDecimal.valueOf(15.21)); + + financialTransactionService.updateEntry(entrySave1); + + } + + @Test + public void removeEntryTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + Date date = DateUtil.createDate(12, 01, 2012); + transaction.setTransactionDate(date); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + Entry entry = new EntryImpl(); + entry.setAccount(accountService.getAccountByNumber("511")); + entry.setVoucher("Voucher"); + entry.setDebit(true); + entry.setAmount(BigDecimal.valueOf(14.36)); + transaction.addEntry(entry); + + Entry entry1 = financialTransactionService.createEntry(entry); + + financialTransactionService.updateFinancialTransaction(transaction); + + financialTransactionService.removeEntry(entry1); + + FinancialTransaction transactionSave = financialTransactionService.getAllFinancialTransactions(date, date).get(0); + + Assert.assertEquals(0, transactionSave.sizeEntry()); + + } + + @Test(expected = LockedFinancialPeriodException.class) + public void removeEntryFailLockedFinancialPeriodTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + Entry entry = new EntryImpl(); + entry.setAccount(accountService.getAccountByNumber("511")); + entry.setVoucher("Voucher"); + entry.setDebit(true); + entry.setAmount(BigDecimal.valueOf(14.36)); + transaction.addEntry(entry); + + Entry entry1 = financialTransactionService.createEntry(entry); + financialTransactionService.updateFinancialTransaction(transaction); + + + FiscalPeriod fiscalPeriod = fiscalPeriodService.getAllFiscalPeriods().get(0); + + FiscalPeriod nextFiscalPeriod = new FiscalPeriodImpl(); + nextFiscalPeriod.setBeginDate(DateUtil.createDate(01, 01, 2013)); + nextFiscalPeriod.setEndDate(DateUtil.createDate(31, 12, 2013)); + fiscalPeriodService.createFiscalPeriod(nextFiscalPeriod); + + fiscalPeriodService.blockFiscalPeriod(fiscalPeriod); + + financialTransactionService.removeEntry(entry1); + + } + + @Test(expected = LockedEntryBookException.class) + public void removeEntryFailLockedEntryBookTest() throws Exception { + + EntryBook entryBook = entryBookService.getEntryBookByCode("jdv"); + + FinancialTransaction transaction = financialTransactionService.createNewFinancialTransaction(); + + transaction.setEntryBook(entryBook); + transaction.setTransactionDate(DateUtil.createDate(12, 01, 2012)); + + transaction = financialTransactionService.createFinancialTransaction(transaction); + + Entry entry1 = new EntryImpl(); + entry1.setAccount(accountService.getAccountByNumber("511")); + entry1.setVoucher("Voucher"); + entry1.setDebit(true); + entry1.setAmount(BigDecimal.valueOf(14.36)); + entry1.setDescription("Description"); + transaction.addEntry(entry1); + + Entry entry2 = new EntryImpl(); + entry2.setAccount(accountService.getAccountByNumber("501")); + entry2.setVoucher("Voucher"); + entry2.setDebit(false); + entry2.setAmount(BigDecimal.valueOf(14.36)); + entry2.setDescription("Description"); + transaction.addEntry(entry2); + + Entry entrySave1 = financialTransactionService.createEntry(entry1); + Entry entrySave2 = financialTransactionService.createEntry(entry2); + financialTransactionService.updateFinancialTransaction(transaction); + + List<FinancialPeriod> financialPeriods = financialPeriodService.getAllFinancialPeriods(); + + ClosedPeriodicEntryBook closedPeriodicEntryBook = financialPeriodService.getClosedPeriodicEntryBook(entryBook, financialPeriods.get(0)); + + financialPeriodService.blockClosedPeriodicEntryBook(closedPeriodicEntryBook); + + financialTransactionService.removeEntry(entrySave1); + + } + + /** * Test to find all unbalanced transactions. * Nothing wrong here. diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialTransactionTableModel.java b/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialTransactionTableModel.java index c002d8d..543c993 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialTransactionTableModel.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/common/FinancialTransactionTableModel.java @@ -218,11 +218,15 @@ public class FinancialTransactionTableModel extends TableModelWithGroup<Entry> { financialTransactionService.updateEntry(entry); updated = true; } catch (LockedEntryBookException e) { - errorHelper.showErrorMessage(t("lima.entry.update.closed.entryBook.error", + errorHelper.showErrorMessage(t("lima.entry.update.error.closedEntryBook", e.getClosedPeriodicEntryBook().getEntryBook().getCode(), e.getClosedPeriodicEntryBook().getEntryBook().getLabel(), e.getClosedPeriodicEntryBook().getFinancialPeriod().getBeginDate(), e.getClosedPeriodicEntryBook().getFinancialPeriod().getEndDate())); + } catch (LockedFinancialPeriodException e) { + errorHelper.showErrorMessage(t("lima.entry.update.error.lockedFinancialPeriod", + e.getFinancialPeriod().getBeginDate(), + e.getFinancialPeriod().getEndDate())); } return updated; } diff --git a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java index 98279e9..c4b7466 100644 --- a/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java +++ b/lima-swing/src/main/java/org/chorem/lima/ui/financialtransaction/FinancialTransactionViewHandler.java @@ -862,6 +862,23 @@ public class FinancialTransactionViewHandler implements ServiceListener, TableMo break; } } + } catch (LockedFinancialPeriodException e) { + errorHelper.showErrorMessage(t("lima.entries.assign.error.lockedFinancialPeriod", + e.getFinancialPeriod().getBeginDate(), + e.getFinancialPeriod().getEndDate())); + // restaure prévious values + for (Map.Entry<Entry, String> mapEntry : previousValuesMap.entrySet()) { + Entry entry = mapEntry.getKey(); + String previousValue = mapEntry.getValue(); + switch (selectedColumn) { + case 1: + entry.setVoucher(previousValue); + break; + case 3: + entry.setDescription(previousValue); + break; + } + } } } } diff --git a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties index 1f21268..424b50e 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties @@ -144,6 +144,7 @@ lima.entries.addEntry=New entry lima.entries.addTransaction=New transaction lima.entries.assign.entries=Assign this value in all entries in transaction lima.entries.assign.error.lockedEntryBook= +lima.entries.assign.error.lockedFinancialPeriod= lima.entries.balance=Balance transaction with this entry lima.entries.copy.entry=Copy entry lima.entries.copy.transaction=Copy transaction @@ -185,6 +186,8 @@ lima.entry.description=Description lima.entry.letter=Letter lima.entry.remove.confirm=Do you really want to remove this financial transaction line ? lima.entry.update.closed.entryBook.error= +lima.entry.update.error.closedEntryBook= +lima.entry.update.error.lockedFinancialPeriod= lima.entryBook=EntryBook lima.entryBook.add=Add entry book (Ctrl+A) lima.entryBook.alreadyExistEntryBook=Already existing entry book diff --git a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties index 3655f1b..a0128dd 100644 --- a/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties +++ b/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties @@ -159,6 +159,7 @@ lima.entries.addEntry=Créer une entrée dans la transaction (Ctrl+N) lima.entries.addTransaction=Créer une transaction (Ctrl+Maj+N) lima.entries.assign.entries=Assigner cette valeur à toutes les écritures de la transaction (Ctrl+Alt+A) lima.entries.assign.error.lockedEntryBook=Impossible d'affecter cette valeur a l'ensemble des écritures de la transaction car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY. +lima.entries.assign.error.lockedFinancialPeriod=Impossible d'affecter cette valeur a l'ensemble des écritures de la transaction car la période fiscale du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY est cloturée. lima.entries.balance=Équilibrer la transaction avec cette écriture (Ctrl+B) lima.entries.copy.entry=Copier l'écritures (Ctrl+Alt+C) lima.entries.copy.transaction=Copier la transaction (Ctrl+Maj+C) @@ -198,7 +199,8 @@ lima.entry.debit=Débit lima.entry.description=Description lima.entry.letter=Lettre lima.entry.remove.confirm=Voulez-vous supprimer cette ligne de transaction? -lima.entry.update.closed.entryBook.error=Impossible de modifier cette écriture car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY. +lima.entry.update.error.closedEntryBook=Impossible de modifier cette écriture car le jounal %2$s (%1$s) est cloturé pour la période du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY. +lima.entry.update.error.lockedFinancialPeriod=Impossilbe de modifier cette écriture car la période fiscale du %3$te %3$tB %3$tY au %4$te %4$tB %4$tY est cloturée. lima.entryBook=Journal lima.entryBook.add=Ajout de journal (Ctrl+A) lima.entryBook.alreadyExistEntryBook=Un journal avec comme code %s existe déjà. -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 47e387f493ad938392ecda3e33718500ef8b693b Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Jun 3 11:05:30 2015 +0200 refs #1233 : test du service des exercices --- .../lima/business/api/FiscalPeriodService.java | 12 -- .../lima/business/ejb/ExportServiceImpl.java | 2 +- .../lima/business/ejb/FiscalPeriodServiceImpl.java | 34 ++-- .../lima/business/ejb/ImportServiceImpl.java | 2 +- .../chorem/lima/entity/FiscalPeriodTopiaDao.java | 24 --- .../FinancialTransactionServiceImplTest.java | 1 - .../lima/business/FiscalPeriodServiceImplTest.java | 220 ++++++++++++++++++--- 7 files changed, 207 insertions(+), 88 deletions(-) diff --git a/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java b/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java index e32e19c..3cf5fff 100644 --- a/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java +++ b/lima-business-api/src/main/java/org/chorem/lima/business/api/FiscalPeriodService.java @@ -61,12 +61,6 @@ public interface FiscalPeriodService { /** * - * @return all fiscal periods ordered by date - */ - List<FiscalPeriod> getAllFiscalPeriodsByDate(); - - /** - * * @return all locked fiscal periods */ List<FiscalPeriod> getAllBlockedFiscalPeriods(); @@ -79,12 +73,6 @@ public interface FiscalPeriodService { /** * - * @return all locked fiscal periods ordered by date - */ - List<FiscalPeriod> getAllUnblockedFiscalPeriodsByBeginDate(); - - /** - * * @return last fiscal period */ FiscalPeriod getLastFiscalPeriod(); diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java index d9ac625..066d259 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java @@ -148,7 +148,7 @@ public class ExportServiceImpl extends AbstractLimaService implements ExportServ ImportExportResults results = new ImportExportResults(); ExportResult exportResult = results.createAddAndGetExportResult(FiscalPeriod.class); - List<FiscalPeriod> entities = fiscalPeriodService.getAllFiscalPeriodsByDate(); + List<FiscalPeriod> entities = fiscalPeriodService.getAllFiscalPeriods(); if (entities != null && !entities.isEmpty()) { FiscalPeriodModel model = new FiscalPeriodModel(); try { diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java index 575f972..78c2c3a 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java @@ -171,16 +171,10 @@ public class FiscalPeriodServiceImpl extends AbstractLimaService implements Fisc public List<FiscalPeriod> getAllFiscalPeriods() { FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao(); - List<FiscalPeriod> result = fiscalPeriodTopiaDao.findAll(); - - return result; - } - - @Override - public List<FiscalPeriod> getAllFiscalPeriodsByDate() { - - FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao(); - List<FiscalPeriod> result = fiscalPeriodTopiaDao.getAllByDate(); + List<FiscalPeriod> result = fiscalPeriodTopiaDao + .forAll() + .setOrderByArguments(FiscalPeriod.PROPERTY_BEGIN_DATE) + .findAll(); return result; } @@ -192,7 +186,10 @@ public class FiscalPeriodServiceImpl extends AbstractLimaService implements Fisc public List<FiscalPeriod> getAllBlockedFiscalPeriods() { FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao(); - List<FiscalPeriod> result = fiscalPeriodTopiaDao.forLockedEquals(true).findAll(); + List<FiscalPeriod> result = fiscalPeriodTopiaDao + .forLockedEquals(true) + .setOrderByArguments(FiscalPeriod.PROPERTY_BEGIN_DATE) + .findAll(); return result; } @@ -203,25 +200,20 @@ public class FiscalPeriodServiceImpl extends AbstractLimaService implements Fisc public List<FiscalPeriod> getAllUnblockedFiscalPeriods() { FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao(); - List<FiscalPeriod> result = fiscalPeriodTopiaDao.forLockedEquals(false).findAll(); + List<FiscalPeriod> result = fiscalPeriodTopiaDao + .forLockedEquals(false) + .setOrderByArguments(FiscalPeriod.PROPERTY_BEGIN_DATE) + .findAll(); return result; } @Override - public List<FiscalPeriod> getAllUnblockedFiscalPeriodsByBeginDate() { - - FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao(); - List<FiscalPeriod> result = fiscalPeriodTopiaDao.forLockedEquals(false).setOrderByArguments(FiscalPeriod.PROPERTY_BEGIN_DATE).findAll(); - return result; - } - - @Override public FiscalPeriod getLastFiscalPeriod() { FiscalPeriodTopiaDao fiscalPeriodTopiaDao = getDaoHelper().getFiscalPeriodDao(); //get the last fiscal period - FiscalPeriod result = fiscalPeriodTopiaDao.getLastFiscalPeriod(); + FiscalPeriod result = fiscalPeriodTopiaDao.forAll().setOrderByArguments(FiscalPeriod.PROPERTY_BEGIN_DATE + " DESC").findFirstOrNull(); return result; } diff --git a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java index 95bf43f..b0d92fb 100644 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java @@ -938,7 +938,7 @@ public class ImportServiceImpl extends AbstractLimaService implements ImportServ result.addException(new NoDataToImportException()); } else { // Get all the valid fiscalPeriods Ordered by date. - List<FiscalPeriod> fiscalPeriods = fiscalPeriodService.getAllUnblockedFiscalPeriodsByBeginDate(); + List<FiscalPeriod> fiscalPeriods = fiscalPeriodService.getAllUnblockedFiscalPeriods(); try { basicEntriesFromEBPValidation(contents, fiscalPeriods); } catch (NoFiscalPeriodFoundException | NoDataToImportException e) { diff --git a/lima-business/src/main/java/org/chorem/lima/entity/FiscalPeriodTopiaDao.java b/lima-business/src/main/java/org/chorem/lima/entity/FiscalPeriodTopiaDao.java index f25a498..25777aa 100644 --- a/lima-business/src/main/java/org/chorem/lima/entity/FiscalPeriodTopiaDao.java +++ b/lima-business/src/main/java/org/chorem/lima/entity/FiscalPeriodTopiaDao.java @@ -22,8 +22,6 @@ package org.chorem.lima.entity; -import java.util.List; - /** * Fiscal period entity DAO. * @@ -36,19 +34,6 @@ import java.util.List; public class FiscalPeriodTopiaDao extends AbstractFiscalPeriodTopiaDao<FiscalPeriod> { /** - * Find fiscal period by financial period. - * - * @param financialPeriod financial period - * @return fiscal period containing financial period - */ - public FiscalPeriod findByFinancialPeriod(FinancialPeriod financialPeriod) { - - FiscalPeriod result = forFinancialPeriodContains(financialPeriod).findUniqueOrNull(); - - return result; - } - - /** * Get last fiscal period (higher end date). * * @return last fiscal period @@ -88,13 +73,4 @@ public class FiscalPeriodTopiaDao extends AbstractFiscalPeriodTopiaDao<FiscalPer return result; } - - public List<FiscalPeriod> getAllByDate() { - - List<FiscalPeriod> result = newQueryBuilder() - .setOrderByArguments(FiscalPeriod.PROPERTY_BEGIN_DATE) - .findAll(); - - return result; - } } diff --git a/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java index 4f56111..0ce6097 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/FinancialTransactionServiceImplTest.java @@ -66,7 +66,6 @@ public class FinancialTransactionServiceImplTest extends AbstractLimaTest { createAccounts(); createEntryBooks(); createFiscalPeriod(); - createFinancialTransaction(); } @Test diff --git a/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java b/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java index 162d74e..721f76e 100644 --- a/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java +++ b/lima-business/src/test/java/org/chorem/lima/business/FiscalPeriodServiceImplTest.java @@ -24,9 +24,19 @@ package org.chorem.lima.business; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.junit.AfterClass; +import org.chorem.lima.business.exceptions.BeginAfterEndFiscalPeriodException; +import org.chorem.lima.business.exceptions.MoreOneUnlockFiscalPeriodException; +import org.chorem.lima.business.exceptions.NotBeginNextDayOfLastFiscalPeriodException; +import org.chorem.lima.entity.FinancialPeriod; +import org.chorem.lima.entity.FiscalPeriod; +import org.chorem.lima.entity.FiscalPeriodImpl; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.nuiton.util.DateUtil; + +import java.util.Date; +import java.util.List; /** * Tests pour la gestion des périodes @@ -47,23 +57,191 @@ public class FiscalPeriodServiceImplTest extends AbstractLimaTest { @Before public void initTest() throws Exception { + createAccounts(); + createEntryBooks(); } - /** - * On nettoie la base de données - * - * @throws Exception - */ - @AfterClass - public static void tearDownClass() throws Exception { - /*Date d = new Date(110,0,1); - PeriodDTO periodDTO = instance.searchPeriodDTOWithDate(d); - instance.removePeriod(periodDTO); - d = new Date(109,0,1); - periodDTO = instance.searchPeriodDTOWithDate(d); - instance.removePeriod(periodDTO);*/ + @Test + public void createPeriod12MonthsTest() throws Exception { + + FiscalPeriod period = new FiscalPeriodImpl(); + Date bedingDate = DateUtil.createDate(01, 01, 2012); + period.setBeginDate(bedingDate); + Date endDate = DateUtil.createDate(31, 12, 2012); + period.setEndDate(endDate); + + FiscalPeriod periodSave = fiscalPeriodService.createFiscalPeriod(period); + + Assert.assertEquals(true, periodSave.isPersisted()); + Assert.assertEquals(bedingDate, periodSave.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(endDate), periodSave.getEndDate()); + List<FiscalPeriod> allFiscalPeriods = fiscalPeriodService.getAllFiscalPeriods(); + Assert.assertEquals(1, allFiscalPeriods.size()); + Assert.assertEquals(periodSave, allFiscalPeriods.get(0)); + + List<FinancialPeriod> financialPeriods = financialPeriodService.getAllFinancialPeriods(); + Assert.assertEquals(12, financialPeriods.size()); + Assert.assertEquals(DateUtil.createDate(01, 01, 2012), financialPeriods.get(0).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(31, 01, 2012)), financialPeriods.get(0).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 02, 2012), financialPeriods.get(1).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(29, 02, 2012)), financialPeriods.get(1).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 03, 2012), financialPeriods.get(2).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(31, 03, 2012)), financialPeriods.get(2).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 04, 2012), financialPeriods.get(3).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(30, 04, 2012)), financialPeriods.get(3).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 05, 2012), financialPeriods.get(4).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(31, 05, 2012)), financialPeriods.get(4).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 06, 2012), financialPeriods.get(5).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(30, 06, 2012)), financialPeriods.get(5).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 07, 2012), financialPeriods.get(6).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(31, 07, 2012)), financialPeriods.get(6).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 8, 2012), financialPeriods.get(7).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(31, 8, 2012)), financialPeriods.get(7).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 9, 2012), financialPeriods.get(8).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(30, 9, 2012)), financialPeriods.get(8).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 10, 2012), financialPeriods.get(9).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(31, 10, 2012)), financialPeriods.get(9).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 11, 2012), financialPeriods.get(10).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(30, 11, 2012)), financialPeriods.get(10).getEndDate()); + Assert.assertEquals(DateUtil.createDate(01, 12, 2012), financialPeriods.get(11).getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(DateUtil.createDate(31, 12, 2012)), financialPeriods.get(11).getEndDate()); + + } + + @Test + public void createPeriod6MonthsTest() throws Exception { + + FiscalPeriod period = new FiscalPeriodImpl(); + Date bedingDate = DateUtil.createDate(01, 01, 2012); + period.setBeginDate(bedingDate); + Date endDate = DateUtil.createDate(31, 06, 2012); + period.setEndDate(endDate); + + FiscalPeriod periodSave = fiscalPeriodService.createFiscalPeriod(period); + + Assert.assertEquals(true, periodSave.isPersisted()); + Assert.assertEquals(bedingDate, periodSave.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(endDate), periodSave.getEndDate()); + List<FiscalPeriod> allFiscalPeriods = fiscalPeriodService.getAllFiscalPeriods(); + Assert.assertEquals(1, allFiscalPeriods.size()); + Assert.assertEquals(periodSave, allFiscalPeriods.get(0)); + } + @Test + public void createPeriod24MonthsTest() throws Exception { + + FiscalPeriod period = new FiscalPeriodImpl(); + Date bedingDate = DateUtil.createDate(01, 01, 2012); + period.setBeginDate(bedingDate); + Date endDate = DateUtil.createDate(31, 12, 2013); + period.setEndDate(endDate); + + FiscalPeriod periodSave = fiscalPeriodService.createFiscalPeriod(period); + + Assert.assertEquals(true, periodSave.isPersisted()); + Assert.assertEquals(bedingDate, periodSave.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(endDate), periodSave.getEndDate()); + List<FiscalPeriod> allFiscalPeriods = fiscalPeriodService.getAllFiscalPeriods(); + Assert.assertEquals(1, allFiscalPeriods.size()); + Assert.assertEquals(periodSave, allFiscalPeriods.get(0)); + + } + + + + @Test(expected = BeginAfterEndFiscalPeriodException.class) + public void createPeriodFailBeginAfterEndFiscalPeriodTest() throws Exception { + + FiscalPeriod period = new FiscalPeriodImpl(); + Date bedingDate = DateUtil.createDate(31, 12, 2012); + period.setBeginDate(bedingDate); + Date endDate = DateUtil.createDate(01, 01, 2012); + period.setEndDate(endDate); + + fiscalPeriodService.createFiscalPeriod(period); + } + + + + @Test + public void createPeriodSecondTest() throws Exception { + + FiscalPeriod period1 = new FiscalPeriodImpl(); + Date bedingDate1 = DateUtil.createDate(01, 01, 2012); + period1.setBeginDate(bedingDate1); + Date endDate1 = DateUtil.createDate(31, 12, 2012); + period1.setEndDate(endDate1); + + FiscalPeriod periodSave1 = fiscalPeriodService.createFiscalPeriod(period1); + + FiscalPeriod period2 = new FiscalPeriodImpl(); + Date bedingDate2 = DateUtil.createDate(01, 01, 2013); + period2.setBeginDate(bedingDate2); + Date endDate2 = DateUtil.createDate(31, 12, 2013); + period2.setEndDate(endDate2); + + FiscalPeriod periodSave2 = fiscalPeriodService.createFiscalPeriod(period2); + + + Assert.assertEquals(true, periodSave2.isPersisted()); + Assert.assertEquals(bedingDate2, periodSave2.getBeginDate()); + Assert.assertEquals(DateUtil.getEndOfDay(endDate2), periodSave2.getEndDate()); + List<FiscalPeriod> allFiscalPeriods = fiscalPeriodService.getAllFiscalPeriods(); + Assert.assertEquals(2, allFiscalPeriods.size()); + Assert.assertEquals(periodSave2, allFiscalPeriods.get(1)); + + } + + @Test(expected = NotBeginNextDayOfLastFiscalPeriodException.class) + public void createPeriodSecondFailNotBeginNextDayOfLastFiscalPeriodTest() throws Exception { + + FiscalPeriod period1 = new FiscalPeriodImpl(); + Date bedingDate1 = DateUtil.createDate(01, 01, 2012); + period1.setBeginDate(bedingDate1); + Date endDate1 = DateUtil.createDate(31, 12, 2012); + period1.setEndDate(endDate1); + + fiscalPeriodService.createFiscalPeriod(period1); + + FiscalPeriod period2 = new FiscalPeriodImpl(); + Date bedingDate2 = DateUtil.createDate(01, 02, 2013); + period2.setBeginDate(bedingDate2); + Date endDate2 = DateUtil.createDate(31, 12, 2013); + period2.setEndDate(endDate2); + + fiscalPeriodService.createFiscalPeriod(period2); + + } + + @Test(expected = MoreOneUnlockFiscalPeriodException.class) + public void createPeriodSecondFailMoreOneUnlockFiscalPeriodTest() throws Exception { + + FiscalPeriod period1 = new FiscalPeriodImpl(); + Date bedingDate1 = DateUtil.createDate(01, 01, 2012); + period1.setBeginDate(bedingDate1); + Date endDate1 = DateUtil.createDate(31, 12, 2012); + period1.setEndDate(endDate1); + + fiscalPeriodService.createFiscalPeriod(period1); + + FiscalPeriod period2 = new FiscalPeriodImpl(); + Date bedingDate2 = DateUtil.createDate(01, 01, 2013); + period2.setBeginDate(bedingDate2); + Date endDate2 = DateUtil.createDate(31, 12, 2013); + period2.setEndDate(endDate2); + + fiscalPeriodService.createFiscalPeriod(period2); + + FiscalPeriod period3 = new FiscalPeriodImpl(); + Date bedingDate3 = DateUtil.createDate(01, 01, 2014); + period3.setBeginDate(bedingDate3); + Date endDate3 = DateUtil.createDate(31, 12, 2014); + period3.setEndDate(endDate3); + + fiscalPeriodService.createFiscalPeriod(period3); + + } @Test public void blockFiscalPeriodTest() throws Exception { @@ -133,20 +311,6 @@ public class FiscalPeriodServiceImplTest extends AbstractLimaTest { }*/ } - - /** Permet de tester l'ajout d'une période. */ - @Test - public void createPeriodTest() { - /*String result; - // debut 1 janvier 2009 - Date beginPeriod = new Date(109, 0, 1); - // fin 31 décembre 2009 - Date endPeriod = new Date(109, 11, 31); - // Création période avec son découpage sur 12 mois - result = instance.createPeriod(beginPeriod, endPeriod, false); - Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS, result);*/ - } - /** * Permet de tester si différentes périodes sont correctes ou non * La création d'une nouvelle période doit remplir ce contrat. -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository lima. See http://git.chorem.org/lima.git commit 56d83059fed1161c50f5444cc5ae799d2984baba Merge: 1d60b71 47e387f Author: Sylvain Bavencoff <bavencoff@codelutin.com> Date: Wed Jun 3 11:06:46 2015 +0200 Merge branch 'feature/1233' into develop .../chorem/lima/business/api/AccountService.java | 5 +- .../lima/business/api/FinancialPeriodService.java | 4 - .../business/api/FinancialTransactionService.java | 6 +- .../lima/business/api/FiscalPeriodService.java | 12 - .../org/chorem/lima/business/AccountingRules.java | 33 +- .../accountingrules/DefaultAccountingRules.java | 151 ++--- .../accountingrules/FranceAccountingRules.java | 3 +- .../lima/business/ejb/AccountServiceImpl.java | 7 +- .../lima/business/ejb/ExportServiceImpl.java | 2 +- .../business/ejb/FinancialPeriodServiceImpl.java | 18 - .../ejb/FinancialTransactionServiceImpl.java | 19 +- .../lima/business/ejb/FiscalPeriodServiceImpl.java | 38 +- .../lima/business/ejb/ImportServiceImpl.java | 14 +- .../lima/entity/FinancialPeriodTopiaDao.java | 14 - .../chorem/lima/entity/FiscalPeriodTopiaDao.java | 24 - .../org/chorem/lima/business/AbstractLimaTest.java | 575 ++----------------- .../lima/business/AccountServiceImplTest.java | 332 ++++++++--- .../lima/business/EntryBookServiceImplTest.java | 148 ++++- .../business/FinancialPeriodServiceImplTest.java | 260 ++++++++- .../FinancialTransactionServiceImplTest.java | 635 ++++++++++++++++++++- .../lima/business/FiscalPeriodServiceImplTest.java | 220 ++++++- .../lima/business/ImportExportServiceTest.java | 31 +- .../lima/business/ReportServiceImplTest.java | 5 +- .../lima/entity/FinancialTransactionDAOTest.java | 5 +- .../chorem/lima/ui/account/AccountViewHandler.java | 12 +- .../ui/common/FinancialTransactionTableModel.java | 6 +- .../FinancialTransactionViewHandler.java | 17 + .../resources/i18n/lima-swing_en_GB.properties | 3 + .../resources/i18n/lima-swing_fr_FR.properties | 4 +- 29 files changed, 1661 insertions(+), 942 deletions(-) diff --cc lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java index f8dc1da,78c2c3a..33098a5 --- a/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java +++ b/lima-business/src/main/java/org/chorem/lima/business/ejb/FiscalPeriodServiceImpl.java @@@ -34,9 -34,10 +34,11 @@@ import org.chorem.lima.business.api.Fin import org.chorem.lima.business.api.FinancialTransactionService; import org.chorem.lima.business.api.FiscalPeriodService; import org.chorem.lima.business.api.ReportService; + import org.chorem.lima.business.exceptions.AfterLastFiscalPeriodException; import org.chorem.lima.business.exceptions.AlreadyExistAccountException; +import org.chorem.lima.business.exceptions.AlreadyExistEntryBookException; import org.chorem.lima.business.exceptions.AlreadyLockedFiscalPeriodException; + import org.chorem.lima.business.exceptions.BeforeFirstFiscalPeriodException; import org.chorem.lima.business.exceptions.BeginAfterEndFiscalPeriodException; import org.chorem.lima.business.exceptions.InvalidAccountNumberException; import org.chorem.lima.business.exceptions.LastUnlockedFiscalPeriodException; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm