Lima-commits
Threads by month
- ----- 2026 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
August 2011
- 3 participants
- 49 discussions
Aug. 11, 2011
Author: vsalaun
Date: 2011-08-11 11:56:41 +0200 (Thu, 11 Aug 2011)
New Revision: 3261
Url: http://chorem.org/repositories/revision/lima/3261
Log:
correct misnamed accounts + char format
Modified:
trunk/lima-swing/src/main/resources/import/pcg_base.csv
trunk/lima-swing/src/main/resources/import/pcg_developed.csv
trunk/lima-swing/src/main/resources/import/pcg_shortened.csv
Modified: trunk/lima-swing/src/main/resources/import/pcg_base.csv
===================================================================
--- trunk/lima-swing/src/main/resources/import/pcg_base.csv 2011-08-11 09:26:08 UTC (rev 3260)
+++ trunk/lima-swing/src/main/resources/import/pcg_base.csv 2011-08-11 09:56:41 UTC (rev 3261)
@@ -51,7 +51,7 @@
"ACCN";"17";"DETTES RATTACHÉES À DES PARTICIPATIONS";"";"1";""
"ACCN";"178";"Dettes rattachées à des sociétés en participation";"";"17";""
"ACCN";"1";"COMPTES DE CAPITAUX";"";"";""
-"ACCN";"201";"Frais détablissement";"";"20";""
+"ACCN";"201";"Frais d'établissement";"";"20";""
"ACCN";"203";"Frais de recherche et de développement";"";"20";""
"ACCN";"205";"Concessions et droits similaires";"";"20";""
"ACCN";"206";"Droit au bail";"";"20";""
@@ -108,7 +108,7 @@
"ACCN";"37";"STOCKS DE MARCHANDISES";"";"3";""
"ACCN";"372";"Marchandise (ou groupe) B";"";"37";""
"ACCN";"3";"COMPTES DE STOCKS ET D'EN-COURS";"";"";""
-"ACCN";"391";"Provisions pour dépréciation des stocks dapprovisionnement";"";"39";""
+"ACCN";"391";"Provisions pour dépréciation des stocks d'approvisionnement";"";"39";""
"ACCN";"392";"Provisions pour dépréciation des autres approvisionnements";"";"39";""
"ACCN";"393";"Provisions pour dépréciation en-cours de production de biens";"";"39";""
"ACCN";"394";"Provisions pour dépréciation en-cours de prod. de services";"";"39";""
@@ -227,7 +227,7 @@
"ACCN";"53";"CAISSE";"";"5";""
"ACCN";"530";"Caisse";"";"53";""
"ACCN";"54";"REGIES D'AVANCES ET ACCREDITIFS";"";"5";""
-"ACCN";"540";"Régies davances et accréditifs";"";"54";""
+"ACCN";"540";"Régies d'avances et accréditifs";"";"54";""
"ACCN";"58";"VIREMENTS INTERNES";"";"5";""
"ACCN";"580";"Virements internes";"";"58";""
"ACCN";"5";"COMPTES FINANCIERS";"";"";""
@@ -251,7 +251,7 @@
"ACCN";"61";"SERVICES EXTERIEURS";"";"6";""
"ACCN";"619";"Rabais, remises et ristournes obtenus sur services extérieurs";"";"61";""
"ACCN";"621";"Personnel extérieur à l'entreprise";"";"62";""
-"ACCN";"622";"Rémunérations dintermédiaires et honoraires";"";"62";""
+"ACCN";"622";"Rémunérations d'intermédiaires et honoraires";"";"62";""
"ACCN";"623";"Publicité; publications; relations publiques";"";"62";""
"ACCN";"624";"Transports de biens et transports collectifs du personnel";"";"62";""
"ACCN";"625";"Déplacements; missions et réceptions";"";"62";""
@@ -287,7 +287,7 @@
"ACCN";"655";"Quote-part de résultat sur opérations faites en commun";"";"65";""
"ACCN";"65";"AUTRES CHARGES DE GESTION COURANTE";"";"6";""
"ACCN";"658";"Autres charges de gestion courante";"";"65";""
-"ACCN";"661";"Charges dintérêt";"";"66";""
+"ACCN";"661";"Charges d'intérêt";"";"66";""
"ACCN";"664";"Pertes sur créances liées à des participations";"";"66";""
"ACCN";"665";"Escomptes accordés";"";"66";""
"ACCN";"667";"Charges nettes sur cessions de valeurs mobilières de placement";"";"66";""
@@ -309,7 +309,7 @@
"ACCN";"687";"Dotations aux amort. et provisions - Charges exceptionnelles";"";"68";""
"ACCN";"68725";"Dotations provisions réglementées - Amort. dérogatoires";"";"687";""
"ACCN";"6";"COMPTES DE CHARGES";"";"";""
-"ACCN";"691";"Participation des salaries aux résultats de lentreprise";"";"69";""
+"ACCN";"691";"Participation des salaries aux résultats de l'entreprise";"";"69";""
"ACCN";"695";"Impôts sur les bénéfices";"";"69";""
"ACCN";"696";"Suppléments d'impôt sur les sociétés, liés aux distributions";"";"69";""
"ACCN";"697";"Imposition forfaitaire annuelle des sociétés";"";"69";""
@@ -335,7 +335,7 @@
"ACCN";"72";"PRODUCTION IMMOBILISEE";"";"7";""
"ACCN";"722";"Immobilisations corporelles";"";"72";""
"ACCN";"74";"SUBVENTlONS D'EXPLOITATION";"";"7";""
-"ACCN";"740";"Subventions dexploitation";"";"74";""
+"ACCN";"740";"Subventions d'exploitation";"";"74";""
"ACCN";"751";"Redevances pour concessions, brevets, licences, marques, procédés, logiciels, droits et valeurs similaires";"";"75";""
"ACCN";"752";"Revenus des immeubles non affectés à des activités professionnelles";"";"75";""
"ACCN";"753";"Jetons de présence et rémunérations d'administrateurs, gérants";"";"75";""
@@ -354,7 +354,7 @@
"ACCN";"76";"PRODUITS FINANCIERS";"";"7";""
"ACCN";"7688";"Gains de change ou de conversion";"";"76";""
"ACCN";"771";"Produits exceptionnels sur opérations de gestion";"";"77";""
-"ACCN";"772";"Compte à la disposition des entités pour enregistrer, en cours d'exercice, les produits sur exercices ant�rieurs";"";"77";""
+"ACCN";"772";"Compte à la disposition des entités pour enregistrer, en cours d'exercice, les produits sur exercices antérieurs";"";"77";""
"ACCN";"775";"Produits des cessions d'éléments d'actif";"";"77";""
"ACCN";"777";"Quote-part des subventions d'investissement virée au résultat de l'exercice";"";"77";""
"ACCN";"77";"PRODUITS EXCEPTIONNELS";"";"7";""
@@ -374,7 +374,7 @@
"ACCN";"802";"Engagements reçus par l'entreprise";"";"80";""
"ACCN";"80";"ENGAGEMENTS";"";"8";""
"ACCN";"809";"Contrepartie des engagements";"";"80";""
-"ACCN";"88";"RESULTAT EN INSTANCE DAFFECTATION";"";"8";""
+"ACCN";"88";"RESULTAT EN INSTANCE D'AFFECTATION";"";"8";""
"ACCN";"8";"COMPTES SPECIAUX";"";"";""
"ACCN";"890";"Bilan d'ouverture";"";"89";""
"ACCN";"89";"BILAN";"";"8";""
Modified: trunk/lima-swing/src/main/resources/import/pcg_developed.csv
===================================================================
--- trunk/lima-swing/src/main/resources/import/pcg_developed.csv 2011-08-11 09:26:08 UTC (rev 3260)
+++ trunk/lima-swing/src/main/resources/import/pcg_developed.csv 2011-08-11 09:56:41 UTC (rev 3261)
@@ -134,7 +134,7 @@
"ACCN";"20121";"Frais de prospection";"";"2012";""
"ACCN";"2012";"Frais de premier établissement";"";"201";""
"ACCN";"20122";"Frais de publicité";"";"2012";""
-"ACCN";"201";"Frais détablissement";"";"20";""
+"ACCN";"201";"Frais d'établissement";"";"20";""
"ACCN";"2013";"Frais d'augmentation de capital et d'opérations diverses";"";"201";""
"ACCN";"203";"Frais de recherche et de développement";"";"20";""
"ACCN";"205";"Concessions et droits similaires";"";"20";""
@@ -169,12 +169,12 @@
"ACCN";"21383";"Voies d'eau";"";"2138";""
"ACCN";"21384";"Barrages";"";"2138";""
"ACCN";"2138";"Ouvrages d'infrastructure";"";"213";""
-"ACCN";"21385";"Pistes daérodromes";"";"2138";""
-"ACCN";"214";"Constructions sur sol dautrui";"";"21";""
-"ACCN";"21511";"#NOM?";"";"2151";""
+"ACCN";"21385";"Pistes d'aérodromes";"";"2138";""
+"ACCN";"214";"Constructions sur sol d'autrui";"";"21";""
+"ACCN";"21511";- sur sol propre";"";"2151";""
"ACCN";"2151";"Installations complexes spécialisées";"";"215";""
"ACCN";"21514";"- sur sol d'autrui";"";"2151";""
-"ACCN";"21531";"#NOM?";"";"2153";""
+"ACCN";"21531";"- sur sol propre";"";"2153";""
"ACCN";"2153";"Installations à caractère spécifique";"";"215";""
"ACCN";"21534";"- sur sol d'autrui";"";"2153";""
"ACCN";"2154";"Matériel industriel";"";"215";""
@@ -286,7 +286,7 @@
"ACCN";"2975";"Dépôts et cautionnements versés";"";"297";""
"ACCN";"297";"Provisions pour dépréciation des immobilisations financières";"";"29";""
"ACCN";"2976";"Autres créances immobilisées";"";"297";""
-"ACCN";"310";"Stocks dapprovisionnement";"";"31";""
+"ACCN";"310";"Stocks d'approvisionnement";"";"31";""
"ACCN";"311";"Matière (ou groupe) A";"";"31";""
"ACCN";"312";"Matière (ou groupe) B";"";"31";""
"ACCN";"31";"MATIERES PREMIERES (et fournitures)";"";"3";""
@@ -339,7 +339,7 @@
"ACCN";"3";"COMPTES DE STOCKS ET D'EN-COURS";"";"";""
"ACCN";"3911";"Matière (ou groupe A)";"";"391";""
"ACCN";"3912";"Matière (ou groupe B)";"";"391";""
-"ACCN";"391";"Provisions pour dépréciation des stocks dapprovisionnement";"";"39";""
+"ACCN";"391";"Provisions pour dépréciation des stocks d'approvisionnement";"";"39";""
"ACCN";"3917";"Fourniture A; B; C ...";"";"391";""
"ACCN";"3921";"Matières consommables (même ventilation que celle du compte";"";"392";""
"ACCN";"3922";"Fournitures consommables";"";"392";""
@@ -504,7 +504,7 @@
"ACCN";"478";"Autres comptes transitoires";"";"47";""
"ACCN";"4811";"Charges différées";"";"481";""
"ACCN";"4812";"Frais d'acquisition des immobilisations";"";"481";""
-"ACCN";"4816";"Frais démission des emprunts";"";"481";""
+"ACCN";"4816";"Frais d'émission des emprunts";"";"481";""
"ACCN";"481";"Charges à repartir sur plusieurs exercices";"";"48";""
"ACCN";"4818";"Charges à étaler";"";"481";""
"ACCN";"486";"Charges constatées d'avance";"";"48";""
@@ -559,7 +559,7 @@
"ACCN";"5187";"Intérêts courus à recevoir";"";"518";""
"ACCN";"51";"BANQUES; ETABLISSEMENTS FINANCIERS ET ASSIMILES";"";"5";""
"ACCN";"5191";"Crédit de mobilisation de créances commerciales (CMCC)";"";"519";""
-"ACCN";"5193";"Mobilisation de créances nées à létranger";"";"519";""
+"ACCN";"5193";"Mobilisation de créances nées à l'étranger";"";"519";""
"ACCN";"519";"Concours bancaires courants";"";"51";""
"ACCN";"5198";"Intérêts courus sur concours bancaires courants";"";"519";""
"ACCN";"52";"Instruments de trésorerie";"";"5";""
@@ -571,7 +571,7 @@
"ACCN";"53";"CAISSE";"";"5";""
"ACCN";"533";"Caisse succursale (ou usine) B";"";"53";""
"ACCN";"54";"REGIES D'AVANCES ET ACCREDITIFS";"";"5";""
-"ACCN";"540";"Régies davances et accréditifs";"";"54";""
+"ACCN";"540";"Régies d'avances et accréditifs";"";"54";""
"ACCN";"58";"VIREMENTS INTERNES";"";"5";""
"ACCN";"580";"Virements internes";"";"58";""
"ACCN";"5";"COMPTES FINANCIERS";"";"";""
@@ -603,7 +603,7 @@
"ACCN";"6032";"Variation des stocks des autres approvisionnements";"";"603";""
"ACCN";"603";"Variation des stocks (approvisionnements et marchandises)";"";"60";""
"ACCN";"6037";"Variation des stocks de marchandises";"";"603";""
-"ACCN";"604";"Achats détudes et prestations de service";"";"60";""
+"ACCN";"604";"Achats d'études et prestations de service";"";"60";""
"ACCN";"605";"Achats de matériel; équipements et travaux";"";"60";""
"ACCN";"6061";"Fournitures non stockables (eau; énergie; ...)";"";"606";""
"ACCN";"6063";"Fournitures d'entretien et de petit équipement";"";"606";""
@@ -617,11 +617,11 @@
"ACCN";"60";"ACHATS (sauf 603)";"";"6";""
"ACCN";"6091";"- de matières premières (et fournitures)";"";"609";""
"ACCN";"6092";"- d'autres approvisionnements stockés";"";"609";""
-"ACCN";"6094";"- détudes et prestations de services";"";"609";""
+"ACCN";"6094";"- d'études et prestations de services";"";"609";""
"ACCN";"6095";"- de matériel; équipements et travaux";"";"609";""
"ACCN";"6096";"- d'approvisionnements non stockés";"";"609";""
"ACCN";"609";"Rabais; remises et ristournes obtenus sur achats";"";"60";""
-"ACCN";"6097";"#NOM?";"";"609";""
+"ACCN";"6097";"- de marchandises";"";"609";""
"ACCN";"611";"Sous-traitance générale";"";"61";""
"ACCN";"6122";"Crédit-bail mobilier";"";"612";""
"ACCN";"612";"Redevances de crédit-bail";"";"61";""
@@ -631,16 +631,16 @@
"ACCN";"613";"Locations";"";"61";""
"ACCN";"6136";"Malis sur emballages";"";"613";""
"ACCN";"614";"Charges locatives et de copropriété";"";"61";""
-"ACCN";"6152";"#NOM?";"";"615";""
-"ACCN";"6155";"#NOM?";"";"615";""
+"ACCN";"6152";"- sur biens immobiliers";"";"615";""
+"ACCN";"6155";"- sur biens mobiliers";"";"615";""
"ACCN";"615";"Entretien et réparations";"";"61";""
"ACCN";"6156";"Maintenance";"";"615";""
"ACCN";"6161";"Multirisques";"";"616";""
"ACCN";"6162";"Assurance obligatoire dommage - construction";"";"616";""
-"ACCN";"61636";"#NOM?";"";"6163";""
-"ACCN";"61637";"#NOM?";"";"6163";""
+"ACCN";"61636";"- sur achats";"";"6163";""
+"ACCN";"61637";"- sur ventes";"";"6163";""
"ACCN";"6163";"Assurance - transport";"";"616";""
-"ACCN";"61638";"#NOM?";"";"6163";""
+"ACCN";"61638";"- sur autres biens";"";"6163";""
"ACCN";"6164";"Risques d'exploitation";"";"616";""
"ACCN";"616";"Primes d'assurance";"";"61";""
"ACCN";"6165";"Insolvabilité clients";"";"616";""
@@ -660,7 +660,7 @@
"ACCN";"6225";"Rémunérations d'affacturage";"";"622";""
"ACCN";"6226";"Honoraires";"";"622";""
"ACCN";"6227";"Frais d'actes et de contentieux";"";"622";""
-"ACCN";"622";"Rémunérations dintermédiaires et honoraires";"";"62";""
+"ACCN";"622";"Rémunérations d'intermédiaires et honoraires";"";"62";""
"ACCN";"6228";"Divers";"";"622";""
"ACCN";"6231";"Annonces et insertions";"";"623";""
"ACCN";"6232";"Echantillons";"";"623";""
@@ -741,7 +741,7 @@
"ACCN";"646";"Cotisations sociales personnelles de l'exploitant";"";"64";""
"ACCN";"6471";"Prestations directes";"";"647";""
"ACCN";"6472";"Versements aux comités d'entreprise et d'établissement";"";"647";""
-"ACCN";"6473";"Versements aux comités dhygiène et de sécurité";"";"647";""
+"ACCN";"6473";"Versements aux comités d'hygiène et de sécurité";"";"647";""
"ACCN";"6474";"Versement aux autres oeuvres sociales";"";"647";""
"ACCN";"647";"Autres charges sociales";"";"64";""
"ACCN";"6475";"Médecine du travail; pharmacie";"";"647";""
@@ -766,10 +766,10 @@
"ACCN";"6615";"Intérêts des comptes courants et des dépôts créditeurs";"";"661";""
"ACCN";"6616";"Intérêts bancaires et sur opérations de financement";"";"661";""
"ACCN";"6617";"Intérêts des obligations cautionnées";"";"661";""
-"ACCN";"661";"Charges dintérêt";"";"66";""
-"ACCN";"66181";"#NOM?";"";"6618";""
+"ACCN";"661";"Charges d'intérêt";"";"66";""
+"ACCN";"66181";"- dettes commerciales";"";"6618";""
"ACCN";"6618";"Intérêts des autres dettes";"";"661";""
-"ACCN";"66188";"#NOM?";"";"6618";""
+"ACCN";"66188";"- dettes diverses";"";"6618";""
"ACCN";"664";"Pertes sur créances liées à des participations";"";"66";""
"ACCN";"665";"Escomptes accordés";"";"66";""
"ACCN";"666";"Pertes de change";"";"66";""
@@ -849,7 +849,7 @@
"ACCN";"7071";"Marchandise (ou groupe) A";"";"707";""
"ACCN";"707";"Ventes de marchandises";"";"70";""
"ACCN";"7072";"Marchandise (ou groupe) B";"";"707";""
-"ACCN";"7081";"Produits des services exploités dans lintérêt du personnel";"";"708";""
+"ACCN";"7081";"Produits des services exploités dans l'intérêt du personnel";"";"708";""
"ACCN";"7082";"Commissions et courtages";"";"708";""
"ACCN";"7083";"Locations diverses";"";"708";""
"ACCN";"7084";"Mise à disposition de personnel facturée";"";"708";""
@@ -859,12 +859,12 @@
"ACCN";"708";"Produits des activités annexes";"";"70";""
"ACCN";"7088";"Autres produits activités annexes";"";"708";""
"ACCN";"70";"VENTES DE PRODUITS; PRESTATIONS DE SERVICES; MARCHANDISES";"";"7";""
-"ACCN";"7091";"#NOM?";"";"709";""
+"ACCN";"7091";"VENTES DE PRODUITS FINIS";"";"709";""
"ACCN";"7092";"- sur ventes de produits intermédiaires";"";"709";""
-"ACCN";"7094";"#NOM?";"";"709";""
+"ACCN";"7094";"- sur travaux";"";"709";""
"ACCN";"7095";"- sur études";"";"709";""
-"ACCN";"7096";"#NOM?";"";"709";""
-"ACCN";"7097";"#NOM?";"";"709";""
+"ACCN";"7096";"- sur prestations de services";"";"709";""
+"ACCN";"7097";"- sur ventes de marchandises";"";"709";""
"ACCN";"709";"Rabais; remises et ristournes accordées par l'entreprise";"";"70";""
"ACCN";"7098";"- sur produits des activités annexes";"";"709";""
"ACCN";"71";"PRODUCTION STOCKEE (ou déstockage)";"";"7";""
@@ -886,7 +886,7 @@
"ACCN";"73";"PRODUITS NETS PARTIELS SUR OPERATIONS A LONG TERME";"";"7";""
"ACCN";"739";"Produits nets partiels sur opérations terminées";"";"73";""
"ACCN";"74";"SUBVENTlONS D'EXPLOITATION";"";"7";""
-"ACCN";"740";"Subventions dexploitation";"";"74";""
+"ACCN";"740";"Subventions d'exploitation";"";"74";""
"ACCN";"7511";"Redevances pour concessions; brevets; licences; marques; log";"";"751";""
"ACCN";"7516";"Droits d'auteur et de reproduction";"";"751";""
"ACCN";"751";"Redevances pour concessions; brevets; licences; marques; log";"";"75";""
@@ -987,6 +987,6 @@
"ACCN";"8091";"Contrepartie 801";"";"809";""
"ACCN";"809";"Contrepartie des engagements";"";"80";""
"ACCN";"8092";"Contrepartie 802";"";"809";""
-"ACCN";"88";"RESULTAT EN INSTANCE DAFFECTATION";"";"8";""
+"ACCN";"88";"RESULTAT EN INSTANCE D'AFFECTATION";"";"8";""
"ACCN";"8";"COMPTES SPECIAUX";"";"";""
"ACCN";"89";"BILAN";"";"8";""
Modified: trunk/lima-swing/src/main/resources/import/pcg_shortened.csv
===================================================================
--- trunk/lima-swing/src/main/resources/import/pcg_shortened.csv 2011-08-11 09:26:08 UTC (rev 3260)
+++ trunk/lima-swing/src/main/resources/import/pcg_shortened.csv 2011-08-11 09:56:41 UTC (rev 3261)
@@ -27,7 +27,7 @@
"ACCN";"164";"Emprunts auprès des établissements de crédit";"";"16";""
"ACCN";"16";"EMPRUNTS ET DETTES ASSIMILEES";"";"1";""
"ACCN";"168";"Autres emprunts et dettes assimilées";"";"16";""
-"ACCN";"201";"Frais détablissement";"";"20";""
+"ACCN";"201";"Frais d'établissement";"";"20";""
"ACCN";"206";"Droit au bail";"";"20";""
"ACCN";"207";"Fonds commercial";"";"20";""
"ACCN";"20";"IMMOBILISATIONS INCORPORELLES";"";"2";""
@@ -52,7 +52,7 @@
"ACCN";"29";"PROVISIONS POUR DEPRECIATION DES IMMOBILISATIONS";"";"2";""
"ACCN";"297";"Provisions pour dépréciation des immobilisations financières";"";"29";""
"ACCN";"31";"MATIERES PREMIERES (et fournitures)";"";"3";""
-"ACCN";"310";"Stocks dapprovisionnement";"";"31";""
+"ACCN";"310";"Stocks d'approvisionnement";"";"31";""
"ACCN";"321";"Matières consommables";"";"32";""
"ACCN";"322";"Fournitures consommables";"";"32";""
"ACCN";"32";"AUTRES APPROVISIONNEMENTS";"";"3";""
@@ -64,7 +64,7 @@
"ACCN";"37";"STOCKS DE MARCHANDISES";"";"3";""
"ACCN";"370";"Stocks de marchandises";"";"37";""
"ACCN";"3";"COMPTES DE STOCKS ET D'EN-COURS";"";"";""
-"ACCN";"391";"Provisions pour dépréciation des stocks dapprovisionnement";"";"39";""
+"ACCN";"391";"Provisions pour dépréciation des stocks d'approvisionnement";"";"39";""
"ACCN";"395";"Provisions pour dépréciation des stocks de produits";"";"39";""
"ACCN";"39";"PROVISIONS POUR DEPRECIATION DES STOCKS ET EN-COURS";"";"3";""
"ACCN";"397";"Provisions pour dépréciation des stocks de marchandises";"";"39";""
@@ -112,7 +112,7 @@
"ACCN";"53";"CAISSE";"";"5";""
"ACCN";"530";"Caisse";"";"53";""
"ACCN";"54";"REGIES D'AVANCES ET ACCREDITIFS";"";"5";""
-"ACCN";"540";"Régies davances et accréditifs";"";"54";""
+"ACCN";"540";"Régies d'avances et accréditifs";"";"54";""
"ACCN";"58";"VIREMENTS INTERNES";"";"5";""
"ACCN";"580";"Virements internes";"";"58";""
"ACCN";"5";"COMPTES FINANCIERS";"";"";""
@@ -134,7 +134,7 @@
"ACCN";"61";"SERVICES EXTERIEURS";"";"6";""
"ACCN";"616";"Primes d'assurance";"";"61";""
"ACCN";"621";"Personnel extérieur à l'entreprise";"";"62";""
-"ACCN";"622";"Rémunérations dintermédiaires et honoraires";"";"62";""
+"ACCN";"622";"Rémunérations d'intermédiaires et honoraires";"";"62";""
"ACCN";"623";"Publicité; publications; relations publiques";"";"62";""
"ACCN";"624";"Transports de biens et transports collectifs du personnel";"";"62";""
"ACCN";"625";"Déplacements; missions et réceptions";"";"62";""
@@ -163,7 +163,7 @@
"ACCN";"655";"Quote-part de résultat sur opérations faites en commun";"";"65";""
"ACCN";"65";"AUTRES CHARGES DE GESTION COURANTE";"";"6";""
"ACCN";"658";"Autres charges de gestion courante";"";"65";""
-"ACCN";"661";"Charges dintérêt";"";"66";""
+"ACCN";"661";"Charges d'intérêt";"";"66";""
"ACCN";"665";"Escomptes accordés";"";"66";""
"ACCN";"66";"CHARGES FINANCIERES";"";"6";""
"ACCN";"6688";"Pertes de change ou de conversion";"";"66";""
@@ -199,7 +199,7 @@
"ACCN";"72";"PRODUCTION IMMOBILISEE";"";"7";""
"ACCN";"722";"Immobilisations corporelles";"";"72";""
"ACCN";"74";"SUBVENTlONS D'EXPLOITATION";"";"7";""
-"ACCN";"740";"Subventions dexploitation";"";"74";""
+"ACCN";"740";"Subventions d'exploitation";"";"74";""
"ACCN";"75";"AUTRES PRODUITS DE GESTION COURANTE";"";"7";""
"ACCN";"758";"Produits divers de gestion courante";"";"75";""
"ACCN";"76";"PRODUITS FINANCIERS";"";"7";""
@@ -219,7 +219,7 @@
"ACCN";"79";"TRANSFERTS DE CHARGES";"";"7";""
"ACCN";"796";"Transfert de charges financières";"";"79";""
"ACCN";"80";"ENGAGEMENTS";"";"8";""
-"ACCN";"88";"RESULTAT EN INSTANCE DAFFECTATION";"";"8";""
+"ACCN";"88";"RESULTAT EN INSTANCE D'AFFECTATION";"";"8";""
"ACCN";"8";"COMPTES SPECIAUX";"";"";""
"ACCN";"89";"BILAN";"";"8";""
"ACCN";"6031";"Variation des stocks de matières premères (et fournitures)";;"603";""
1
0
r3260 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-callao/src/main/xmi
by vsalaun@users.chorem.org Aug. 11, 2011
by vsalaun@users.chorem.org Aug. 11, 2011
Aug. 11, 2011
Author: vsalaun
Date: 2011-08-11 11:26:08 +0200 (Thu, 11 Aug 2011)
New Revision: 3260
Url: http://chorem.org/repositories/revision/lima/3260
Log:
#347 make code simplier (delete non usefull variables)
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java
trunk/lima-callao/src/main/xmi/accounting.zargo
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2011-08-11 09:23:09 UTC (rev 3259)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2011-08-11 09:26:08 UTC (rev 3260)
@@ -385,12 +385,12 @@
/**
* Local methode, export vatstatements from database
- * vatstatement Structure : TYPE | label | header |
- * | accounts | subAmount | headerAmount | masterVatStatement
+ * vatstatement Structure : TYPE | boxName | label | header
+ * | accounts | masterVatStatement
*/
public void exportVatStatementChartAsCSV(CSVWriter csvWriter, TopiaContext topiaContext) throws LimaException {
try {
- String[] nextLine = new String[8];
+ String[] nextLine = new String[6];
// Get all Vatstatements
VatStatementDAO vatStatementDAO =
LimaCallaoDAOHelper.getVatStatementDAO(topiaContext);
@@ -408,10 +408,6 @@
nextLine[3] = Boolean.toString(
vatStatement.getHeader());
nextLine[4] = vatStatement.getAccounts();
- nextLine[5] = Boolean.toString(
- vatStatement.getSubAmount());
- nextLine[6] = Boolean.toString(
- vatStatement.getHeaderAmount());
VatStatement masterVatStatement =
vatStatement.getMasterVatStatement();
String masterVatStatementString = "";
@@ -419,7 +415,7 @@
masterVatStatementString =
masterVatStatement.getLabel();
}
- nextLine[7] = masterVatStatementString;
+ nextLine[5] = masterVatStatementString;
csvWriter.writeNext(nextLine);
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2011-08-11 09:23:09 UTC (rev 3259)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2011-08-11 09:26:08 UTC (rev 3260)
@@ -908,8 +908,8 @@
/**
- * Import and create vatstatement Structure : TYPE | boxName | label | header
- * | accounts | subAmount | headerAmount | masterVatStatement
+ * Import and create vatstatement Structure : TYPE | boxName | label
+ * | header | accounts | masterVatStatement
*/
public String importVatStatementChartCSV(String[] nextLine,
@@ -922,9 +922,7 @@
String label = nextLine[2];
String header = nextLine[3];
String accounts = nextLine[4];
- String subAmount = nextLine[5];
- String headerAmount = nextLine[6];
- String masterVatStatement = nextLine[7];
+ String masterVatStatement = nextLine[5];
try {
@@ -939,8 +937,6 @@
vatStatementImport.setBoxName(boxName);
vatStatementImport.setHeader(header);
vatStatementImport.setAccounts(accounts);
- vatStatementImport.setSubAmount(subAmount);
- vatStatementImport.setHeaderAmount(headerAmount);
vatStatementImport.setMasterVatStatement(masterVatStatement);
// put it in hashlinkedlist
@@ -1134,11 +1130,6 @@
vatStatement.setHeader(Boolean
.parseBoolean(vatStatementImport
.getHeader()));
- vatStatement.setSubAmount(Boolean
- .parseBoolean(vatStatementImport
- .getSubAmount()));
- vatStatement.setHeaderAmount(vatStatement
- .getHeaderAmount());
vatStatement.setAmount(BigDecimal.ZERO);
vatStatementService
.createVatStatementWithTransaction(
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2011-08-11 09:23:09 UTC (rev 3259)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2011-08-11 09:26:08 UTC (rev 3260)
@@ -459,7 +459,7 @@
VatStatementAmounts headerVatStatementAmounts =
vatStatementDatas.getVatStatementAmounts();
//Si sous-total
- if (subVatStatement.getSubAmount()){
+ if (subVatStatement.getHeader()){
VatStatementAmounts header =
new VatStatementAmountsImpl();
header.setLabel(headerVatStatementAmounts.getLabel());
@@ -474,18 +474,6 @@
//ajoute une ligne vide
subResult.add(new VatStatementAmountsImpl());
- }//sinon
- else {
- if (subVatStatement.getHeaderAmount()){
- subResult.add(headerVatStatementAmounts);
- }
- else {
- subResult.add(headerVatStatementAmounts);
- }
- //ajoute liste
- if (vatStatementDatas.getListResult() != null){
- subResult.addAll(vatStatementDatas.getListResult());
- }
}
}
}
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
1
0
r3259 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor
by vsalaun@users.chorem.org Aug. 11, 2011
by vsalaun@users.chorem.org Aug. 11, 2011
Aug. 11, 2011
Author: vsalaun
Date: 2011-08-11 11:23:09 +0200 (Thu, 11 Aug 2011)
New Revision: 3259
Url: http://chorem.org/repositories/revision/lima/3259
Log:
update BigDecimal editor
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2011-08-10 13:27:34 UTC (rev 3258)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/celleditor/BigDecimalTableCellEditor.java 2011-08-11 09:23:09 UTC (rev 3259)
@@ -45,6 +45,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.LimaContext;
+import org.chorem.lima.business.LimaException;
public class BigDecimalTableCellEditor extends AbstractCellEditor
implements TableCellEditor, FocusListener, AncestorListener, KeyListener {
@@ -81,8 +82,17 @@
textValue = textValue.replaceAll(",", ".");
if (textValue.equals("")) {
return BigDecimal.ZERO;
- } else {
- BigDecimal bdValue = new BigDecimal(textValue);
+ } else {
+ //set 0 in case the user type in a non number format
+ BigDecimal bdValue = BigDecimal.ZERO;
+ try {
+ bdValue = new BigDecimal(textValue);
+ } catch (NumberFormatException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't set " + textValue + " to a BigDecimal", eee);
+ }
+ }
+ //round half up the number using the scale given by the configuration
bdValue = bdValue.setScale(LimaContext.getContext().getConfig().getScale(),
BigDecimal.ROUND_HALF_UP);
return bdValue;
@@ -138,21 +148,20 @@
}
@Override
- public void keyReleased(KeyEvent e) {
- if (keyPressed == false) {
- if ((e.getKeyCode() >= KeyEvent.VK_0
- && e.getKeyCode() <= KeyEvent.VK_9)
- || e.getKeyCode() == KeyEvent.VK_COMMA
- || e.getKeyCode() == KeyEvent.VK_PERIOD) {
- //check if the TextField is selectAll
- if (textField.getSelectedText().equals(textField.getText())) {
- textField.setText(String.valueOf(e.getKeyChar()));
- }
- keyPressed = true;
- } else if (e.getKeyChar() == KeyEvent.VK_BACK_SPACE){
- textField.setText("");
- keyPressed = true;
- }
+ public void keyReleased(KeyEvent e) {
+ // replace all the cell content only if all the text has been selected
+ if (keyPressed == false
+ && textField.getSelectionStart() == 0
+ && textField.getSelectionEnd() == textField.getText().length()) {
+ // delete the the cell content
+ if (e.getKeyChar() == KeyEvent.VK_BACK_SPACE) {
+ textField.setText("");
+ keyPressed = true;
+ // replace the content by the char typed in
+ } else if (String.valueOf(e.getKeyChar()).matches("[a-zA-z0-9]")) {
+ textField.setText(String.valueOf(e.getKeyChar()));
+ keyPressed = true;
+ }
}
}
1
0
r3258 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-swing/src/main/java/org/chorem/lima/ui/account
by vsalaun@users.chorem.org Aug. 10, 2011
by vsalaun@users.chorem.org Aug. 10, 2011
Aug. 10, 2011
Author: vsalaun
Date: 2011-08-10 15:27:34 +0200 (Wed, 10 Aug 2011)
New Revision: 3258
Url: http://chorem.org/repositories/revision/lima/3258
Log:
#426 add forms for updating accounts + uppercase ledger account number (when contains letters)
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-08-10 11:38:02 UTC (rev 3257)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-08-10 13:27:34 UTC (rev 3258)
@@ -83,6 +83,9 @@
public void createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException {
try {
+ // force upppercase account number
+ account.setAccountNumber(account.getAccountNumber().toUpperCase());
+
// check if account number already exist
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(topiaContext);
@@ -150,6 +153,10 @@
public void createSubLedgerWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException {
try {
+
+ // force upppercase account number
+ account.setAccountNumber(account.getAccountNumber().toUpperCase());
+
// check if the accountnumber already exist
AccountDAO accountDAO =
LimaCallaoDAOHelper.getAccountDAO(topiaContext);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2011-08-10 11:38:02 UTC (rev 3257)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2011-08-10 13:27:34 UTC (rev 3258)
@@ -31,42 +31,11 @@
<script>
<![CDATA[
- import org.chorem.lima.business.AccountServiceMonitorable;
- import org.chorem.lima.service.LimaServiceFactory;
- import org.chorem.lima.business.LimaException;
- import org.chorem.lima.entity.AccountImpl;
-
getRootPane().setDefaultButton(ok);
protected void performCancel() {
setAccount(null);
dispose();
}
- protected void performOk() {
- if (getMasterAccountTextField().getText().length() != 0) {
- AccountServiceMonitorable accountService =
- LimaServiceFactory.getInstance().getService(
- AccountServiceMonitorable.class);
- Account masterAccount = new AccountImpl();
- try {
- System.out.println("setMaster : "
- + getMasterAccountTextField().getText() + " to : "
- + getAccount().getAccountNumber());
- masterAccount = accountService
- .getAccountByNumber(getMasterAccountTextField().getText());
- } catch (LimaException eee) {
- log.debug("Can't search account for update : "
- + getMasterAccountTextField().getText(), eee);
- }
- if (masterAccount != null) {
- getAccount().setMasterAccount(masterAccount);
- } else {
- getAccount().setMasterAccount(null);
- }
- } else {
- setAccount(null);
- }
- dispose();
- }
]]>
</script>
@@ -77,7 +46,10 @@
<JLabel text="lima.charts.account.number"/>
</cell>
<cell fill="horizontal">
- <JTextField id="numberTextField" editable='{false}' text="{getAccount().getAccountNumber()}"/>
+ <JTextField id="numberTextField" text="{getAccount().getAccountNumber()}"/>
+ <javax.swing.text.Document javaBean="getNumberTextField().getDocument()"
+ onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
+ onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())' />
</cell>
</row>
<row>
@@ -92,19 +64,11 @@
</cell>
</row>
<row>
- <cell fill="horizontal">
- <JLabel text="lima.common.masteraccount"/>
- </cell>
- <cell fill="horizontal">
- <JTextField id="masterAccountTextField" text="{getAccount().getMasterAccount().getAccountNumber()}"/>
- </cell>
- </row>
- <row>
<cell fill="none">
<JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
</cell>
<cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="performOk()"/>
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
</cell>
</row>
</Table>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-08-10 11:38:02 UTC (rev 3257)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-08-10 13:27:34 UTC (rev 3258)
@@ -44,6 +44,8 @@
import org.chorem.lima.ui.account.AccountForm;
import org.chorem.lima.ui.account.AccountView;
import org.chorem.lima.ui.account.SubLedgerForm;
+import org.chorem.lima.ui.account.UpdateAccountForm;
+import org.chorem.lima.ui.account.UpdateSubLedgerForm;
import org.chorem.lima.ui.importexport.ImportExport;
import org.chorem.lima.util.DialogHelper;
import org.chorem.lima.util.ErrorHelper;
@@ -224,7 +226,7 @@
}
//test if selectedrow is account or ledger
if (selectedObject.getGeneralLedger()==null) {
- AccountForm accountForm = new AccountForm(view);
+ UpdateAccountForm accountForm = new UpdateAccountForm(view);
accountForm.setAccount(selectedObject);
// jaxx constructor don't call super() ?
accountForm.setLocationRelativeTo(view);
@@ -234,7 +236,7 @@
}
// else is a subledger
else {
- SubLedgerForm subLedgerForm = new SubLedgerForm(view);
+ UpdateSubLedgerForm subLedgerForm = new UpdateSubLedgerForm(view);
subLedgerForm.setAccount(selectedObject);
// jaxx constructor don't call super() ?
subLedgerForm.setLocationRelativeTo(view);
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateAccountForm.jaxx 2011-08-10 13:27:34 UTC (rev 3258)
@@ -0,0 +1,86 @@
+<JDialog modal="true"
+ defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
+ onWindowClosing="performCancel();">
+
+ <org.chorem.lima.entity.Account id="account" javaBean='null'/>
+
+ <script>
+ <![CDATA[
+ import org.chorem.lima.business.AccountServiceMonitorable;
+ import org.chorem.lima.service.LimaServiceFactory;
+ import org.chorem.lima.business.LimaException;
+ import org.chorem.lima.entity.AccountImpl;
+
+ getRootPane().setDefaultButton(ok);
+ protected void performCancel() {
+ setAccount(null);
+ dispose();
+ }
+ protected void performOk() {
+ if (getMasterAccountTextField().getText().length() != 0) {
+ AccountServiceMonitorable accountService =
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
+ Account masterAccount = new AccountImpl();
+ try {
+ System.out.println("setMaster : "
+ + getMasterAccountTextField().getText() + " to : "
+ + getAccount().getAccountNumber());
+ masterAccount = accountService
+ .getAccountByNumber(getMasterAccountTextField().getText());
+ } catch (LimaException eee) {
+ log.debug("Can't search account for update : "
+ + getMasterAccountTextField().getText(), eee);
+ }
+ if (masterAccount != null) {
+ getAccount().setMasterAccount(masterAccount);
+ } else {
+ getAccount().setMasterAccount(null);
+ }
+ } else {
+ setAccount(null);
+ }
+ dispose();
+ }
+ ]]>
+ </script>
+
+ <Table>
+
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.charts.account.number"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="numberTextField" editable='{false}' text="{getAccount().getAccountNumber()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
+ <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.masteraccount"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="masterAccountTextField" text="{getAccount().getMasterAccount().getAccountNumber()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="performOk()"/>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/UpdateSubLedgerForm.jaxx 2011-08-10 13:27:34 UTC (rev 3258)
@@ -0,0 +1,101 @@
+<JDialog modal="true"
+ defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
+ onWindowClosing="performCancel();">
+
+ <org.chorem.lima.entity.Account id="account" javaBean='null'/>
+
+ <script>
+ <![CDATA[
+ import org.chorem.lima.business.AccountServiceMonitorable;
+ import org.chorem.lima.service.LimaServiceFactory;
+ import org.chorem.lima.business.LimaException;
+ import org.chorem.lima.entity.AccountImpl;
+
+ getRootPane().setDefaultButton(ok);
+ protected void performCancel() {
+ setAccount(null);
+ dispose();
+ }
+ protected void performOk() {
+ if (getMasterAccountTextField().getText().length() != 0) {
+ AccountServiceMonitorable accountService =
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
+ Account masterAccount = new AccountImpl();
+ try {
+ System.out.println("setMaster : "
+ + getMasterAccountTextField().getText() + " to : "
+ + getAccount().getAccountNumber());
+ masterAccount = accountService
+ .getAccountByNumber(getMasterAccountTextField().getText());
+ } catch (LimaException eee) {
+ log.debug("Can't search account for update : "
+ + getMasterAccountTextField().getText(), eee);
+ }
+ if (masterAccount != null) {
+ getAccount().setMasterAccount(masterAccount);
+ } else {
+ getAccount().setMasterAccount(null);
+ }
+ } else {
+ setAccount(null);
+ }
+ dispose();
+ }
+ ]]>
+ </script>
+
+ <Table>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.code"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="numberTextField"
+ text="{getAccount().getAccountNumber()}"/>
+ <javax.swing.text.Document javaBean="getNumberTextField().getDocument()"
+ onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
+ onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="descriptionTextField" text="{getAccount().getLabel()}"/>
+ <javax.swing.text.Document javaBean="getDescriptionTextField().getDocument()"
+ onInsertUpdate='getAccount().setLabel(getDescriptionTextField().getText())'
+ onRemoveUpdate='getAccount().setLabel(getDescriptionTextField().getText())' />
+ </cell>
+ </row>
+ <!-- Lien Fiche contact-->
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.identity.contact"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="thirdPartyTextField" text="{getAccount().getThirdParty()}"/>
+ <javax.swing.text.Document javaBean="getThirdPartyTextField().getDocument()"
+ onInsertUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())'
+ onRemoveUpdate='getAccount().setThirdParty(getThirdPartyTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.masteraccount"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="masterAccountTextField" text="{getAccount().getMasterAccount().getAccountNumber()}"/>
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="performOk()"/>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
1
0
r3257 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-swing/src/main/java/org/chorem/lima/ui/account lima-swing/src/main/resources/i18n
by vsalaun@users.chorem.org Aug. 10, 2011
by vsalaun@users.chorem.org Aug. 10, 2011
Aug. 10, 2011
Author: vsalaun
Date: 2011-08-10 13:38:02 +0200 (Wed, 10 Aug 2011)
New Revision: 3257
Url: http://chorem.org/repositories/revision/lima/3257
Log:
#426 enable changing master account for an account
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-08-09 12:38:19 UTC (rev 3256)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-08-10 11:38:02 UTC (rev 3257)
@@ -335,6 +335,17 @@
}
accountsList.addAll(accountDAO.findAllByQuery(query));
Collections.sort(accountsList, new AccountComparator());
+
+ // sort of bug fix 2011.09.10 vsalaun (+ bleny)
+ // do NOT delete these lines unless you find a better way to
+ // prevent lazy exception when updating account from the account chart
+ for (Account t : accountsList) {
+ if (t.getMasterAccount() != null) {
+ t.getMasterAccount().getTopiaId();
+ }
+ t.sizeSubAccounts();
+ t.sizeSubLedgers();
+ }
}
catch (TopiaException ex) {
@@ -425,9 +436,7 @@
* Il n'est pas possible de modifier un numéro de compte.
* Si le compte n'existe pas, il envoie alors un message d'avertissement.
*
- * @param accountNumber numéro de compte à modifier
- * @param label label à modifier
- * @param masterAccountNumber compte père à modifier
+ * @param account compte à modifier
* @throws LimaException
*/
@@ -444,19 +453,15 @@
LimaCallaoDAOHelper.getAccountDAO(transaction);
Account subAccount = accountDAO.findByTopiaId(account.getTopiaId());
//check rules account if ledger or account
- if (account.getGeneralLedger() == null){
+ if (account.getGeneralLedger() == null) { // is an account
- //get masteraccount, search account have account in params in all subaccounts collection
- TopiaQuery query = accountDAO.createQuery()
- .addInElements(":account", "subAccounts")
- .addParam("account", account);
- Account master = accountDAO.findByQuery(query);
+ Account master = account.getMasterAccount();
accountingRules.updateAccountRules(master, account);
subAccount.setMasterAccount(account.getMasterAccount());
subAccount.setSubAccounts(account.getSubAccounts());
}
- else {
+ else { // is a ledger
accountingRules.updateSubLedgerRules(account);
subAccount.setGeneralLedger(account.getGeneralLedger());
subAccount.setSubLedgers(account.getSubLedgers());
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-08-09 12:38:19 UTC (rev 3256)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-08-10 11:38:02 UTC (rev 3257)
@@ -37,11 +37,9 @@
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.List;
-import java.util.Locale;
import javax.ejb.EJB;
import javax.ejb.Stateless;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2011-08-09 12:38:19 UTC (rev 3256)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountForm.jaxx 2011-08-10 11:38:02 UTC (rev 3257)
@@ -28,28 +28,56 @@
onWindowClosing="performCancel();">
<org.chorem.lima.entity.Account id="account" javaBean='null'/>
- <Boolean id="addState" javaBean='true'/>
<script>
<![CDATA[
+ import org.chorem.lima.business.AccountServiceMonitorable;
+ import org.chorem.lima.service.LimaServiceFactory;
+ import org.chorem.lima.business.LimaException;
+ import org.chorem.lima.entity.AccountImpl;
+
getRootPane().setDefaultButton(ok);
protected void performCancel() {
setAccount(null);
dispose();
}
+ protected void performOk() {
+ if (getMasterAccountTextField().getText().length() != 0) {
+ AccountServiceMonitorable accountService =
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
+ Account masterAccount = new AccountImpl();
+ try {
+ System.out.println("setMaster : "
+ + getMasterAccountTextField().getText() + " to : "
+ + getAccount().getAccountNumber());
+ masterAccount = accountService
+ .getAccountByNumber(getMasterAccountTextField().getText());
+ } catch (LimaException eee) {
+ log.debug("Can't search account for update : "
+ + getMasterAccountTextField().getText(), eee);
+ }
+ if (masterAccount != null) {
+ getAccount().setMasterAccount(masterAccount);
+ } else {
+ getAccount().setMasterAccount(null);
+ }
+ } else {
+ setAccount(null);
+ }
+ dispose();
+ }
]]>
</script>
<Table>
+
<row>
<cell fill="horizontal">
<JLabel text="lima.charts.account.number"/>
</cell>
<cell fill="horizontal">
- <JTextField id="numberTextField" editable='{isAddState()}' text="{getAccount().getAccountNumber()}"/>
- <javax.swing.text.Document javaBean="getNumberTextField().getDocument()"
- onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
- onRemoveUpdate='getAccount().setAccountNumber(getNumberTextField().getText())' />
+ <JTextField id="numberTextField" editable='{false}' text="{getAccount().getAccountNumber()}"/>
</cell>
</row>
<row>
@@ -64,11 +92,19 @@
</cell>
</row>
<row>
+ <cell fill="horizontal">
+ <JLabel text="lima.common.masteraccount"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="masterAccountTextField" text="{getAccount().getMasterAccount().getAccountNumber()}"/>
+ </cell>
+ </row>
+ <row>
<cell fill="none">
<JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
</cell>
<cell fill="none">
- <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="performOk()"/>
</cell>
</row>
</Table>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-08-09 12:38:19 UTC (rev 3256)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-08-10 11:38:02 UTC (rev 3257)
@@ -222,21 +222,24 @@
/**
* Update account.
*
- * @param path
* @param account
* @throws LimaException
*/
- public void updateAccount(TreePath path, Account account) throws LimaException {
+ public void updateAccount(Account account) throws LimaException {
// Calling account service
//FIXME Force fire for no update if error. Where is the cache ?
try{
accountService.updateAccount(account);
}
catch (LimaBusinessException eee) {
- modelSupport.fireTreeStructureChanged(path);
- throw eee;
+ //modelSupport.fireTreeStructureChanged(path);
+ throw new LimaBusinessException("Can't update account : "
+ + account.getAccountNumber(), eee);
}
- modelSupport.fireTreeStructureChanged(path);
+ //FIXME 2011.08.10 vsalaun quick tree refresh, it should only refresh the path where
+ //the account were, and the path where it has been moved
+ //modelSupport.fireTreeStructureChanged(path);
+ modelSupport.fireNewRoot();
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-08-09 12:38:19 UTC (rev 3256)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-08-10 11:38:02 UTC (rev 3257)
@@ -144,61 +144,61 @@
};
public void addSubLedger(){
- JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
- AccountTreeTableModel accountsTreeTableModel =
- (AccountTreeTableModel)accountsTreeTable.getTreeTableModel();
-
- Account newAccount = new AccountImpl();
- SubLedgerForm subledgerForm = new SubLedgerForm(view);
- subledgerForm.setAccount(newAccount);
- // jaxx constructor don't call super() ?
- subledgerForm.setLocationRelativeTo(view);
- subledgerForm.setVisible(true);
- newAccount=subledgerForm.getAccount();
-
- // null == cancel action
- if (newAccount != null) {
- Account parentAccount = new AccountImpl();
- String number = newAccount.getAccountNumber();
+
+ JXTreeTable accountsTreeTable = view.getAccountsTreeTable();
+ AccountTreeTableModel accountsTreeTableModel =
+ (AccountTreeTableModel)accountsTreeTable.getTreeTableModel();
+ Account newAccount = new AccountImpl();
+ SubLedgerForm subledgerForm = new SubLedgerForm(view);
+ subledgerForm.setAccount(newAccount);
+ // jaxx constructor don't call super() ?
+ subledgerForm.setLocationRelativeTo(view);
+ subledgerForm.setVisible(true);
+ newAccount=subledgerForm.getAccount();
+
+ // null == cancel action
+ if (newAccount != null) {
+ Account parentAccount = new AccountImpl();
+ String number = newAccount.getAccountNumber();
- //search for the nearest account from the one been created
- //e.g.: for 41019 search for 4, 41, 410, 4101
- //and stop when the account doesn't exist, use last account found instead
- for (int i = 1; i<=number.length(); i++) {
- try {
- //get the parent account from the new account subnumber
- parentAccount = accountService.getAccountByNumber(number.substring(0, i));
- } catch (LimaException eee) {
- log.debug("Can't search account : " + number.substring(0, i), eee);
- }
- if (parentAccount == null) {
- try {
- //if the account is null, get the previous account searched then stop the loop
- parentAccount = accountService.getAccountByNumber(number.substring(0, i-1));
- break;
- } catch (LimaException eee) {
- log.debug("Can't search account : " + number.substring(0, i-1), eee);
- }
- }
- }
+ //search for the nearest account from the one been created
+ //e.g.: for 41019 search for 4, 41, 410, 4101
+ //and stop when the account doesn't exist, use last account found instead
+ for (int i = 1; i<=number.length(); i++) {
+ try {
+ //get the parent account from the new account subnumber
+ parentAccount = accountService.getAccountByNumber(number.substring(0, i));
+ } catch (LimaException eee) {
+ log.debug("Can't search account : " + number.substring(0, i), eee);
+ }
+ if (parentAccount == null) {
+ try {
+ //if the account is null, get the previous account searched then stop the loop
+ parentAccount = accountService.getAccountByNumber(number.substring(0, i-1));
+ break;
+ } catch (LimaException eee) {
+ log.debug("Can't search account : " + number.substring(0, i-1), eee);
+ }
+ }
+ }
- // add it
- try {
- accountsTreeTableModel.addSubLedger(parentAccount, newAccount);
- } catch (LimaBusinessException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add subledger", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
+ // add it
+ try {
+ accountsTreeTableModel.addSubLedger(parentAccount, newAccount);
+ } catch (LimaBusinessException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add subledger", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
- catch (LimaException eee) {
- if (log.isErrorEnabled()) {
- log.error("Can't add subledger", eee);
- }
- DialogHelper.showMessageDialog(eee.getMessage());
- }
- }
+ catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add subledger", eee);
+ }
+ DialogHelper.showMessageDialog(eee.getMessage());
+ }
+ }
}
/**
@@ -223,7 +223,7 @@
treePath = new TreePath(accountsTreeTableModel.getRoot());
}
//test if selectedrow is account or ledger
- if (selectedObject.getGeneralLedger()==null){
+ if (selectedObject.getGeneralLedger()==null) {
AccountForm accountForm = new AccountForm(view);
accountForm.setAccount(selectedObject);
// jaxx constructor don't call super() ?
@@ -231,9 +231,9 @@
accountForm.setVisible(true);
// null == cancel action
selectedObject = accountForm.getAccount();
- }
+ }
// else is a subledger
- else{
+ else {
SubLedgerForm subLedgerForm = new SubLedgerForm(view);
subLedgerForm.setAccount(selectedObject);
// jaxx constructor don't call super() ?
@@ -243,11 +243,11 @@
selectedObject = subLedgerForm.getAccount();
}
//if action confirmed
- if (selectedObject != null){
+ if (selectedObject != null) {
// update it
try {
accountsTreeTableModel.
- updateAccount(treePath, selectedObject);
+ updateAccount(selectedObject);
} catch (LimaException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add update", eee);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2011-08-09 12:38:19 UTC (rev 3256)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/SubLedgerForm.jaxx 2011-08-10 11:38:02 UTC (rev 3257)
@@ -28,8 +28,6 @@
onWindowClosing="performCancel();">
<org.chorem.lima.entity.Account id="account" javaBean='null'/>
-
- <Boolean id="addState" javaBean='true'/>
<script>
<![CDATA[
@@ -47,7 +45,7 @@
<JLabel text="lima.common.code"/>
</cell>
<cell fill="horizontal">
- <JTextField id="numberTextField" editable='{isAddState()}'
+ <JTextField id="numberTextField"
text="{getAccount().getAccountNumber()}"/>
<javax.swing.text.Document javaBean="getNumberTextField().getDocument()"
onInsertUpdate='getAccount().setAccountNumber(getNumberTextField().getText())'
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2011-08-09 12:38:19 UTC (rev 3256)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2011-08-10 11:38:02 UTC (rev 3257)
@@ -70,6 +70,7 @@
lima.common.globalexception=Global lima exception
lima.common.info=Information
lima.common.label=Label
+lima.common.masteraccount=Master account
lima.common.movmentedfilter=Accounts filtered
lima.common.next=Next
lima.common.ok=OK
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2011-08-09 12:38:19 UTC (rev 3256)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2011-08-10 11:38:02 UTC (rev 3257)
@@ -70,6 +70,7 @@
lima.common.globalexception=Global lima exception
lima.common.info=Information
lima.common.label=Libellé
+lima.common.masteraccount=Compte parent
lima.common.movmentedfilter=Comptes mouvementés
lima.common.next=Suivant
lima.common.ok=OK
1
0
r3256 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/account
by vsalaun@users.chorem.org Aug. 9, 2011
by vsalaun@users.chorem.org Aug. 9, 2011
Aug. 9, 2011
Author: vsalaun
Date: 2011-08-09 14:38:19 +0200 (Tue, 09 Aug 2011)
New Revision: 3256
Url: http://chorem.org/repositories/revision/lima/3256
Log:
#426 stop using path to set account inception
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-08-09 10:35:40 UTC (rev 3255)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-08-09 12:38:19 UTC (rev 3256)
@@ -190,23 +190,6 @@
public boolean isLeaf(Object node) {
return getChildCount(node) == 0;
}
-
- /**
- * Add account (path can be null).
- *
- * @param path
- * @param account
- * @throws LimaException
- */
- public void addAccount(TreePath path, Account account) throws LimaException {
- // Calling account service
- Account parentAccount = (Account)path.getLastPathComponent();
- if (parentAccount == getRoot()) {
- parentAccount = null;
- }
- accountService.createAccount(parentAccount, account);
- modelSupport.fireTreeStructureChanged(path);
- }
/**
* Add account
@@ -217,25 +200,23 @@
*/
public void addAccount(Account parentAccount, Account account) throws LimaException{
accountService.createAccount(parentAccount, account);
- //FIXME 2011.08.09 vsalaun quick tree refresh, it should refresh only the path changed
+ //FIXME 2011.08.09 vsalaun quick tree refresh, it should refresh only the path changed
+ //modelSupport.fireTreeStructureChanged(path);
modelSupport.fireNewRoot();
}
/**
- * Add account (path can be null).
+ * Add account
*
- * @param path
+ * @param parentAccount
* @param account
* @throws LimaException
*/
- public void addSubLedger(TreePath path, Account account) throws LimaException {
- // Calling account service
- Account parentAccount = (Account)path.getLastPathComponent();
- if (parentAccount == getRoot()) {
- parentAccount = null;
- }
+ public void addSubLedger(Account parentAccount, Account account) throws LimaException {
accountService.createSubLedger(parentAccount, account);
- modelSupport.fireTreeStructureChanged(path);
+ //FIXME 2011.08.09 vsalaun quick tree refresh, it should refresh only the path changed
+ //modelSupport.fireTreeStructureChanged(path);
+ modelSupport.fireNewRoot();
}
/**
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2011-08-09 10:35:40 UTC (rev 3255)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountView.jaxx 2011-08-09 12:38:19 UTC (rev 3256)
@@ -55,8 +55,7 @@
<row>
<cell fill="horizontal">
<JButton id="addSubLedger" text="lima.charts.account.addSubLedger"
- onActionPerformed="getHandler().addSubLedger()"
- enabled="{isSelectedRow()}"/>
+ onActionPerformed="getHandler().addSubLedger()"/>
</cell>
</row>
<row>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-08-09 10:35:40 UTC (rev 3255)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-08-09 12:38:19 UTC (rev 3256)
@@ -99,42 +99,33 @@
newAccount = accountForm.getAccount();
Account parentAccount = new AccountImpl();
if (newAccount != null) {
- // get current selection path
- TreePath treePath = null;
- int selectedRow = view.getAccountsTreeTable().getSelectedRow();
- if (selectedRow != -1) {
- treePath = view.getAccountsTreeTable().getPathForRow(selectedRow);
- } else {
- //FIXME Get root created on model with Impl()
- //Can best not create root in model, and verify if root is null ?
- treePath = new TreePath(accountsTreeTableModel.getRoot());
-
- String number = newAccount.getAccountNumber();
+ //get the account number been created
+ String number = newAccount.getAccountNumber();
- for (int i = 1; i<=number.length(); i++) {
+ //search for the nearest account from the one been created
+ //e.g.: for 41019 search for 4, 41, 410, 4101
+ //and stop when the account doesn't exist, use last account found instead
+ for (int i = 1; i<number.length(); i++) {
+ try {
+ //get the parent account from the new account subnumber
+ parentAccount = accountService.getAccountByNumber(number.substring(0, i));
+ } catch (LimaException eee) {
+ log.debug("Can't search account : " + number.substring(0, i), eee);
+ }
+ if (parentAccount == null) {
try {
- parentAccount = accountService.getAccountByNumber(number.substring(0, i));
+ //if the account is null, get the previous account searched then stop the loop
+ parentAccount = accountService.getAccountByNumber(number.substring(0, i-1));
+ break;
} catch (LimaException eee) {
- log.debug("Can't search account : " + number.substring(0, i), eee);
+ log.debug("Can't search account : " + number.substring(0, i-1), eee);
}
- if (parentAccount == null) {
- try {
- parentAccount = accountService.getAccountByNumber(number.substring(0, i-1));
- break;
- } catch (LimaException eee) {
- log.debug("Can't search account : " + number.substring(0, i-1), eee);
- }
- }
}
}
// add it
try {
- if (selectedRow != -1) {
- accountsTreeTableModel.addAccount(treePath, newAccount);
- } else {
- accountsTreeTableModel.addAccount(parentAccount, newAccount);
- }
+ accountsTreeTableModel.addAccount(parentAccount, newAccount);
} catch (LimaBusinessException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add account", eee);
@@ -167,14 +158,33 @@
// null == cancel action
if (newAccount != null) {
- // get current selection path
- TreePath treePath = null;
- int selectedRow = view.getAccountsTreeTable().getSelectedRow();
- treePath = view.getAccountsTreeTable().getPathForRow(selectedRow);
+ Account parentAccount = new AccountImpl();
+ String number = newAccount.getAccountNumber();
+
+ //search for the nearest account from the one been created
+ //e.g.: for 41019 search for 4, 41, 410, 4101
+ //and stop when the account doesn't exist, use last account found instead
+ for (int i = 1; i<=number.length(); i++) {
+ try {
+ //get the parent account from the new account subnumber
+ parentAccount = accountService.getAccountByNumber(number.substring(0, i));
+ } catch (LimaException eee) {
+ log.debug("Can't search account : " + number.substring(0, i), eee);
+ }
+ if (parentAccount == null) {
+ try {
+ //if the account is null, get the previous account searched then stop the loop
+ parentAccount = accountService.getAccountByNumber(number.substring(0, i-1));
+ break;
+ } catch (LimaException eee) {
+ log.debug("Can't search account : " + number.substring(0, i-1), eee);
+ }
+ }
+ }
+
// add it
try {
- accountsTreeTableModel.
- addSubLedger(treePath, newAccount);
+ accountsTreeTableModel.addSubLedger(parentAccount, newAccount);
} catch (LimaBusinessException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add subledger", eee);
1
0
r3255 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/account
by vsalaun@users.chorem.org Aug. 9, 2011
by vsalaun@users.chorem.org Aug. 9, 2011
Aug. 9, 2011
Author: vsalaun
Date: 2011-08-09 12:35:40 +0200 (Tue, 09 Aug 2011)
New Revision: 3255
Url: http://chorem.org/repositories/revision/lima/3255
Log:
#426 add possibility to add an account without selecting a row
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-08-08 14:15:02 UTC (rev 3254)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountTreeTableModel.java 2011-08-09 10:35:40 UTC (rev 3255)
@@ -66,7 +66,7 @@
accountService =
LimaServiceFactory.getInstance().getService(
AccountServiceMonitorable.class);
- }
+ }
@Override
@@ -207,6 +207,19 @@
accountService.createAccount(parentAccount, account);
modelSupport.fireTreeStructureChanged(path);
}
+
+ /**
+ * Add account
+ *
+ * @param parentAccount
+ * @param account
+ * @throws LimaException
+ */
+ public void addAccount(Account parentAccount, Account account) throws LimaException{
+ accountService.createAccount(parentAccount, account);
+ //FIXME 2011.08.09 vsalaun quick tree refresh, it should refresh only the path changed
+ modelSupport.fireNewRoot();
+ }
/**
* Add account (path can be null).
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-08-08 14:15:02 UTC (rev 3254)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/account/AccountViewHandler.java 2011-08-09 10:35:40 UTC (rev 3255)
@@ -31,6 +31,7 @@
import javax.swing.tree.TreePath;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.business.AccountServiceMonitorable;
import org.chorem.lima.business.ImportServiceMonitorable;
import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
@@ -64,17 +65,21 @@
protected AccountView view;
- //protected AccountServiceMonitorable accountService;
+ protected AccountServiceMonitorable accountService;
protected AccountViewHandler(AccountView view) {
this.view = view;
// Gets factory service
LimaServiceFactory.getInstance().getService(
ImportServiceMonitorable.class).addListener(this);
+ accountService =
+ LimaServiceFactory.getInstance().getService(
+ AccountServiceMonitorable.class);
}
/**
* Add new account with account form.
+ * @throws LimaException
*/
public void addAccount() {
@@ -92,21 +97,44 @@
// null == cancel action
newAccount = accountForm.getAccount();
+ Account parentAccount = new AccountImpl();
if (newAccount != null) {
// get current selection path
TreePath treePath = null;
int selectedRow = view.getAccountsTreeTable().getSelectedRow();
- if ( selectedRow != -1) {
+ if (selectedRow != -1) {
treePath = view.getAccountsTreeTable().getPathForRow(selectedRow);
} else {
//FIXME Get root created on model with Impl()
//Can best not create root in model, and verify if root is null ?
treePath = new TreePath(accountsTreeTableModel.getRoot());
+
+ String number = newAccount.getAccountNumber();
+
+ for (int i = 1; i<=number.length(); i++) {
+ try {
+ parentAccount = accountService.getAccountByNumber(number.substring(0, i));
+ } catch (LimaException eee) {
+ log.debug("Can't search account : " + number.substring(0, i), eee);
+ }
+ if (parentAccount == null) {
+ try {
+ parentAccount = accountService.getAccountByNumber(number.substring(0, i-1));
+ break;
+ } catch (LimaException eee) {
+ log.debug("Can't search account : " + number.substring(0, i-1), eee);
+ }
+ }
+ }
}
// add it
try {
- accountsTreeTableModel.addAccount(treePath, newAccount);
+ if (selectedRow != -1) {
+ accountsTreeTableModel.addAccount(treePath, newAccount);
+ } else {
+ accountsTreeTableModel.addAccount(parentAccount, newAccount);
+ }
} catch (LimaBusinessException eee) {
if (log.isErrorEnabled()) {
log.error("Can't add account", eee);
1
0
r3254 - trunk/lima-business/src/test/java/org/chorem/lima/business
by vsalaun@users.chorem.org Aug. 8, 2011
by vsalaun@users.chorem.org Aug. 8, 2011
Aug. 8, 2011
Author: vsalaun
Date: 2011-08-08 16:15:02 +0200 (Mon, 08 Aug 2011)
New Revision: 3254
Url: http://chorem.org/repositories/revision/lima/3254
Log:
#424 update all EntryBooks tests
Modified:
trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2011-08-08 13:57:43 UTC (rev 3253)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2011-08-08 14:15:02 UTC (rev 3254)
@@ -92,24 +92,33 @@
@Test
public void searchJournalWithLabelTest() throws LimaException {
List<EntryBook> result = instance.getAllEntryByProperty(EntryBook.LABEL, "Journal des ventes");
- Assert.assertEquals("Journal des ventes", result.get(0).getLabel());
- /*result = instance.searchJournalWithLabel("Journal des achats");
- Assert.assertEquals("Journal des achats", result.getLabel());*/
+ if ((result != null) && (result.size() != 0)) {
+ Assert.assertEquals("Journal des ventes", result.get(0).getLabel());
+ }
+ result = instance.getAllEntryByProperty(EntryBook.LABEL, "Journal des achats");
+ if ((result != null) && (result.size() != 0)) {
+ Assert.assertEquals("Journal des achats", result.get(0).getLabel());
+ }
}
/**
* Permet de tester la modification d'un journal suivant son préfixe.
+ * @throws LimaException
*/
@Test
- public void modifyJournalTest() {
- /*Journal journal = instance.searchJournalWithLabel("Journal des ventes");
- Assert.assertEquals("Journal des ventes", journal.getLabel());
- String result = instance.modifyJournal(journal.getTopiaId(),
- "Journal des ventes", "new_prefix", "new_description");
+ public void modifyJournalTest() throws LimaException {
+ List<EntryBook> entryBooksList = instance.getAllEntryByProperty(EntryBook.LABEL, "Journal des ventes");
+ if (entryBooksList != null) {
+ Assert.assertEquals("Journal des ventes", entryBooksList.get(0).getLabel());
+ entryBooksList.get(0).setCode("New Code");
+ instance.updateEntryBook(entryBooksList.get(0));
+ }
+
// Recherche du journal dans la bdd
- JournalDTO journalDTO = instance
- .searchJournalDTOWithLabel("Journal des ventes");
- Assert.assertEquals("new_prefix", journalDTO.getPrefix());*/
+ entryBooksList = instance.getAllEntryByProperty(EntryBook.LABEL, "Journal des ventes");
+ if (entryBooksList != null) {
+ Assert.assertEquals("New Code", entryBooksList.get(0).getCode());
+ }
}
}
\ No newline at end of file
1
0
r3253 - in trunk/lima-business/src: main/java/org/chorem/lima/business/ejb main/java/org/chorem/lima/business/ejbinterface test/java/org/chorem/lima/business
by vsalaun@users.chorem.org Aug. 8, 2011
by vsalaun@users.chorem.org Aug. 8, 2011
Aug. 8, 2011
Author: vsalaun
Date: 2011-08-08 15:57:43 +0200 (Mon, 08 Aug 2011)
New Revision: 3253
Url: http://chorem.org/repositories/revision/lima/3253
Log:
#424 update all accounts tests
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookService.java
trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-08-08 10:06:23 UTC (rev 3252)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-08-08 13:57:43 UTC (rev 3253)
@@ -80,9 +80,7 @@
@Override
- public boolean createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException {
-
- boolean result = true;
+ public void createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException {
try {
// check if account number already exist
@@ -112,10 +110,8 @@
commitTransaction(topiaContext);
}
catch (TopiaException ex) {
- result = false;
doCatch(topiaContext, ex, log);
}
- return result;
}
@@ -129,10 +125,8 @@
* @throws LimaException
*/
@Override
- public boolean createAccount(Account masterAccount, Account account) throws LimaException {
+ public void createAccount(Account masterAccount, Account account) throws LimaException {
- boolean result = true;
-
//check rules before create the account
accountingRules.createAccountRules(masterAccount, account);
@@ -140,17 +134,15 @@
try {
transaction = beginTransaction();
- result = createAccountWithTransaction(masterAccount, account, transaction);
+ createAccountWithTransaction(masterAccount, account, transaction);
}
catch (TopiaException ex) {
- result = false;
doCatch(transaction, ex, log);
}
finally {
doFinally(transaction, log);
}
- return result;
}
@@ -443,6 +435,7 @@
public void updateAccount(Account account) throws LimaException {
TopiaContext transaction = null;
+
try {
transaction = beginTransaction();
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2011-08-08 10:06:23 UTC (rev 3252)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2011-08-08 13:57:43 UTC (rev 3253)
@@ -132,10 +132,9 @@
* @return
* @throws LimaException
*/
- public boolean createEntryBook(EntryBook entryBook) throws LimaException {
+ public void createEntryBook(EntryBook entryBook) throws LimaException {
TopiaContext transaction = null;
- boolean result = true;
try {
transaction = beginTransaction();
@@ -143,13 +142,11 @@
createEntryBookWithTransaction(entryBook, transaction);
}
catch (TopiaException ex) {
- result = false;
doCatch(transaction, ex, log);
}
finally {
doFinally(transaction, log);
}
- return result;
}
/**
@@ -209,9 +206,8 @@
* @throws LimaException
*
*/
- public boolean updateEntryBook(EntryBook entryBook) throws LimaException {
+ public void updateEntryBook(EntryBook entryBook) throws LimaException {
TopiaContext transaction = null;
- boolean result = true;
try {
transaction = beginTransaction();
@@ -225,13 +221,11 @@
commitTransaction(transaction);
}
catch (TopiaException ex) {
- result = false;
doCatch(transaction, ex, log);
}
finally {
doFinally(transaction, log);
}
- return result;
}
/**
@@ -243,10 +237,9 @@
* @param prefix préfixe du EntryBook à supprimer
* @throws LimaException
*/
- public boolean removeEntryBook(EntryBook entryBook) throws LimaException {
+ public void removeEntryBook(EntryBook entryBook) throws LimaException {
TopiaContext topiaTransaction = null;
- boolean result = true;
try {
topiaTransaction = beginTransaction();
@@ -262,13 +255,11 @@
commitTransaction(topiaTransaction);
}
catch (TopiaException ex) {
- result = false;
doCatch(topiaTransaction, ex, log);
}
finally {
doFinally(topiaTransaction, log);
}
- return result;
}
protected TopiaContext beginTransaction() throws TopiaException {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookService.java 2011-08-08 10:06:23 UTC (rev 3252)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/EntryBookService.java 2011-08-08 13:57:43 UTC (rev 3253)
@@ -45,6 +45,8 @@
List<EntryBook> getAllEntryBooks() throws LimaException;
+ List<EntryBook> getAllEntryByProperty(String propertyName, String value) throws LimaException;
+
void createEntryBook(EntryBook entryBook) throws LimaException;
void updateEntryBook(EntryBook entryBook) throws LimaException;
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2011-08-08 10:06:23 UTC (rev 3252)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2011-08-08 13:57:43 UTC (rev 3253)
@@ -91,38 +91,34 @@
*/
@Test
public void createAccountDAOTest() throws LimaException {
- Boolean result;
- // Création des comptes DTO
+ // Création des comptes
Account account = new AccountImpl();
account.setAccountNumber("5");
account.setLabel("COMPTES FINANCIERS");
- result = instance.createAccount(null, account);
-
+ instance.createAccount(null, account);
Account accountChild1 = new AccountImpl();
accountChild1.setAccountNumber("50");
accountChild1.setLabel("Valeurs mobilières de placement");
//accountChild1.setMasterAccount(account);
- result = instance.createAccount(account, accountChild1);
+ instance.createAccount(account, accountChild1);
Account accountChild2 = new AccountImpl();
accountChild2.setAccountNumber("51");
accountChild2.setLabel("Banques établissements financiers et assimilés");
//accountChild2.setMasterAccount(account);
- result = instance.createAccount(account, accountChild2);
+ instance.createAccount(account, accountChild2);
Account accountChildChild1 = new AccountImpl();
accountChildChild1.setAccountNumber("511");
accountChildChild1.setLabel("Valeurs à l'encaissement");
//accountChildChild1.setMasterAccount(accountChild2);
- result = instance.createAccount(accountChild2, accountChildChild1);
+ instance.createAccount(accountChild2, accountChildChild1);
Account accountChildChild2 = new AccountImpl();
accountChildChild2.setAccountNumber("512");
accountChildChild2.setLabel("Banques");
//accountChildChild2.setMasterAccount(accountChild2);
- result = instance.createAccount(accountChild2, accountChildChild2);
-
- Assert.assertEquals(true,result);
+ instance.createAccount(accountChild2, accountChildChild2);
}
@@ -165,32 +161,47 @@
/**
- * Permet de tester si un compte est bien effacé. Si celui-ci n'existe pas
- * un message d'avertissement doit apparaître.
- * On supprime un compte avec seulement son numéro de compte (supposé/vérifié
- * unique lors de la création).
+ * Permet de tester si un compte est bien effacé.
+ * @throws LimaException
*/
@Test
- public void removeAccountTest() {
- boolean result;
+ public void removeAccountTest() throws LimaException {
+ Account masterAccount = instance.getAccountByNumber("4");
// Création de comptes
- /*instance.createAccount("40", "Fournisseurs", "4","actif");
- instance.createAccount("41", "Usagers", "4","actif");
- instance.createAccount("44", "Etat", "4","actif");
+ Account account = new AccountImpl();
+ account.setAccountNumber("40");
+ account.setLabel("Fournisseurs");
+ instance.createAccount(masterAccount, account);
+
+ Account account2 = new AccountImpl();
+ account2.setAccountNumber("41");
+ account2.setLabel("Usagers");
+ instance.createAccount(masterAccount, account2);
+
+ Account account3 = new AccountImpl();
+ account3.setAccountNumber("44");
+ account3.setLabel("Etat");
+ instance.createAccount(masterAccount, account3);
// On souhaite supprimer le compte 41. Ce compte existe bien. Il ne possède
// pas de fils. La suppression se déroule bien.
- result = instance.removeAccount("41");
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS,result);
+ instance.removeAccount(account2);
+
// On recherche les fils du compte 4
- List<Account> listAccount = instance.searchListChildAccount("4");
+ List<Account> listAccount = instance.getChildrenAccounts(masterAccount);
// Il ne doit en possèder que 2 (au lieu de 3)
Assert.assertEquals(2,listAccount.size());
-
+ }
+
+
+ @Test(expected=LimaException.class)
+ public void removeUnexistedAccountTest() throws LimaException {
// On souhaite supprimer le compte 422, ce dernier n'existe pas. La
// suppression ne peut s'effectuer.
- result = instance.removeAccount("422");
- Assert.assertEquals(ServiceHelper.ACCOUNT_NOT_EXIST,result);*/
+ Account account4 = new AccountImpl();
+ account4.setAccountNumber("422");
+ account4.setLabel("Unsaved account");
+ instance.removeAccount(account4);
}
@@ -203,36 +214,46 @@
* 50 et 51, dont 51 a à son tour les comptes enfants 511 et 512.
* Nous ajoutons un compte supplémentaire 53 à 5. Nous modifions une valeur
* sur le compte 5, et supprimons le compte 51 (et ses enfants).
+ * @throws LimaException
*/
@Test
- public void updateTest() {
- /*String result;
+ public void updateTest() throws LimaException {
// On recherche le compte 5 - COMPTES FINANCIERS
- AccountDTO accountDTO = instance.searchAccountDTO("5");
+ Account account = instance.getAccountByNumber("5");
+
// {ETAPE 1} Modification du nom pour le compte 5
- accountDTO.setLabel("COMPTES FINANCIERS modifié");
+ account.setLabel("COMPTES FINANCIERS modifié");
+
// {ETAPE 2} Ajout du compte 53
- AccountDTO accountChildDTO = new AccountDTO("","53","Caisse","5",null,"actif");
- accountDTO.addAccountChild(accountChildDTO);
+ Account accountChild = new AccountImpl();
+ accountChild.setAccountNumber("53");
+ accountChild.setLabel("Caisse");
+ accountChild.setMasterAccount(account);
+
+ instance.createAccount(account, accountChild);
+
+ account.addSubAccounts(accountChild);
+
// {ETAPE 3} Supprime le compte 51 (ainsi que ses enfants 511 et 512)
- AccountDTO accountremoveDTO = instance.searchAccountDTO("51");
- accountDTO.removeAccountChild(accountremoveDTO);
+ Account accountRemove = instance.getAccountByNumber("51");
+
+ account.removeSubAccounts(accountRemove);
+
// Met à jour le compte 5 DTO dans la bdd ainsi que toutes les {ETAPE *}
- result = instance.updateDTO(accountDTO);
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS,result);
+ instance.updateAccount(account);
// Vérification ETAPE
// ETAPE 1
- Account account = instance.searchAccount("5");
+ account = instance.getAccountByNumber("5");
Assert.assertEquals("COMPTES FINANCIERS modifié",account.getLabel());
// ETAPE 2
- account = instance.searchAccount("53");
+ account = instance.getAccountByNumber("53");
Assert.assertEquals("Caisse",account.getLabel());
// ETAPE 3
- account = instance.searchAccount("5"); // les comptes fils de 5
- List<Account> listAccount = instance.searchListChildAccount(account);
- // Il doit avoir 50 et 53
- Assert.assertEquals(2,listAccount.size());*/
+ account = instance.getAccountByNumber("5"); // les comptes fils de 5
+ List<Account> listAccount = instance.getChildrenAccounts(account);
+ // Il doit avoir 50, 51 (de la méthode searchListAccountTest) et 53
+ Assert.assertEquals(3,listAccount.size());
}
}
\ No newline at end of file
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2011-08-08 10:06:23 UTC (rev 3252)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2011-08-08 13:57:43 UTC (rev 3253)
@@ -82,8 +82,7 @@
EntryBook entryBook = new EntryBookImpl();
entryBook.setLabel("Journal des ventes");
entryBook.setCode("jdv");
- boolean result = instance.createEntryBook(entryBook);
- Assert.assertTrue(result);
+ instance.createEntryBook(entryBook);
}
/**
1
0
r3252 - in trunk/lima-business/src: main/java/org/chorem/lima/business/ejb test/java/org/chorem/lima/business
by vsalaun@users.chorem.org Aug. 8, 2011
by vsalaun@users.chorem.org Aug. 8, 2011
Aug. 8, 2011
Author: vsalaun
Date: 2011-08-08 12:06:23 +0200 (Mon, 08 Aug 2011)
New Revision: 3252
Url: http://chorem.org/repositories/revision/lima/3252
Log:
#424 update accounts tests + change return type for AccountServiceImpl and EntryBookServiceImpl
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-08-08 09:12:40 UTC (rev 3251)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/AccountServiceImpl.java 2011-08-08 10:06:23 UTC (rev 3252)
@@ -80,8 +80,10 @@
@Override
- public void createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException {
+ public boolean createAccountWithTransaction(Account masterAccount, Account account, TopiaContext topiaContext) throws LimaException {
+ boolean result = true;
+
try {
// check if account number already exist
AccountDAO accountDAO =
@@ -110,8 +112,10 @@
commitTransaction(topiaContext);
}
catch (TopiaException ex) {
+ result = false;
doCatch(topiaContext, ex, log);
- }
+ }
+ return result;
}
@@ -125,8 +129,10 @@
* @throws LimaException
*/
@Override
- public void createAccount(Account masterAccount, Account account) throws LimaException {
+ public boolean createAccount(Account masterAccount, Account account) throws LimaException {
+ boolean result = true;
+
//check rules before create the account
accountingRules.createAccountRules(masterAccount, account);
@@ -134,15 +140,17 @@
try {
transaction = beginTransaction();
- createAccountWithTransaction(masterAccount, account, transaction);
+ result = createAccountWithTransaction(masterAccount, account, transaction);
}
catch (TopiaException ex) {
+ result = false;
doCatch(transaction, ex, log);
}
finally {
doFinally(transaction, log);
}
+ return result;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2011-08-08 09:12:40 UTC (rev 3251)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/EntryBookServiceImpl.java 2011-08-08 10:06:23 UTC (rev 3252)
@@ -129,22 +129,27 @@
* Création d'un EntryBook. Il peut être unique sur son label (au choix).
*
* @param EntryBook EntryBook
+ * @return
* @throws LimaException
*/
- public void createEntryBook(EntryBook entryBook) throws LimaException {
+ public boolean createEntryBook(EntryBook entryBook) throws LimaException {
TopiaContext transaction = null;
+ boolean result = true;
+
try {
transaction = beginTransaction();
- createEntryBookWithTransaction(entryBook, transaction);
+ createEntryBookWithTransaction(entryBook, transaction);
}
catch (TopiaException ex) {
+ result = false;
doCatch(transaction, ex, log);
}
finally {
doFinally(transaction, log);
}
+ return result;
}
/**
@@ -172,15 +177,42 @@
return entryBooksList;
}
+
+ @Override
+ public List<EntryBook> getAllEntryByProperty(String propertyName, String value) throws LimaException {
+ List<EntryBook> entryBookList = null;
+
+ TopiaContext transaction = null;
+
+ try {
+ transaction = beginTransaction();
+
+ EntryBookDAO entryBookDAO =
+ LimaCallaoDAOHelper.getEntryBookDAO(transaction);
+ entryBookList = entryBookDAO.findAllByProperty(propertyName, value);
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+
+ return entryBookList;
+ }
+
/**
* Permet de modifier un journal.
*
* @param entryBook journal
- * @throws LimaException
+ * @throws LimaException
+ *
*/
- public void updateEntryBook(EntryBook entryBook) throws LimaException {
+ public boolean updateEntryBook(EntryBook entryBook) throws LimaException {
TopiaContext transaction = null;
+ boolean result = true;
+
try {
transaction = beginTransaction();
@@ -193,11 +225,13 @@
commitTransaction(transaction);
}
catch (TopiaException ex) {
+ result = false;
doCatch(transaction, ex, log);
}
finally {
doFinally(transaction, log);
}
+ return result;
}
/**
@@ -209,9 +243,11 @@
* @param prefix préfixe du EntryBook à supprimer
* @throws LimaException
*/
- public void removeEntryBook(EntryBook entryBook) throws LimaException {
+ public boolean removeEntryBook(EntryBook entryBook) throws LimaException {
TopiaContext topiaTransaction = null;
+ boolean result = true;
+
try {
topiaTransaction = beginTransaction();
@@ -226,11 +262,13 @@
commitTransaction(topiaTransaction);
}
catch (TopiaException ex) {
+ result = false;
doCatch(topiaTransaction, ex, log);
}
finally {
doFinally(topiaTransaction, log);
}
+ return result;
}
protected TopiaContext beginTransaction() throws TopiaException {
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2011-08-08 09:12:40 UTC (rev 3251)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2011-08-08 10:06:23 UTC (rev 3252)
@@ -25,10 +25,13 @@
package org.chorem.lima.business;
+import java.util.List;
+
import org.chorem.lima.business.ejb.AccountServiceImpl;
import org.chorem.lima.business.ejbinterface.AccountService;
import org.chorem.lima.entity.Account;
import org.chorem.lima.entity.AccountImpl;
+import org.junit.Assert;
import org.junit.Test;
/**
@@ -53,6 +56,7 @@
public void createAccountTest() throws LimaException {
Account myAccount = new AccountImpl();
myAccount.setAccountNumber("4");
+ myAccount.setLabel("Comptes de tiers");
instance.createAccount(null, myAccount);
}
@@ -83,10 +87,11 @@
* 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
*/
@Test
- public void createAccountDAOTest() {
- /*String result;
+ public void createAccountDAOTest() throws LimaException {
+ Boolean result;
// Création des comptes DTO
Account account = new AccountImpl();
account.setAccountNumber("5");
@@ -112,72 +117,50 @@
result = instance.createAccount(accountChild2, accountChildChild1);
Account accountChildChild2 = new AccountImpl();
- accountChildChild2.setAccountNumber("51");
+ accountChildChild2.setAccountNumber("512");
accountChildChild2.setLabel("Banques");
//accountChildChild2.setMasterAccount(accountChild2);
result = instance.createAccount(accountChild2, accountChildChild2);
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS,result);*/
+ Assert.assertEquals(true,result);
}
/**
* Recherche d'un compte dans le plan comptable à partir d'un numéro de
* compte.
+ * @throws LimaException
*/
@Test
- public void searchAccountTest() {
- /*// On recherche le compte 4 - Comptes de tiers
- Account result = instance.searchAccount("4");
- Assert.assertEquals("Comptes de tiers",result.getLabel());*/
+ public void searchAccountTest() throws LimaException {
+ // On recherche le compte 4 - Comptes de tiers
+ Account result = instance.getAccountByNumber("4");
+ Assert.assertEquals("Comptes de tiers",result.getLabel());
}
/**
- * Recherche d'un compte dans le plan comptable à partir d'un numéro de
- * compte. Il renvoie un objet DTO compte
- */
- @Test
- public void searchAccountDTOTest() {
- /*// On recherche le compte 4 - Comptes de tiers
- AccountDTO result = instance.searchAccountDTO("4");
- Assert.assertEquals("Comptes de tiers",result.getLabel());*/
- }
-
-
- /**
* Permet de tester le nombre d'enfants renvoyés appartenant à un père.
+ * @throws LimaException
*/
@Test
- public void searchListAccountTest() {
- /*// On recherche le compte 5 - COMPTES FINANCIERS
- Account account = instance.searchAccount("5");
- List<Account> listAccount = instance.searchListChildAccount(account);
+ public void searchListAccountTest() throws LimaException {
+ // On recherche le compte 5 - COMPTES FINANCIERS
+ Account account = instance.getAccountByNumber("5");
+ List<Account> listAccount = instance.getChildrenAccounts(account);
// Il possède les comptes 50 et 51
- Assert.assertEquals(2,listAccount.size());*/
+ Assert.assertEquals(2,listAccount.size());
}
/**
- * Permet de tester le nombre d'enfants renvoyés appartenant à un père.
- */
- @Test
- public void searchListAccountDTOTest() {
- /*// On recherche le compte 5 - COMPTES FINANCIERS
- AccountDTO accountDTO = instance.searchAccountDTO("5");
- // Il possède les comptes 50 et 51
- Assert.assertEquals(2,accountDTO.getAccountChildDTO().size());*/
- }
-
-
- /**
* Permet de tester la méthode recherchant tous les comptes au format DTO.
+ * @throws LimaException
*/
@Test
- public void getAllAccountTest() {
- /*List<AccountDTO> listAccountDTO = instance.getAllAccount();
- // doit être égal à 2 (compte 4 et 5)
- Assert.assertEquals(2,listAccountDTO.size());*/
+ public void getAllAccountTest() throws LimaException {
+ List<Account> listAccount = instance.getAllAccounts();
+ Assert.assertEquals(9,listAccount.size());
}
@@ -189,9 +172,9 @@
*/
@Test
public void removeAccountTest() {
- /*String result;
+ boolean result;
// Création de comptes
- instance.createAccount("40", "Fournisseurs", "4","actif");
+ /*instance.createAccount("40", "Fournisseurs", "4","actif");
instance.createAccount("41", "Usagers", "4","actif");
instance.createAccount("44", "Etat", "4","actif");
1
0
r3251 - trunk/lima-business/src/test/java/org/chorem/lima/business
by vsalaun@users.chorem.org Aug. 8, 2011
by vsalaun@users.chorem.org Aug. 8, 2011
Aug. 8, 2011
Author: vsalaun
Date: 2011-08-08 11:12:40 +0200 (Mon, 08 Aug 2011)
New Revision: 3251
Url: http://chorem.org/repositories/revision/lima/3251
Log:
#424 starts adding some tests
Modified:
trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
trunk/lima-business/src/test/java/org/chorem/lima/business/GeneratorTest.java
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2011-08-05 12:09:49 UTC (rev 3250)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/AccountServiceImplTest.java 2011-08-08 09:12:40 UTC (rev 3251)
@@ -52,7 +52,7 @@
@Test
public void createAccountTest() throws LimaException {
Account myAccount = new AccountImpl();
- myAccount.setAccountNumber("2");
+ myAccount.setAccountNumber("4");
instance.createAccount(null, myAccount);
}
@@ -85,23 +85,38 @@
* enfants.
*/
@Test
- public void createAccountDTOTest() {
+ public void createAccountDAOTest() {
/*String result;
// Création des comptes DTO
- AccountDTO accountDTO = new AccountDTO("","5","COMPTES FINANCIERS","0",null,"actif");
- AccountDTO accountChildDTO = new AccountDTO("","50","Valeurs mobilières de placement","5",null,"actif");
- accountDTO.addAccountChild(accountChildDTO);
- accountChildDTO = new AccountDTO("","51","Banques établissements financiers et assimilés","5",null,"actif");
- accountDTO.addAccountChild(accountChildDTO);
- AccountDTO accountChilChilddDTO = new AccountDTO("","511","Valeurs à l'encaissement","51",null,"actif");
- accountChildDTO.addAccountChild(accountChilChilddDTO);
- accountChilChilddDTO = new AccountDTO("","512","Banques","51",null,"actif");
- accountChildDTO.addAccountChild(accountChilChilddDTO);
- // Pour afficher les comptes enfants
- //accountDTO.toStringAccountChild();
-
- // Création dans la base de données. Les comptes 5, 50, 51, 511 et 512 sont créés.
- result = instance.createAccount(accountDTO);
+ Account account = new AccountImpl();
+ account.setAccountNumber("5");
+ account.setLabel("COMPTES FINANCIERS");
+ result = instance.createAccount(null, account);
+
+ Account accountChild1 = new AccountImpl();
+ accountChild1.setAccountNumber("50");
+ accountChild1.setLabel("Valeurs mobilières de placement");
+ //accountChild1.setMasterAccount(account);
+ result = instance.createAccount(account, accountChild1);
+
+ Account accountChild2 = new AccountImpl();
+ accountChild2.setAccountNumber("51");
+ accountChild2.setLabel("Banques établissements financiers et assimilés");
+ //accountChild2.setMasterAccount(account);
+ result = instance.createAccount(account, accountChild2);
+
+ Account accountChildChild1 = new AccountImpl();
+ accountChildChild1.setAccountNumber("511");
+ accountChildChild1.setLabel("Valeurs à l'encaissement");
+ //accountChildChild1.setMasterAccount(accountChild2);
+ result = instance.createAccount(accountChild2, accountChildChild1);
+
+ Account accountChildChild2 = new AccountImpl();
+ accountChildChild2.setAccountNumber("51");
+ accountChildChild2.setLabel("Banques");
+ //accountChildChild2.setMasterAccount(accountChild2);
+ result = instance.createAccount(accountChild2, accountChildChild2);
+
Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS,result);*/
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2011-08-05 12:09:49 UTC (rev 3250)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/EntryBookServiceImplTest.java 2011-08-08 09:12:40 UTC (rev 3251)
@@ -25,12 +25,16 @@
package org.chorem.lima.business;
+import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.ejb.EntryBookServiceImpl;
+import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.EntryBookImpl;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -54,16 +58,16 @@
*/
@AfterClass
public static void tearDownClass() throws Exception {
- /*List<JournalDTO> list = instance.getAllJournal();
+ List<EntryBook> list = instance.getAllEntryBooks();
// On supprime chaque journal
- for (JournalDTO journalDTO : list) {
- instance.removeJournal(journalDTO);
- }*/
+ for (EntryBook entryBook : list) {
+ instance.removeEntryBook(entryBook);
+ }
}
@Before
public void setUp() {
- //instance = new EntryBookServiceImpl();
+ instance = new EntryBookServiceImpl();
}
public EntryBookServiceImplTest() {
@@ -71,22 +75,26 @@
/**
* Permet de tester l'ajout d'un journal dans la base de données.
+ * @throws LimaException
*/
@Test
- public void createJournalTest() {
- /*String result = instance.createJournal("Journal des ventes", "jdv",
- "description");
- Assert.assertEquals(ServiceHelper.RESPOND_SUCCESS, result);*/
+ public void createJournalTest() throws LimaException {
+ EntryBook entryBook = new EntryBookImpl();
+ entryBook.setLabel("Journal des ventes");
+ entryBook.setCode("jdv");
+ boolean result = instance.createEntryBook(entryBook);
+ Assert.assertTrue(result);
}
/**
* Permet de tester la recherche d'un journal suivant son préfixe.
+ * @throws LimaException
*/
@Test
- public void searchJournalWithLabelTest() {
- /*Journal result = instance.searchJournalWithLabel("Journal des ventes");
- Assert.assertEquals("Journal des ventes", result.getLabel());
- result = instance.searchJournalWithLabel("Journal des achats");
+ public void searchJournalWithLabelTest() throws LimaException {
+ List<EntryBook> result = instance.getAllEntryByProperty(EntryBook.LABEL, "Journal des ventes");
+ Assert.assertEquals("Journal des ventes", result.get(0).getLabel());
+ /*result = instance.searchJournalWithLabel("Journal des achats");
Assert.assertEquals("Journal des achats", result.getLabel());*/
}
Modified: trunk/lima-business/src/test/java/org/chorem/lima/business/GeneratorTest.java
===================================================================
--- trunk/lima-business/src/test/java/org/chorem/lima/business/GeneratorTest.java 2011-08-05 12:09:49 UTC (rev 3250)
+++ trunk/lima-business/src/test/java/org/chorem/lima/business/GeneratorTest.java 2011-08-08 09:12:40 UTC (rev 3251)
@@ -32,8 +32,11 @@
import org.chorem.lima.business.ejb.FinancialPeriodServiceImpl;
import org.chorem.lima.business.ejb.FinancialTransactionServiceImpl;
import org.chorem.lima.business.ejb.FiscalPeriodServiceImpl;
+import org.chorem.lima.entity.Account;
+import org.chorem.lima.entity.AccountImpl;
+import org.chorem.lima.entity.EntryBook;
+import org.chorem.lima.entity.EntryBookImpl;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
/**
@@ -46,48 +49,72 @@
private static final Log log = LogFactory.getLog(FinancialTransactionServiceImpl.class);
private static FinancialTransactionServiceImpl instanceTransaction;
- private static FiscalPeriodServiceImpl instancePeriod;
- private static FinancialPeriodServiceImpl instanceTimespan;
+ private static FiscalPeriodServiceImpl instanceFiscalPeriod;
+ private static FinancialPeriodServiceImpl instanceFinancialPeriod;
private static EntryBookServiceImpl instanceJournal;
private static AccountServiceImpl instanceAccount;
private static String topiaIDTransaction;
@Before
public void setUp() {
- /* instanceTransaction = new FinancialTransactionServiceImpl();
- instancePeriod = new FiscalPeriodServiceImpl();
- instanceTimespan = new FinancialPeriodServiceImpl();
+ instanceTransaction = new FinancialTransactionServiceImpl();
+ instanceFiscalPeriod = new FiscalPeriodServiceImpl();
+ instanceFinancialPeriod = new FinancialPeriodServiceImpl();
instanceJournal = new EntryBookServiceImpl();
- instanceAccount = new AccountServiceImpl();*/
+ instanceAccount = new AccountServiceImpl();
}
/**
* Permet de tester l'ajout d'un timspan
+ * @throws LimaException
*/
@Test
- public void generate ()
+ public void generate () throws LimaException
{
- /*
+
// Création Journal
- instanceJournal.createJournal("Journal des ventes", "jv","description");
- instanceJournal.createJournal("Journal des achats", "ja","description");
- instanceJournal.createJournal("Journal de trésorerie", "jt","description");
- instanceJournal.createJournal("Journal des opérations diverses", "OD","description");
- instanceJournal.createJournal("Journal de banque 1", "jb1","description");
- instanceJournal.createJournal("Journal de banque 2", "jb2","description");
+ EntryBook entryBook1 = new EntryBookImpl();
+ entryBook1.setLabel("Journal des ventes");
+ entryBook1.setCode("jv");
+ instanceJournal.createEntryBook(entryBook1);
+ EntryBook entryBook2 = new EntryBookImpl();
+ entryBook2.setLabel("Journal des achats");
+ entryBook2.setCode("ja");
+ instanceJournal.createEntryBook(entryBook2);
+ EntryBook entryBook3 = new EntryBookImpl();
+ entryBook3.setLabel("Journal de trésorerie");
+ entryBook3.setCode("jt");
+ instanceJournal.createEntryBook(entryBook3);
+ EntryBook entryBook4 = new EntryBookImpl();
+ entryBook4.setLabel("Journal des opérations diverses");
+ entryBook4.setCode("od");
+ instanceJournal.createEntryBook(entryBook4);
+ EntryBook entryBook5 = new EntryBookImpl();
+ entryBook5.setLabel("Journal de banque");
+ entryBook5.setCode("jb");
+ /*instanceJournal.createJournal("Journal de banque 2", "jb2","description");
instanceJournal.createJournal("Journal de banque 3", "jb3","description");
instanceJournal.createJournal("Journal de banque 4", "jb4","description");
instanceJournal.createJournal("Journal de banque 5", "jb5","description");
instanceJournal.createJournal("Journal de banque 6", "jb6","description");
instanceJournal.createJournal("Journal de banque 7", "jb7","description");
- instanceJournal.createJournal("Journal de banque 8", "jb8","description");
+ instanceJournal.createJournal("Journal de banque 8", "jb8","description");*/
// Création account
- instanceAccount.createAccount(1, "COMPTES DE CAPITAUX", null);
- instanceAccount.createAccount(2, "COMPTES D'IMMOBILISATIONS", null);
- instanceAccount.createAccount(3, "COMPTES DE STOCKS ET EN-COURS ", null);
- instanceAccount.createAccount(4, "COMPTES DE TIERS ", null);
+ Account account1 = new AccountImpl();
+ account1.setAccountNumber("1");
+ account1.setLabel("COMPTES DE CAPITAUX");
+ instanceAccount.createAccount(null, account1);
+ Account account2 = new AccountImpl();
+ account2.setAccountNumber("2");
+ account2.setLabel("COMPTES D'IMMOBILISATIONS");
+ instanceAccount.createAccount(null, account2);
+ Account account3 = new AccountImpl();
+ account3.setAccountNumber("3");
+ account3.setLabel("COMPTES DE STOCKS ET EN-COURS");
+ instanceAccount.createAccount(null, account3);
+ /*instanceAccount.createAccount(4, "COMPTES DE TIERS ", null);
instanceAccount.createAccount(5, "COMPTES FINANCIERS", null);
instanceAccount.createAccount(6, "COMPTES DE CHARGES", null);
instanceAccount.createAccount(7, "COMPTES DE PRODUITS", null);
@@ -108,28 +135,25 @@
instanceAccount.createAccount(20, "Immobilisations incorporelles", 2);
instanceAccount.createAccount(201, "Frais d'établissement", 20);
instanceAccount.createAccount(207, "Fonds commercial", 20);
- instanceAccount.createAccount(21, "Immobilisations corporelles", 2);
+ instanceAccount.createAccount(21, "Immobilisations corporelles", 2);*/
-
-
-
- Date beginTimeSpan;
- Date endTimeSpan;
+ /*Date beginDate;
+ Date endDate;
Date dateSearch;
- for (int annee = 109 ; annee < 115 ; annee++)
- {
- beginTimeSpan = new Date(annee,0,1);
- endTimeSpan = new Date(annee,11,31);
- instancePeriod.createPeriod(beginTimeSpan, endTimeSpan, false);
+ for (int annee = 109 ; annee < 115 ; annee++) {
+ beginDate = new Date(annee,0,1);
+ endDate = new Date(annee,11,31);
+ FiscalPeriod fiscalPeriod = new FiscalPeriodImpl();
+ fiscalPeriod.setBeginDate(beginDate);
+ fiscalPeriod.setEndDate(endDate);
+ instanceFiscalPeriod.createFiscalPeriod(fiscalPeriod);
- for (int mois = 0 ; mois<11 ; mois++)
- {
+ for (int mois = 0 ; mois<11 ; mois++) {
dateSearch = new Date(annee,mois,1);
- TimeSpan timespan = instanceTimespan.searchTimeSpanByDate(dateSearch);
+ TimeSpan timespan = instanceFiscalPeriod.searchTimeSpanByDate(dateSearch);
- for (int j=0 ; j<50 ; j++)
- {
+ for (int j=0 ; j<50 ; j++) {
Journal journal = instanceJournal.searchJournalWithLabel("Journal des ventes");
topiaIDTransaction = instanceTransaction.createTransaction(dateSearch, "Facture 6", "description transaction", timespan, journal);
@@ -145,8 +169,7 @@
Period period = instancePeriod.searchPeriodWithDate(beginTimeSpan);
instancePeriod.blockAllTimeSpanOfPeriod(period);
instancePeriod.blockPeriod(period);
- }
- */
+ }*/
}
1
0
r3250 - in trunk: lima-business/src/main/java/org/chorem/lima/business lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/resources/i18n lima-swing/src/main/java/org/chorem/lima/ui/importexport lima-swing/src/main/java/org/chorem/lima/ui/vatreports lima-swing/src/main/resources/i18n
by vsalaun@users.chorem.org Aug. 5, 2011
by vsalaun@users.chorem.org Aug. 5, 2011
Aug. 5, 2011
Author: vsalaun
Date: 2011-08-05 14:09:49 +0200 (Fri, 05 Aug 2011)
New Revision: 3250
Url: http://chorem.org/repositories/revision/lima/3250
Log:
#347 add i18n text + option setting for vat pdf path
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java
trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties
trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/LimaConfig.java 2011-08-05 12:09:49 UTC (rev 3250)
@@ -129,6 +129,16 @@
setOption(Option.SCALE.key, locale);
saveForUser();
}
+
+ public String getVatPDFUrl() {
+ String vatPDFUrl = getOption(Option.VAT_PDF_URL.getKey());
+ return vatPDFUrl;
+ }
+
+ public void setVatPDFUrl(String url) {
+ setOption(Option.VAT_PDF_URL.key, url);
+ saveForUser();
+ }
/**
* Load configuration with custom file name.
@@ -161,7 +171,8 @@
REPORTS_DIR("lima.report.dir", _("lima.config.reportsdir"), "", String.class, false, false),
HTTP_PORT("lima.httpport", _("lima.config.httpport"), "5462", String.class, false, false),
SERVER_ADRESS("lima.serveraddress", _("lima.config.serveraddress"), "", String.class, false, false),
- SCALE("lima.scale", _("lima.config.scale"), "2", String.class, false, false);
+ SCALE("lima.scale", _("lima.config.scale"), "2", String.class, false, false),
+ VAT_PDF_URL("lima.report.vatpdfurl", _("lima.config.reportvatpdfurl"), "default", String.class, false, false);
private final String key;
private final String description;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-08-05 12:09:49 UTC (rev 3250)
@@ -29,6 +29,7 @@
import java.awt.Color;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -155,7 +156,7 @@
log.error("Can't init topia context", ex);
}
}
- path = LimaConfig.getInstance().getReportsDir();
+ path = LimaConfig.getInstance().getReportsDir();
}
@@ -1463,13 +1464,35 @@
TopiaContext transaction = null;
- String filePath =
- path+File.separator+DocumentsEnum.VAT.getFileName()+format.getExtension();
+ String filePath = path + File.separator
+ + DocumentsEnum.VAT.getFileName() + format.getExtension();
+ String path = LimaConfig.getInstance().getReportsDir();
+
+ String filePathDefault = path + File.separator
+ + DocumentsEnum.VAT.getFileName() + "_default.pdf";
+
PDDocument doc = null;
- InputStream reportsStream =
- DocumentServiceImpl.class.getResourceAsStream("/reports/vat_form_fr.pdf");
+ InputStream reportsStream = null;
+ String vatPDFUrl = LimaConfig.getInstance().getVatPDFUrl();
+
+ if (vatPDFUrl.equals("default")) {
+ reportsStream = DocumentServiceImpl.class
+ .getResourceAsStream("/reports/vat_form_fr.pdf");
+ if (reportsStream == null) {
+ throw new LimaException ("Could not find such file "
+ + "/reports/vat_form_fr.pdf");
+ }
+ } else {
+ try {
+ reportsStream = new FileInputStream(filePathDefault);
+ } catch (FileNotFoundException eee) {
+ throw new LimaException("Could not find such file "
+ + filePathDefault, eee);
+ }
+ }
+
try {
transaction = beginTransaction();
@@ -1480,88 +1503,8 @@
if (autocomplete.equals("true")) {
SetField fields = new SetField();
-
- Identity identity = identityService.getIdentity();
-
- //page one
-
- //sets names for each TextField
- String periodTextField = "a1.a1",
- serviceAddressTextField = "a2.a2",
- companyAlternativeAddressTextField = "a3.a3",
- companyAddressTextField = "a4.a4",
- a5TextField = "a5.a5", //field doesn't exist
- SIETextField = "a6.a6",
- fileNumberTextField = "a6.a6",
- keyTextField = "a8.a8",
- PeriodTextField = "a9.a9",
- CDITextField = "a10.a10",
- serviceCodeTextField = "a11.a11",
- regimeTextField = "a12.12",
- VATNumberTextField = "a13.a13",
- phoneNumberTextField = "a14.a14",
- transfertAmount = "a15.a15",
- answerSpace = "a16.a16",
- finalDateTextField = "date1.date1", // dd/mm/yyyy
- payementDateTextField = "date2.date2"; // dd/mm/yyyy;
-
- //fills in Period TextField
- Calendar beginDateCal = Calendar.getInstance();
- beginDateCal.setTime(beginDate);
-
- Calendar endDateCal = Calendar.getInstance();
- endDateCal.setTime(endDate);
-
- Locale locale = new Locale("fr","FR","");
-
- fields.setField(doc, periodTextField,
- beginDateCal.get(Calendar.DAY_OF_WEEK) + " "
- + beginDateCal.getDisplayName(Calendar.MONTH, Calendar.LONG, locale)
- + " " + beginDateCal.get(Calendar.YEAR) + " - "
- + endDateCal.get(Calendar.DAY_OF_WEEK) + " "
- + endDateCal.getDisplayName(Calendar.MONTH, Calendar.LONG, locale)
- + " " + endDateCal.get(Calendar.YEAR));
-
- //fills in address TextField
- String address = "";
- if (identity.getName() != null) {
- address = identity.getName() + "\n";
- }
- if (identity.getAddress() != null) {
- address += identity.getAddress() + "\n";
- }
- if (identity.getAddress2() != null) {
- address += identity.getAddress2() + "\n";
- }
- if (identity.getZipCode() != null) {
- address += identity.getZipCode() + " ";
- }
- if (identity.getCity() != null) {
- address += identity.getCity();
- }
- fields.setField(doc, companyAddressTextField, address);
-
-
- //fills in SIRET TextField
- if (identity.getVatNumber() != null) {
- String VATNumber = "";
- for (int i=0; i<identity.getVatNumber().length(); i++) {
- //add spaces to suit cells width
- VATNumber += identity.getVatNumber().substring(i, i+1) + " ";
- }
- fields.setField(doc, VATNumberTextField, VATNumber);
- }
-
-
- //fills in phone number TextField
- if (identity.getPhoneNumber() != null) {
- fields.setField(doc, phoneNumberTextField, identity.getPhoneNumber());
- }
-
-
- //end of page one
- //page two
-
+
+ //search for all VAT Statements from the report
List<VatStatement> vatStatementsList = vatStatementService.getAllVatStatements();
for (VatStatement vatStatement: vatStatementsList) {
//search for amount to display
@@ -1572,8 +1515,6 @@
}
}
- //end of page two
-
}
// save the updated document to the new file and close
doc.save(filePath);
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2011-08-05 12:09:49 UTC (rev 3250)
@@ -636,30 +636,30 @@
return result.toString();
}
- /**
- * Remote method to call entity import from UI
- * This method let import just on type of entity
- * @throws IOException
- * @throws COSVisitorException
- */
@Override
- public String importAsPDF(String datas, ImportExportEntityEnum importExportEntityEnum, boolean saveMode) throws LimaException {
+ public String importAsPDF(String datas, ImportExportEntityEnum importExportEntityEnum, boolean setMode) throws LimaException {
StringBuffer result = new StringBuffer();
try {
String path = LimaConfig.getInstance().getReportsDir();
- String filePath =
- path+File.separator + DocumentsEnum.VAT.getFileName() + "_structure.pdf";
+ String filePathDefault = path + File.separator
+ + DocumentsEnum.VAT.getFileName() + "_default.pdf";
+ String filePathStructured = path + File.separator
+ + DocumentsEnum.VAT.getFileName() + "_structure.pdf";
PDDocument doc = null;
InputStream reportsStream = new FileInputStream(datas);
//DocumentServiceImpl.class.getResourceAsStream("/reports/vat_form_fr.pdf");
- //DocumentServiceImpl.class.getResourceAsStream("~"+datas);
// load the document
doc = PDDocument.load(reportsStream);
+ //save default vat document with empty boxes
+ if (setMode) {
+ doc.save(filePathDefault);
+ }
+
//search for all PDFBox
List<PDField> FieldList = doc.getDocumentCatalog().getAcroForm().getFields();
@@ -668,9 +668,12 @@
pdField.setValue(pdField.getFullyQualifiedName());
}
- // save the updated document to the new file and close
- if (saveMode) {
- doc.save(filePath);
+ // save the structured document
+ doc.save(filePathStructured);
+
+ //sets the new pdf url to be used as pdf document edited for reports
+ if (setMode) {
+ LimaConfig.getInstance().setVatPDFUrl(datas);
}
doc.close();
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/OptionsServiceImpl.java 2011-08-05 12:09:49 UTC (rev 3250)
@@ -33,10 +33,13 @@
@Stateless
public class OptionsServiceImpl extends AbstractLimaService implements OptionsService, OptionsServiceLocal {
- protected String scale;
+ protected String scale;
+
+ protected String vatPDFUrl;
public OptionsServiceImpl() {
- scale = LimaConfig.getInstance().getScale();
+ scale = LimaConfig.getInstance().getScale();
+ vatPDFUrl = LimaConfig.getInstance().getVatPDFUrl();
}
public int getScale() {
@@ -49,6 +52,14 @@
public void setScale(String scale) {
LimaConfig.getInstance().setScale(scale);
+ }
+
+ public String getVatPDFUrl() {
+ return vatPDFUrl;
+ }
+
+ public void setVatPDFUrl(String url) {
+ LimaConfig.getInstance().setVatPDFUrl(url);
}
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2011-08-05 12:09:49 UTC (rev 3250)
@@ -442,7 +442,6 @@
vatStatementAmounts(subVatStatement,
selectedBeginDate, selectedEndDate, topiaContext);
vatStatementAmounts.setLabel(subVatStatement.getLabel());
- vatStatementAmounts.setAmount(subVatStatement.getAmount());
if (!subVatStatement.getHeader()){
//on calcul
amount =
@@ -465,7 +464,6 @@
new VatStatementAmountsImpl();
header.setLabel(headerVatStatementAmounts.getLabel());
header.setLevel(headerVatStatementAmounts.getLevel());
- header.setAmount(headerVatStatementAmounts.getAmount());
header.setHeader(true);
//ajoute header
subResult.add(header);
@@ -482,8 +480,6 @@
subResult.add(headerVatStatementAmounts);
}
else {
- headerVatStatementAmounts.
- setAmount(new BigDecimal(0));
subResult.add(headerVatStatementAmounts);
}
//ajoute liste
@@ -500,7 +496,6 @@
vatStatementAmounts.setLabel(vatStatement.getLabel());
vatStatementAmounts.setHeader(vatStatement.getHeader());
vatStatementAmounts.setLevel(vatStatement.getLevel());
- vatStatementAmounts.setAmount(vatStatement.getAmount());
}
result.setVatStatementAmounts(vatStatementAmounts);
result.setListResult(subResult);
Modified: trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties
===================================================================
--- trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_en_GB.properties 2011-08-05 12:09:49 UTC (rev 3250)
@@ -96,7 +96,9 @@
lima-business.import.vatstatementalreadyexist=FAILED \: The vatStatement %s already exists \!\n
lima.config.configFileName.description=
lima.config.httpport=HTTP Port
+lima.config.i18ndir=i18n directories
lima.config.reportsdir=Reports directories
+lima.config.reportvatpdfurl=
lima.config.rulesnationality=Rules Nationality
lima.config.scale=Scale
lima.config.serveraddress=Server Address
Modified: trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties
===================================================================
--- trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-business/src/main/resources/i18n/lima-business_fr_FR.properties 2011-08-05 12:09:49 UTC (rev 3250)
@@ -96,7 +96,9 @@
lima-business.import.vatstatementalreadyexist=u00C9chec \: Le plan %s exist déjà \!\n
lima.config.configFileName.description=
lima.config.httpport=Port HTTP
+lima.config.i18ndir=Dossier des i18n
lima.config.reportsdir=Dossier des rapports
+lima.config.reportvatpdfurl=Chemin du raport
lima.config.rulesnationality=Règles nationales
lima.config.scale=Précision
lima.config.serveraddress=Addresse serveur
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2011-08-05 12:09:49 UTC (rev 3250)
@@ -204,11 +204,20 @@
}
else {
if (importMode){
- JOptionPane.showMessageDialog(
+ //special message when importing a VAT PDF
+ if (importExportMethodeF.equals(ImportExportEnum.PDF_VAT_IMPORT)) {
+ JOptionPane.showMessageDialog(
waitView,
+ _("lima.importexport.import.vatpdfimport"),
+ _("lima.importexport.import"),
+ JOptionPane.INFORMATION_MESSAGE);
+ } else {
+ JOptionPane.showMessageDialog(
+ waitView,
_("lima.importexport.import.terminated"),
_("lima.importexport.import"),
JOptionPane.INFORMATION_MESSAGE);
+ }
}
else {
JOptionPane.showMessageDialog(
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2011-08-05 12:09:49 UTC (rev 3250)
@@ -242,7 +242,7 @@
@Override
public void notifyMethod(String serviceName, String methodeName) {
//automatic refresh when FinancialTransaction, VatStatement chart or import for VAT services have been used by the user
- if (serviceName.contains("FinancialTransaction") || methodeName.contains("VatStatement") || methodeName.contains("importAll")) {
+ if (serviceName.contains("FinancialTransaction") || methodeName.contains("VatStatement") || methodeName.contains("import") ) {
refresh();
}
}
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2011-08-05 12:09:49 UTC (rev 3250)
@@ -92,7 +92,9 @@
lima.config.currency.description=
lima.config.decimalseparator.description=
lima.config.host.adress=Host adress
+lima.config.i18ndir=Directory used for i18n files
lima.config.locale.description=Localization used by LIMA
+lima.config.resourcesdir=Directory used for Lima resources
lima.config.scale.description=
lima.config.ui.flaunchui.description=
lima.config.ui.fullscreen.description=FullScreen
@@ -199,6 +201,7 @@
lima.importexport.financialstatements=FinancialStatements chart
lima.importexport.import=Import
lima.importexport.import.terminated=Import terminated
+lima.importexport.import.vatpdfimport=The PDF has been imported. It can be found inside the Lima resources directory
lima.importexport.importcsv=Import CSV
lima.importexport.importebp=Import EBP
lima.importexport.usevatpdf=Would you like to use this PDF when editing the VAT document ?
@@ -233,7 +236,6 @@
lima.reports.financialstatement=Financialstatements
lima.reports.ledger=Ledger
lima.reports.vat=Edit VAT
-lima.reports.vatstatement=
lima.response.no=No
lima.response.yes=Yes
lima.splash.1=Loading services...
@@ -283,14 +285,10 @@
lima.vatreport.listerror=Can't get entries list
lima.vatstatement.accounts=List of accounts
lima.vatstatement.boxname=PDF BoxName
-lima.vatstatement.check=
lima.vatstatement.delete=Delete actual VAT statement chart before import new
-lima.vatstatement.header=
lima.vatstatement.label=Label
-lima.vatstatement.masteramount=
lima.vatstatement.mastervatstatement=
lima.vatstatement.movement.add=Add movement
-lima.vatstatement.subamount=
lima.warning.nimbus.landf=Could not find Numbus Look&Feel
limma.config.thousandseparator.description=
nuitonutil.error.applicationconfig.save=
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2011-08-04 11:45:18 UTC (rev 3249)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2011-08-05 12:09:49 UTC (rev 3250)
@@ -92,7 +92,9 @@
lima.config.currency.description=
lima.config.decimalseparator.description=
lima.config.host.adress=Adresse du serveur distant
+lima.config.i18ndir=Répertoire utilisée pour stocker les fichiers i18n
lima.config.locale.description=Locale utilisée par l'application
+lima.config.resourcesdir=Répertoire utilisée pour stocker les ressources
lima.config.scale.description=
lima.config.ui.flaunchui.description=
lima.config.ui.fullscreen.description=Plein écran
@@ -199,6 +201,7 @@
lima.importexport.financialstatements=Plan BCR
lima.importexport.import=Import
lima.importexport.import.terminated=Import terminé
+lima.importexport.import.vatpdfimport=Le PDF a bien été importé dans le répertoire des ressources de Lima
lima.importexport.importcsv=Import CSV
lima.importexport.importebp=Import EBP
lima.importexport.usevatpdf=Voulez-vous utilser ce PDF pour la déclaration de TVA ?
@@ -282,14 +285,11 @@
lima.vatreport.listerror=Erreur lors de la récupération des données de la liste
lima.vatstatement.accounts=Liste des comptes
lima.vatstatement.boxname=PDF BoxName
-lima.vatstatement.check=
lima.vatstatement.delete=Supprimer le plan TVA actuel avant d'importer
lima.vatstatement.header=
lima.vatstatement.label=Libellé
-lima.vatstatement.masteramount=
lima.vatstatement.mastervatstatement=
lima.vatstatement.movement.add=Ajouter un regrouprement
-lima.vatstatement.subamount=
lima.warning.nimbus.landf=Le look and feel nymbus n'a pas été trouvé
limma.config.thousandseparator.description=
nuitonutil.error.applicationconfig.save=
1
0
r3249 - in trunk: . lima-swing/src/main/java/org/chorem/lima
by tchemit@users.chorem.org Aug. 4, 2011
by tchemit@users.chorem.org Aug. 4, 2011
Aug. 4, 2011
Author: tchemit
Date: 2011-08-04 13:45:18 +0200 (Thu, 04 Aug 2011)
New Revision: 3249
Url: http://chorem.org/repositories/revision/lima/3249
Log:
Evolution #422: Updates to i18n 2.4.1
Evolution #421: Add i18n file in directory in zip release file and add this directory un classpath
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
trunk/pom.xml
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2011-08-04 11:09:14 UTC (rev 3248)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2011-08-04 11:45:18 UTC (rev 3249)
@@ -116,7 +116,7 @@
}
try {
//create directory to store i18n files
- FileUtil.createDirectoryIfNecessary(i18nDirectory.getParentFile());
+ FileUtil.createDirectoryIfNecessary(i18nDirectory);
} catch (IOException eee) {
throw new RuntimeException(
"Could not create directory " +
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-08-04 11:09:14 UTC (rev 3248)
+++ trunk/pom.xml 2011-08-04 11:45:18 UTC (rev 3249)
@@ -315,7 +315,7 @@
<eugenePluginVersion>2.3.5</eugenePluginVersion>
<topiaVersion>2.5.4</topiaVersion>
<jaxxVersion>2.4.2</jaxxVersion>
- <nuitonI18nVersion>2.4</nuitonI18nVersion>
+ <nuitonI18nVersion>2.4.1-SNAPSHOT</nuitonI18nVersion>
<openEjbVersion>3.1.4</openEjbVersion>
<slf4jVersion>1.6.1</slf4jVersion>
<!--axis.version>1.4.1</axis.version-->
1
0
r3248 - in trunk/lima-swing/src/main: java/org/chorem/lima java/org/chorem/lima/ui resources
by tchemit@users.chorem.org Aug. 4, 2011
by tchemit@users.chorem.org Aug. 4, 2011
Aug. 4, 2011
Author: tchemit
Date: 2011-08-04 13:09:14 +0200 (Thu, 04 Aug 2011)
New Revision: 3248
Url: http://chorem.org/repositories/revision/lima/3248
Log:
make i18n works with external resources
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
trunk/lima-swing/src/main/resources/lima-config.properties
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-08-04 10:44:34 UTC (rev 3247)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-08-04 11:09:14 UTC (rev 3248)
@@ -25,35 +25,30 @@
package org.chorem.lima;
-import static org.nuiton.i18n.I18n._;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Locale;
-import java.util.Properties;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.actions.MiscAction;
import org.chorem.lima.business.OptionsServiceMonitorable;
-import org.chorem.lima.business.LimaConfig.Option;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.service.LimaServiceFactory;
-import org.nuiton.i18n.I18n;
-import org.nuiton.i18n.init.DefaultI18nInitializer;
-import org.nuiton.i18n.init.I18nInitializer;
-import org.nuiton.i18n.init.UserI18nInitializer;
import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.ArgumentsParserException;
import org.nuiton.util.FileUtil;
import org.nuiton.util.SortedProperties;
-import org.nuiton.util.StringUtil;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
import org.nuiton.util.converter.ConverterUtil;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Locale;
+import java.util.Properties;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* La configuration de l'application.
*
@@ -340,13 +335,13 @@
return result;
}
- public String getVersionDirectory() {
- String result = getOption(Option.VERSION_DIRECTORY.key);
+ public File getResourcesDirectory() {
+ File result = getOptionAsFile(Option.RESOURCES_DIRECTORY.key);
return result;
}
- public String getI18nDirectory() {
- String result = getOption(Option.I18N_DIRECTORY.key);
+ public File getI18nDirectory() {
+ File result = getOptionAsFile(Option.I18N_DIRECTORY.key);
return result;
}
@@ -390,8 +385,8 @@
public static enum Option implements OptionDef {
CONFIG_FILE(CONFIG_FILE_NAME, _("lima.config.configFileName.description"), "lima-config.properties", String.class, true, true),
- VERSION_DIRECTORY("lima.version.dir", _("lima.config.versiondir"), "", String.class, false, false),
- I18N_DIRECTORY("lima.i18n.dir", _("lima.config.i18ndir"), "", String.class, false, false),
+ RESOURCES_DIRECTORY("lima.resources.dir", _("lima.config.resourcesdir"), "${lima.dir}/resources-${application.version}", String.class, false, false),
+ I18N_DIRECTORY("lima.i18n.dir", _("lima.config.i18ndir"), "${lima.resources.dir}/i18n", String.class, false, false),
LOCALE("locale", _("lima.config.locale.description"), "fr_FR", Locale.class, false, false),
DECIMAL_SEPARATOR("lima.config.decimalseparator", _("lima.config.decimalseparator.description"), ",", String.class, false, false),
SCALE("scale", _("lima.config.scale.description"), "2", Integer.class, false, false),
@@ -469,7 +464,7 @@
/**
* Lima action definition.
*/
- public static enum Action {
+ public enum Action {
HELP(_("lima.action.commandline.help"), MiscAction.class.getName() + "#help", "-h", "--help");
@@ -482,7 +477,7 @@
public String action;
public String[] aliases;
- private Action(String description, String action, String... aliases) {
+ Action(String description, String action, String... aliases) {
this.description = description;
this.action = action;
this.aliases = aliases;
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2011-08-04 10:44:34 UTC (rev 3247)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2011-08-04 11:09:14 UTC (rev 3248)
@@ -33,9 +33,7 @@
import org.chorem.lima.ui.MainViewHandler;
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.DefaultI18nInitializer;
-import org.nuiton.i18n.init.I18nInitializer;
import org.nuiton.i18n.init.UserI18nInitializer;
-import org.nuiton.i18n.init.ClassPathI18nInitializer;
import org.nuiton.util.FileUtil;
import org.nuiton.util.StringUtil;
@@ -110,30 +108,28 @@
public void initI18n(LimaConfig config) {
I18n.close();
-
- File versionDirectory = new File(config.getVersionDirectory());
- File i18nDirectory = new File(config.getI18nDirectory());
- //create directory to store files for the current version only
- try {
- FileUtil.createDirectoryIfNecessary(versionDirectory);
+
+ File i18nDirectory = config.getI18nDirectory();
+
+ if (log.isInfoEnabled()) {
+ log.info("I18n directory : " + i18nDirectory);
+ }
+ try {
//create directory to store i18n files
- FileUtil.createDirectoryIfNecessary(i18nDirectory);
+ FileUtil.createDirectoryIfNecessary(i18nDirectory.getParentFile());
+ } catch (IOException eee) {
+ throw new RuntimeException(
+ "Could not create directory " +
+ i18nDirectory.getParentFile(), eee);
}
- catch (IOException eee) {
- throw new RuntimeException("Could not create directory ", eee);
- }
-
UserI18nInitializer i18nInitializer =
new UserI18nInitializer(
i18nDirectory,
new DefaultI18nInitializer("lima")
);
-
- //I18nInitializer i18nInitializer = new DefaultI18nInitializer("lima-config");
-
+
Locale locale = config.getLocale();
-
- //I18n.init(new ClassPathI18nInitializer(), locale);
+
I18n.init(i18nInitializer, locale);
// Default Locale for DatePicker
@@ -146,12 +142,6 @@
log.debug("i18n loading time : " +
StringUtil.convertTime(t00, System.nanoTime()));
}
-
- /*
- Locale locale = getConfig().getLocale();
- I18n.init(new ClassPathI18nInitializer(), locale);
- // Default Locale for DatePicker
- Locale.setDefault(locale);*/
}
public MainView getMainUI() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2011-08-04 10:44:34 UTC (rev 3247)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainViewHandler.java 2011-08-04 11:09:14 UTC (rev 3248)
@@ -25,10 +25,6 @@
package org.chorem.lima.ui;
-import static org.nuiton.i18n.I18n._;
-import java.awt.Desktop;
-import java.net.URL;
-import java.util.Locale;
import jaxx.runtime.JAXXContext;
import jaxx.runtime.swing.AboutPanel;
import jaxx.runtime.swing.editor.config.ConfigUIHelper;
@@ -43,12 +39,12 @@
import org.chorem.lima.ui.entrybook.EntryBookView;
import org.chorem.lima.ui.entrybooksreports.EntryBooksReportsView;
import org.chorem.lima.ui.financialperiod.FinancialPeriodView;
-import org.chorem.lima.ui.fiscalperiod.FiscalPeriodView;
import org.chorem.lima.ui.financialstatementchart.FinancialStatementChartView;
import org.chorem.lima.ui.financialstatementreport.FinancialStatementReportView;
import org.chorem.lima.ui.financialtransaction.FinancialTransactionView;
import org.chorem.lima.ui.financialtransactionsearch.FinancialTransactionSearchView;
import org.chorem.lima.ui.financialtransactionunbalanced.FinancialTransactionUnbalancedView;
+import org.chorem.lima.ui.fiscalperiod.FiscalPeriodView;
import org.chorem.lima.ui.home.HomeView;
import org.chorem.lima.ui.identity.IdentityForm;
import org.chorem.lima.ui.importexport.ImportExport;
@@ -58,6 +54,12 @@
import org.chorem.lima.ui.vatreports.VatReportView;
import org.chorem.lima.util.ErrorHelper;
+import java.awt.Desktop;
+import java.net.URL;
+import java.util.Locale;
+
+import static org.nuiton.i18n.I18n._;
+
/**
* Handler for main view.
*
@@ -103,7 +105,7 @@
config.setLocale(newLocale);
// rechargement i18n
- LimaContext.get().initI18n();
+ LimaContext.get().initI18n(config);
// on recharge l'ui
reloadUI(LimaContext.get(), config.isFullScreen());
Modified: trunk/lima-swing/src/main/resources/lima-config.properties
===================================================================
--- trunk/lima-swing/src/main/resources/lima-config.properties 2011-08-04 10:44:34 UTC (rev 3247)
+++ trunk/lima-swing/src/main/resources/lima-config.properties 2011-08-04 11:09:14 UTC (rev 3248)
@@ -39,12 +39,7 @@
#LIMA Defaults values
# main directory
lima.dir=${user.home}/.lima
-# version directory
-lima.version.dir=${lima.dir}/${project.version}
-# directory for i18n files
-lima.i18n.dir=${lima.version.dir}/i18n
-
########################
# Open EJB Configuration
########################
1
0
Author: vsalaun
Date: 2011-08-04 12:44:34 +0200 (Thu, 04 Aug 2011)
New Revision: 3247
Url: http://chorem.org/repositories/revision/lima/3247
Log:
add directory properties
Modified:
trunk/lima-swing/src/main/resources/lima-config.properties
Modified: trunk/lima-swing/src/main/resources/lima-config.properties
===================================================================
--- trunk/lima-swing/src/main/resources/lima-config.properties 2011-08-04 10:31:43 UTC (rev 3246)
+++ trunk/lima-swing/src/main/resources/lima-config.properties 2011-08-04 10:44:34 UTC (rev 3247)
@@ -33,7 +33,18 @@
lima.misc.supportemail=support(a)codelutin.com
+########################
+# LIMA Defaults values
+########################
+#LIMA Defaults values
+# main directory
+lima.dir=${user.home}/.lima
+# version directory
+lima.version.dir=${lima.dir}/${project.version}
+# directory for i18n files
+lima.i18n.dir=${lima.version.dir}/i18n
+
########################
# Open EJB Configuration
########################
1
0
r3246 - in trunk/lima-swing: . src/main/java/org/chorem/lima
by vsalaun@users.chorem.org Aug. 4, 2011
by vsalaun@users.chorem.org Aug. 4, 2011
Aug. 4, 2011
Author: vsalaun
Date: 2011-08-04 12:31:43 +0200 (Thu, 04 Aug 2011)
New Revision: 3246
Url: http://chorem.org/repositories/revision/lima/3246
Log:
add i18n:bundle
Modified:
trunk/lima-swing/pom.xml
trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
Modified: trunk/lima-swing/pom.xml
===================================================================
--- trunk/lima-swing/pom.xml 2011-08-04 09:52:55 UTC (rev 3245)
+++ trunk/lima-swing/pom.xml 2011-08-04 10:31:43 UTC (rev 3246)
@@ -136,6 +136,9 @@
<license.generateBundle>true</license.generateBundle>
<license.bundleLicensePath>META-INF/lima-swing-LICENSE.txt</license.bundleLicensePath>
<license.bundleThirdPartyPath>META-INF/lima-swing-THIRD-PARTY.txt</license.bundleThirdPartyPath>
+
+ <i18n.bundles>fr_FR,en_GB</i18n.bundles>
+ <i18n.bundleOutputName>lima</i18n.bundleOutputName>
</properties>
@@ -175,22 +178,29 @@
</execution>
</executions>
</plugin>
-
+
<plugin>
<groupId>org.nuiton.i18n</groupId>
<artifactId>maven-i18n-plugin</artifactId>
<executions>
<execution>
+ <id>scan-sources</id>
+ <goals>
+ <goal>parserJava</goal>
+ <goal>gen</goal>
+ </goals>
<configuration>
<entries>
<entry>
- <basedir>${maven.gen.dir}/java</basedir>
+ <basedir>${maven.gen.dir}/java/</basedir>
</entry>
</entries>
</configuration>
+ </execution>
+ <execution>
+ <id>make-bundle</id>
<goals>
- <goal>parserJava</goal>
- <goal>gen</goal>
+ <goal>bundle</goal>
</goals>
</execution>
</executions>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-08-04 09:52:55 UTC (rev 3245)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaConfig.java 2011-08-04 10:31:43 UTC (rev 3246)
@@ -38,12 +38,18 @@
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.actions.MiscAction;
import org.chorem.lima.business.OptionsServiceMonitorable;
+import org.chorem.lima.business.LimaConfig.Option;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
import org.chorem.lima.service.LimaServiceFactory;
+import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.init.DefaultI18nInitializer;
+import org.nuiton.i18n.init.I18nInitializer;
+import org.nuiton.i18n.init.UserI18nInitializer;
import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.ArgumentsParserException;
import org.nuiton.util.FileUtil;
import org.nuiton.util.SortedProperties;
+import org.nuiton.util.StringUtil;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
import org.nuiton.util.converter.ConverterUtil;
@@ -68,9 +74,6 @@
private static final String configFile = "lima-config.properties";
- //used for services
- protected static final String SERVICECONFIGFILE = "lima.properties";
-
protected OptionsServiceMonitorable optionsService;
/**
@@ -337,6 +340,16 @@
return result;
}
+ public String getVersionDirectory() {
+ String result = getOption(Option.VERSION_DIRECTORY.key);
+ return result;
+ }
+
+ public String getI18nDirectory() {
+ String result = getOption(Option.I18N_DIRECTORY.key);
+ return result;
+ }
+
public String getHostAdress() {
return getOption(Option.LIMA_HOST_ADDRESS.key);
}
@@ -377,6 +390,8 @@
public static enum Option implements OptionDef {
CONFIG_FILE(CONFIG_FILE_NAME, _("lima.config.configFileName.description"), "lima-config.properties", String.class, true, true),
+ VERSION_DIRECTORY("lima.version.dir", _("lima.config.versiondir"), "", String.class, false, false),
+ I18N_DIRECTORY("lima.i18n.dir", _("lima.config.i18ndir"), "", String.class, false, false),
LOCALE("locale", _("lima.config.locale.description"), "fr_FR", Locale.class, false, false),
DECIMAL_SEPARATOR("lima.config.decimalseparator", _("lima.config.decimalseparator.description"), ",", String.class, false, false),
SCALE("scale", _("lima.config.scale.description"), "2", Integer.class, false, false),
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2011-08-04 09:52:55 UTC (rev 3245)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaContext.java 2011-08-04 10:31:43 UTC (rev 3246)
@@ -32,8 +32,15 @@
import org.chorem.lima.ui.MainView;
import org.chorem.lima.ui.MainViewHandler;
import org.nuiton.i18n.I18n;
+import org.nuiton.i18n.init.DefaultI18nInitializer;
+import org.nuiton.i18n.init.I18nInitializer;
+import org.nuiton.i18n.init.UserI18nInitializer;
import org.nuiton.i18n.init.ClassPathI18nInitializer;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.StringUtil;
+import java.io.File;
+import java.io.IOException;
import java.util.Locale;
/**
@@ -78,7 +85,7 @@
instance = new LimaContext();
instance.setContextValue(new LimaConfig());
instance.setContextValue(new MainViewHandler());
-
+
return instance;
}
@@ -100,12 +107,51 @@
return getContextValue(LimaConfig.class);
}
- public void initI18n() {
+ public void initI18n(LimaConfig config) {
+
+ I18n.close();
+
+ File versionDirectory = new File(config.getVersionDirectory());
+ File i18nDirectory = new File(config.getI18nDirectory());
+ //create directory to store files for the current version only
+ try {
+ FileUtil.createDirectoryIfNecessary(versionDirectory);
+ //create directory to store i18n files
+ FileUtil.createDirectoryIfNecessary(i18nDirectory);
+ }
+ catch (IOException eee) {
+ throw new RuntimeException("Could not create directory ", eee);
+ }
+ UserI18nInitializer i18nInitializer =
+ new UserI18nInitializer(
+ i18nDirectory,
+ new DefaultI18nInitializer("lima")
+ );
+
+ //I18nInitializer i18nInitializer = new DefaultI18nInitializer("lima-config");
+
+ Locale locale = config.getLocale();
+
+ //I18n.init(new ClassPathI18nInitializer(), locale);
+ I18n.init(i18nInitializer, locale);
+
+ // Default Locale for DatePicker
+ Locale.setDefault(locale);
+
+ long t00 = System.nanoTime();
+
+ if (log.isDebugEnabled()) {
+ log.debug("i18n language : " + locale);
+ log.debug("i18n loading time : " +
+ StringUtil.convertTime(t00, System.nanoTime()));
+ }
+
+ /*
Locale locale = getConfig().getLocale();
I18n.init(new ClassPathI18nInitializer(), locale);
// Default Locale for DatePicker
- Locale.setDefault(locale);
+ Locale.setDefault(locale);*/
}
public MainView getMainUI() {
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2011-08-04 09:52:55 UTC (rev 3245)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/LimaMain.java 2011-08-04 10:31:43 UTC (rev 3246)
@@ -27,7 +27,6 @@
import static org.nuiton.i18n.I18n._;
import java.util.List;
-import java.util.Locale;
import javax.swing.SwingUtilities;
import jaxx.runtime.SwingUtil;
import org.apache.commons.logging.Log;
@@ -41,8 +40,6 @@
import org.chorem.lima.ui.MainViewHandler;
import org.chorem.lima.ui.opening.OpeningView;
import org.chorem.lima.util.ErrorHelper;
-import org.nuiton.i18n.I18n;
-import org.nuiton.util.StringUtil;
/**
* Lima main.
@@ -138,7 +135,7 @@
LimaConfig config = context.getContextValue(LimaConfig.class);
config.parse(args);
- context.initI18n();
+ context.initI18n(config);
// prepare ui look&feel and load ui properties
try {
1
0
Author: tchemit
Date: 2011-08-04 11:52:55 +0200 (Thu, 04 Aug 2011)
New Revision: 3245
Url: http://chorem.org/repositories/revision/lima/3245
Log:
Update mavenpom4redmine to 3.0.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-08-04 08:41:56 UTC (rev 3244)
+++ trunk/pom.xml 2011-08-04 09:52:55 UTC (rev 3245)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.5.5</version>
+ <version>3.0</version>
</parent>
<groupId>org.chorem</groupId>
1
0
r3244 - in trunk/lima-swing/src/main/java/org/chorem/lima/ui: vatchart vatreports
by vsalaun@users.chorem.org Aug. 4, 2011
by vsalaun@users.chorem.org Aug. 4, 2011
Aug. 4, 2011
Author: vsalaun
Date: 2011-08-04 10:41:56 +0200 (Thu, 04 Aug 2011)
New Revision: 3244
Url: http://chorem.org/repositories/revision/lima/3244
Log:
#347 add headers
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx 2011-08-02 14:26:15 UTC (rev 3243)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx 2011-08-04 08:41:56 UTC (rev 3244)
@@ -1,3 +1,27 @@
+<!--
+ #%L
+ Lima :: Swing
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2011 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
<JDialog modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx 2011-08-02 14:26:15 UTC (rev 3243)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx 2011-08-04 08:41:56 UTC (rev 3244)
@@ -1,3 +1,27 @@
+<!--
+ #%L
+ Lima :: Swing
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2008 - 2011 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as
+ published by the Free Software Foundation, either version 3 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public
+ License along with this program. If not, see
+ <http://www.gnu.org/licenses/gpl-3.0.html>.
+ #L%
+ -->
<JDialog modal="true"
defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
onWindowClosing="performCancel();">
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java 2011-08-02 14:26:15 UTC (rev 3243)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java 2011-08-04 08:41:56 UTC (rev 3244)
@@ -1,3 +1,27 @@
+/*
+ * #%L
+ * Lima :: Swing
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2011 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
package org.chorem.lima.ui.vatreports;
import static org.nuiton.i18n.I18n._;
1
0
r3243 - trunk/lima-business/src/main/java/org/chorem/lima/business/ejb
by vsalaun@users.chorem.org Aug. 2, 2011
by vsalaun@users.chorem.org Aug. 2, 2011
Aug. 2, 2011
Author: vsalaun
Date: 2011-08-02 16:26:15 +0200 (Tue, 02 Aug 2011)
New Revision: 3243
Url: http://chorem.org/repositories/revision/lima/3243
Log:
#347 display PDF boxes inside the pdf
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-08-02 11:39:58 UTC (rev 3242)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-08-02 14:26:15 UTC (rev 3243)
@@ -36,7 +36,6 @@
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2011-08-02 11:39:58 UTC (rev 3242)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2011-08-02 14:26:15 UTC (rev 3243)
@@ -53,6 +53,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.pdfbox.exceptions.COSVisitorException;
import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.interactive.form.PDField;
import org.chorem.lima.FinancialStatementWayEnum;
import org.chorem.lima.beans.AccountEBP;
import org.chorem.lima.beans.AccountEBPImpl;
@@ -650,7 +651,7 @@
String path = LimaConfig.getInstance().getReportsDir();
String filePath =
- path+File.separator+DocumentsEnum.VAT.getFileName()+".pdf";
+ path+File.separator + DocumentsEnum.VAT.getFileName() + "_structure.pdf";
PDDocument doc = null;
InputStream reportsStream = new FileInputStream(datas);
@@ -658,6 +659,15 @@
//DocumentServiceImpl.class.getResourceAsStream("~"+datas);
// load the document
doc = PDDocument.load(reportsStream);
+
+ //search for all PDFBox
+ List<PDField> FieldList = doc.getDocumentCatalog().getAcroForm().getFields();
+
+ //display inside each box their name
+ for (PDField pdField : FieldList) {
+ pdField.setValue(pdField.getFullyQualifiedName());
+ }
+
// save the updated document to the new file and close
if (saveMode) {
doc.save(filePath);
1
0
r3242 - in trunk: lima-business/src/main/java/org/chorem/lima/business/ejb lima-business/src/main/java/org/chorem/lima/business/ejbinterface lima-business/src/main/java/org/chorem/lima/business/utils lima-callao/src/main/xmi
by vsalaun@users.chorem.org Aug. 2, 2011
by vsalaun@users.chorem.org Aug. 2, 2011
Aug. 2, 2011
Author: vsalaun
Date: 2011-08-02 13:39:58 +0200 (Tue, 02 Aug 2011)
New Revision: 3242
Url: http://chorem.org/repositories/revision/lima/3242
Log:
#347 update accounting.zargo for vat + vat services
Modified:
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ImportService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementService.java
trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementServiceLocal.java
trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ImportExportEntityEnum.java
trunk/lima-callao/src/main/xmi/accounting.zargo
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-08-02 11:39:02 UTC (rev 3241)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-08-02 11:39:58 UTC (rev 3242)
@@ -77,6 +77,7 @@
import org.chorem.lima.entity.FinancialTransaction;
import org.chorem.lima.entity.Identity;
import org.chorem.lima.entity.LimaCallaoDAOHelper;
+import org.chorem.lima.entity.VatStatement;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaContextFactory;
import org.nuiton.topia.TopiaException;
@@ -1458,17 +1459,22 @@
//############## VAT ##############
@Override
- public void createVatDocuments(Date beginDate, Date endDate, FormatsEnum format, String autocomplete, String datas)
+ public void createVatDocuments(Date beginDate, Date endDate, FormatsEnum format, String autocomplete)
throws LimaException, IOException, COSVisitorException {
+ TopiaContext transaction = null;
+
+ String filePath =
+ path+File.separator+DocumentsEnum.VAT.getFileName()+format.getExtension();
+
+ PDDocument doc = null;
+ InputStream reportsStream =
+ DocumentServiceImpl.class.getResourceAsStream("/reports/vat_form_fr.pdf");
+
try {
- String filePath =
- path+File.separator+DocumentsEnum.VAT.getFileName()+format.getExtension();
+ transaction = beginTransaction();
- PDDocument doc = null;
- InputStream reportsStream =
- DocumentServiceImpl.class.getResourceAsStream("/reports/vat_form_fr.pdf");
// load the document
doc = PDDocument.load(reportsStream);
@@ -1556,75 +1562,15 @@
//end of page one
//page two
-
- String[] bigDecimalList = datas.split("_");
-
- //sets parameters to use for each TextField
- ArrayList<ArrayList<String>> listOfLists = new ArrayList<ArrayList<String>>();
- // Structure : box name on the pdf | text showed on the pdf | amount
- listOfLists.add(new ArrayList<String>(Arrays.asList("b1.b1", "Ventes, prestations de services", bigDecimalList[2])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b2.b2", "Autres opérations imposables", bigDecimalList[3])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b3.b3", "Achats de prestations de services intracommunautaires", bigDecimalList[4])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b4.b4", "Acquisitions intracommunautaires", bigDecimalList[5])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b5.b5", "Livraisons de gaz naturel ou d'électricité imposables en France", bigDecimalList[6])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b6.b6", "Achats de biens ou de prestations de services réalisées auprès d'un assujetti non établi en France", bigDecimalList[7])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b7.b7", "Régularisations (imposables)", bigDecimalList[8])));
-
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b8.b8", "Exportations hors CE", bigDecimalList[11])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b9.b9", "Autres opérations non imposables", bigDecimalList[12])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b10.b10", "Livraisons intracommunautaires", bigDecimalList[13])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b11.b11", "Livraisons de gaz naturel ou d'électricité non imposables en France", bigDecimalList[14])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b12.b12", "Achats de franchise", bigDecimalList[15])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b13.b13", "Ventes de biens ou prestations de services réalisées aurpès d'un assujetti non établi en France", bigDecimalList[16])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b14.b14", "Régularisations (non imposables)", bigDecimalList[17])));
-
-
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b15.b15", "Taux normal 19,6% (Base hors taxe)", bigDecimalList[23])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b23.b23", "Taux normal 19,6% (Taxe due)", bigDecimalList[24])));
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b16.b16", "Taux réduit 5,5% (Base hors taxe)", bigDecimalList[25])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b24.b24", "Taux réduit 5,5% (Taxe due)", bigDecimalList[26])));
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b18.b18", "Taux normal 8,5% (Base hors taxe)", bigDecimalList[29])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b26.b26", "Taux normal 8,5% (Taxe due)", bigDecimalList[30])));
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b19.b19", "Taux réduit 2,1% (Base hors taxe)", bigDecimalList[31])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b27.b27", "Taux réduit 2,1% (Taxe due)", bigDecimalList[32])));
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b21.b21", "Ancien taux (Base hors taxe)", bigDecimalList[35])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b29.b29", "Ancien taux (Taxe due)", bigDecimalList[36])));
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b22.b22", "Opérations imposables à un autre taux (France métropolitaine ou DOM) (Base hors taxe)", bigDecimalList[37])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b30.b30", "Opérations imposables à un autre taux (France métropolitaine ou DOM) (Taxe due)", bigDecimalList[38])));
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b31.b31", "TVA antérieurement déduite à reverser", bigDecimalList[40])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b32.b32", "Total de la TVA brute due (lignes 08 à 15)", bigDecimalList[41])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b33.b33", "Dont TVA sur acquisitions intracommunautaires", bigDecimalList[42])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b34.b34", "Dont TVA sur opérations à destination de Monaco", bigDecimalList[43])));
-
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b35.b35", "Biens constituant des immobilisations", bigDecimalList[46])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b36.b36", "Autres biens et services", bigDecimalList[47])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b37.b37", "Autre TVA à déduire", bigDecimalList[48])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b38.b38", "Report du crédit apparaissant ligne 27 de la précédente déclaration", bigDecimalList[49])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("total1.total1", "Total TVA déductible (lignes 19 à 22)", bigDecimalList[50])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b39.b39", "Dont TVA non perçue récupérable par les assujettis disposant d’un établissement stable dans les DOM", bigDecimalList[51])));
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b40.b40", "Crédit de TVA", bigDecimalList[55])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b41.b41", "Remboursement demandé sur formulaire", bigDecimalList[56])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b42.b42", "Crédit à reporter", bigDecimalList[57])));
-
- listOfLists.add(new ArrayList<String>(Arrays.asList("b43.b43", "TVA nette due", bigDecimalList[60])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b44.b44", "Taxes assimilées calculées sur annexe no 3310 A", bigDecimalList[61])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b45.b45", "Sommes à imputer, exprimées en euros, y compris acompte congés", bigDecimalList[62])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b46.b46", "Sommes à ajouter, exprimées en euros, y compris acompte congés", bigDecimalList[63])));
- listOfLists.add(new ArrayList<String>(Arrays.asList("b47.b47", "Total à payer", bigDecimalList[64])));
-
-
- for (List<String> list : listOfLists) {
- fields.setField(doc, list.get(0), list.get(2));
+
+ List<VatStatement> vatStatementsList = vatStatementService.getAllVatStatements();
+ for (VatStatement vatStatement: vatStatementsList) {
+ //search for amount to display
+ BigDecimal amount = vatStatementService.vatStatementAmounts(vatStatement, beginDate, endDate).getAmount();
+ //display amount only if it is a child and has a BoxName
+ if (vatStatement.getBoxName() != null && !vatStatement.isHeader()) {
+ fields.setField(doc, vatStatement.getBoxName(), amount.toString());
+ }
}
//end of page two
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2011-08-02 11:39:02 UTC (rev 3241)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ExportServiceImpl.java 2011-08-02 11:39:58 UTC (rev 3242)
@@ -386,11 +386,11 @@
/**
* Local methode, export vatstatements from database
* vatstatement Structure : TYPE | label | header |
- * | accounts | subAmount | headerAmount | masterVatStatement | editable
+ * | accounts | subAmount | headerAmount | masterVatStatement
*/
public void exportVatStatementChartAsCSV(CSVWriter csvWriter, TopiaContext topiaContext) throws LimaException {
try {
- String[] nextLine = new String[9];
+ String[] nextLine = new String[8];
// Get all Vatstatements
VatStatementDAO vatStatementDAO =
LimaCallaoDAOHelper.getVatStatementDAO(topiaContext);
@@ -420,8 +420,6 @@
masterVatStatement.getLabel();
}
nextLine[7] = masterVatStatementString;
- nextLine[8] = Boolean.toString(
- vatStatement.getEditable());
csvWriter.writeNext(nextLine);
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2011-08-02 11:39:02 UTC (rev 3241)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/HttpServerServiceImpl.java 2011-08-02 11:39:58 UTC (rev 3242)
@@ -128,7 +128,6 @@
String beginDate = req.getParameter("beginDate");
String endDate = req.getParameter("endDate");
String autocomplete = req.getParameter("autocomplete");
- String datas = req.getParameter("datas");
//if image
if (imageParam != null){
@@ -174,7 +173,7 @@
case VAT:
documentService.createVatDocuments(
beginDateFormat, endDateFormat, formatsEnum,
- autocomplete, datas);
+ autocomplete);
break;
}
} catch (LimaException eeeLE) {
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2011-08-02 11:39:02 UTC (rev 3241)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2011-08-02 11:39:58 UTC (rev 3242)
@@ -26,7 +26,11 @@
package org.chorem.lima.business.ejb;
import static org.nuiton.i18n.I18n._;
+
+import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.StringReader;
import java.math.BigDecimal;
import java.text.ParseException;
@@ -43,9 +47,12 @@
import java.util.TreeMap;
import javax.ejb.EJB;
import javax.ejb.Stateless;
+
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.pdfbox.exceptions.COSVisitorException;
+import org.apache.pdfbox.pdmodel.PDDocument;
import org.chorem.lima.FinancialStatementWayEnum;
import org.chorem.lima.beans.AccountEBP;
import org.chorem.lima.beans.AccountEBPImpl;
@@ -77,6 +84,7 @@
import org.chorem.lima.business.ejbinterface.ImportServiceLocal;
import org.chorem.lima.business.ejbinterface.VatStatementServiceLocal;
import org.chorem.lima.business.utils.AccountEBPComparator;
+import org.chorem.lima.business.utils.DocumentsEnum;
import org.chorem.lima.business.utils.EntryEBPComparator;
import org.chorem.lima.business.utils.FiscalPeriodComparator;
import org.chorem.lima.business.utils.ImportExportEntityEnum;
@@ -627,7 +635,47 @@
return result.toString();
}
+ /**
+ * Remote method to call entity import from UI
+ * This method let import just on type of entity
+ * @throws IOException
+ * @throws COSVisitorException
+ */
+ @Override
+ public String importAsPDF(String datas, ImportExportEntityEnum importExportEntityEnum, boolean saveMode) throws LimaException {
+ StringBuffer result = new StringBuffer();
+
+ try {
+ String path = LimaConfig.getInstance().getReportsDir();
+
+ String filePath =
+ path+File.separator+DocumentsEnum.VAT.getFileName()+".pdf";
+
+ PDDocument doc = null;
+ InputStream reportsStream = new FileInputStream(datas);
+ //DocumentServiceImpl.class.getResourceAsStream("/reports/vat_form_fr.pdf");
+ //DocumentServiceImpl.class.getResourceAsStream("~"+datas);
+ // load the document
+ doc = PDDocument.load(reportsStream);
+ // save the updated document to the new file and close
+ if (saveMode) {
+ doc.save(filePath);
+ }
+ doc.close();
+ }
+ catch (IOException eee) {
+ log.error("Can't read vat pdf", eee);
+ result.append("Can't read vat pdf");
+ }
+ catch (COSVisitorException eee) {
+ log.error("Can't save vat pdf", eee);
+ result.append("Can't save vat pdf");
+ }
+ return result.toString();
+ }
+
+
// ################ Import entities an put to lists ################
/**
@@ -848,7 +896,7 @@
/**
* Import and create vatstatement Structure : TYPE | boxName | label | header
- * | accounts | subAmount | headerAmount | masterVatStatement | editable
+ * | accounts | subAmount | headerAmount | masterVatStatement
*/
public String importVatStatementChartCSV(String[] nextLine,
@@ -864,7 +912,6 @@
String subAmount = nextLine[5];
String headerAmount = nextLine[6];
String masterVatStatement = nextLine[7];
- String editable = nextLine[8];
try {
@@ -882,7 +929,6 @@
vatStatementImport.setSubAmount(subAmount);
vatStatementImport.setHeaderAmount(headerAmount);
vatStatementImport.setMasterVatStatement(masterVatStatement);
- vatStatementImport.setEditable(editable);
// put it in hashlinkedlist
if (vatStatements.containsKey(label)){
@@ -1080,9 +1126,7 @@
.getSubAmount()));
vatStatement.setHeaderAmount(vatStatement
.getHeaderAmount());
- vatStatement.setEditable(Boolean
- .parseBoolean(vatStatementImport
- .getEditable()));
+ vatStatement.setAmount(BigDecimal.ZERO);
vatStatementService
.createVatStatementWithTransaction(
masterVatStatement,
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2011-08-02 11:39:02 UTC (rev 3241)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/VatStatementServiceImpl.java 2011-08-02 11:39:58 UTC (rev 3242)
@@ -442,6 +442,7 @@
vatStatementAmounts(subVatStatement,
selectedBeginDate, selectedEndDate, topiaContext);
vatStatementAmounts.setLabel(subVatStatement.getLabel());
+ vatStatementAmounts.setAmount(subVatStatement.getAmount());
if (!subVatStatement.getHeader()){
//on calcul
amount =
@@ -464,6 +465,7 @@
new VatStatementAmountsImpl();
header.setLabel(headerVatStatementAmounts.getLabel());
header.setLevel(headerVatStatementAmounts.getLevel());
+ header.setAmount(headerVatStatementAmounts.getAmount());
header.setHeader(true);
//ajoute header
subResult.add(header);
@@ -498,6 +500,7 @@
vatStatementAmounts.setLabel(vatStatement.getLabel());
vatStatementAmounts.setHeader(vatStatement.getHeader());
vatStatementAmounts.setLevel(vatStatement.getLevel());
+ vatStatementAmounts.setAmount(vatStatement.getAmount());
}
result.setVatStatementAmounts(vatStatementAmounts);
result.setListResult(subResult);
@@ -507,7 +510,57 @@
}
return result;
}
+
+ @Override
+ public void removeVatStatement(VatStatement vatStatement) throws LimaException {
+ TopiaContext transaction = null;
+ try {
+ transaction = beginTransaction();
+ VatStatementDAO vatStatementDAO =
+ LimaCallaoDAOHelper.getVatStatementDAO(transaction);
+
+
+ // remove vatstatement
+ VatStatement vatStatementToDelete =
+ vatStatementDAO.findByTopiaId(
+ vatStatement.getTopiaId());
+ vatStatementDAO.delete(vatStatementToDelete);
+
+ //get all subVatStatement
+ List<VatStatement> vatStatements =
+ getAllChildrenVatStatement(vatStatement,
+ new ArrayList<VatStatement>());
+
+ //if VatStatement have subVatStatement
+ if (vatStatements.size() > 0){
+ for (VatStatement subVatStatement : vatStatements) {
+ VatStatement subVatStatementToDelete =
+ vatStatementDAO.findByTopiaId(
+ subVatStatement.getTopiaId());
+ vatStatementDAO.delete(subVatStatementToDelete);
+ }
+ }
+
+ //commit
+ commitTransaction(transaction);
+
+ }
+ catch (TopiaException ex) {
+ doCatch(transaction, ex, log);
+ }
+ finally {
+ doFinally(transaction, log);
+ }
+ }
+
+ @Override
+ public void removeAllVatStatement() throws LimaException {
+ for (VatStatement vatStatement : getChildrenVatStatement(null)) {
+ removeVatStatement(vatStatement);
+ }
+ }
+
protected TopiaContext beginTransaction() throws TopiaException {
// basic check done, make check in database
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentService.java 2011-08-02 11:39:02 UTC (rev 3241)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/DocumentService.java 2011-08-02 11:39:58 UTC (rev 3242)
@@ -47,6 +47,6 @@
void createEntryBooksDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException;
void createBalanceDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException;
void createGeneralEntryBooksDocuments(Date beginDate, Date endDate, FormatsEnum format) throws LimaException;
- void createVatDocuments(Date beginDate, Date endDate, FormatsEnum format, String autocomplete, String datas) throws LimaException, IOException, COSVisitorException;;
+ void createVatDocuments(Date beginDate, Date endDate, FormatsEnum format, String autocomplete) throws LimaException, IOException, COSVisitorException;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ImportService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ImportService.java 2011-08-02 11:39:02 UTC (rev 3241)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/ImportService.java 2011-08-02 11:39:58 UTC (rev 3242)
@@ -76,4 +76,6 @@
String importAllAsCSV(String path) throws LimaException;
String importAsCSV(String datas, ImportExportEntityEnum importExportEntityEnum) throws LimaException;
+
+ String importAsPDF(String datas, ImportExportEntityEnum importExportEntityEnum, boolean saveMode) throws LimaException;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementService.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementService.java 2011-08-02 11:39:02 UTC (rev 3241)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementService.java 2011-08-02 11:39:58 UTC (rev 3242)
@@ -58,6 +58,10 @@
VatStatement findVatStatementByString(String label) throws LimaException;
List<VatStatementAmounts> vatStatementReport(Date beginDate, Date endDate) throws LimaException;
+
+ void removeAllVatStatement() throws LimaException;
+
+ void removeVatStatement(VatStatement vatStatement) throws LimaException;
}
\ No newline at end of file
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementServiceLocal.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementServiceLocal.java 2011-08-02 11:39:02 UTC (rev 3241)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejbinterface/VatStatementServiceLocal.java 2011-08-02 11:39:58 UTC (rev 3242)
@@ -28,6 +28,7 @@
import javax.ejb.Local;
import org.chorem.lima.beans.VatStatementAmounts;
+import org.chorem.lima.beans.VatStatementDatas;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.entity.VatStatement;
import org.nuiton.topia.TopiaContext;
@@ -40,8 +41,12 @@
VatStatement masterVatStatement, VatStatement vatStatement,
TopiaContext transaction) throws LimaException;
- VatStatementAmounts vatStatementAmounts(VatStatement vatStatement,
+ public VatStatementAmounts vatStatementAmounts(VatStatement vatStatement,
Date selectedBeginDate, Date selectedEndDate,
TopiaContext topiacontext) throws LimaException, TopiaException;
+
+ public VatStatementDatas vatStatementReport(VatStatement vatStatement,
+ Date selectedBeginDate, Date selectedEndDate, VatStatementDatas result,
+ TopiaContext topiaContext) throws LimaException, TopiaException;
}
Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ImportExportEntityEnum.java
===================================================================
--- trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ImportExportEntityEnum.java 2011-08-02 11:39:02 UTC (rev 3241)
+++ trunk/lima-business/src/main/java/org/chorem/lima/business/utils/ImportExportEntityEnum.java 2011-08-02 11:39:58 UTC (rev 3242)
@@ -30,7 +30,7 @@
ACCOUNT("ACCN"), ENTRYBOOK("ENBK"), FINANCIALSTATEMENT("FNST"),
FISCALPERIOD("FSCP"), CLOSEDPERIODICENTRYBOOK("CPEB"),
FINANCIALTRANSACTION("FTRC"), ENTRY("NTRY"),
- VATSTATEMENT("VAT"), IDENTITY("IDNT");
+ VATSTATEMENT("VAT"), IDENTITY("IDNT"), VATPDF("VATPDF");
private final String label;
private ImportExportEntityEnum(String label) {
Modified: trunk/lima-callao/src/main/xmi/accounting.zargo
===================================================================
(Binary files differ)
1
0
r3241 - in trunk/lima-swing/src/main: java/org/chorem/lima/enums java/org/chorem/lima/ui java/org/chorem/lima/ui/importexport java/org/chorem/lima/util resources/i18n
by vsalaun@users.chorem.org Aug. 2, 2011
by vsalaun@users.chorem.org Aug. 2, 2011
Aug. 2, 2011
Author: vsalaun
Date: 2011-08-02 13:39:02 +0200 (Tue, 02 Aug 2011)
New Revision: 3241
Url: http://chorem.org/repositories/revision/lima/3241
Log:
#347 update import/export for vat
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2011-08-02 11:37:55 UTC (rev 3240)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/enums/ImportExportEnum.java 2011-08-02 11:39:02 UTC (rev 3241)
@@ -36,6 +36,7 @@
CSV_ENTRYBOOKS_EXPORT(false, true), CSV_ENTRYBOOKS_IMPORT(true, true),
CSV_FINANCIALSTATEMENTS_EXPORT(false, true), CSV_FINANCIALSTATEMENTS_IMPORT(true, true),
CSV_VAT_EXPORT(false, true), CSV_VAT_IMPORT(true, true),
+ PDF_VAT_EXPORT(false, true), PDF_VAT_IMPORT(true, true),
EBP_ACCOUNTCHARTS_EXPORT(false, false), EBP_ENTRIES_EXPORT(false, false),
EBP_ACCOUNTCHARTS_IMPORT(true, false), EBP_ENTRIES_IMPORT(true, false);
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2011-08-02 11:37:55 UTC (rev 3240)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/MainView.jaxx 2011-08-02 11:39:02 UTC (rev 3241)
@@ -170,8 +170,12 @@
actionIcon='charts-financialperiod'/>
<JMenuItem text="lima.charts.financialstatement" onActionPerformed='getHandler().showFinancialStatementView(this)'
actionIcon='charts-financialstatements'/>
- <JMenuItem text="lima.charts.vatstatement" onActionPerformed='getHandler().showVatChartView(this)'
- actionIcon='charts-vatstatements'/>
+ <JMenu text="lima.charts.vatstatement" actionIcon='charts-vatstatements'>
+ <JMenuItem text="lima.charts.vatstatement" onActionPerformed='getHandler().showVatChartView(this)'
+ actionIcon='charts-vatstatements'/>
+ <JMenuItem text="lima.charts.vatpdf" onActionPerformed='getHandler().showImportExportView(this, ImportExportEnum.PDF_VAT_IMPORT)'
+ actionIcon='charts-vatstatements'/>
+ </JMenu>
</JMenu>
<JMenu text="lima.entries" mnemonic="{'E'}">
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2011-08-02 11:37:55 UTC (rev 3240)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/importexport/ImportExport.java 2011-08-02 11:39:02 UTC (rev 3241)
@@ -172,6 +172,13 @@
datas = extractFile(filePath, charset.getEncoding());
result = importService.importAsCSV(datas, ImportExportEntityEnum.VATSTATEMENT);
break;
+ case PDF_VAT_IMPORT:
+ int response = JOptionPane.showConfirmDialog(waitView,
+ _("lima.importexport.usevatpdf"),
+ _("lima.common.confirmation"), JOptionPane.YES_NO_OPTION);
+ datas = extractFile(filePath, charset.getEncoding());
+ result = importService.importAsPDF(filePath, ImportExportEntityEnum.VATPDF, (response == JOptionPane.YES_OPTION));
+ break;
case EBP_ACCOUNTCHARTS_IMPORT:
//For windows ebp
datas = extractFile(filePath, EncodingEnum.ISOLATIN1.getEncoding());
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2011-08-02 11:37:55 UTC (rev 3240)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/util/DialogHelper.java 2011-08-02 11:39:02 UTC (rev 3241)
@@ -51,6 +51,17 @@
}
/** @deprecated */
+ /*
+ * Use instead: JOptionPane.showMessageDialog (String message,String titre,int type)
+ *
+ * for e.g:
+ * JOptionPane.showMessageDialog(
+ view,
+ _("lima.importexport.export.terminated"),
+ _("lima.importexport.export"),
+ JOptionPane.INFORMATION_MESSAGE);
+ *
+ */
public static void showMessageDialog(String message) {
JFrame f = new JFrame();
f.setIconImage(Resource.getIcon("icons/lima.png").getImage());
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2011-08-02 11:37:55 UTC (rev 3240)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_en_GB.properties 2011-08-02 11:39:02 UTC (rev 3241)
@@ -39,7 +39,14 @@
lima.charts.fiscalperiod.question.morethan12=This period is longer than 12 months. Do you really create this ?
lima.charts.fiscalperiod.question.newyear=Do you want to create a new fiscal year ?
lima.charts.fiscalyear=Fiscal Years
+lima.charts.vatpdf=PDF structure
lima.charts.vatstatement=VAT statement chart
+lima.charts.vatstatement.base=Base VAT statement chart
+lima.charts.vatstatement.deleteparent=Delete subcategories before this line
+lima.charts.vatstatement.developed=Developped VAT statement chart
+lima.charts.vatstatement.nothing=No vat statement chart
+lima.charts.vatstatement.question.remove=Do you really want to delete this line ?
+lima.charts.vatstatement.shortened=Shortened vat statement chart
lima.common.account=Account
lima.common.amount=Amount
lima.common.amountcredit=Credit amount
@@ -61,6 +68,7 @@
lima.common.filter=Filter
lima.common.fin=Terminated
lima.common.globalexception=Global lima exception
+lima.common.info=Information
lima.common.label=Label
lima.common.movmentedfilter=Accounts filtered
lima.common.next=Next
@@ -193,6 +201,7 @@
lima.importexport.import.terminated=Import terminated
lima.importexport.importcsv=Import CSV
lima.importexport.importebp=Import EBP
+lima.importexport.usevatpdf=Would you like to use this PDF when editing the VAT document ?
lima.importexport.vatstatements=VAT chart
lima.importexport.wait=Job in progress…
lima.init.closed=Lima closed at %1$s
@@ -272,6 +281,16 @@
lima.tooltip.filter=<html>Regular expression \:<br/>- accounts interval i..j <br/>- accounts list i,j,k <br/>- Exclude an account -i</html>
lima.tooltip.lettering=<html>Add a letter on many entries <br/>Select many rows with combination ctrl + click</html>
lima.vatreport.listerror=Can't get entries list
+lima.vatstatement.accounts=List of accounts
+lima.vatstatement.boxname=PDF BoxName
+lima.vatstatement.check=
+lima.vatstatement.delete=Delete actual VAT statement chart before import new
+lima.vatstatement.header=
+lima.vatstatement.label=Label
+lima.vatstatement.masteramount=
+lima.vatstatement.mastervatstatement=
+lima.vatstatement.movement.add=Add movement
+lima.vatstatement.subamount=
lima.warning.nimbus.landf=Could not find Numbus Look&Feel
limma.config.thousandseparator.description=
nuitonutil.error.applicationconfig.save=
Modified: trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties
===================================================================
--- trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2011-08-02 11:37:55 UTC (rev 3240)
+++ trunk/lima-swing/src/main/resources/i18n/lima-swing_fr_FR.properties 2011-08-02 11:39:02 UTC (rev 3241)
@@ -27,7 +27,7 @@
lima.charts.financialstatement=Plan BCR
lima.charts.financialstatement.base=Plan BCR de base
lima.charts.financialstatement.developed=Plan BCR développé
-lima.charts.financialstatement.nothing=<html><center>Aucun plan BCR chargé<br/>Veuillez sélectionner un plan par défault, <br/>importer un plan personnalisé<br/> ou annuler pour créer votre propre plan.</center></html>
+lima.charts.financialstatement.nothing=<html><center>Aucun plan BCR chargé<br/>Veuillez sélectionner un plan par défaut, <br/>importer un plan personnalisé<br/> ou annuler pour créer votre propre plan.</center></html>
lima.charts.financialstatement.shortened=Plan BCR abrégé
lima.charts.financialtransaction.question.removeentry=Voulez-vous supprimer cette ligne de transaction?
lima.charts.financialtransaction.question.removetransaction=Voulez-vous supprimer cette transaction?
@@ -39,7 +39,14 @@
lima.charts.fiscalperiod.question.morethan12=La période sélectionnée n'est pas de 12 mois, voulez-vous continuer ?
lima.charts.fiscalperiod.question.newyear=Voulez vous créer un nouvel exercice?
lima.charts.fiscalyear=Exercices
+lima.charts.vatpdf=Structure du pdf
lima.charts.vatstatement=Plan TVA
+lima.charts.vatstatement.base=Plan TVA de base
+lima.charts.vatstatement.deleteparent=Veuillez supprimer les sous-catégories de cette ligne
+lima.charts.vatstatement.developed=Plan TVA développé
+lima.charts.vatstatement.nothing=<html><center>Aucun plan TVA chargé<br/>Veuillez sélectionner un plan par défaut, <br/>importer un plan personnalisé<br/> ou annuler pour créer votre propre plan.</center></html>
+lima.charts.vatstatement.question.remove=Etes vous sur de vouloir supprimer cette ligne ?
+lima.charts.vatstatement.shortened=Plan TVA abrégé
lima.common.account=Compte
lima.common.amount=Montant
lima.common.amountcredit=Total Crédit
@@ -61,6 +68,7 @@
lima.common.filter=Filtrer
lima.common.fin=Terminé
lima.common.globalexception=Global lima exception
+lima.common.info=Information
lima.common.label=Libellé
lima.common.movmentedfilter=Comptes mouvementés
lima.common.next=Suivant
@@ -193,6 +201,7 @@
lima.importexport.import.terminated=Import terminé
lima.importexport.importcsv=Import CSV
lima.importexport.importebp=Import EBP
+lima.importexport.usevatpdf=Voulez-vous utilser ce PDF pour la déclaration de TVA ?
lima.importexport.vatstatements=Plan TVA
lima.importexport.wait=Traitement en cours …
lima.init.closed=Lima fermé à %1$s
@@ -224,7 +233,6 @@
lima.reports.financialstatement=Bilan et Compte de résultat
lima.reports.ledger=Grand Livre
lima.reports.vat=Edition TVA
-lima.reports.vatstatement=
lima.response.no=Non
lima.response.yes=Oui
lima.splash.1=Chargement des services...
@@ -272,6 +280,16 @@
lima.tooltip.filter=<html>Expression régulière \:<br/>- intervalle de compte i..j <br/>- liste de compte i,j,k <br/>- Exclure un compte -i</html>
lima.tooltip.lettering=<html>Pour ajouter une lettre à plusieurs écritures <br/>Sélectionner plusieurs lignes avec la combinaison ctrl + click</html>
lima.vatreport.listerror=Erreur lors de la récupération des données de la liste
+lima.vatstatement.accounts=Liste des comptes
+lima.vatstatement.boxname=PDF BoxName
+lima.vatstatement.check=
+lima.vatstatement.delete=Supprimer le plan TVA actuel avant d'importer
+lima.vatstatement.header=
+lima.vatstatement.label=Libellé
+lima.vatstatement.masteramount=
+lima.vatstatement.mastervatstatement=
+lima.vatstatement.movement.add=Ajouter un regrouprement
+lima.vatstatement.subamount=
lima.warning.nimbus.landf=Le look and feel nymbus n'a pas été trouvé
limma.config.thousandseparator.description=
nuitonutil.error.applicationconfig.save=
1
0
r3240 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart
by vsalaun@users.chorem.org Aug. 2, 2011
by vsalaun@users.chorem.org Aug. 2, 2011
Aug. 2, 2011
Author: vsalaun
Date: 2011-08-02 13:37:55 +0200 (Tue, 02 Aug 2011)
New Revision: 3240
Url: http://chorem.org/repositories/revision/lima/3240
Log:
#347 update VatChart
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartImportForm.jaxx 2011-08-02 11:37:55 UTC (rev 3240)
@@ -0,0 +1,67 @@
+<JDialog modal="true"
+ defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
+ onWindowClosing="performCancel();">
+
+ <jaxx.runtime.swing.JAXXButtonGroup id="radioButtons" javaBean='new JAXXButtonGroup()'/>
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
+ <![CDATA[
+ import org.chorem.lima.enums.VatStatementsChartEnum;
+ getRootPane().setDefaultButton(ok);
+ protected void performCancel() {
+ getRadioButtons().setSelectedValue(null);
+ dispose();
+ }
+ ]]>
+ </script>
+
+ <Table>
+ <row>
+ <cell><JLabel text='lima.charts.vatstatement.nothing' /></cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.vatstatement.shortened' value='{VatStatementsChartEnum.SHORTENED}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.vatstatement.base' value='{VatStatementsChartEnum.BASE}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.charts.vatstatement.developed' value='{VatStatementsChartEnum.DEVELOPED}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JRadioButton text='lima.importexport.import' value='{VatStatementsChartEnum.IMPORT}' buttonGroup="{getRadioButtons()}"
+ selected='true'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <JCheckBox id='deleteVatStatementChart' text='lima.vatstatement.delete' selected='false'/>
+ </cell>
+ </row>
+ <row>
+ <cell>
+ <Table>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartMovementForm.jaxx 2011-08-02 11:37:55 UTC (rev 3240)
@@ -0,0 +1,76 @@
+<JDialog modal="true"
+ defaultCloseOperation="{JDialog.DO_NOTHING_ON_CLOSE}"
+ onWindowClosing="performCancel();">
+
+ <org.chorem.lima.entity.VatStatement id="vatStatement" javaBean='null'/>
+ <Boolean id="addState" javaBean='true'/>
+
+ <script>
+ <![CDATA[
+
+ import org.chorem.lima.entity.VatStatementImpl;
+
+ getRootPane().setDefaultButton(ok);
+
+ protected void performCancel() {
+ setVatStatement(null);
+ dispose();
+ }
+
+ ]]>
+ </script>
+
+ <Table>
+
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.vatstatement.label"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="labelTextField" text="{getVatStatement().getLabel()}"/>
+ <javax.swing.text.Document javaBean="getLabelTextField().getDocument()"
+ onInsertUpdate='getVatStatement().setLabel(getLabelTextField().getText())'
+ onRemoveUpdate='getVatStatement().setLabel(getLabelTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.vatstatement.boxname"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="boxNameTextField" text="{getVatStatement().getBoxName()}"/>
+ <javax.swing.text.Document javaBean="getBoxNameTextField().getDocument()"
+ onInsertUpdate='getVatStatement().setBoxName(getBoxNameTextField().getText())'
+ onRemoveUpdate='getVatStatement().setBoxName(getBoxNameTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.vatstatement.accounts"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField id="accountsTextField" text="{getVatStatement().getAccounts()}"/>
+ <javax.swing.text.Document javaBean="getAccountsTextField().getDocument()"
+ onInsertUpdate='getVatStatement().setAccounts(getAccountsTextField().getText())'
+ onRemoveUpdate='getVatStatement().setAccounts(getAccountsTextField().getText())' />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JLabel text="lima.vatstatement.mastervatstatement"/>
+ </cell>
+ <cell fill="horizontal">
+ <JTextField editable="{false}" id="masterVatStatementTextField"
+ text="{getVatStatement().getMasterVatStatement().getLabel()}" />
+ </cell>
+ </row>
+ <row>
+ <cell fill="none">
+ <JButton text="lima.common.cancel" onActionPerformed="performCancel()"/>
+ </cell>
+ <cell fill="none">
+ <JButton id="ok" text="lima.common.ok" onActionPerformed="dispose()"/>
+ </cell>
+ </row>
+ </Table>
+</JDialog>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2011-08-02 11:37:37 UTC (rev 3239)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTable.java 2011-08-02 11:37:55 UTC (rev 3240)
@@ -24,14 +24,24 @@
*/
package org.chorem.lima.ui.vatchart;
+import java.awt.Color;
+import java.awt.Component;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.entity.VatStatement;
import org.jdesktop.swingx.JXTreeTable;
+import org.jdesktop.swingx.decorator.ColorHighlighter;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
+import org.jdesktop.swingx.treetable.TreeTableModel;
public class VatChartTreeTable extends JXTreeTable
implements KeyListener, MouseListener {
@@ -45,12 +55,48 @@
protected VatChartViewHandler handler;
+ private Highlighter colorLine;
+
public VatChartTreeTable(VatChartViewHandler handler) {
this.handler = handler;
addKeyListener(this);
addMouseListener(this);
+
+ //highlight missing box name lines
+ addMissingBoxNameColor();
+ }
+ /**
+ * Highlights line when line is a leaf and is missing its BoxName parameter
+ */
+ private void addMissingBoxNameColor() {
+ if (colorLine != null) {
+ removeHighlighter(colorLine);
+ }
+ HighlightPredicate predicate = new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer,
+ ComponentAdapter adapter) {
+ JXTreeTable treeTable = handler.view.getTreeTable();
+ TreeTableModel treeTableModel = treeTable.getTreeTableModel();
+ TreePath treePath = treeTable.getPathForRow(adapter.row);
+ VatStatement vatStatement =
+ (VatStatement) treePath.getLastPathComponent();
+ boolean highlighted = false;
+ if (vatStatement.getBoxName() != null) {
+ if (treeTableModel.isLeaf(vatStatement) && vatStatement.getBoxName().isEmpty()) {
+ highlighted = true;
+ }
+ } else {
+ highlighted = true;
+ }
+ return highlighted;
+ }
+ };
+ colorLine =
+ new ColorHighlighter(predicate, new Color(255, 198, 209), null);
+ addHighlighter(colorLine);
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2011-08-02 11:37:37 UTC (rev 3239)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartTreeTableModel.java 2011-08-02 11:37:55 UTC (rev 3240)
@@ -198,10 +198,11 @@
*/
public void addVatStatement(TreePath path, VatStatement vatStatement) throws LimaException {
// Calling account service
- VatStatement parentVatStatementHeader =
- (VatStatement) path.getLastPathComponent();
- if (parentVatStatementHeader == getRoot()) {
- parentVatStatementHeader = null;
+ //fixed bug when path is null
+ VatStatement parentVatStatementHeader = null;
+ if (path != null) {
+ parentVatStatementHeader =
+ (VatStatement) path.getLastPathComponent();
}
vatStatementService.createVatStatement(
parentVatStatementHeader, vatStatement);
@@ -221,6 +222,21 @@
vatStatementService.updateVatStatement(vatStatement);
modelSupport.fireTreeStructureChanged(path);
}
+
+ /**
+ * Remove vatStatement
+ *
+ * @param path
+ * @param object
+ * @throws LimaException
+ */
+ public void removeVatStatementObject(TreePath path, VatStatement vatStatement) throws LimaException {
+ // Calling account service
+ int index = getIndexOfChild(
+ path.getParentPath().getLastPathComponent(), vatStatement);
+ vatStatementService.removeVatStatement(vatStatement);
+ modelSupport.fireChildRemoved(path.getParentPath(), index, vatStatement);
+ }
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx 2011-08-02 11:37:37 UTC (rev 3239)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartView.jaxx 2011-08-02 11:37:55 UTC (rev 3240)
@@ -36,15 +36,41 @@
<row>
<cell fill="both" weightx="1" weighty="1" rows='6'>
<JScrollPane>
- <VatChartTreeTable id="treeTable"
+ <org.chorem.lima.ui.vatchart.VatChartTreeTableModel id="vatTreeTableModel"/>
+ <org.chorem.lima.ui.vatchart.VatChartTreeTable id="treeTable"
constructorParams="getHandler()"
selectionMode="{ListSelectionModel.SINGLE_SELECTION}"
- treeTableModel="{new org.chorem.lima.ui.vatchart.VatChartTreeTableModel()}"
- highlighters="{org.jdesktop.swingx.decorator.HighlighterFactory.createSimpleStriping(new java.awt.Color(222,222,222))}" />
+ treeTableModel="{getVatTreeTableModel()}" />
<javax.swing.ListSelectionModel
javaBean="getTreeTable().getSelectionModel()"
onValueChanged="setSelectedRow(treeTable.getSelectedRow() != -1)"/>
</JScrollPane>
</cell>
</row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="addVatStatementMovement" text="lima.vatstatement.movement.add"
+ onActionPerformed="getHandler().addVatStatementMovement()" />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="updateButton" text="lima.common.update"
+ onActionPerformed="getHandler().updateVatStatement()"
+ enabled="{isSelectedRow()}" />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="removeButton" text="lima.common.remove"
+ onActionPerformed="getHandler().removeVatStatement()"
+ enabled="{isSelectedRow()}" />
+ </cell>
+ </row>
+ <row>
+ <cell fill="horizontal">
+ <JButton id="importButton" text="lima.importexport.import"
+ onActionPerformed="getHandler().importVatStatementChart()" />
+ </cell>
+ </row>
</Table>
\ No newline at end of file
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2011-08-02 11:37:37 UTC (rev 3239)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatchart/VatChartViewHandler.java 2011-08-02 11:37:55 UTC (rev 3240)
@@ -24,13 +24,26 @@
*/
package org.chorem.lima.ui.vatchart;
+import static org.nuiton.i18n.I18n._;
+
+import java.math.BigDecimal;
+
+import javax.swing.JOptionPane;
+import javax.swing.tree.TreePath;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.chorem.lima.business.ImportServiceMonitorable;
+import org.chorem.lima.business.LimaBusinessException;
import org.chorem.lima.business.LimaException;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.VatStatementServiceMonitorable;
+import org.chorem.lima.entity.VatStatement;
+import org.chorem.lima.entity.VatStatementImpl;
+import org.chorem.lima.enums.ImportExportEnum;
+import org.chorem.lima.enums.VatStatementsChartEnum;
import org.chorem.lima.service.LimaServiceFactory;
+import org.chorem.lima.ui.importexport.ImportExport;
import org.jdesktop.swingx.JXTreeTable;
public class VatChartViewHandler implements ServiceListener {
@@ -41,7 +54,7 @@
protected VatStatementServiceMonitorable vatStatementService;
protected VatChartView view;
-
+
protected VatChartViewHandler(VatChartView view) {
this.view = view;
@@ -52,11 +65,196 @@
ImportServiceMonitorable.class).addListener(this);
}
- public void refresh(){
- JXTreeTable treeTable = view.getTreeTable();
+ public void addVatStatementMovement(){
+
+ VatChartTreeTableModel treeTableModel =
+ (VatChartTreeTableModel) view.getTreeTable().getTreeTableModel();
+
+ int selectedRow = view.getTreeTable().getSelectedRow();
+ // get current selection path
+ TreePath treePath = null;
+ if (selectedRow == -1) {
+ treePath = null;
+ } else {
+ treePath = view.getTreeTable().getPathForRow(selectedRow);
+ }
+
+ VatStatement newVatChartMovement = new VatStatementImpl();
+ VatChartMovementForm vatChartMovementForm =
+ new VatChartMovementForm(view);
+ VatStatement masterVatStatement = null;
+ if (selectedRow != -1) {
+ masterVatStatement = (VatStatement)treePath.getLastPathComponent();
+ }
+ newVatChartMovement.setMasterVatStatement(masterVatStatement);
+ vatChartMovementForm.setVatStatement(newVatChartMovement);
+ // jaxx constructor don't call super() ?
+ vatChartMovementForm.setLocationRelativeTo(view);
+ vatChartMovementForm.setVisible(true);
+ newVatChartMovement = vatChartMovementForm.getVatStatement();
+
+ // null == cancel action
+ if (newVatChartMovement != null) {
+ newVatChartMovement.setAmount(BigDecimal.ZERO);
+ // add it
+ try {
+ treeTableModel.addVatStatement(treePath, newVatChartMovement);
+ } catch (LimaBusinessException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add Vat chart Movement", eee);
+ }
+ JOptionPane.showMessageDialog(
+ view,
+ eee.getMessage(),
+ _("lima.common.error"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add Vat chart Movement", eee);
+ }
+ JOptionPane.showMessageDialog(
+ view,
+ eee.getMessage(),
+ _("lima.common.error"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ refresh();
+ }
+ }
+
+ public void updateVatStatement() {
+
+ JXTreeTable treeTable = view.getTreeTable();
+ VatChartTreeTableModel treeTableModel =
+ (VatChartTreeTableModel) treeTable.getTreeTableModel();
+
+ // get selected account
+ int selectedRow = view.treeTable.getSelectedRow();
+ TreePath treePath = view.treeTable.getPathForRow(selectedRow); // not null
+ VatStatement vatStatement =
+ (VatStatement) treePath.getLastPathComponent();
+ //update Account or update SubLedger
+ if (vatStatement != null) {
+ // get current selection path
+ if ( selectedRow != -1) {
+ treePath = view.treeTable.getPathForRow(selectedRow);
+ } else {
+ treePath = new TreePath(treeTableModel.getRoot());
+ }
+ VatChartMovementForm vatChartMovementForm =
+ new VatChartMovementForm(view);
+ if (vatStatement.getMasterVatStatement() == null) {
+ VatStatement masterVatStatement = new VatStatementImpl();
+ vatStatement.setMasterVatStatement(masterVatStatement);
+ }
+ vatChartMovementForm.setVatStatement(vatStatement);
+ // jaxx constructor don't call super() ?
+ vatChartMovementForm.setLocationRelativeTo(view);
+ vatChartMovementForm.setVisible(true);
+ // null == cancel action
+ vatStatement = vatChartMovementForm.getVatStatement();
+ //if action confirmed
+ if (vatStatement != null){
+ // update it
+ try {
+ treeTableModel.updateVatStatement(
+ treePath, vatStatement);
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't add update", eee);
+ }
+ JOptionPane.showMessageDialog(
+ view,
+ eee.getMessage(),
+ _("lima.common.error"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+ refresh();
+ }
+
+ public void importVatStatementChart(){
+ VatChartImportForm form =
+ new VatChartImportForm();
+ form.setLocationRelativeTo(view);
+ form.setVisible(true);
+
+ Object value = form.getRadioButtons().getSelectedValue();
+ // if action confirmed
+ if (value != null){
+ if (form.getDeleteVatStatementChart().isSelected()){
+ try {
+ vatStatementService.removeAllVatStatement();
+
+ } catch (LimaException eee) {
+ if (log.isDebugEnabled()){
+ log.debug("Can't delete financial statement chart", eee);
+ }
+ }
+ }
+ VatStatementsChartEnum defaultVatStatementsEnum =
+ (VatStatementsChartEnum) value;
+ ImportExport importExport = ImportExport.getInstance(view);
+ importExport.importExport(ImportExportEnum.CSV_VAT_IMPORT,
+ defaultVatStatementsEnum.getFilePath(), true);
+ refresh();
+ }
+ }
+
+ /**
+ * Ask for user to remove for selected account, and remove it if confirmed.
+ */
+ public void removeVatStatement() {
+ JXTreeTable treeTable = view.getTreeTable();
VatChartTreeTableModel treeTableModel =
(VatChartTreeTableModel) treeTable.getTreeTableModel();
- try {
+
+ // Any row selected
+ int selectedRow = view.treeTable.getSelectedRow();
+ if ( selectedRow != -1) {
+ int n = JOptionPane.showConfirmDialog(view,
+ _("lima.charts.vatstatement.question.remove"),
+ _("lima.common.confirmation"),
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
+ if (n == JOptionPane.YES_OPTION) {
+ // update view of treetable
+ TreePath treePath = treeTable.getPathForRow(selectedRow);
+ VatStatement vatStatement =
+ (VatStatement) treePath.getLastPathComponent();
+ if (!treeTableModel.isLeaf(vatStatement)) {
+ JOptionPane.showMessageDialog(
+ view,
+ _("lima.charts.vatstatement.deleteparent"),
+ _("lima.common.info"),
+ JOptionPane.INFORMATION_MESSAGE);
+ } else {
+ try{
+ treeTableModel.removeVatStatementObject(
+ treePath, vatStatement);
+ } catch (LimaException eee) {
+ if (log.isErrorEnabled()) {
+ log.error("Can't delete account", eee);
+ }
+ JOptionPane.showMessageDialog(
+ view,
+ eee.getMessage(),
+ _("lima.common.error"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+ refresh();
+ }
+ }
+
+ public void refresh(){
+ JXTreeTable treeTable = view.getTreeTable();
+ VatChartTreeTableModel treeTableModel =
+ (VatChartTreeTableModel) treeTable.getTreeTableModel();
+ try {
treeTableModel.refreshTree();
} catch (LimaException eee) {
if(log.isDebugEnabled()){
1
0
r3239 - trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports
by vsalaun@users.chorem.org Aug. 2, 2011
by vsalaun@users.chorem.org Aug. 2, 2011
Aug. 2, 2011
Author: vsalaun
Date: 2011-08-02 13:37:37 +0200 (Tue, 02 Aug 2011)
New Revision: 3239
Url: http://chorem.org/repositories/revision/lima/3239
Log:
#347 update VatReport
Added:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java
Modified:
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx
trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
Added: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java (rev 0)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportPeriodSearchPanel.java 2011-08-02 11:37:37 UTC (rev 3239)
@@ -0,0 +1,138 @@
+package org.chorem.lima.ui.vatreports;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Calendar;
+import java.util.Date;
+
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import org.apache.commons.lang.time.DateUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.chorem.lima.entity.FinancialPeriod;
+import org.chorem.lima.entity.FiscalPeriod;
+import org.chorem.lima.enums.ComboBoxDatesEnum;
+import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxModel;
+import org.chorem.lima.ui.combobox.FinancialPeriodComboBoxRenderer;
+import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel;
+import org.chorem.lima.ui.combobox.FiscalPeriodComboBoxRenderer;
+import org.jdesktop.swingx.JXDatePicker;
+
+public class VatReportPeriodSearchPanel extends JPanel {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final Log log =
+ LogFactory.getLog(VatReportPeriodSearchPanel.class);
+
+ protected VatReportViewHandler handler;
+
+ public VatReportPeriodSearchPanel(VatReportViewHandler handler) {
+
+ this.handler = handler;
+
+ //init date
+ refresh(ComboBoxDatesEnum.FISCAL_PERIOD);
+ }
+
+ public void refresh(ComboBoxDatesEnum comboBoxPeriodEnum){
+
+ switch (comboBoxPeriodEnum) {
+ case PERIOD:
+ // get begin date
+ Calendar calendarBegin = Calendar.getInstance();
+ // set begindate to JAN 1 - 0:00.000 of this years
+ Date beginDate = calendarBegin.getTime();
+ beginDate = DateUtils.truncate(beginDate, Calendar.YEAR);
+ //handler().setBeginDate(beginDate);
+
+ // get end date
+ Calendar calendarEnd = Calendar.getInstance();
+ Date endDate = calendarEnd.getTime();
+ //handler().setEndDate(endDate);
+ JLabel beginDateLabel = new JLabel(_("lima.common.begindate"));
+ final JXDatePicker beginDatePicker = new JXDatePicker(beginDate);
+ ActionListener beginDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.tableModel.setBeginDate(beginDatePicker.getDate());
+ handler.refresh();
+ }
+ };
+ handler.tableModel.setBeginDate(beginDatePicker.getDate());
+ beginDatePicker.addActionListener(beginDateActionListener);
+
+ JLabel endDateLabel = new JLabel(_("lima.common.enddate"));
+ final JXDatePicker endDatePicker = new JXDatePicker(endDate);
+ ActionListener endDateActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ handler.tableModel.setEndDate(endDatePicker.getDate());
+ handler.refresh();
+ }
+ };
+ handler.tableModel.setEndDate(endDatePicker.getDate());
+ endDatePicker.addActionListener(endDateActionListener);
+ handler.refresh();
+
+ this.removeAll();
+ this.add(beginDateLabel);
+ this.add(beginDatePicker);
+ this.add(endDateLabel);
+ this.add(endDatePicker);
+ break;
+
+ case FISCAL_PERIOD:
+ FiscalPeriodComboBoxModel fiscalModel = new FiscalPeriodComboBoxModel(true);
+ FiscalPeriodComboBoxRenderer fiscalRenderer = new FiscalPeriodComboBoxRenderer();
+ final JComboBox fiscalPeriod = new JComboBox(fiscalModel);
+ fiscalPeriod.setRenderer(fiscalRenderer);
+ fiscalPeriod.setEditable(false);
+ ActionListener fiscalPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FiscalPeriod fPeriod = (FiscalPeriod) fiscalPeriod.getSelectedItem();
+ if (fPeriod != null){
+ handler.tableModel.setBeginDate(fPeriod.getBeginDate());
+ handler.tableModel.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ fiscalPeriod.addActionListener(fiscalPeriodActionListener);
+
+ this.removeAll();
+ this.add(fiscalPeriod);
+ break;
+
+ case FINANCIAL_PERIOD:
+ FinancialPeriodComboBoxModel financialModel = new FinancialPeriodComboBoxModel(true);
+ FinancialPeriodComboBoxRenderer financialRenderer = new FinancialPeriodComboBoxRenderer();
+ final JComboBox financialPeriod = new JComboBox(financialModel);
+ financialPeriod.setRenderer(financialRenderer);
+ financialPeriod.setEditable(false);
+ ActionListener financialPeriodActionListener = new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ FinancialPeriod fPeriod = (FinancialPeriod) financialPeriod.getSelectedItem();
+ if (fPeriod !=null){
+ handler.tableModel.setBeginDate(fPeriod.getBeginDate());
+ handler.tableModel.setEndDate(fPeriod.getEndDate());
+ handler.refresh();
+ }
+ }
+ };
+ financialPeriod.addActionListener(financialPeriodActionListener);
+ this.removeAll();
+ this.add(financialPeriod);
+ break;
+ }
+
+ }
+
+}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java 2011-08-01 08:03:10 UTC (rev 3238)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTable.java 2011-08-02 11:37:37 UTC (rev 3239)
@@ -24,20 +24,13 @@
*/
package org.chorem.lima.ui.vatreports;
-import java.awt.Color;
-import java.awt.Component;
import java.math.BigDecimal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.chorem.lima.entity.FinancialPeriod;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellEditor;
import org.chorem.lima.ui.celleditor.BigDecimalTableCellRenderer;
import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.decorator.ColorHighlighter;
-import org.jdesktop.swingx.decorator.ComponentAdapter;
-import org.jdesktop.swingx.decorator.HighlightPredicate;
-import org.jdesktop.swingx.decorator.Highlighter;
public class VatReportTable extends JXTable {
@@ -50,8 +43,6 @@
protected VatReportViewHandler handler;
protected VatReportTableModel model;
-
- private Highlighter colorTransaction;
public VatReportTable(VatReportViewHandler handler) {
@@ -63,31 +54,6 @@
setDefaultEditor(BigDecimal.class, new BigDecimalTableCellEditor());
//Get new BigDecimal renderer
setDefaultRenderer(BigDecimal.class, new BigDecimalTableCellRenderer());
-
- //highlight financial financial transactions
- //FIXME 2011.06.09 doesn't work !!!
- addMonthColor();
}
-
- /*
- * Color the background row in grey if the month number is even (pair in french)
- */
- protected void addMonthColor() {
- HighlightPredicate predicate = new HighlightPredicate() {
- @Override
- public boolean isHighlighted(Component renderer,
- ComponentAdapter adapter) {
- Object object = model.getElementAt(adapter.row);
- if (object instanceof FinancialPeriod) {
- return true;
- } else {
- return false;
- }
- }
- };
- colorTransaction =
- new ColorHighlighter(predicate, new Color(222,222,222), null);
- addHighlighter(colorTransaction);
- }
}
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2011-08-01 08:03:10 UTC (rev 3238)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportTableModel.java 2011-08-02 11:37:37 UTC (rev 3239)
@@ -27,7 +27,7 @@
import static org.nuiton.i18n.I18n._;
import java.math.BigDecimal;
-import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import javax.swing.table.AbstractTableModel;
@@ -41,7 +41,6 @@
import org.chorem.lima.business.ReportServiceMonitorable;
import org.chorem.lima.business.ServiceListener;
import org.chorem.lima.business.VatStatementServiceMonitorable;
-import org.chorem.lima.entity.FiscalPeriod;
import org.chorem.lima.service.LimaServiceFactory;
import org.chorem.lima.util.ErrorHelper;
import org.nuiton.topia.TopiaException;
@@ -62,18 +61,13 @@
protected ImportServiceMonitorable importService;
/** selected financial period */
- protected FiscalPeriod selectedFiscalPeriod;
+ protected Date selectedBeginDate;
+ protected Date selectedEndDate;
/** data cache */
protected List<VatStatementAmounts> cacheDataList;
/**
- * list of BigDecimal, save the difference between the number given by the VAT chart
- * and the number given by the user afterwards
- */
- private List<BigDecimal> diffBigDecimalList = new ArrayList<BigDecimal>(); //list of 65 elements
-
- /**
* variable used for the document edition,
* if "true" then the document will be automatically filled in
* if "false" the the document will be empty
@@ -108,11 +102,11 @@
List<VatStatementAmounts> list = null;
- if (selectedFiscalPeriod != null) {
+ if ((selectedBeginDate != null ) || (selectedEndDate != null)) {
try {
list = vatStatementService.vatStatementReport(
- selectedFiscalPeriod.getBeginDate(),
- selectedFiscalPeriod.getEndDate());
+ getBeginDate(),
+ getEndDate());
}
catch (LimaException eee) {
if (log.isErrorEnabled()) {
@@ -133,15 +127,6 @@
}
ErrorHelper.showErrorDialog("Can't get VAT list", eee);
}
-
- if (cacheDataList != null) {
- for (int index = 0; index < cacheDataList.size(); index++) {
- //sets the BigDecimal difference list
- if (diffBigDecimalList.size() != 65) {
- diffBigDecimalList.add(BigDecimal.ZERO);
- }
- }
- }
fireTableDataChanged();
}
@@ -152,7 +137,7 @@
switch (column) {
case 0:
- result = String.class; //libellé
+ result = String.class; //label
break;
case 1:
result = BigDecimal.class; //solde
@@ -210,12 +195,8 @@
result = value.getLabel();
break;
case 1:
- if (value.getAmount() != null) {
- //the number showed is the number given by the chart plus
- //the number calculated from the diffBigDecimalList
- //diffBigDecimalList can be a negative number !
- result = value.getAmount()
- .add(diffBigDecimalList.get(row));
+ if ((value.getAmount() != null) && (!value.isHeader())) {
+ result = value.getAmount();
} else {
result = null;
}
@@ -224,26 +205,21 @@
}
return result;
}
+
+ public void setBeginDate(Date date) {
+ selectedBeginDate = date;
+ }
- @Override
- public void setValueAt(Object value, int row, int column) {
- //check first if the user has changed the number value
- if (!getValueAt(row, column).equals((BigDecimal)value)) {
- //if so set the difference between the values inside diffBigDecimalList
- BigDecimal diff = diffBigDecimalList.get(row)
- .add(((BigDecimal) value)
- .subtract((BigDecimal)getValueAt(row, column)));
- diffBigDecimalList.set(row, diff);
- }
+ public Date getBeginDate() {
+ return selectedBeginDate;
}
- public FiscalPeriod getFiscalPeriod() {
- return selectedFiscalPeriod;
+ public void setEndDate(Date date) {
+ selectedEndDate = date;
}
- public void setFiscalPeriod(FiscalPeriod fiscalPeriod){
- selectedFiscalPeriod = fiscalPeriod;
- refresh();
+ public Date getEndDate() {
+ return selectedEndDate;
}
public String getAutocomplete() {
@@ -258,19 +234,9 @@
}
}
- public String getDiffBigDecimalList() {
- String result = "";
- for (BigDecimal bigdecimal : diffBigDecimalList) {
- result += bigdecimal.toString() + "_";
- }
- result = result.substring(0, result.length()-1);
- return result;
- }
-
@Override
public boolean isCellEditable(int row, int column) {
- //only the second column can be editable, and also if it contains a number
- return ((column ==1) && (getValueAt(row, column) != null));
+ return false;
}
@Override
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx 2011-08-01 08:03:10 UTC (rev 3238)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportView.jaxx 2011-08-02 11:37:37 UTC (rev 3239)
@@ -37,6 +37,9 @@
import org.chorem.lima.ui.vatreports.VatTableModel;
import org.chorem.lima.ui.vatreports.VatTable;
+ import org.chorem.lima.enums.ComboBoxDatesEnum;
+ VatReportPeriodSearchPanel periodSearchPanel = new VatReportPeriodSearchPanel(handler);
+
void $afterCompleteSetup() {
getHandler().refresh();
}
@@ -50,12 +53,11 @@
</cell>
<cell anchor="west">
<org.chorem.lima.ui.combobox.FiscalPeriodComboBoxModel id="modelFiscalPeriod"/>
- <JComboBox id="fiscalPeriodComboBox"
- model="{getModelFiscalPeriod()}"
- renderer="{new FiscalPeriodComboBoxRenderer()}"
- onActionPerformed="getVatReportTableModel().setFiscalPeriod((FiscalPeriod)fiscalPeriodComboBox.getSelectedItem())"
- editable="false"/>
+ <JComboBox id="periodComboBox" javaBean="new JComboBox(ComboBoxDatesEnum.descriptions())"
+ onActionPerformed="periodSearchPanel.refresh(ComboBoxDatesEnum.valueOfDescription((String) periodComboBox.getSelectedItem()));
+ validate(); repaint()"/>
</cell>
+ <cell><VatReportPeriodSearchPanel javaBean="periodSearchPanel"/></cell>
<cell>
<JCheckBox id='autocomplete' text='lima.common.autocomplete' selected='true'
onActionPerformed="getVatReportTableModel().setAutocomplete()"/>
Modified: trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java
===================================================================
--- trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2011-08-01 08:03:10 UTC (rev 3238)
+++ trunk/lima-swing/src/main/java/org/chorem/lima/ui/vatreports/VatReportViewHandler.java 2011-08-02 11:37:37 UTC (rev 3239)
@@ -78,16 +78,15 @@
* Edit VAT document
*/
public void editVat() {
- if (tableModel.getFiscalPeriod() != null){
+ if ((tableModel.getBeginDate() != null) || (tableModel.getEndDate() != null)){
String address = LimaConfig.getInstance().getHostAdress();
try {
String url = "http://"+address+":"+port+"/?beginDate="
- + dateFormat.format(tableModel.getFiscalPeriod().getBeginDate())
- + "&endDate=" + dateFormat.format(tableModel.getFiscalPeriod().getEndDate())
+ + dateFormat.format(tableModel.getBeginDate())
+ + "&endDate=" + dateFormat.format(tableModel.getEndDate())
+ "&format=.pdf&model=" + DocumentsEnum.VAT.getFileName()
- + "&autocomplete=" + tableModel.getAutocomplete()
- + "&datas=" + tableModel.getDiffBigDecimalList();
+ + "&autocomplete=" + tableModel.getAutocomplete();
Desktop.getDesktop().browse(new URI(url));
} catch (IOException e) {
log.error("Can't open browser", e);
1
0
Author: vsalaun
Date: 2011-08-01 10:03:10 +0200 (Mon, 01 Aug 2011)
New Revision: 3238
Url: http://chorem.org/repositories/revision/lima/3238
Log:
add contributor to project
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-07-28 14:48:10 UTC (rev 3237)
+++ trunk/pom.xml 2011-08-01 08:03:10 UTC (rev 3238)
@@ -289,6 +289,16 @@
<role>Développeur</role>
</roles>
</contributor>
+ <contributor>
+ <name>Victor Salaun</name>
+ <email>salaun(a)codelutin.com</email>
+ <organization>Code Lutin</organization>
+ <organizationUrl>http://www.codelutin.com</organizationUrl>
+ <timezone>+2</timezone>
+ <roles>
+ <role>Développeur</role>
+ </roles>
+ </contributor>
</contributors>
<!-- ************************************************************* -->
1
0