Author: rchapelet
Date: 2009-08-27 15:38:17 +0200 (Thu, 27 Aug 2009)
New Revision: 2694
Modified:
trunk/lima-main/src/main/java/org/chorem/lima/export/CSVExport.java
trunk/lima-main/src/main/java/org/chorem/lima/export/XMLExport.java
trunk/lima-main/src/main/java/org/chorem/lima/ui/AccueilViewImpl.java
trunk/lima-main/src/main/java/org/chorem/lima/ui/BilanViewImpl.java
trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultView.jaxx
trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultViewImpl.java
Log:
Barre de chargement pour le bilan et calcul du r?\195?\169sultat dans celui-ci
Modified: trunk/lima-main/src/main/java/org/chorem/lima/export/CSVExport.java
===================================================================
--- trunk/lima-main/src/main/java/org/chorem/lima/export/CSVExport.java 2009-08-27 09:18:03 UTC (rev 2693)
+++ trunk/lima-main/src/main/java/org/chorem/lima/export/CSVExport.java 2009-08-27 13:38:17 UTC (rev 2694)
@@ -84,7 +84,13 @@
*/
String[] nextLine = new String[1];
// Début période
+ // Sélection la période utilisée actuellement
PeriodDTO period = Main.getContext().getDataManager().getCurrentPeriod();
+ // Si la période courante est une période mensuelle, on récupère la période annuelle
+ if ( period.getParent() != null )
+ {
+ period = period.getParent();
+ }
nextLine[0] = Util.DateToString(period.getBegin(),"dd/MM/yyyy");
csvWriter.writeNext(nextLine);
// Fin périod
Modified: trunk/lima-main/src/main/java/org/chorem/lima/export/XMLExport.java
===================================================================
--- trunk/lima-main/src/main/java/org/chorem/lima/export/XMLExport.java 2009-08-27 09:18:03 UTC (rev 2693)
+++ trunk/lima-main/src/main/java/org/chorem/lima/export/XMLExport.java 2009-08-27 13:38:17 UTC (rev 2694)
@@ -86,7 +86,6 @@
@Override
public void run()
{
- String i18;
progressBar = new ProgressBarImpl();
progressBar.setTitle(_("lima.progressBar.export.title"));
progressBar.getProgressBar().setString("0% : "+_("lima.progressBar.export.etape1"));
Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/AccueilViewImpl.java
===================================================================
--- trunk/lima-main/src/main/java/org/chorem/lima/ui/AccueilViewImpl.java 2009-08-27 09:18:03 UTC (rev 2693)
+++ trunk/lima-main/src/main/java/org/chorem/lima/ui/AccueilViewImpl.java 2009-08-27 13:38:17 UTC (rev 2694)
@@ -19,7 +19,6 @@
package org.chorem.lima.ui;
-
/**
* @author Rémi Chapelet
*/
Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/BilanViewImpl.java
===================================================================
--- trunk/lima-main/src/main/java/org/chorem/lima/ui/BilanViewImpl.java 2009-08-27 09:18:03 UTC (rev 2693)
+++ trunk/lima-main/src/main/java/org/chorem/lima/ui/BilanViewImpl.java 2009-08-27 13:38:17 UTC (rev 2694)
@@ -54,8 +54,9 @@
private BilanPassifTableModel modelBilanPassif;
Hashtable<String,Bilan> actifTab = new Hashtable<String,Bilan>();
Hashtable<String,Bilan> passifTab = new Hashtable<String,Bilan>();
- Hashtable<String,List<BalanceDTO>> provisionMap = new Hashtable<String,List<BalanceDTO>>();
+ Hashtable<String,List<BalanceDTO>> provisionMap;
private Balance balance = new Balance();
+ private ProgressBarImpl progressBar;
/**
* Constructor
@@ -172,256 +173,322 @@
public void updateBilan ()
{
log.debug("Update bilan :");
- // Chargement de la balance
- List<BalanceDTO> ListbalanceDTO = balance.createBalance((PeriodDTO) comboBoxPeriod.getSelectedItem());
-
- /**
- * Vérifie chaque numéro de compte (balance) pour déterminer sa position
- * dans le bilan.
- * Chaque catégorie est un objet bilan, et possède à son tour des bilans
- * correspondants aux comptes.
- * Cette boucle ne prend pas en compte les amortissement et provisions.
- * Ces comptes sont mis dans une liste à part, pour être traités une seconde fois.
- */
- // Liste amort/prov à traiter apres
-
- createCategory();
- // Pour chaque balance
- for ( BalanceDTO balanceDTO : ListbalanceDTO)
+ new Thread()
{
- /**
- * ACTIF
- */
- /** IMMOBILISATION */
- if ( Category.accountNumberCategory("20", balanceDTO.getAccount().getIdNumber()) )
+ @Override
+ public void run()
{
- actifTab.get("ACTIF_IMMOBILISE_INCORPOREL").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
- }
- if ( Category.accountNumberCategory("21", balanceDTO.getAccount().getIdNumber()) )
- {
- actifTab.get("ACTIF_IMMOBILISE_CORPOREL").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
- }
- if ( Category.accountNumberCategory("22", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("23", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("25", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("26", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("27", balanceDTO.getAccount().getIdNumber()) )
- {
- actifTab.get("ACTIF_IMMOBILISE_FINANCIER").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
- }
- /** ACTIF CIRCULANT */
- if ( Category.accountNumberCategory("31", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("32", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("33", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("34", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("35", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("36", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("37", balanceDTO.getAccount().getIdNumber()) )
- {
- actifTab.get("ACTIF_CIRCULANT_STOCK").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
- }
- if ( Category.accountNumberCategory("99", balanceDTO.getAccount().getIdNumber()) )
- {
- // TODO
- //actifTab.get("ACTIF_CIRCULANT_AVANCES").add(balanceDTO,Util.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
- }
- if ( Category.accountNumberCategory("41", balanceDTO.getAccount().getIdNumber()) )
- {
- actifTab.get("ACTIF_CIRCULANT_CREANCES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
- }
- if ( Category.accountNumberCategory("50", balanceDTO.getAccount().getIdNumber()) )
- {
- actifTab.get("ACTIF_CIRCULANT_VMP").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
- }
- if ( Category.accountNumberCategory("51", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("52", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("53", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("54", balanceDTO.getAccount().getIdNumber()) )
- {
- actifTab.get("ACTIF_CIRCULANT_DISPONIBILITE").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
- }
- if ( Category.accountNumberCategory("486", balanceDTO.getAccount().getIdNumber()) )
- {
- actifTab.get("ACTIF_CIRCULANT_CCA").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
- }
- /** AMORT. & PROV. */
- if ( Category.accountNumberCategory("280", balanceDTO.getAccount().getIdNumber()) )
- {
- if ( provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL") == null )
- {
- LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>();
- provisionMap.put("ACTIF_IMMOBILISE_INCORPOREL", listBalance);
- }
- provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL").add(balanceDTO);
- }
- if ( Category.accountNumberCategory("281", balanceDTO.getAccount().getIdNumber()) )
- {
- if ( provisionMap.get("ACTIF_IMMOBILISE_CORPOREL") == null )
- {
- LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>();
- provisionMap.put("ACTIF_IMMOBILISE_CORPOREL", listBalance);
- }
- provisionMap.get("ACTIF_IMMOBILISE_CORPOREL").add(balanceDTO);
- }
- if ( Category.accountNumberCategory("282", balanceDTO.getAccount().getIdNumber()) )
- {
- if ( provisionMap.get("ACTIF_IMMOBILISE_FINANCIER") == null )
- {
- LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>();
- provisionMap.put("ACTIF_IMMOBILISE_FINANCIER", listBalance);
- }
- provisionMap.get("ACTIF_IMMOBILISE_FINANCIER").add(balanceDTO);
- }
- /**
- * PASSIF
- */
- /** CAPITAUX PROPRES */
- if ( Category.accountNumberCategory("101", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("104", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("105", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("107", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("108", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("109", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_CP_CAPITAL").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("106", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_CP_RESERVES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("11", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_CP_RAN").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("12", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_CP_RESULTAT").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("13", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_CP_SUBVENTION").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("14", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_CP_PROVISION").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- /** PROVISIONS */
- if ( Category.accountNumberCategory("15", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_PROVISIONS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- /** DETTES */
- if ( Category.accountNumberCategory("16", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_DETTES_EMPRUNTS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("15", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_DETTES_AVANCES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("40", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_DETTES_FOURNISSEURS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("43", balanceDTO.getAccount().getIdNumber()) ||
- Category.accountNumberCategory("44", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_DETTES_FISCALES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("999", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_DETTES_IMMOBILISATIONS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("9999", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_DETTES_AUTRES_DETTES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- if ( Category.accountNumberCategory("487", balanceDTO.getAccount().getIdNumber()) )
- {
- passifTab.get("PASSIF_DETTES_PCA").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- }
+ progressBar = new ProgressBarImpl();
+ progressBar.setTitle("Chargement du bilan");
+ progressBar.getProgressBar().setString("0% : Préparation des données");
+ progressBar.getProgressBar().setValue(0);
- /**
- * Mise en place des provisions et amortissements
- */
- if ( provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL") != null )
- {
- List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL");
- for ( BalanceDTO balanceDTO : listBalance )
- {
- actifTab.get("ACTIF_IMMOBILISE_INCORPOREL").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- }
- if ( provisionMap.get("ACTIF_IMMOBILISE_CORPOREL") != null )
- {
- List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_CORPOREL");
- for ( BalanceDTO balanceDTO : listBalance )
- {
- actifTab.get("ACTIF_IMMOBILISE_CORPOREL").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- }
- if ( provisionMap.get("ACTIF_IMMOBILISE_FINANCIER") != null )
- {
- List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_FINANCIER");
- for ( BalanceDTO balanceDTO : listBalance )
- {
- actifTab.get("ACTIF_IMMOBILISE_FINANCIER").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
- }
- }
-
- /**
- * Ajout des données dans le model
- */
- /** ACTIF */
- List<Bilan> listActif = new LinkedList<Bilan>();
- listActif.add(actifTab.get("ACTIF_IMMOBILISE"));
- listActif.add(actifTab.get("ACTIF_IMMOBILISE_INCORPOREL"));
- listActif.add(actifTab.get("ACTIF_IMMOBILISE_CORPOREL"));
- listActif.add(actifTab.get("ACTIF_IMMOBILISE_FINANCIER"));
- listActif.add(new Bilan("SOUS-TOTAL (1)","soustotal",actifTab.get("ACTIF_IMMOBILISE").getTotal(),actifTab.get("ACTIF_IMMOBILISE").getDepreciation()));
- listActif.add(actifTab.get("ACTIF_CIRCULANT"));
- listActif.add(actifTab.get("ACTIF_CIRCULANT_STOCK"));
- listActif.add(actifTab.get("ACTIF_CIRCULANT_AVANCES"));
- listActif.add(actifTab.get("ACTIF_CIRCULANT_CREANCES"));
- listActif.add(actifTab.get("ACTIF_CIRCULANT_VMP"));
- listActif.add(actifTab.get("ACTIF_CIRCULANT_DISPONIBILITE"));
- listActif.add(actifTab.get("ACTIF_CIRCULANT_CCA"));
- listActif.add(new Bilan("SOUS-TOTAL (2)","soustotal",actifTab.get("ACTIF_CIRCULANT").getTotal(),actifTab.get("ACTIF_CIRCULANT").getDepreciation()));
- listActif.add(actifTab.get("ACTIF"));
+ // Chargement de la balance
+ List<BalanceDTO> ListbalanceDTO = balance.createBalance((PeriodDTO) comboBoxPeriod.getSelectedItem());
- // Création du modèle à partir de la liste précédement créée
- modelBilanActif.setData(listActif);
- modelBilanActif.fireTableDataChanged();
- /** PASSIF */
- List<Bilan> listPassif = new LinkedList<Bilan>();
- listPassif.add(passifTab.get("PASSIF_CAPITAUX"));
- listPassif.add(passifTab.get("PASSIF_CP_CAPITAL"));
- listPassif.add(passifTab.get("PASSIF_CP_RESERVES"));
- listPassif.add(passifTab.get("PASSIF_CP_RAN"));
- listPassif.add(passifTab.get("PASSIF_CP_SUBVENTION"));
- listPassif.add(passifTab.get("PASSIF_CP_PROVISION"));
- listPassif.add(new Bilan("SOUS-TOTAL (1)","soustotal",passifTab.get("PASSIF_CAPITAUX").getTotal(),"0"));
- listPassif.add(passifTab.get("PASSIF_PR_PROVISIONS"));
- listPassif.add(passifTab.get("PASSIF_PROVISIONS"));
- listPassif.add(new Bilan("SOUS-TOTAL (2)","soustotal",passifTab.get("PASSIF_PR_PROVISIONS").getTotal(),"0"));
- listPassif.add(passifTab.get("PASSIF_DETTES"));
- listPassif.add(passifTab.get("PASSIF_DETTES_EMPRUNTS"));
- listPassif.add(passifTab.get("PASSIF_DETTES_AVANCES"));
- listPassif.add(passifTab.get("PASSIF_DETTES_FOURNISSEURS"));
- listPassif.add(passifTab.get("PASSIF_DETTES_FISCALES"));
- listPassif.add(passifTab.get("PASSIF_DETTES_IMMOBILISATIONS"));
- listPassif.add(passifTab.get("PASSIF_DETTES_AUTRES_DETTES"));
- listPassif.add(passifTab.get("PASSIF_DETTES_PCA"));
- listPassif.add(new Bilan("SOUS-TOTAL (3)","soustotal",passifTab.get("PASSIF_DETTES").getTotal(),"0"));
- listPassif.add(passifTab.get("PASSIF"));
+ progressBar.getProgressBar().setString("10% : Balance chargée");
+ progressBar.getProgressBar().setValue(10);
+ /**
+ * Vérifie chaque numéro de compte (balance) pour déterminer sa position
+ * dans le bilan.
+ * Chaque catégorie est un objet bilan, et possède à son tour des bilans
+ * correspondants aux comptes.
+ * Cette boucle ne prend pas en compte les amortissement et provisions.
+ * Ces comptes sont mis dans une liste à part, pour être traités une seconde fois.
+ */
- // Création du modèle à partir de la liste précédement créée
- modelBilanPassif.setData(listPassif);
- modelBilanPassif.fireTableDataChanged();
+ progressBar.getProgressBar().setString("15% : Création catégorie");
+ progressBar.getProgressBar().setValue(15);
+ createCategory();
+ // Liste amort/prov à traiter apres
+ provisionMap = new Hashtable<String,List<BalanceDTO>>();
+ progressBar.getProgressBar().setString("20% : Chargement des comptes");
+ progressBar.getProgressBar().setValue(20);
+ // Récupère le nombre de balances
+ float nbBalances = ListbalanceDTO.size();
+ float incremente = 40 / nbBalances;
+ float value = 20;
+ // Pour chaque balance
+ for ( BalanceDTO balanceDTO : ListbalanceDTO)
+ {
+ /**
+ * ACTIF
+ */
+ /** IMMOBILISATION */
+ if ( Category.accountNumberCategory("20", balanceDTO.getAccount().getIdNumber()) )
+ {
+ actifTab.get("ACTIF_IMMOBILISE_INCORPOREL").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
+ }
+ if ( Category.accountNumberCategory("21", balanceDTO.getAccount().getIdNumber()) )
+ {
+ actifTab.get("ACTIF_IMMOBILISE_CORPOREL").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
+ }
+ if ( Category.accountNumberCategory("22", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("23", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("25", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("26", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("27", balanceDTO.getAccount().getIdNumber()) )
+ {
+ actifTab.get("ACTIF_IMMOBILISE_FINANCIER").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
+ }
+ /** ACTIF CIRCULANT */
+ if ( Category.accountNumberCategory("31", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("32", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("33", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("34", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("35", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("36", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("37", balanceDTO.getAccount().getIdNumber()) )
+ {
+ actifTab.get("ACTIF_CIRCULANT_STOCK").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
+ }
+ if ( Category.accountNumberCategory("99", balanceDTO.getAccount().getIdNumber()) )
+ {
+ // TODO
+ //actifTab.get("ACTIF_CIRCULANT_AVANCES").add(balanceDTO,Util.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
+ }
+ if ( Category.accountNumberCategory("41", balanceDTO.getAccount().getIdNumber()) )
+ {
+ actifTab.get("ACTIF_CIRCULANT_CREANCES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
+ }
+ if ( Category.accountNumberCategory("50", balanceDTO.getAccount().getIdNumber()) )
+ {
+ actifTab.get("ACTIF_CIRCULANT_VMP").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
+ }
+ if ( Category.accountNumberCategory("51", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("52", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("53", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("54", balanceDTO.getAccount().getIdNumber()) )
+ {
+ actifTab.get("ACTIF_CIRCULANT_DISPONIBILITE").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
+ }
+ if ( Category.accountNumberCategory("486", balanceDTO.getAccount().getIdNumber()) )
+ {
+ actifTab.get("ACTIF_CIRCULANT_CCA").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getDebit(), balanceDTO.getCredit()));
+ }
+ /** AMORT. & PROV. */
+ if ( Category.accountNumberCategory("280", balanceDTO.getAccount().getIdNumber()) )
+ {
+ if ( provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL") == null )
+ {
+ LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>();
+ provisionMap.put("ACTIF_IMMOBILISE_INCORPOREL", listBalance);
+ }
+ provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL").add(balanceDTO);
+ }
+ if ( Category.accountNumberCategory("281", balanceDTO.getAccount().getIdNumber()) )
+ {
+ if ( provisionMap.get("ACTIF_IMMOBILISE_CORPOREL") == null )
+ {
+ LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>();
+ provisionMap.put("ACTIF_IMMOBILISE_CORPOREL", listBalance);
+ }
+ provisionMap.get("ACTIF_IMMOBILISE_CORPOREL").add(balanceDTO);
+ }
+ if ( Category.accountNumberCategory("282", balanceDTO.getAccount().getIdNumber()) )
+ {
+ if ( provisionMap.get("ACTIF_IMMOBILISE_FINANCIER") == null )
+ {
+ LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>();
+ provisionMap.put("ACTIF_IMMOBILISE_FINANCIER", listBalance);
+ }
+ provisionMap.get("ACTIF_IMMOBILISE_FINANCIER").add(balanceDTO);
+ }
+ if ( Category.accountNumberCategory("491", balanceDTO.getAccount().getIdNumber()) )
+ {
+ if ( provisionMap.get("ACTIF_CIRCULANT_CREANCES") == null )
+ {
+ LinkedList<BalanceDTO> listBalance = new LinkedList<BalanceDTO>();
+ provisionMap.put("ACTIF_CIRCULANT_CREANCES", listBalance);
+ }
+ provisionMap.get("ACTIF_CIRCULANT_CREANCES").add(balanceDTO);
+ }
+ /**
+ * PASSIF
+ */
+ /** CAPITAUX PROPRES */
+ if ( Category.accountNumberCategory("101", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("104", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("105", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("107", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("108", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("109", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_CP_CAPITAL").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("106", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_CP_RESERVES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("11", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_CP_RAN").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("12", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_CP_RESULTAT").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("13", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_CP_SUBVENTION").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("14", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_CP_PROVISION").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ /** PROVISIONS */
+ if ( Category.accountNumberCategory("15", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_PROVISIONS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ /** DETTES */
+ if ( Category.accountNumberCategory("16", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_DETTES_EMPRUNTS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("15", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_DETTES_AVANCES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("40", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_DETTES_FOURNISSEURS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("43", balanceDTO.getAccount().getIdNumber()) ||
+ Category.accountNumberCategory("44", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_DETTES_FISCALES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("999", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_DETTES_IMMOBILISATIONS").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("9999", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_DETTES_AUTRES_DETTES").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ if ( Category.accountNumberCategory("487", balanceDTO.getAccount().getIdNumber()) )
+ {
+ passifTab.get("PASSIF_DETTES_PCA").add(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ // Incrémente la barre de chargement
+ value = value + incremente;
+ progressBar.getProgressBar().setValue((int)value);
+ progressBar.getProgressBar().setString((int)value+"% : Compte : "+balanceDTO.getName());
+ }
+
+ progressBar.getProgressBar().setString("60% : Mise en place des amortissements et provisions");
+ progressBar.getProgressBar().setValue(60);
+ /**
+ * Mise en place des provisions et amortissements
+ */
+ if ( provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL") != null )
+ {
+ List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_INCORPOREL");
+ for ( BalanceDTO balanceDTO : listBalance )
+ {
+ actifTab.get("ACTIF_IMMOBILISE_INCORPOREL").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ }
+ if ( provisionMap.get("ACTIF_IMMOBILISE_CORPOREL") != null )
+ {
+ List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_CORPOREL");
+ for ( BalanceDTO balanceDTO : listBalance )
+ {
+ actifTab.get("ACTIF_IMMOBILISE_CORPOREL").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ }
+ if ( provisionMap.get("ACTIF_IMMOBILISE_FINANCIER") != null )
+ {
+ List<BalanceDTO> listBalance = provisionMap.get("ACTIF_IMMOBILISE_FINANCIER");
+ for ( BalanceDTO balanceDTO : listBalance )
+ {
+ actifTab.get("ACTIF_IMMOBILISE_FINANCIER").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ }
+ if ( provisionMap.get("ACTIF_CIRCULANT_CREANCES") != null )
+ {
+ List<BalanceDTO> listBalance = provisionMap.get("ACTIF_CIRCULANT_CREANCES");
+ for ( BalanceDTO balanceDTO : listBalance )
+ {
+ actifTab.get("ACTIF_CIRCULANT_CREANCES").addDepreciation(balanceDTO,DTOHelper.SubNumbersString(balanceDTO.getCredit(), balanceDTO.getDebit()));
+ }
+ }
+
+ progressBar.getProgressBar().setString("70% : Calcul du résultat");
+ progressBar.getProgressBar().setValue(70);
+ /**
+ * Appel de la méthode du calcul du compte de résultat pour avoir le
+ * résultat
+ */
+ ResultViewImpl resultViewImpl = new ResultViewImpl ();
+ resultViewImpl.updateResult((PeriodDTO) comboBoxPeriod.getSelectedItem());
+ passifTab.get("PASSIF_CP_RESULTAT").add(new Bilan("Résultat","",resultViewImpl.getResult(),"0"), resultViewImpl.getResult());
+
+ progressBar.getProgressBar().setString("90% : Création des tableaux");
+ progressBar.getProgressBar().setValue(90);
+ /**
+ * Ajout des données dans le model
+ */
+ /** ACTIF */
+ List<Bilan> listActif = new LinkedList<Bilan>();
+ listActif.add(actifTab.get("ACTIF_IMMOBILISE"));
+ listActif.add(actifTab.get("ACTIF_IMMOBILISE_INCORPOREL"));
+ listActif.add(actifTab.get("ACTIF_IMMOBILISE_CORPOREL"));
+ listActif.add(actifTab.get("ACTIF_IMMOBILISE_FINANCIER"));
+ listActif.add(new Bilan("SOUS-TOTAL (1)","soustotal",actifTab.get("ACTIF_IMMOBILISE").getTotal(),actifTab.get("ACTIF_IMMOBILISE").getDepreciation()));
+ listActif.add(actifTab.get("ACTIF_CIRCULANT"));
+ listActif.add(actifTab.get("ACTIF_CIRCULANT_STOCK"));
+ listActif.add(actifTab.get("ACTIF_CIRCULANT_AVANCES"));
+ listActif.add(actifTab.get("ACTIF_CIRCULANT_CREANCES"));
+ listActif.add(actifTab.get("ACTIF_CIRCULANT_VMP"));
+ listActif.add(actifTab.get("ACTIF_CIRCULANT_DISPONIBILITE"));
+ listActif.add(actifTab.get("ACTIF_CIRCULANT_CCA"));
+ listActif.add(new Bilan("SOUS-TOTAL (2)","soustotal",actifTab.get("ACTIF_CIRCULANT").getTotal(),actifTab.get("ACTIF_CIRCULANT").getDepreciation()));
+ listActif.add(actifTab.get("ACTIF"));
+
+ // Création du modèle à partir de la liste précédement créée
+ modelBilanActif.setData(listActif);
+ modelBilanActif.fireTableDataChanged();
+
+ /** PASSIF */
+ List<Bilan> listPassif = new LinkedList<Bilan>();
+ listPassif.add(passifTab.get("PASSIF_CAPITAUX"));
+ listPassif.add(passifTab.get("PASSIF_CP_CAPITAL"));
+ listPassif.add(passifTab.get("PASSIF_CP_RESULTAT"));
+ listPassif.add(passifTab.get("PASSIF_CP_RESERVES"));
+ listPassif.add(passifTab.get("PASSIF_CP_RAN"));
+ listPassif.add(passifTab.get("PASSIF_CP_SUBVENTION"));
+ listPassif.add(passifTab.get("PASSIF_CP_PROVISION"));
+ listPassif.add(new Bilan("SOUS-TOTAL (1)","soustotal",passifTab.get("PASSIF_CAPITAUX").getTotal(),"0"));
+ listPassif.add(passifTab.get("PASSIF_PR_PROVISIONS"));
+ listPassif.add(passifTab.get("PASSIF_PROVISIONS"));
+ listPassif.add(new Bilan("SOUS-TOTAL (2)","soustotal",passifTab.get("PASSIF_PR_PROVISIONS").getTotal(),"0"));
+ listPassif.add(passifTab.get("PASSIF_DETTES"));
+ listPassif.add(passifTab.get("PASSIF_DETTES_EMPRUNTS"));
+ listPassif.add(passifTab.get("PASSIF_DETTES_AVANCES"));
+ listPassif.add(passifTab.get("PASSIF_DETTES_FOURNISSEURS"));
+ listPassif.add(passifTab.get("PASSIF_DETTES_FISCALES"));
+ listPassif.add(passifTab.get("PASSIF_DETTES_IMMOBILISATIONS"));
+ listPassif.add(passifTab.get("PASSIF_DETTES_AUTRES_DETTES"));
+ listPassif.add(passifTab.get("PASSIF_DETTES_PCA"));
+ listPassif.add(new Bilan("SOUS-TOTAL (3)","soustotal",passifTab.get("PASSIF_DETTES").getTotal(),"0"));
+ listPassif.add(passifTab.get("PASSIF"));
+
+ progressBar.getProgressBar().setString("90% : Opération terminée");
+ progressBar.getProgressBar().setValue(90);
+ // Création du modèle à partir de la liste précédement créée
+ modelBilanPassif.setData(listPassif);
+ progressBar.getProgressBar().setValue(95);
+ modelBilanPassif.fireTableDataChanged();
+ progressBar.getProgressBar().setValue(100);
+ progressBar.getProgressBarFrame().dispose();
+ }
+ }.start();
+
}
Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultView.jaxx
===================================================================
--- trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultView.jaxx 2009-08-27 09:18:03 UTC (rev 2693)
+++ trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultView.jaxx 2009-08-27 13:38:17 UTC (rev 2694)
@@ -1,6 +1,6 @@
<Table insets="0,0,0,0" fill="both">
<script>
- protected void updateResult() {};
+ protected void update() {};
</script>
<!-- Choix pour les périodes -->
@@ -15,7 +15,7 @@
<row columns="2" weightx="2" fill="both" insets="8,40,8,40">
<cell>
- <JButton width="80" id="updateButton" text="lima.update" onActionPerformed="updateResult()" />
+ <JButton width="80" id="updateButton" text="lima.update" onActionPerformed="update()" />
</cell>
</row>
Modified: trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultViewImpl.java
===================================================================
--- trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultViewImpl.java 2009-08-27 09:18:03 UTC (rev 2693)
+++ trunk/lima-main/src/main/java/org/chorem/lima/ui/ResultViewImpl.java 2009-08-27 13:38:17 UTC (rev 2694)
@@ -68,6 +68,7 @@
private JXTable tableProduit;
private JXTable tableChargeRes;
private JXTable tableProduitRes;
+ private String resultat;
private ResultChargesTableModel modelResultCharges;
private ResultProduitsTableModel modelResultProduits;
private DefaultTableModel modelChargeRes;
@@ -107,7 +108,7 @@
// Charge les produits et charges
- updateResult();
+ updateResult((PeriodDTO) comboBoxPeriod.getSelectedItem());
/**
* CHARGES
@@ -132,13 +133,19 @@
@Override
public void itemStateChanged(ItemEvent e) {
// Actualise le compte de résultat
- updateResult();
+ updateResult((PeriodDTO) comboBoxPeriod.getSelectedItem());
}
});
}
+ @Override
+ public void update ()
+ {
+ updateResult((PeriodDTO) comboBoxPeriod.getSelectedItem());
+ }
+
/**
* Permet d'initialiser le résultat des charges
* @param totalCharges
@@ -189,11 +196,10 @@
* Enfin, il associe les données aux modèles, et lance le calcul des
* résultats.
*/
- @Override
- protected void updateResult ()
+ protected void updateResult (PeriodDTO period)
{
// Chargement de la balance
- List<BalanceDTO> ListbalanceDTO = balance.createBalance((PeriodDTO) comboBoxPeriod.getSelectedItem());
+ List<BalanceDTO> ListbalanceDTO = balance.createBalance(period);
/**
* Création tableau associatif pour produits et charges
*/
@@ -338,7 +344,7 @@
initTabProduitRes(totalProduits);
// Affiche le résultat en produit OU en charge suivant le bénéfice ou perte
- String resultat = "0";
+ resultat = "0";
// On efface les résultats (ligne bénéfice ou perte)
if ( modelChargeRes.getRowCount() > 1 )
{
@@ -366,7 +372,7 @@
modelProduitRes.fireTableDataChanged();
}
}
-
+
/**
* Initialise la combobox contenant les périodes
*/
@@ -388,4 +394,9 @@
periodPanel.validate();
}
+ public String getResult()
+ {
+ return resultat;
+ }
+
}
\ No newline at end of file