Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/OpenConcerto/.classpath |
---|
37,16 → 37,16 |
<classpathentry kind="lib" path="lib/icudata_56.jar"/> |
<classpathentry kind="lib" path="lib/javax.mail-1.6.0.jar"/> |
<classpathentry kind="lib" path="lib/json-smart-2.2.1.jar"/> |
<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.40-bin.jar"/> |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> |
<classpathentry exported="true" kind="lib" path="lib/poi-3.17.jar"/> |
<classpathentry kind="lib" path="lib/piccolo-1.04.jar"/> |
<classpathentry kind="lib" path="lib/fontbox-2.0.19.jar"/> |
<classpathentry kind="lib" path="lib/javax.activation-1.1.1.jar"/> |
<classpathentry kind="lib" path="lib/pdfbox-2.0.19.jar"/> |
<classpathentry kind="lib" path="lib/pdfbox.jar"/> |
<classpathentry kind="lib" path="lib/flatlaf-0.41.jar"/> |
<classpathentry kind="lib" path="lib/postgresql-42.2.8.jar"/> |
<classpathentry kind="lib" path="lib/jsch-0.1.55.jar"/> |
<classpathentry exported="true" kind="lib" path="lib/poi-5.0.0.jar"/> |
<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.45-bin.jar"/> |
<classpathentry kind="lib" path="lib/flatlaf-1.2.jar"/> |
<classpathentry kind="lib" path="lib/fontbox-2.0.22.jar"/> |
<classpathentry kind="lib" path="lib/pdfbox-2.0.22.jar"/> |
<classpathentry kind="output" path="bin"/> |
</classpath> |
/trunk/OpenConcerto/lib/poi-4.1.0.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/flatlaf-0.41.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/fontbox-2.0.19.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/pdfbox-2.0.19.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/mysql-connector-java-5.1.40-bin.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/poi-3.17.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.badSecurity.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.badSecurity.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/pdfbox-2.0.22.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/pdfbox-2.0.22.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/jOpenCalendar.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/flatlaf-1.2.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/flatlaf-1.2.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/pdfbox2d.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/pdfbox2d.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/mysql-connector-java-5.1.45-bin.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/mysql-connector-java-5.1.45-bin.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/poi-5.0.0.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/poi-5.0.0.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/fontbox-2.0.22.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/fontbox-2.0.22.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Labels/test.graphicspl |
---|
New file |
0,0 → 1,30 |
<?xml version="1.0" encoding="UTF-8" ?> |
<graphicspl width="600" height="400" dpi="300" |
printratio="0.5"> |
<rectangle fill="true" x="0" y="380" width="600" height="20" |
color="#FF000" /> |
<image x="420" y="20" width="160" height="160" file="icon.png" /> |
<text x="10" y="10" fontsize="20" font="Verdana">OpenConcerto</text> |
<text x="390" y="60" fontsize="40" font="Verdana" align="right" |
wrap="true" maxwidth="200">Atome Premium</text> |
<text x="390" y="140" fontsize="40" font="Verdana" align="right" |
color="#12000">56.00 € HT</text> |
<barcode x="10" y="120" modulewidth="4" type="datamatrix" |
width="200">OpenConcerto</barcode> |
<barcode x="10" y="220" type="gs1" height="100" modulewidth="6" |
fontsize="25">1234566546 |
</barcode> |
<text x="300" y="200" fontsize="10" font="Verdana" align="center" |
color="#666666">ARTICLE EN PROMOTION - NON ECHANGEABLE</text> |
<rectangle fill="false" x="0" y="0" width="599" height="399" /> |
</graphicspl> |
/trunk/OpenConcerto/Configuration/Template/Labels/icon.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Labels/icon.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/BonReception.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/CommandeClient.odsp |
---|
1,6 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">65</sheet> |
<sheet number="0">66</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/trunk/OpenConcerto/Configuration/Template/Default/SituationCompte.xml |
---|
New file |
0,0 → 1,57 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<element0 location="A1" type="Value" ValueName="SOCIETE_NOM"> |
</element0> |
<element0 location="A2" type="Value" ValueName="SOCIETE_ADRESSE"> |
</element0> |
<element0 location="A4" type="Value" ValueName="SOCIETE_VILLE"> |
</element0> |
<element0 location="A5" type="Value" prefix="Tél:" ValueName="SOCIETE_TEL"> |
</element0> |
<element0 location="D6" type="Value" ValueName="NOM_CLIENT"> |
</element0> |
<element0 location="F8" type="Value" ValueName="DATE"> |
</element0> |
<element0 location="G51" type="Value" ValueName="TOTAL_ECHEANCE"> |
</element0> |
<element0 location="G52" type="Value" ValueName="TOTAL_FUTUR"> |
</element0> |
<element0 location="G53" type="Value" ValueName="TOTAL_PASSE"> |
</element0> |
<table0 firstLine="17" endLine="50" endPageLine="58" lastColumn="G" base="Societe" table="ECHEANCE_CLIENT" pageRef="F1"> |
<element location="A" type="fill" useOOFormat="false"> |
<field base="Societe" name="DATE"/> |
</element> |
<element location="B" type="fill" useOOFormat="false"> |
<field base="Societe" name="PIECE"/> |
</element> |
<element location="C" type="fill" useOOFormat="false" maxChar="25"> |
<field base="Societe" name="LIBELLE"/> |
</element> |
<element location="D" type="fill" useOOFormat="false"> |
<field base="Societe" name="DATE_ECHEANCE"/> |
</element> |
<element location="E" type="fill" > |
<field base="Societe" name="DU"/> |
</element> |
<element location="F" type="fill" > |
<field base="Societe" name="REGLE"/> |
</element> |
<element location="G" type="fill" > |
<field base="Societe" name="SOLDE"/> |
</element> |
</table0> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/ListeDebiteur.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/JournauxAnalytique.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ReleveCheque.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Operations Report.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingTaxeComplementaire.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/DIPE.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatVentes.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.odsp |
---|
1,6 → 1,7 |
<odsp> |
<spliteveryrow> |
<sheet number="0">61</sheet> |
<sheet number="0">65</sheet> |
</spliteveryrow> |
<offset x="20" y ="20"/> |
<resize percent="92"/> |
<offset x="23" y ="0"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/ExportArticle.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/VentilationAnalytique.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Courrier.odt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Commande.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingVentes.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/JournauxMois.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureSituation.xml |
---|
24,7 → 24,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingClient.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingClient.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/FicheArticle.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/DepotCheque.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">56</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFacture.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Relance1.odt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/RepartitionAnalytique.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FichePaye.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Relance3.odt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Commande.odsp |
---|
1,6 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">57</sheet> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/trunk/OpenConcerto/Configuration/Template/Default/DepotCheque.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/DepotCheque.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">57</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/BalanceAgee.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Devis.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureTicket.xml |
---|
New file |
0,0 → 1,90 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<element0 location="B1" type="Value" ValueName="SOCIETE_NOM"> |
</element0> |
<element0 location="B2" type="Value" ValueName="SOCIETE_RUE"> |
</element0> |
<element0 location="B3" type="Value" ValueName="SOCIETE_CODE_POSTAL_VILLE"> |
</element0> |
<element0 location="B5" type="Value" ValueName="SOCIETE_TYPE_CAPITAL"> |
</element0> |
<element0 location="B6" type="Value" ValueName="SOCIETE_SIRET" prefix="N° de SIREN "> |
</element0> |
<element0 location="B7" type="Value" ValueName="SOCIETE_TVA" prefix="N° de TVA "> |
</element0> |
<element0 location="B8" type="Value" ValueName="SOCIETE_TEL" prefix="N° de Téléphone "> |
</element0> |
<element0 location="B10" type="Value" ValueName="SOCIETE_MAIL" prefix="Email "> |
</element0> |
<element0 location="B13" type="Value" ValueName="NUMERO"> |
</element0> |
<element0 location="C13" type="Value" ValueName="DATE"> |
</element0> |
<element0 location="H10" type="Value" ValueName="CLIENT"> |
</element0> |
<element0 location="H11" type="Value" ValueName="ADRESSE"> |
</element0> |
<element0 location="L62" type="Value" ValueName="T_HT"> |
</element0> |
<element0 location="L65" type="Value" ValueName="T_TTC"> |
</element0> |
<element0 location="L63" type="Value" ValueName="T_TVA_1"> |
</element0> |
<element0 location="I63" type="Value" ValueName="TVA_1"> |
</element0> |
<element0 location="L64" type="Value" ValueName="T_TVA_2"> |
</element0> |
<element0 location="I64" type="Value" ValueName="TVA_2"> |
</element0> |
<table0 endPageLine="66" firstLine="20" endLine="60" blankLineBeforeStyle="Titre 1,Titre 2" lastColumn="K" |
base="Societe" table="SAISIE_VENTE_FACTURE_ELEMENT" pageRef="L16"> |
<element location="B" type="fill" cellSize="45"> |
<field name="CODE" /> |
</element> |
<element location="C" type="fill" cellSize="45"> |
<field name="NOM" /> |
</element> |
<element location="H" type="fill"> |
<field name="POURCENT_REMISE"> |
<exclude value="0.000000" /> |
</field> |
</element> |
<element location="I" type="fill"> |
<field name="PV_HT" type="devise"> |
<exclude value="0.000000" /> |
</field> |
</element> |
<element location="J" type="fill"> |
<field name="QTE" /> |
</element> |
<element location="K" type="fill"> |
<field name="TVA"> |
</field> |
</element> |
<element location="L" type="fill"> |
<field name="T_HT_REMISE" type="devise"> |
<exclude value="0.000000" /> |
</field> |
</element> |
</table0> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/Journaux.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/ReleveChequeEmis.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/LivrePaye.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/AvoirF.xml |
---|
27,7 → 27,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/BonLivraison.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FicheRelance.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatChargesPaye.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FactureFournisseur.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN " /> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET " /> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/Avoir.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatVentes.xml |
---|
124,4 → 124,28 |
</element> |
</table3> |
<element4 location="A4" type="Value" ValueName="DATE"> |
</element4> |
<table4 firstLine="7" endLine="52" endPageLine="54" lastColumn="F" base="Societe" table="SAISIE_VENTE_FACTURE_ELEMENT"> |
<element location="A" type="fill"> |
<field base="Societe" name="CODE" /> |
</element> |
<element location="B" type="fill"> |
<field base="Societe" name="NOM" /> |
</element> |
<element location="D" type="fill"> |
<field base="Societe" name="QTE" /> |
</element> |
<element location="E" type="fill"> |
<field base="Societe" name="QTE_REEL" /> |
</element> |
<element location="F" type="fill"> |
<field base="Societe" name="QTE_MIN" /> |
</element> |
</table4> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/DemandePrix.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/CommandeClient.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingClient.xml |
---|
New file |
0,0 → 1,36 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<element location="C2" type="Value" ValueName="DATE"> |
</element> |
<element location="C5" type="Value" ValueName="CLIENT" > |
</element> |
<table firstLine="8" endLine="305" endPageLine="305" lastColumn="H" > |
<element location="B" type="fill"> |
<field base="Societe" name="NUMERO_FACTURE"/> |
</element> |
<element location="C" type="fill"> |
<field base="Societe" name="DATE"/> |
</element> |
<element location="D" type="fill" cellSize="24"> |
<field base="Societe" name="NOM"/> |
</element> |
<element location="E" type="fill"> |
<field base="Societe" name="ECHEANCE"/> |
</element> |
<element location="F" type="fill"> |
<field base="Societe" name="T_TTC"/> |
</element> |
<element location="G" type="fill"> |
<field base="Societe" name="REGLE"/> |
</element> |
<element location="H" type="fill"> |
<field base="Societe" name="DU"/> |
</element> |
</table> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStocks.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Balance.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/SituationCompte.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/SituationCompte.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/BonReception.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ListeFacture.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingEcoContribution.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFacture.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/SituationCompte.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="0" y ="0"/> |
<resize percent="100"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/BonReception.odsp |
---|
1,6 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">57</sheet> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/trunk/OpenConcerto/Configuration/Template/Default/DemandePrix.odsp |
---|
2,8 → 2,4 |
<spliteveryrow> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/DepotCheque.xml |
---|
New file |
0,0 → 1,60 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<element location="H1" type="fill"> |
<field base="Societe" name="DATE"> |
</field> |
</element> |
<element location="K56" type="fill"> |
<field base="Societe" name="MONTANT" type="devise"> |
</field> |
</element> |
<element location="A55" type="fill"> |
<field base="Societe" name="NOM"> |
</field> |
</element> |
<element location="A56" type="fill"> |
<field base="Societe" name="ID_BANQUE"> |
<field base="Societe" name="NOM" prefix ="Dépôt sur la banque "/> |
</field> |
</element> |
<table endPageLine="56" firstLine="5" endLine="53" lastColumn="L" base="Societe" table="DEPOT_CHEQUE_ELEMENT"> |
<element location="A" type="fill"> |
<field name="BANQUE" /> |
</element> |
<element location="B" type="fill"> |
<field name="DATE" /> |
</element> |
<element location="C" type="fill"> |
<field name="NUMERO" /> |
</element> |
<element location="E" type="fill"> |
<field name="ID_CLIENT" > |
<field name="NOM" /> |
</field> |
</element> |
<element location="J" type="fill"> |
<field name="PIECE" /> |
</element> |
<element location="K" type="fill"> |
<field name="MONTANT" type="devise"/> |
</element> |
<element location="L" type="LineReference"> |
<field name="MONTANT" type="LineReference"/> |
</element> |
</table> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/Commande.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Devis.xml |
---|
23,7 → 23,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
62,7 → 62,7 |
<field name="OBJET" /> |
</element> |
<element location="I10" type="fill"> |
<element location="H10" type="fill"> |
<field name="ID_CLIENT"> |
<field name="FORME_JURIDIQUE" /> |
<field name="NOM" /> |
69,7 → 69,7 |
</field> |
</element> |
<element location="I11" type="address.customer.full"> |
<element location="H11" type="address.customer.full"> |
</element> |
<element location="L63" type="fill"> |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureSituation.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Relance2.odt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/GrandLivre.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.xml |
---|
New file |
0,0 → 1,33 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<!-- <element location="A3" type="Value" ValueName="DATE"> |
</element> |
--> |
<table firstLine="2" endLine="17000" endPageLine="25000" lastColumn="E" table="SAISIE_VENTE_FACTURE"> |
<element location="A" type="fill"> |
<field name="FAMILLE" /> |
</element> |
<element location="B" type="fill"> |
<field name="CODE" /> |
</element> |
<element location="C" type="fill"> |
<field name="NOM" /> |
</element> |
<element location="D" type="fill"> |
<field name="TAILLE" /> |
</element> |
<element location="E" type="fill"> |
<field name="COULEUR" /> |
</element> |
<element location="F" type="fill"> |
<field name="QTE" /> |
</element> |
</table> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.xml |
---|
47,7 → 47,7 |
<field name="AU" prefix=" au " type="date" datePattern="dd/MM/yy" /> |
</element> |
<element location="D54" type="fill"> |
<element location="D58" type="fill"> |
<field name="DU" type="datePaye" /> |
</element> |
89,7 → 89,7 |
</element> |
<element location="F12" type="fill"> |
<field name="ID_CUMULS_CONGES"> |
<field name="ACQUIS" /> |
<field name="ACQUIS" type="cumulConges" /> |
</field> |
</element> |
<element location="B6" type="replace" replacePattern="_"> |
122,79 → 122,159 |
</element> |
<element location="I54" type="fill"> |
<field name="NET_A_PAYER" /> |
<element location="H54" type="fill"> |
<field name="NET_AVANT_PAS" /> |
</element> |
<element location="I55" type="fill"> |
<field name="REDUCTION_GVT" /> |
</element> |
<element location="D58" type="fill"> |
<element location="E57" type="fill"> |
<field name="NET_IMP" /> |
</element> |
<element location="F57" type="fill"> |
<field name="ID_PAS"> |
<field name="TAUX_PAS" /> |
</field> |
</element> |
<element location="I57" type="fill"> |
<field name="TOTAL_PAS" /> |
</element> |
<element location="I58" type="fill"> |
<field name="NET_A_PAYER" /> |
</element> |
<element location="D62" type="fill"> |
<field name="SAL_BRUT" /> |
</element> |
<element location="E58" type="fill"> |
<element location="E62" type="fill"> |
<field name="COT_SAL" /> |
</element> |
<element location="F58" type="fill"> |
<element location="F62" type="fill"> |
<field name="COT_PAT" /> |
</element> |
<element location="G58" type="fill"> |
<element location="G62" type="fill"> |
<field name="AVANTAGE_NATURE" /> |
</element> |
<element location="H58" type="fill"> |
<element location="H62" type="fill"> |
<field name="NET_IMP" /> |
</element> |
<element location="I58" type="fill"> |
<element location="I62" type="fill"> |
<field name="ALLEGEMENT_COTISATION" /> |
</element> |
<element location="D59" type="fill"> |
<element location="D63" type="fill"> |
<field name="SAL_BRUT" type="cumulPaye" /> |
</element> |
<element location="E59" type="fill"> |
<element location="E63" type="fill"> |
<field name="COT_SAL" type="cumulPaye" /> |
</element> |
<element location="F59" type="fill"> |
<element location="F63" type="fill"> |
<field name="COT_PAT" type="cumulPaye" /> |
</element> |
<element location="G59" type="fill"> |
<element location="G63" type="fill"> |
<field name="AVANTAGE_NATURE" type="cumulPaye" /> |
</element> |
<element location="H59" type="fill"> |
<element location="H63" type="fill"> |
<field name="NET_IMP" type="cumulPaye" /> |
</element> |
<element location="I59" type="fill"> |
<element location="I63" type="fill"> |
<field name="ALLEGEMENT_COTISATION" type="cumulPaye" /> |
</element> |
<table endPageLine="61" firstLine="15" endLine="51" lastColumn="J" base="Societe" table="FICHE_PAYE_ELEMENT" |
<element location="J16" type="fill"> |
<field name="ID_SALARIE"> |
<field name="CODE" /> |
</field> |
</element> |
<element location="J18" type="fill"> |
<field name="ID_SALARIE"> |
<field name="ID_INFOS_SALARIE_PAYE"> |
<field name="DATE_ARRIVE"> |
</field> |
</field> |
</field> |
</element> |
<element location="J21" type="fichepaye.smic" /> |
<element location="J23" type="fichepaye.plafond" /> |
<element location="J28" type="fill"> |
<field name="ID_VARIABLE_SALARIE"> |
<field name="HEURE_TRAV" /> |
</field> |
</element> |
<element location="J30" type="fichepaye.heure.sup.total"> |
</element> |
<element location="J32" type="fichepaye.heure.total"> |
</element> |
<element location="J35" type="fill"> |
<field name="ID_VARIABLE_SALARIE"> |
<field name="HEURE_TRAV_CUMUL_VAL" /> |
</field> |
</element> |
<element location="J37" type="fichepaye.heure.sup.cumul.total"> |
</element> |
<element location="J39" type="fichepaye.heure.cumul.total"> |
</element> |
<table endPageLine="65" firstLine="15" endLine="51" lastColumn="J" base="Societe" table="FICHE_PAYE_ELEMENT" |
blankLineBeforeStyle="Titre 1,Titre 2" fieldWhere="IMPRESSION" orderBy="POSITION"> |
<element location="B" type="fill" cellSize="52"> |
<field name="NOM" /> |
</element> |
<element location="E" type="fill"> |
<element location="D" type="fill"> |
<field name="NB_BASE" /> |
</element> |
<element location="E" type="fill"> |
<field name="TAUX_SAL"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
</element> |
<element location="F" type="fill"> |
<field name="TAUX_SAL" /> |
<field name="MONTANT_SAL_AJ"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
</element> |
<element location="G" type="fill"> |
<field name="MONTANT_SAL_AJ" /> |
<field name="MONTANT_SAL_DED"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
</element> |
<element location="H" type="fill"> |
<field name="MONTANT_SAL_DED" /> |
<field name="TAUX_PAT"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
</element> |
<!-- <element location="I" type="fill"> |
<field name="TAUX_PAT" type="Devise" /> |
</element> --> |
<element location="J" type="fill"> |
<field name="MONTANT_PAT" /> |
<element location="I" type="fill"> |
<field name="MONTANT_PAT"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
</element> |
/trunk/OpenConcerto/Configuration/Template/Default/BonLivraison.xml |
---|
24,7 → 24,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/Avoir.xml |
---|
26,7 → 26,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureTicket.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureTicket.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/DemandePrix.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/FicheClient.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FactureFournisseur.odsp |
---|
1,6 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">57</sheet> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureTicket.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">66</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/AvoirF.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/CommandeClient.xml |
---|
24,7 → 24,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
62,7 → 62,7 |
<field name="NOM" /> |
</element> |
<element location="I10" type="fill"> |
<element location="H10" type="fill"> |
<field name="ID_CLIENT"> |
<field name="FORME_JURIDIQUE" /> |
<field name="NOM" /> |
69,7 → 69,7 |
</field> |
</element> |
<element location="I11" type="address.customer.full"> |
<element location="H11" type="address.customer.full"> |
</element> |
/trunk/OpenConcerto/Configuration/Template/Default/FactureFournisseur.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/src/org/openconcerto/laf/IComboBoxUI.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/laf/IButtonUI.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/laf/IScrollBarUI.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/laf/ILookAndFeel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/task/config/Customer.java |
---|
New file |
0,0 → 1,34 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.task.config; |
public enum Customer { |
GESTION_DEFAULT("Gestion_Default"), IDEATION("Ideation"), TCP("TCP"), KD("KD"), PREVENTEC("Preventec"), PROFILBAT("Profilbat"), CTD("CTD"), ODT("ODT"); |
private final String name; |
private Customer(String name) { |
if (name == null) |
throw new NullPointerException(); |
this.name = name; |
} |
public String getName() { |
return this.name; |
} |
public static Customer fromName(String n) { |
return Customer.valueOf(n.toUpperCase()); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/task/config/ComptaOptions.java |
---|
New file |
0,0 → 1,59 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.task.config; |
import net.jcip.annotations.Immutable; |
@Immutable |
public class ComptaOptions { |
private final Customer customer; |
public ComptaOptions(final Customer customer) { |
this.customer = customer; |
} |
public final Customer getCustomer() { |
return this.customer; |
} |
public final boolean customerUseControle() { |
return customerIsPreventec() || customerIsKD(); |
} |
public final boolean customerIsKD() { |
final boolean kd = getCustomer() == Customer.KD; |
return kd; |
} |
public final boolean customerIsODT() { |
final boolean kd = getCustomer() == Customer.ODT; |
return kd; |
} |
public final boolean customerIsTCP() { |
final boolean kd = getCustomer() == Customer.TCP; |
return kd; |
} |
public final boolean customerIsPreventec() { |
final boolean prev = getCustomer() == Customer.PREVENTEC; |
return prev; |
} |
public final boolean customerIsProfilbat() { |
return getCustomer() == Customer.PROFILBAT; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/NewsUpdater.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/DSNInstallationUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
56,7 → 56,7 |
private void insertValues(List<Tuple2<String, String>> values, SQLTable table) throws SQLException { |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(table.getField("CODE")); |
List<String> codes = (List<String>) table.getDBSystemRoot().getDataSource().executeA(sel.asString()); |
List<String> codes = (List<String>) table.getDBSystemRoot().getDataSource().executeCol(sel.asString()); |
for (Tuple2<String, String> tuple2 : values) { |
if (!codes.contains(tuple2.get0())) { |
SQLRowValues rowVals = new SQLRowValues(table); |
86,6 → 86,14 |
root.getSchema().updateVersion(); |
} |
if (!societeCommonT.contains("ORG_PROTECTION_SOCIAL_ID")) { |
AlterTable t = new AlterTable(societeCommonT); |
t.addVarCharColumn("ORG_PROTECTION_SOCIAL_ID", 256); |
root.getBase().getDataSource().execute(t.asString()); |
root.refetchTable("SOCIETE_COMMON"); |
root.getSchema().updateVersion(); |
} |
SQLTable tableRubCot = root.getTable("RUBRIQUE_COTISATION"); |
if (!tableRubCot.contains("ASSIETTE_PLAFONNEE")) { |
AlterTable tableRub = new AlterTable(tableRubCot); |
160,7 → 168,7 |
throw new IllegalStateException("Erreur lors de la création de la table " + "MOTIF_ARRET_TRAVAIL", ex); |
} |
} |
if (!root.contains("DIPLOME_PREPARE")) { |
final SQLCreateTable createTableDiplome = new SQLCreateTable(root, "DIPLOME_PREPARE"); |
createTableDiplome.addVarCharColumn("CODE", 25); |
187,7 → 195,6 |
} |
} |
if (!root.contains("TYPE_PREAVIS")) { |
final SQLCreateTable createTableMotif = new SQLCreateTable(root, "TYPE_PREAVIS"); |
createTableMotif.addVarCharColumn("CODE", 25); |
1037,6 → 1044,7 |
v.add(Tuple2.create("102", "Cotisation Allocation Familiale - taux réduit")); |
v.add(Tuple2.create("103", "Contribution actions gratuites")); |
v.add(Tuple2.create("226", "Assiette du Versement Transport")); |
v.add(Tuple2.create("901", "Cotisation épargne retraite")); |
insertValues(v, table); |
1350,9 → 1358,40 |
// P19V01.2 |
final SQLTable tableCotInd = root.getTable("CODE_COTISATION_INDIVIDUELLE"); |
List<Tuple2<String, String>> vCodeIndiv = new ArrayList<>(); |
vCodeIndiv.add(Tuple2.create("104", "Pénibilité Cotisation de base")); |
vCodeIndiv.add(Tuple2.create("105", "Montant de cotisation Régime Unifié Agirc-Arrco y compris Apec")); |
vCodeIndiv.add(Tuple2.create("106", "Réduction générale des cotisations patronales Agirc-Arrco")); |
vCodeIndiv.add(Tuple2.create("104", " Pénibilité Cotisation de base")); |
vCodeIndiv.add(Tuple2.create("105", " Montant de cotisation Régime Unifié Agirc Arrco, y compris Apec")); |
vCodeIndiv.add(Tuple2.create("106", " Réduction générale des cotisations patronales de retraite complémentaire")); |
vCodeIndiv.add(Tuple2.create("107", " Forfait marin")); |
vCodeIndiv.add(Tuple2.create("108", " Demi rôle marin")); |
vCodeIndiv.add(Tuple2.create("109", " Exonération de cotisations salariales de retraite complémentaire au titre de l'emploi d'un apprenti")); |
vCodeIndiv.add(Tuple2.create("110", " Exonération de cotisations patronales de retraite complémentaire applicable dans les DOM (LODEOM) SMIC 130% à 220%")); |
vCodeIndiv.add(Tuple2.create("111", " Exonération de cotisations de retraite complémentaire applicable aux entreprises et associations d'aide à domicile")); |
vCodeIndiv.add(Tuple2.create("112", " Exonération de cotisations patronales de retraite complémentaire applicable dans les DOM (LODEOM) SMIC 170% à 270%")); |
vCodeIndiv.add(Tuple2.create("113", " Exonération de cotisations patronales de retraite complémentaire applicable dans les DOM (LODEOM) SMIC 170% à 350%")); |
vCodeIndiv.add(Tuple2.create("114", " Montant de réduction des heures supplémentaires/complémentaires")); |
vCodeIndiv.add(Tuple2.create("115", " Cotisation Assurance Maladie pour le Régime Local Alsace Moselle")); |
vCodeIndiv.add(Tuple2.create("116", " Cotisation absente de la norme en cas de régularisation prud'homale")); |
vCodeIndiv.add(Tuple2.create("128", " Contribution à la formation professionnelle (CFP)")); |
vCodeIndiv.add(Tuple2.create("129", " Contribution dédiée au financement du Compte Professionnel de Formation pour les titulaires de CDD (CPFCDD)")); |
vCodeIndiv.add(Tuple2.create("130", " Part principale de la taxe d'apprentissage")); |
vCodeIndiv.add(Tuple2.create("131", " Cotisation régime unifié Agirc Arrco")); |
vCodeIndiv.add(Tuple2.create("132", " Cotisation Apec")); |
vCodeIndiv.add(Tuple2.create("133", " Contribution maladie spécifique Mayotte")); |
vCodeIndiv.add(Tuple2.create("902", " Contribution à la formation professionnelle des Artisans assimilés salariés")); |
vCodeIndiv.add(Tuple2.create("903", " Cotisation AFNCA")); |
vCodeIndiv.add(Tuple2.create("904", " Cotisation ANEFA")); |
vCodeIndiv.add(Tuple2.create("905", " Cotisation ASCPA")); |
vCodeIndiv.add(Tuple2.create("906", " Cotisation PROVEA")); |
vCodeIndiv.add(Tuple2.create("907", " Complément de cotisation Assurance Maladie")); |
vCodeIndiv.add(Tuple2.create("908", " Taxe forfaitaire CDDU Assurance Chômage")); |
vCodeIndiv.add(Tuple2.create("909", " Cotisation au titre du financement des régimes de retraites supplémentaires à prestation définies")); |
vCodeIndiv.add(Tuple2.create("910", " Exonération de cotisations patronales pour les entreprises affectées par la crise sanitaire")); |
vCodeIndiv.add(Tuple2.create("911", " Réduction de cotisations patronales pour les entreprises du secteur de la vigne affectées par la crise sanitaire")); |
vCodeIndiv.add(Tuple2.create("912", " Exonération du forfait social à 10%")); |
vCodeIndiv.add(Tuple2.create("913", " Potentielle nouvelle cotisation C")); |
vCodeIndiv.add(Tuple2.create("914", " Potentielle nouvelle cotisation A")); |
vCodeIndiv.add(Tuple2.create("915", " Potentielle nouvelle cotisation B")); |
insertValues(vCodeIndiv, tableCotInd); |
final SQLTable tableCTP = root.getTable("CODE_CAISSE_TYPE_RUBRIQUE"); |
1360,6 → 1399,40 |
vCTP.add(Tuple2.create("003", "Réduction cotisations salariale heures supplémentaires")); |
vCTP.add(Tuple2.create("510", "Prime exceptionnelle de pouvoir d’achat")); |
vCTP.add(Tuple2.create("060", "RR Chômage CSG-CRDS taux plein")); |
vCTP.add(Tuple2.create("917", "MOBILITE ADD JOURNALISTE TX MINO 20%")); |
vCTP.add(Tuple2.create("920", "EMPL AGRIC (1500 TONNES CANNE) RMI OM")); |
vCTP.add(Tuple2.create("921", "MOBILITE ARTISTES TX MINORE 30%")); |
vCTP.add(Tuple2.create("922", "ENTR.DE PRODUCTION D ELECTRICITE")); |
vCTP.add(Tuple2.create("922", "ENTR.DE PRODUCTION D ELECTRICITE")); |
vCTP.add(Tuple2.create("926", "AT SEULEMENT - GESTION TOTALE")); |
vCTP.add(Tuple2.create("927", "MOBILITE ADD ARTISTES TX MINO 30%")); |
vCTP.add(Tuple2.create("936", "CNIEG PRESTATION COMPL. INVALIDITE")); |
vCTP.add(Tuple2.create("937", "COTISATIONS AGS CAS GENERAL U2")); |
vCTP.add(Tuple2.create("938", "CONTRATS AIDES ATELIER INSERTION")); |
vCTP.add(Tuple2.create("939", "ATELIER INSERTION MAYOTTE")); |
vCTP.add(Tuple2.create("939", "ATELIER INSERTION MAYOTTE")); |
vCTP.add(Tuple2.create("940", "CNIEG DROITS SPE. PASSES NON REGULES")); |
vCTP.add(Tuple2.create("948", "CONTRAT EMPLOI SOLIDARITE")); |
vCTP.add(Tuple2.create("950", "CONTRAT EMPLOI SOLIDARITE CAS PART")); |
vCTP.add(Tuple2.create("951", "CONTRATS EMPLOI SOLIDARITE CAS PART")); |
vCTP.add(Tuple2.create("952", "CONTRAT EMPLOI CONSOLIDE CAS GENERAL")); |
vCTP.add(Tuple2.create("954", "CONTRAT EMPLOI CONSOLIDE CAS PART")); |
vCTP.add(Tuple2.create("955", "CNIEG PETIT POOL")); |
vCTP.add(Tuple2.create("959", "CFP ENTREPRISE < 11 SALARIES")); |
vCTP.add(Tuple2.create("967", "CONTR.ROYALTIES ART.ET MANNEQUINS")); |
vCTP.add(Tuple2.create("969", "COT.MAL.ROYALTIES ART.ETRANGER")); |
vCTP.add(Tuple2.create("971", "CFP ENTREPRISE >= 11 SALARIES")); |
vCTP.add(Tuple2.create("983", "CFP INTERMITTENTS DU SPECTACLE")); |
vCTP.add(Tuple2.create("985", "PENALITE PENIBILITE")); |
vCTP.add(Tuple2.create("987", "CONTRIBUTION CPF CDD ")); |
vCTP.add(Tuple2.create("992", "TA PRINCIPALE HORS ALSACE MOSELLE")); |
vCTP.add(Tuple2.create("993", "TA ALSACE MOSELLE")); |
vCTP.add(Tuple2.create("994", "TA DEDUCTION CFA ET OFFRE NOUVELLE")); |
vCTP.add(Tuple2.create("995", "TA - SOLDE VERSEMENT LIBERATOIRE")); |
vCTP.add(Tuple2.create("995", "TA - SOLDE VERSEMENT LIBERATOIRE")); |
vCTP.add(Tuple2.create("996", "TA - DEDUCTION AU SOLDE CFA")); |
vCTP.add(Tuple2.create("997", "TA - DEDUCTION SOLDE CREANCE ALTERN")); |
vCTP.add(Tuple2.create("998", "CSA CONTRIBUTION ANNUELLE")); |
insertValues(vCTP, tableCTP); |
final SQLTable tableTypeBrut = root.getTable("CODE_TYPE_RUBRIQUE_BRUT"); |
1369,9 → 1442,92 |
vbrutType.add(Tuple3.create("018", "Heures supplémentaires structurelles", DsnTypeCodeBrut.REMUNERATION.getName())); |
vbrutType.add(Tuple3.create("019", "Heures d'activité partielle", DsnTypeCodeBrut.REMUNERATION.getName())); |
vbrutType.add(Tuple3.create("020", "Heures affectées à un travail d’aide à domicile de publics fragiles", DsnTypeCodeBrut.REMUNERATION.getName())); |
vbrutType.add(Tuple3.create("021", "[FP] Taux de rémunération de la situation administrative", DsnTypeCodeBrut.REMUNERATION.getName())); |
vbrutType.add(Tuple3.create("022", "Potentiel nouveau type de rémunération B", DsnTypeCodeBrut.REMUNERATION.getName())); |
vbrutType.add(Tuple3.create("023", "Potentiel nouveau type de rémunération C", DsnTypeCodeBrut.REMUNERATION.getName())); |
vbrutType.add(Tuple3.create("025", "Heures correspondant à du chômage intempéries", DsnTypeCodeBrut.REMUNERATION.getName())); |
vbrutType.add(Tuple3.create("026", "Heures supplémentaires exonérées", DsnTypeCodeBrut.REMUNERATION.getName())); |
vbrutType.add(Tuple3.create("027", "Potentiel nouveau type de rémunération A", DsnTypeCodeBrut.REMUNERATION.getName())); |
DsnBrutCode dsnBurCode = new DsnBrutCode(); |
dsnBurCode.updateTable(vbrutType, tableTypeBrut); |
// P21 |
final SQLTable tableArret = root.getTable("MOTIF_ARRET_TRAVAIL"); |
List<Tuple2<String, String>> vArret = new ArrayList<Tuple2<String, String>>(); |
vArret.add(Tuple2.create("09", "adoption")); |
vArret.add(Tuple2.create("15", "temps partiel thérapeutique (risque maladie)")); |
vArret.add(Tuple2.create("16", "temps partiel thérapeutique (risque accident de travail)")); |
vArret.add(Tuple2.create("17", "temps partiel thérapeutique (risque accident de trajet)")); |
vArret.add(Tuple2.create("18", "temps partiel thérapeutique (risque maladie professionnelle)")); |
insertValues(vArret, tableArret); |
if (!root.contains("CODE_CAISSE_CONGES_PAYES")) { |
final SQLCreateTable createTableCode = new SQLCreateTable(root, "CODE_CAISSE_CONGES_PAYES"); |
createTableCode.addVarCharColumn("CODE", 25); |
createTableCode.addVarCharColumn("NOM", 512); |
try { |
root.getBase().getDataSource().execute(createTableCode.asString()); |
insertUndef(createTableCode); |
root.refetchTable("CODE_CAISSE_CONGES_PAYES"); |
root.getSchema().updateVersion(); |
} catch (SQLException ex) { |
throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_CAISSE_CONGES_PAYES", ex); |
} |
} |
if (!root.contains("MOTIF_NON_ASSUJETIS_TA")) { |
final SQLCreateTable createTableCode = new SQLCreateTable(root, "MOTIF_NON_ASSUJETIS_TA"); |
createTableCode.addVarCharColumn("CODE", 25); |
createTableCode.addVarCharColumn("NOM", 512); |
try { |
root.getBase().getDataSource().execute(createTableCode.asString()); |
insertUndef(createTableCode); |
root.refetchTable("MOTIF_NON_ASSUJETIS_TA"); |
root.getSchema().updateVersion(); |
final SQLTable tableMotif = root.getTable("MOTIF_NON_ASSUJETIS_TA"); |
List<Tuple2<String, String>> vMotif = new ArrayList<Tuple2<String, String>>(); |
vMotif.add(Tuple2.create("001", "Non assujetti par choix du régime fiscal (option IR en catégorie BNC)")); |
vMotif.add(Tuple2.create("002", "Collectivités publiques")); |
vMotif.add(Tuple2.create("003", "Etablissements publics de recherche et les établissements publics d'enseignement supérieurs")); |
vMotif.add(Tuple2.create("004", "Personnes morales créées pour la gestion d'un pôle de recherche et d'enseignement supérieur ou d'un réseau thématique de recherche avancée")); |
vMotif.add(Tuple2.create("005", "Fondations reconnues d'utilité public du secteur de la recherche")); |
vMotif.add(Tuple2.create("006", "Sociétés et personnes morales ayant pour objet exclusif l'enseignement")); |
vMotif.add(Tuple2.create("007", "Associations sans but lucratif")); |
vMotif.add(Tuple2.create("008", "Syndicats professionnels")); |
vMotif.add(Tuple2.create("009", "Entreprises sans établissement en France (ESEF)")); |
vMotif.add(Tuple2.create("010", "Sociétés civiles de moyens (SCM) non commerciale")); |
vMotif.add(Tuple2.create("011", "Personnes physiques ou morales assujetties aux BNC ou BA")); |
vMotif.add(Tuple2.create("012", "Les coopératives agricoles")); |
vMotif.add(Tuple2.create("013", "Les coopératives artisanales, transport (y compris fluvial et maritime) et leurs unions")); |
vMotif.add(Tuple2.create("014", "Les groupements d'employeurs dont agricoles")); |
vMotif.add(Tuple2.create("015", "Les sociétés civiles agricoles")); |
vMotif.add(Tuple2.create("016", "Les mutuelles et organismes mutualistes")); |
vMotif.add(Tuple2.create("017", |
"Les organismes HLM, SA de crédit immobilier (I et au II de l'article L. 422-4 du code de la construction et de l'habitation ) et unions d'économie sociale")); |
vMotif.add(Tuple2.create("018", "Les sociétés coopératives de construction désignées à l'article L. 432-2 du code de la construction et de l'habitation.")); |
vMotif.add(Tuple2.create("019", "Organismes chargés de l'organisation en France d'une compétition sportive internationale en France (Article L6131-1 du code du travail)")); |
insertValues(vMotif, tableMotif); |
} catch (SQLException ex) { |
throw new IllegalStateException("Erreur lors de la création de la table " + "MOTIF_NON_ASSUJETIS_TA", ex); |
} |
} |
if (!societeCommonT.contains("ASSUJETTISSEMENT_TA")) { |
AlterTable alterSoc = new AlterTable(societeCommonT); |
alterSoc.addBooleanColumn("ASSUJETTISSEMENT_TA", Boolean.TRUE, false); |
alterSoc.addBooleanColumn("ASSUJETTISSEMENT_CFP", Boolean.TRUE, false); |
alterSoc.addBooleanColumn("ASSUJETTISSEMENT_CFP_CDD", Boolean.TRUE, false); |
alterSoc.addForeignColumn("ID_MOTIF_NON_ASSUJETIS_TA", root.findTable("MOTIF_NON_ASSUJETIS_TA")); |
root.getBase().getDataSource().execute(alterSoc.asString()); |
root.getSchema().updateVersion(); |
} |
} |
public void updateDSN(final DBRoot root) throws SQLException { |
1678,7 → 1834,7 |
root.getBase().getDataSource().execute(alter.asString()); |
root.getSchema().updateVersion(); |
} |
if (!tableContrat.contains("ID_DIPLOME_PREPARE")) { |
updateContrat = true; |
AlterTable alter = new AlterTable(tableContrat); |
1882,6 → 2038,35 |
throw new IllegalStateException("Erreur lors de la création de la table " + "CODE_PENIBILITE_CONTRAT_SALARIE", ex); |
} |
} |
if (!root.contains("ARRET_CHOMAGE_INTEMPERIE")) { |
final SQLCreateTable createTableSal = new SQLCreateTable(root, "ARRET_CHOMAGE_INTEMPERIE"); |
final SQLTable tableInfosSalarie = root.getTable("INFOS_SALARIE_PAYE"); |
createTableSal.addForeignColumn("ID_INFOS_SALARIE_PAYE", tableInfosSalarie); |
createTableSal.addForeignColumn("ID_CODE_AMENAGEMENT_PARTIEL", root.findTable("CODE_AMENAGEMENT_PARTIEL")); |
createTableSal.addForeignColumn("ID_CODE_SUSPENSION", root.findTable("CODE_SUSPENSION")); |
createTableSal.addColumn("DATE_DEBUT_SUSPENSION", "date"); |
createTableSal.addColumn("DATE_FIN_SUSPENSION", "date"); |
try { |
root.getBase().getDataSource().execute(createTableSal.asString()); |
insertUndef(createTableSal); |
root.refetchTable("ARRET_CHOMAGE_INTEMPERIE"); |
root.getSchema().updateVersion(); |
} catch (SQLException ex) { |
throw new IllegalStateException("Erreur lors de la création de la table " + "ARRET_CHOMAGE_INTEMPERIE", ex); |
} |
} |
if (!tableContrat.contains("ID_CODE_CAISSE_CONGES_PAYES")) { |
AlterTable alterContrat = new AlterTable(tableContrat); |
alterContrat.addForeignColumn("ID_CODE_CAISSE_CONGES_PAYES", root.findTable("CODE_CAISSE_CONGES_PAYES")); |
alterContrat.addDecimalColumn("TAUX_FRAIS_PROFESSIONNELS", 16, 4, null, true); |
root.getBase().getDataSource().execute(alterContrat.asString()); |
root.getSchema().updateVersion(); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/ComptaPropsConfiguration.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
83,6 → 83,7 |
import org.openconcerto.erp.core.humanresources.employe.element.ObjectifSQLElement; |
import org.openconcerto.erp.core.humanresources.employe.element.SituationFamilialeSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.AcompteSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.ArretChomageIntemperieSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.AyantDroitContratPrevSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.AyantDroitSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.AyantDroitTypeSQLElement; |
92,6 → 93,7 |
import org.openconcerto.erp.core.humanresources.payroll.element.ClassementConventionnelSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.CodeAmenagementPartielSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.CodeBaseAssujettieSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.CodeCaisseCongesPayesSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.CodeCaisseTypeRubriqueSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.CodeCaractActiviteSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.CodeContratTravailSQLElement; |
131,6 → 133,7 |
import org.openconcerto.erp.core.humanresources.payroll.element.ModeReglementPayeSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.MotifArretTravailSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.MotifFinContratSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.MotifNonAssujettisTASQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.MotifRepriseArretTravailSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.PasSQLElement; |
import org.openconcerto.erp.core.humanresources.payroll.element.PeriodeValiditeSQLElement; |
171,11 → 174,14 |
import org.openconcerto.erp.core.sales.pos.element.TicketCaisseSQLElement; |
import org.openconcerto.erp.core.sales.pos.io.BarcodeReader; |
import org.openconcerto.erp.core.sales.price.element.DeviseSQLElement; |
import org.openconcerto.erp.core.sales.price.element.TarifPromotionSQLElement; |
import org.openconcerto.erp.core.sales.price.element.TarifSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ArticleCatComptableSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ArticleCodeClientSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ArticleDeclinaisonSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ArticleDesignationSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ArticleFournisseurSecondaireSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ArticleTarifPromotionSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ArticleTarifSQLElement; |
import org.openconcerto.erp.core.sales.product.element.CoutRevientSQLElement; |
import org.openconcerto.erp.core.sales.product.element.CustomerProductFamilyQtyPriceSQLElement; |
183,6 → 189,7 |
import org.openconcerto.erp.core.sales.product.element.EcoContributionSQLElement; |
import org.openconcerto.erp.core.sales.product.element.FamilleArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.element.FamilleEcoContributionSQLElement; |
import org.openconcerto.erp.core.sales.product.element.LotSQLElement; |
import org.openconcerto.erp.core.sales.product.element.MetriqueSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ModeVenteArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ProductItemSQLElement; |
191,6 → 198,7 |
import org.openconcerto.erp.core.sales.product.element.ReliquatSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ReliquatSQLElement.ReliquatBRSQLElement; |
import org.openconcerto.erp.core.sales.product.element.SupplierPriceListSQLElement; |
import org.openconcerto.erp.core.sales.product.element.TaxeCatComptableSQLElement; |
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement; |
import org.openconcerto.erp.core.sales.quote.element.DevisItemSQLElement; |
import org.openconcerto.erp.core.sales.quote.element.DevisLogMailSQLElement; |
254,7 → 262,9 |
import org.openconcerto.erp.generationDoc.provider.PrixUVProvider; |
import org.openconcerto.erp.generationDoc.provider.PrixUnitaireProvider; |
import org.openconcerto.erp.generationDoc.provider.PrixUnitaireRemiseProvider; |
import org.openconcerto.erp.generationDoc.provider.QteLineDocProvider; |
import org.openconcerto.erp.generationDoc.provider.QteTotalDocProvider; |
import org.openconcerto.erp.generationDoc.provider.QteTotalLineDocProvider; |
import org.openconcerto.erp.generationDoc.provider.QteTotalProvider; |
import org.openconcerto.erp.generationDoc.provider.RecapFactureProvider; |
import org.openconcerto.erp.generationDoc.provider.RefClientValueProvider; |
292,6 → 302,7 |
import org.openconcerto.erp.injector.DevisBlSQLInjector; |
import org.openconcerto.erp.injector.DevisCommandeFournisseurSQLInjector; |
import org.openconcerto.erp.injector.DevisCommandeSQLInjector; |
import org.openconcerto.erp.injector.DevisEltCmdEltSQLInjector; |
import org.openconcerto.erp.injector.DevisEltFactureEltSQLInjector; |
import org.openconcerto.erp.injector.DevisFactureSQLInjector; |
import org.openconcerto.erp.injector.DmdAchatDmdPrixEltSQLInjector; |
357,6 → 368,7 |
import java.util.Collection; |
import java.util.List; |
import java.util.Properties; |
import java.util.Set; |
import javax.imageio.ImageIO; |
import javax.swing.JFrame; |
438,7 → 450,8 |
// b/ dans le jar |
try { |
final Properties props; |
// webstart should be self-contained, e.g. if a user launches from the web it shoudln't |
// webstart should be self-contained, e.g. if a user launches from the web it |
// shoudln't |
// read an old preference file but should always read its own configuration. |
if (confFile != null && confFile.exists() && !inWebStart) { |
props = create(new FileInputStream(confFile), defaults); |
474,6 → 487,7 |
private File portableDir = null; |
private Currency currency = null; |
private final ModuleManager moduleMngr = new ModuleManager(); |
private boolean isExperimental; |
public ComptaPropsConfiguration(Properties props, final ProductInfo productInfo) { |
super(props, productInfo); |
488,6 → 502,7 |
this.isMain = main; |
this.inWebstart = inWebstart; |
this.isPortable = Boolean.parseBoolean(this.getProperty("portable", "false")); |
this.isExperimental = Boolean.parseBoolean(this.getProperty("experimental", "false")); |
String pDir = this.getProperty("portableDir", null); |
if (isPortable) { |
if (pDir == null) { |
577,10 → 592,11 |
} |
this.setProperty("server.ip", getProperty("server.ip").replace(DATA_DIR_VAR, getDataDir().getPath())); |
final SQLSystem system = getSystem(); |
this.isServerless = system == SQLSystem.H2 && system.getHostname(getServerIp()) == null; |
this.isServerless = system == SQLSystem.H2 && system.getHostnameAndPath(getServerIp()).get0() == null; |
} |
if (this.isMain) { |
// ATTN this works because this is executed last (i.e. if you put this in a superclass |
// ATTN this works because this is executed last (i.e. if you put this in a |
// superclass |
// this won't work since e.g. app.name won't have its correct value) |
try { |
this.setupLogging("logs"); |
590,6 → 606,10 |
registerAccountingProvider(); |
registerCellValueProvider(); |
} |
// Early so that other apps may add jars before setUpSocieteDataBaseConnexion() |
// Perhaps add a folder relative to VMLauncher.getJPackageAppDir() |
this.getModuleManager().setFolders(new File(Gestion.MODULES_DIR_NAME), new File(this.getBaseDirs().getAppDataFolder(), Gestion.MODULES_DIR_NAME)); |
} |
public final TM getERP_TM() { |
622,6 → 642,8 |
AdresseVilleNomClientValueProvider.register(); |
AdresseFullClientValueProvider.register(); |
QteTotalProvider.register(); |
QteLineDocProvider.register(); |
QteTotalLineDocProvider.register(); |
QteTotalDocProvider.register(); |
StockLocationProvider.register(); |
RefClientValueProvider.register(); |
657,6 → 679,10 |
return getProperty("token"); |
} |
public boolean isExperimental() { |
return isExperimental; |
} |
public final boolean isServerless() { |
return this.isServerless; |
} |
722,7 → 748,8 |
return; |
try { |
// H2 create the database on connection |
// don't create if root explicitly excluded (e.g. map no roots just to quickly test |
// don't create if root explicitly excluded (e.g. map no roots just to quickly |
// test |
// connection) |
if (sysRoot.shouldMap(getRootName()) && !sysRoot.contains(getRootName())) { |
Log.get().warning("Creating DB"); |
749,8 → 776,10 |
@Override |
protected DBSystemRoot createSystemRoot() { |
final DBSystemRoot res = super.createSystemRoot(); |
// Don't create a separate server for createDB() as on normal databases just setting up a |
// data source can take 2 seconds (e.g. validateConnectionFactory()). And this is for every |
// Don't create a separate server for createDB() as on normal databases just |
// setting up a |
// data source can take 2 seconds (e.g. validateConnectionFactory()). And this |
// is for every |
// boot. |
this.createDB(res); |
return res; |
777,6 → 806,8 |
dir.addSQLElement(CodeBaseAssujettieSQLElement.class, root); |
dir.addSQLElement(ContratModaliteTempsSQLElement.class, root); |
dir.addSQLElement(CodeCaisseTypeRubriqueSQLElement.class, root); |
dir.addSQLElement(CodeCaisseCongesPayesSQLElement.class, root); |
dir.addSQLElement(MotifNonAssujettisTASQLElement.class, root); |
dir.addSQLElement(CodeTypeRubriqueBrutSQLElement.class, root); |
dir.addSQLElement(MotifArretTravailSQLElement.class, root); |
dir.addSQLElement(ContratDispositifPolitiqueSQLElement.class, root); |
816,6 → 847,8 |
dir.addSQLElement(CodeCotisationIndividuelleSQLElement.class, root); |
dir.addSQLElement(CodeCotisationEtablissementSQLElement.class, root); |
dir.addSQLElement(CodePenibiliteSQLElement.class, root); |
dir.addSQLElement(CodeIdccSQLElement.class, root); |
dir.addSQLElement(new ImpressionRubriqueSQLElement(root)); |
dir.addSQLElement(new VariablePayeSQLElement(root)); |
831,8 → 864,15 |
} |
// Check 1.6 updated |
if (!this.getRootSociete().contains("ETAT_STOCK")) { |
throw new DBStructureItemNotFound("Base de données non à jour"); |
throw new DBStructureItemNotFound("Base de données non à jour (<1.6)"); |
} |
// Check 1.7 updated |
if (!this.getRootSociete().contains("AGENCE")) { |
throw new DBStructureItemNotFound("Base de données non à jour (< 1.7.0)"); |
} |
if (!this.getRootSociete().getTable("NUMEROTATION_AUTO").contains("ARTICLE_FORMAT")) { |
throw new DBStructureItemNotFound("Base de données non à jour (< 1.7.1)"); |
} |
SQLElementDirectory dir = this.getDirectory(); |
dir.addSQLElement(AttachmentSQLElement.class); |
849,6 → 889,7 |
dir.addSQLElement(ProductItemSQLElement.class); |
dir.addSQLElement(CategorieComptableSQLElement.class); |
dir.addSQLElement(ArticleCatComptableSQLElement.class); |
dir.addSQLElement(TaxeCatComptableSQLElement.class); |
dir.addSQLElement(ArticleFournisseurSecondaireSQLElement.class); |
dir.addSQLElement(SupplierPriceListSQLElement.class); |
dir.addSQLElement(FraisDocumentSQLElement.class); |
886,7 → 927,14 |
dir.addSQLElement(new AcompteSQLElement()); |
dir.addSQLElement(new AxeAnalytiqueSQLElement()); |
Set<SQLTable> tablesInRoot = dir.getElement(ReferenceArticleSQLElement.class).getTable().getDBRoot().getTables(); |
for (SQLTable table : tablesInRoot) { |
if (table.getName().startsWith("ARTICLE_DECLINAISON_")) { |
dir.addSQLElement(new ArticleDeclinaisonSQLElement(table.getName())); |
} |
} |
dir.addSQLElement(LotSQLElement.class); |
dir.addSQLElement(new BonDeLivraisonItemSQLElement()); |
dir.addSQLElement(new BonDeLivraisonSQLElement()); |
dir.addSQLElement(new TransferShipmentSQLElement()); |
972,8 → 1020,6 |
dir.addSQLElement(new FournisseurSQLElement()); |
dir.addSQLElement(new CodeIdccSQLElement()); |
dir.addSQLElement(new InfosSalariePayeSQLElement()); |
dir.addSQLElement(new JournalSQLElement()); |
1021,10 → 1067,9 |
dir.addSQLElement(SituationFamilialeSQLElement.class); |
dir.addSQLElement(new StockSQLElement()); |
dir.addSQLElement(new StyleSQLElement()); |
dir.addSQLElement(new SalarieSQLElement()); |
dir.addSQLElement(TarifSQLElement.class); |
dir.addSQLElement(TarifPromotionSQLElement.class); |
dir.addSQLElement(ArticleTarifPromotionSQLElement.class); |
dir.addSQLElement(new TaxeSQLElement()); |
dir.addSQLElement(TaxeComplementaireSQLElement.class); |
dir.addSQLElement(TicketCaisseSQLElement.class); |
1036,8 → 1081,17 |
dir.addSQLElement(new TypeReglementSQLElement()); |
dir.addSQLElement(new SDDMessageSQLElement(this)); |
dir.addSQLElement(new SEPAMandateSQLElement(this)); |
dir.addSQLElement(TarifSQLElement.class); |
dir.addSQLElement(TarifPromotionSQLElement.class); |
dir.addSQLElement(ArticleTarifPromotionSQLElement.class); |
dir.addSQLElement(new TaxeSQLElement()); |
dir.addSQLElement(TaxeComplementaireSQLElement.class); |
dir.addSQLElement(TicketCaisseSQLElement.class); |
dir.addSQLElement(ClôtureCaisseSQLElement.class); |
dir.addSQLElement(CaisseJournalSQLElement.class); |
dir.addSQLElement(new VariableSalarieSQLElement()); |
dir.addSQLElement(SalarieSQLElement.class); |
dir.addSQLElement(UniteVenteArticleSQLElement.class); |
dir.addSQLElement(CalendarItemSQLElement.class); |
1045,6 → 1099,8 |
dir.addSQLElement(DeviseHistoriqueSQLElement.class); |
dir.addSQLElement(EmailTemplateSQLElement.class); |
dir.addSQLElement(ArretChomageIntemperieSQLElement.class); |
if (getRootSociete().contains("FWK_LIST_PREFS")) { |
dir.addSQLElement(new FWKListPrefs(getRootSociete())); |
} |
1109,6 → 1165,7 |
new FactureCommandeSQLInjector(rootSociete); |
new DevisFactureSQLInjector(rootSociete); |
new DevisCommandeSQLInjector(rootSociete); |
new DevisEltCmdEltSQLInjector(rootSociete); |
new DevisCommandeFournisseurSQLInjector(rootSociete); |
new DevisBlEltSQLInjector(rootSociete); |
new DevisBlSQLInjector(rootSociete); |
1191,8 → 1248,15 |
List<String> listFieldDevisElt = new ArrayList<String>(); |
listFieldDevisElt.add("NUMERO"); |
listFieldDevisElt.add("OBJET"); |
listFieldDevisElt.add("DATE"); |
listFieldDevisElt.add("ID_CLIENT"); |
if (root.getTable("DEVIS").contains("DATE_LIVRAISON")) { |
listFieldDevisElt.add("DATE_LIVRAISON"); |
} |
if (root.getTable("DEVIS").contains("TRANSFORMATION")) { |
listFieldDevisElt.add("TRANSFORMATION"); |
} |
listFieldDevisElt.add("ID_ETAT_DEVIS"); |
showAs.showField("DEVIS_ELEMENT.ID_DEVIS", listFieldDevisElt); |
1243,21 → 1307,14 |
List<String> listFieldFactureElt = new ArrayList<String>(); |
listFieldFactureElt.add("NUMERO"); |
listFieldFactureElt.add("NOM"); |
listFieldFactureElt.add("DATE"); |
listFieldFactureElt.add("ID_COMMERCIAL"); |
listFieldFactureElt.add("ID_CLIENT"); |
showAs.showField("SAISIE_VENTE_FACTURE_ELEMENT.ID_SAISIE_VENTE_FACTURE", listFieldFactureElt); |
showAs.show("SALARIE", SQLRow.toList("CODE,NOM,PRENOM")); |
showAs.show("SITUATION_FAMILIALE", "NOM"); |
showAs.show("SITUATION_FAMILIALE", "NOM"); |
if (root.getTable("STOCK").contains("ID_ARTICLE")) { |
List<String> listFieldArtElt = new ArrayList<String>(); |
listFieldArtElt.add("CODE"); |
listFieldArtElt.add("NOM"); |
listFieldArtElt.add("ID_FAMILLE_ARTICLE"); |
showAs.showField("STOCK.ID_ARTICLE", listFieldArtElt); |
} |
showAs.show("STYLE", "NOM"); |
showAs.show("TAXE", "TAUX"); |
1308,7 → 1365,6 |
// Prefetch undefined |
rootSociete.getTables().iterator().next().getUndefinedID(); |
this.getModuleManager().addFactories(Gestion.MODULES_DIR); |
this.getModuleManager().setup(this.getRootSociete(), this); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/MainFrame.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
33,6 → 33,7 |
import java.awt.Color; |
import java.awt.Container; |
import java.awt.Desktop; |
import java.awt.Dimension; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
43,6 → 44,9 |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.io.File; |
import java.lang.reflect.InvocationHandler; |
import java.lang.reflect.Method; |
import java.lang.reflect.Proxy; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Collections; |
75,6 → 79,10 |
public static final String FILE_MENU = "menu.file"; |
public static final String HELP_MENU = "menu.help"; |
public static final String PREFS_MENU_ITEM = "preferences"; |
public static final String QUIT_MENU_ITEM = "quit"; |
public static final String ABOUT_MENU_ITEM = "information"; |
static private final List<Runnable> runnables = new ArrayList<Runnable>(); |
@GuardedBy("MainFrame") |
static private MainFrame instance = null; |
185,8 → 193,6 |
final File confFile = new File(conf.getConfDir(), "Configuration" + File.separator + "Frame" + File.separator + "mainFrame" + confSuffix + ".xml"); |
new WindowStateManager(this, confFile).loadState(); |
registerForMacOSXEvents(); |
this.addWindowListener(new WindowAdapter() { |
@Override |
public void windowClosing(WindowEvent arg0) { |
211,10 → 217,10 |
if (im != null) { |
image.setImage(im); |
} |
new NewsUpdater(this.image); |
} |
// create the UI menu from the menu manager |
// create the UI menu from the MenuAndActions and hide items handled by java.awt.Desktop |
public final void initMenuBar() { |
final MenuManager mm = MenuManager.getInstance(); |
final PropertyChangeListener listener = new PropertyChangeListener() { |
382,10 → 388,59 |
MenuUtils.removeMenuItem(item); |
} |
public void registerDesktopEvents(final MenuAndActions menuAndActions) { |
// First try standard >=9 way, otherwise fall back to com.apple.eawt.Application |
if (!this.registerAWTDesktopEvents(menuAndActions)) |
this.registerForMacOSXEvents(menuAndActions); |
} |
private boolean registerAWTDesktopEvents(final MenuAndActions menuAndActions) { |
if (!Desktop.isDesktopSupported()) |
return false; |
final Desktop desktop = Desktop.getDesktop(); |
final boolean quitHandled = registerAWTDesktopEvent(desktop, "QuitHandler", "APP_QUIT_HANDLER", menuAndActions, QUIT_MENU_ITEM); |
final boolean aboutHandled = registerAWTDesktopEvent(desktop, "AboutHandler", "APP_ABOUT", menuAndActions, ABOUT_MENU_ITEM); |
final boolean prefsHandled = registerAWTDesktopEvent(desktop, "PreferencesHandler", "APP_PREFERENCES", menuAndActions, PREFS_MENU_ITEM); |
return quitHandled && aboutHandled && prefsHandled; |
} |
private boolean registerAWTDesktopEvent(final Desktop desktop, final String handlerClassName, final String desktopActionName, final MenuAndActions menuAndActions, final String menuActionName) { |
final Desktop.Action appPrefsAction; |
try { |
appPrefsAction = Desktop.Action.valueOf(desktopActionName); |
} catch (Exception e) { |
// JRE <9, fallback to the old way |
return false; |
} |
if (!desktop.isSupported(appPrefsAction)) { |
// JRE >= 9, but not supported |
return false; |
} |
try { |
final Class<?> prefHandlerClass = Class.forName("java.awt.desktop." + handlerClassName); |
final Object prefHandler = Proxy.newProxyInstance(prefHandlerClass.getClassLoader(), new Class<?>[] { prefHandlerClass }, new InvocationHandler() { |
@Override |
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { |
menuAndActions.getAction(menuActionName).actionPerformed(null); |
return null; |
} |
}); |
desktop.getClass().getMethod("set" + handlerClassName, prefHandlerClass).invoke(desktop, prefHandler); |
menuAndActions.setMenuItemVisible(menuActionName, false); |
return true; |
} catch (Exception e) { |
// Unknown error, still try to fallback to the old way |
e.printStackTrace(); |
return false; |
} |
} |
// Generic registration with the Mac OS X application menu |
// Checks the platform, then attempts to register with the Apple EAWT |
// See OSXAdapter.java to see how this is done without directly referencing any Apple APIs |
public void registerForMacOSXEvents() { |
// Remove once depending on Java 11. |
@Deprecated |
public void registerForMacOSXEvents(final MenuAndActions menuAndActions) { |
if (Gestion.MAC_OS_X) { |
try { |
// Generate and register the OSXAdapter, passing it a hash of all the methods we |
393,6 → 448,9 |
OSXAdapter.setQuitHandler(this, getClass().getDeclaredMethod("quit", new Class[0])); |
OSXAdapter.setAboutHandler(this, getClass().getDeclaredMethod("about", new Class[0])); |
OSXAdapter.setPreferencesHandler(this, getClass().getDeclaredMethod("preferences", new Class[0])); |
menuAndActions.setMenuItemVisible(QUIT_MENU_ITEM, false); |
menuAndActions.setMenuItemVisible(ABOUT_MENU_ITEM, false); |
menuAndActions.setMenuItemVisible(PREFS_MENU_ITEM, false); |
// no OSXAdapter.setFileHandler() for now |
} catch (Exception e) { |
System.err.println("Error while loading the OSXAdapter:"); |
402,12 → 460,14 |
} |
// used by OSXAdapter |
@Deprecated |
public final void preferences() { |
MenuManager.getInstance().getActionForId("preferences").actionPerformed(null); |
MenuManager.getInstance().getActionForId(PREFS_MENU_ITEM).actionPerformed(null); |
} |
@Deprecated |
public final void about() { |
MenuManager.getInstance().getActionForId("information").actionPerformed(null); |
MenuManager.getInstance().getActionForId(ABOUT_MENU_ITEM).actionPerformed(null); |
} |
public boolean quit() { |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/MenuManager.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
24,10 → 24,14 |
public class MenuManager { |
private static MenuManager instance = null; |
public static synchronized final void setInstance(final MenuAndActions baseMA) { |
instance = new MenuManager(baseMA); |
public static final void setInstance(final MenuAndActions baseMA) { |
setInstance(new MenuManager(baseMA)); |
} |
public static synchronized final void setInstance(final MenuManager mm) { |
instance = mm; |
} |
public static synchronized final MenuManager getInstance() { |
if (instance == null) |
throw new IllegalStateException("Not inited"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/DefaultMenuConfiguration.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
40,6 → 40,7 |
import org.openconcerto.erp.core.finance.accounting.action.GestionPlanComptableEAction; |
import org.openconcerto.erp.core.finance.accounting.action.ImportEcritureAction; |
import org.openconcerto.erp.core.finance.accounting.action.ImportEcritureFECAction; |
import org.openconcerto.erp.core.finance.accounting.action.ImportEcritureRImportAction; |
import org.openconcerto.erp.core.finance.accounting.action.ImpressionJournauxAnalytiqueAction; |
import org.openconcerto.erp.core.finance.accounting.action.ImpressionLivrePayeAction; |
import org.openconcerto.erp.core.finance.accounting.action.ImpressionRepartitionAnalytiqueAction; |
80,7 → 81,6 |
import org.openconcerto.erp.core.humanresources.employe.action.ListeDesContratsPrevoyanceAction; |
import org.openconcerto.erp.core.humanresources.employe.action.ListeDesSalariesAction; |
import org.openconcerto.erp.core.humanresources.employe.action.ListeDesSecretairesAction; |
import org.openconcerto.erp.core.humanresources.employe.action.N4DSAction; |
import org.openconcerto.erp.core.humanresources.payroll.action.ClotureMensuellePayeAction; |
import org.openconcerto.erp.core.humanresources.payroll.action.EditionFichePayeAction; |
import org.openconcerto.erp.core.humanresources.payroll.action.ListeDesInfosSalariePayeAction; |
124,6 → 124,7 |
import org.openconcerto.erp.core.sales.order.action.ListeDesElementsACommanderClientAction; |
import org.openconcerto.erp.core.sales.order.action.ListeDesFacturationCommandesClientAction; |
import org.openconcerto.erp.core.sales.order.action.NouvelleCommandeClientAction; |
import org.openconcerto.erp.core.sales.order.element.CommandeClientSQLElement; |
import org.openconcerto.erp.core.sales.pos.action.ListeDesCaissesTicketAction; |
import org.openconcerto.erp.core.sales.product.action.FamilleArticleAction; |
import org.openconcerto.erp.core.sales.product.action.ListeDesArticlesAction; |
260,10 → 261,8 |
if (UserRightsManager.getCurrentUserRights().haveRight(BackupPanel.RIGHT_CODE)) |
group.addItem("backup"); |
group.addItem("modules"); |
if (!Gestion.MAC_OS_X) { |
group.addItem("preferences"); |
group.addItem("quit"); |
} |
group.addItem(MainFrame.PREFS_MENU_ITEM); |
group.addItem(MainFrame.QUIT_MENU_ITEM); |
return group; |
} |
310,7 → 309,7 |
public Group createHelpMenuGroup() { |
final Group group = new Group(MainFrame.HELP_MENU); |
group.addItem("information"); |
group.addItem(MainFrame.ABOUT_MENU_ITEM); |
group.addItem("tips"); |
return group; |
} |
388,7 → 387,7 |
Group gCustomer = new Group("menu.payment.customer"); |
gCustomer.addItem("customer.invoice.unpaid.list"); |
gCustomer.addItem("customer.payment.prelevement.list"); |
gCustomer.addItem("customer.payment.report"); |
gCustomer.addItem("customer.payment.report"); |
gCustomer.addItem("customer.dept.list"); |
gCustomer.addItem("customer.payment.list"); |
gCustomer.addItem("customer.payment.followup.list"); |
441,7 → 440,7 |
group.addItem("accounting.costs.report"); |
group.addItem("accounting.balance.report"); |
// group.addItem("accounting.2050Report"); |
group.addItem("employe.social.report"); |
// group.addItem("employe.social.report"); |
return group; |
} |
463,6 → 462,9 |
final Group gIO = new Group("menu.accounting.io", LayoutHints.DEFAULT_NOLABEL_SEPARATED_GROUP_HINTS); |
gIO.addItem("accounting.import"); |
gIO.addItem("accounting.import.fec"); |
if (this.configuration.isExperimental()) { |
gIO.addItem("accounting.import.rimport"); |
} |
gIO.addItem("accounting.export"); |
group.add(gIO); |
516,6 → 518,7 |
} |
gCustomer.addItem("customer.credit.list"); |
gCustomer.addItem("sales.quote.element.list"); |
gCustomer.addItem("customer.invoice.details.list"); |
final Group gSupplier = new Group("menu.list.supplier", LayoutHints.DEFAULT_NOLABEL_SEPARATED_GROUP_HINTS); |
555,6 → 558,9 |
public Group createTestMenuGroup() { |
final Group group = new Group("menu.test"); |
group.addItem("test.checkReplannedCmd"); |
group.addItem("test.checkReplannedMultiCmd"); |
group.addItem("test.lettrage.fact"); |
group.addItem("test.lettrage.compt"); |
group.addItem("test.lettrage.achat"); |
581,13 → 587,13 |
FrameUtil.show(this.frame); |
} |
}, "modules"); |
mManager.putAction(new PreferencesAction(getConfiguration().getModuleManager()), "preferences"); |
mManager.putAction(new PreferencesAction(getConfiguration().getModuleManager()), MainFrame.PREFS_MENU_ITEM); |
mManager.putAction(new AbstractAction() { |
@Override |
public void actionPerformed(ActionEvent e) { |
MainFrame.getInstance().quit(); |
} |
}, "quit"); |
}, MainFrame.QUIT_MENU_ITEM); |
} |
public void registerCreationMenuActions(final MenuAndActions mManager) { |
668,6 → 674,7 |
mManager.putAction(new ListeDesAvoirsClientsAction(conf), "customer.credit.list"); |
mManager.putAction(new ListeDesFactureItemsAction(conf), "customer.invoice.details.list"); |
mManager.putAction(new ListeDesElementsDevisAction(conf), "sales.quote.element.list"); |
mManager.putAction(new ListeDesFournisseursAction(), "supplier.list"); |
mManager.putAction(new ListeDesContactsFournisseursAction(), "supplier.contact.list"); |
713,6 → 720,7 |
mManager.putAction(new ImportEcritureAction(), "accounting.import"); |
mManager.putAction(new ExportRelationExpertAction(), "accounting.export"); |
mManager.putAction(new ImportEcritureFECAction(), "accounting.import.fec"); |
mManager.putAction(new ImportEcritureRImportAction(), "accounting.import.rimport"); |
} |
public void registerStatsDocumentsActions(final MenuAndActions mManager) { |
719,7 → 727,7 |
// mManager.putAction("accounting.vat.report", new DeclarationTVAAction()); |
mManager.putAction(new EtatChargeAction(), "accounting.costs.report"); |
mManager.putAction(new CompteResultatBilanAction(), "accounting.balance.report"); |
mManager.putAction(new N4DSAction(), "employe.social.report"); |
// mManager.putAction(new N4DSAction(), "employe.social.report"); |
// mManager.putAction("accounting.2050Report", new CompteResultatBilan2050Action()); |
} |
881,7 → 889,7 |
} |
public void registerHelpMenuActions(final MenuAndActions mManager) { |
mManager.putAction(new AboutAction(getConfiguration()), "information"); |
mManager.putAction(new AboutAction(getConfiguration()), MainFrame.ABOUT_MENU_ITEM); |
mManager.putAction(new AstuceAction(), "tips"); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/translation_fr.xml |
---|
161,6 → 161,11 |
<menu id="menu.supplier.invoice.list" label="Factures" /> |
<menu id="menu.supplier.credit.list" label="Avoirs" /> |
<!-- Standard labels --> |
<item id="button.cancel" label="Annuler" /> |
<item id="button.close" label="Fermer" /> |
<item id="button.add" label="Ajouter" /> |
<item id="button.save.modification" label="Enregistrer les modifications" /> |
<!-- Quote --> |
179,9 → 184,7 |
<action id="sales.quote.clone" label="Créer à partir de" /> |
<action id="sales.quote.create.customer.order" label="Transfert vers commande client" /> |
<action id="sales.quote.create.customer.delivery" label="Transfert vers bon de livraison" /> |
<action id="sales.quote.accept.create.customer.order" |
label="Marquer comme accepté et Transfert en commande client" /> |
<action id="sales.quote.accept.create.customer.order" label="Accepté et Transfert en commande client" /> |
<!-- Customer --> |
<action id="customerrelationship.customer.label.print" label="Imprimer l'étiquette client" /> |
<action id="customerrelationship.customer.info.create" label="Créer la fiche client" /> |
211,6 → 214,7 |
<action id="sales.shipment.create.invoice" label="Transfert en facture" /> |
<!-- Document --> |
<action id="modify" label="Modifier" /> |
<action id="document.quickprint" label="Impression rapide" /> |
<action id="document.print" label="Imprimer..." /> |
<action id="document.print.all" label="Imprimer les documents" /> |
219,6 → 223,8 |
<action id="document.create" label="Générer le document" /> |
<action id="document.pdf.send.email" label="Envoyer le document PDF par email" /> |
<action id="document.send.email" label="Envoyer le document par email" /> |
<action id="document.saveToPDF" label="Enregistrer le PDF sous ..." /> |
<action id="ticket.document.generate" label="Générer une facture" /> |
<!-- Supplier order --> |
<action id="supplychain.order.create.purchase" label="Transfert vers saisie achat" /> |
230,6 → 236,7 |
<action id="sales.order.create.deliverynote" label="Transfert vers bon de livraison" /> |
<action id="sales.order.create.invoice" label="Transfert vers facture" /> |
<action id="sales.order.create.supplier.order" label="Transfert vers commande fournisseur" /> |
<action id="sales.order.reliquat.show" label="Voir les reliquats" /> |
<item id="sales.order.state.waiting" label="A préparer" /> |
<item id="sales.order.state.running" label="En préparation" /> |
<item id="sales.order.state.noStock" label="Rupture de stock" /> |
238,7 → 245,15 |
<item id="sales.order.state.block" label="Bloquée" /> |
<item id="sales.order.state.cancelled" label="Annulée" /> |
<item id="sales.order.state.kd.waiting" label="En attente" /> |
<item id="sales.order.state.kd.rapportrecu" label="Facturable(Rapport reçu)" /> |
<item id="sales.order.state.kd.facture" label="Facturé" /> |
<item id="sales.order.state.kd.cancelled" label="Annulée" /> |
<!-- Customer --> |
<item id="customerrelationship.customer" label="Clients" /> |
<item id="delivery.address.same.main.address" label="Adresse identique à l'adresse du siège" /> |
<item id="invoice.address.same.main.address" label="Adresse identique à l'adresse du siège" /> |
<item id="customerrelationship.customer.address" label="Adresses" /> |
322,4 → 337,51 |
<item id="csg.imp" label="CSG/CRDS non déductible à l'impôt sur le revenu" /> |
<item id="allegement" label="Allégement de cotisation" /> |
<action id="email" label="Email" /> |
<!-- Affaire --> |
<action id="controle.project.seeAttribution" label="Voir la fiche d'attribution" /> |
<action id="controle.project.invoice" label="Facturer" /> |
<action id="controle.project.history" label="Historique" /> |
<action id="controle.project.seeAdminLabel" label="Voir l'étiquette administrative" /> |
<action id="controle.project.generateAdminLabel" label="Générer l'étiquette administrative" /> |
<action id="controle.project.seeTechLabel" label="Voir l'étiquette technique" /> |
<action id="controle.project.generateTechLabel" label="Générer l'étiquette technique" /> |
<!-- Avoir fournisseur --> |
<item id="supplychain.credit.note.amounts" label="Montant" /> |
<item id="supplychain.credit.note.accounting" label="Comptabilité" /> |
<item id="supplychain.credit.note.information" label="Informations Complémentaires" /> |
<!-- Finances --> |
<item id="finance.accounting.userentry.table" label="Comptabilité" /> |
<item id="finance.accounting.userentry.create.account" label=" " /> |
<item id="finance.accounting.userentry.create.lineauto" label=" " /> |
<item id="finance.accounting.userentry.total.credit" label="Crédit" /> |
<item id="finance.accounting.userentry.total.debit" label="Débit" /> |
<item id="finance.accounting.userentry.total" label="Totaux" /> |
<item id="finance.accounting.userentry.warning" label=" " /> |
<!-- Commercial --> |
<item id="humanresources.employe.salesman.tab1" label="Informations" /> |
<item id="humanresources.employe.salesman.tab2" label="Objectifs" /> |
<item id="humanresources.employe.salesman.initial" label="Initiales" /> |
<!-- Fournisseur --> |
<item id="supplychain.supplier" label="Fournisseurs" /> |
<item id="supplychain.supplier.tab1" label="Adresses" /> |
<item id="supplychain.supplier.tab2" label="Contacts" /> |
<item id="supplychain.supplier.tab3" label="Mode de règlement" /> |
<item id="supplychain.supplier.tab4" label="Banque et comptes" /> |
<item id="supplychain.supplier.tab5" label="Comptes associés" /> |
<item id="supplychain.supplier.contacts" label="Contacts fournisseur" /> |
<!-- Societe Common --> |
<item id="common.SOCIETE_COMMON.grp1" label="Informations générales" /> |
<item id="common.SOCIETE_COMMON.grp2" label="Adresse" /> |
<item id="common.SOCIETE_COMMON.grp3" label="Contact" /> |
<item id="common.SOCIETE_COMMON.grp4" label="Dates exercice" /> |
<item id="common.SOCIETE_COMMON.grp5" label="Plan comptable de l'entreprise" /> |
<item id="common.SOCIETE_COMMON.accounting.plan" label="Choix du plan comptable" /> |
</translation> |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/mappingCompta_fr.xml |
---|
1,6 → 1,5 |
<?xml version="1.0" encoding="UTF-8" ?> |
<ROOT> |
<element refid="sales.customer.product.qty.price" nameClass="masculine" name="tarif client"> |
<FIELD name="QUANTITE" label="Quantité" /> |
<FIELD name="ID_ARTICLE" label="Article" /> |
12,9 → 11,21 |
<FIELD name="MONTANT" label="Montant" /> |
<FIELD name="ID_MOUVEMENT" label="Mouvement" /> |
</element> |
<element refid="humanresources.payroll.suspension.contract" nameClass="masculine" |
name="Arrêt chômage, intempérie"> |
<FIELD name="ID_INFOS_SALARIE_PAYE" label="Salarié" /> |
<FIELD name="ID_CODE_AMENAGEMENT_PARTIEL" label="Code d'aménagement" /> |
<FIELD name="ID_CODE_SUSPENSION" label="Code de suspension" /> |
<FIELD name="DATE_DEBUT_SUSPENSION" label="Début de suspension" /> |
<FIELD name="DATE_FIN_SUSPENSION" label="Fin de suspension" /> |
</element> |
<element refid="customerrelationship.customer.category" nameClass="feminine" name="catégorie de client"> |
<FIELD name="name" label="Nom" /> |
</element> |
<element refid="sales.customer.product.qty.price" nameClass="masculine" name="tarif client"> |
<FIELD name="QUANTITE" label="Quantité" /> |
<FIELD name="ID_ARTICLE" label="Article" /> |
114,11 → 125,25 |
<FIELD name="SITUATION_ADMIN" label="Situation administrative" /> |
<FIELD name="NOTA" label="Nota" /> |
</element> |
<element refid="sales.product.ARTICLE_DECLINAISON_TAILLE.name" nameClass="feminine" name="déclinaison taille"> |
<FIELD name="NOM" label="Taille" /> |
</element> |
<element refid="sales.product.ARTICLE_DECLINAISON_COULEUR.name" nameClass="feminine" name="déclinaison couleur"> |
<FIELD name="NOM" label="Couleur" /> |
</element> |
<element refid="sales.product.ref" nameClass="masculine" name="article"> |
<FIELD name="OPTION" label="Option" /> |
<FIELD name="HAUTEUR" label="Hauteur" /> |
<FIELD name="LARGEUR" label="Largeur" /> |
<FIELD name="LONGUEUR" label="Longueur" /> |
<FIELD name="POIDS_COLIS_NET" label="Poids colis" /> |
<FIELD name="OPTION" label="Option" /> |
<FIELD name="ID_ARTICLE_VIRTUEL_PERE" label="Article référent" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="MARGE_WITH_COUT_REVIENT" label="Inclure le coût de revient dans le calcul du prix de vente" /> |
<FIELD name="ID_COUT_REVIENT" label="%CR" /> |
<FIELD name="QTE_UNITAIRE" label="Quantité unitaire par défaut" /> |
182,6 → 207,13 |
<FIELD name="ID_COMPTE_PCE_VENTE" label="Compte spécifique de vente" /> |
<FIELD name="ID_COMPTE_PCE_ACHAT" label="Compte spécifique d'achat" /> |
</element> |
<element refid="sales.product.taxe.compta" nameClass="feminine" name="liaison taxe catégorie comptable" |
namePlural="liaisons taxe catégorie comptable"> |
<FIELD name="ID_TAXE" label="TVA" /> |
<FIELD name="ID_CATEGORIE_COMPTABLE" label="Catégorie comptable" /> |
<FIELD name="ID_COMPTE_PCE_VENTE" label="Compte spécifique de vente" /> |
<FIELD name="ID_COMPTE_PCE_ACHAT" label="Compte spécifique d'achat" /> |
</element> |
<element refid="sales.product.customcode" nameClass="masculine" name="code article client" |
namePlural="codes articles clients"> |
<FIELD name="ID_ARTICLE" label="Article" /> |
211,6 → 243,19 |
<FIELD name="PRIX_FINAL_TTC" label="Prix client final ttc" /> |
<FIELD name="PV_HT" label="Prix vente HT" /> |
<FIELD name="PV_TTC" label="Prix vente TTC" /> |
<FIELD name="POURCENT_REMISE" label="% Remise" /> |
<FIELD name="PRIX_METRIQUE_VT_1" label="P.V. UV HT" /> |
</element> |
<element refid="sales.product.promo" nameClass="masculine" name="tarif promotionnel d'article" |
namePlural="tarifs promotionnels d'article"> |
<FIELD name="ID_TARIF_PROMOTION" label="Tarif promotionnel" /> |
<FIELD name="ID_TAXE" label="Taxe" /> |
<FIELD name="QTE" label="Qté" /> |
<FIELD name="ID_DEVISE" label="Devise" /> |
<FIELD name="PRIX_REVENTE_HT" label="Prix de revente ht" /> |
<FIELD name="PRIX_FINAL_TTC" label="Prix client final ttc" /> |
<FIELD name="PV_HT" label="Prix vente HT" /> |
<FIELD name="PV_TTC" label="Prix vente TTC" /> |
<FIELD name="PRIX_METRIQUE_VT_1" label="P.V. UV HT" /> |
</element> |
310,6 → 355,8 |
<FIELD name="ID_TAXE_PORT" label="Taxe sur port" /> |
</element> |
<element refid="sales.credit.item" nameClass="masculine" name="élément d'avoir" namePlural="éléments d'avoir"> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" /> |
<FIELD name="ID_ECO_CONTRIBUTION" label="Code Eco-Contrib." /> |
<FIELD name="ECO_CONTRIBUTION" label="Dont Eco-Contrib." /> |
440,6 → 487,7 |
</element> |
<element refid="supplychain.receipt.note" nameClass="masculine" name="bon de réception" |
namePlural="bons de réception"> |
<FIELD name="ID_MODELE" label="Modèle" /> |
<FIELD name="DATE" label="Date" /> |
<FIELD name="ID_FOURNISSEUR" label="Fournisseur" /> |
<FIELD name="NUMERO" label="Numéro du bon" titlelabel="Numéro BR" /> |
459,6 → 507,8 |
</element> |
<element refid="supplychain.receipt.item" nameClass="masculine" name="élément de bon" |
namePlural="éléments de bon"> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="NB_COLIS" label="Nb Colis" /> |
<FIELD name="POIDS_COLIS_NET" label="Pds Colis" /> |
<FIELD name="T_POIDS_COLIS_NET" label="Pds Colis Total" /> |
539,6 → 589,8 |
</element> |
<element refid="sales.shipment.item" nameClass="masculine" name="élément de bon de livraison" |
namePlural="éléments de bon de livraison"> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" /> |
<FIELD name="ID_ECO_CONTRIBUTION" label="Code Eco-Contrib." /> |
<FIELD name="ECO_CONTRIBUTION" label="Dont Eco-Contrib." /> |
680,7 → 732,7 |
</element> |
<!-- Mapping pour client partagé KD/Preventec --> |
<element refid="controle.customer" nameClass="masculine" name="client"> |
<FIELD name="ALERTE" label="Alerte" /> |
<FIELD name="ID_SEPA_MANDATE_DEFAULT" label="Mandat par défaut" /> |
<FIELD name="ID_FRAIS_DOCUMENT" label="Frais de création de documents" /> |
<FIELD name="CODE_FOURNISSEUR" label="Code interne fournisseur" /> |
763,6 → 815,15 |
<FIELD name="BLOQUE_LIVRAISON" label="Bloquer les livraisons" /> |
<FIELD name="OBSOLETE" label="Obsolète" /> |
<FIELD name="USE_CLIENT_FORMAT" label="Utiliser la numérotation du client (GARI)" /> |
<FIELD name="NOMENCLATURE_RAPPORT" label="Nomenclature des rapports" /> |
<FIELD name="SEND_FAX" label="Envoyer une copie des rapports par fax " /> |
<FIELD name="SEND_POST_MAIL" label="Envoyer une copie des rapports par courrier " /> |
<FIELD name="MAIL_SUPPL_OBL_GARI" label="Email dest. suppl. GARI requis" /> |
</element> |
<!-- Mapping pour client standard OpenConcerto --> |
<element refid="customerrelationship.customer" nameClass="masculine" name="client"> |
848,7 → 909,7 |
<FIELD name="GROUPE" label="Groupe" /> |
<FIELD name="BLOQUE_LIVRAISON" label="Bloquer les livraisons" /> |
<FIELD name="OBSOLETE" label="Obsolète" /> |
<FIELD name="ALERTE" label="Message d'alerte" /> |
</element> |
<element refid="customerrelationship.customer.department" nameClass="masculine" name="service client" |
namePlural="services client"> |
1029,9 → 1090,20 |
<FIELD name="NB_AYANT_DROIT_AUTRE" label="Nombre d'ayants-droit autres (ascendants, collatéraux...)" /> |
<FIELD name="NB_ENFANT_AYANT_DROIT" label="Nombre d'enfants ayants-droit" /> |
</element> |
<element refid="humanresources.payroll.suspention.contract" nameClass="masculine" |
name="arrêt chômage ou intempéries" namePlural="arrêts chômages ou intempéries"> |
<FIELD name="ID_INFOS_SALARIE_PAYE" label="Contrat salarié" /> |
<FIELD name="ID_CODE_AMENAGEMENT_PARTIEL" label="Aménagement temps partiel (S21.G00.40.078)" /> |
<FIELD name="ID_CODE_SUSPENSION" label="Motif de suspension (S21.G00.65.001)" /> |
<FIELD name="DATE_FIN_SUSPENSION" label="Fin de supension (S21.G00.65.003)" /> |
<FIELD name="DATE_DEBUT_SUSPENSION" label="Début de supension (S21.G00.65.002)" /> |
</element> |
<element refid="humanresources.payroll.contract.employe" nameClass="masculine" name="contrat salarié" |
namePlural="contrats salariés"> |
<FIELD name="ID_DIPLOME_PREPARE" label="Diplôme préparé (S21.G00.30.025)" /> |
<FIELD name="ID_CODE_CAISSE_CONGES_PAYES" label="Caisse de congés payés (S21.G00.40.022)" /> |
<FIELD name="TAUX_FRAIS_PROFESSIONNELS" label="Taux frais professionnels (S21.G00.40.023)" /> |
<FIELD name="ID_CODE_AMENAGEMENT_PARTIEL" label="Aménagement temps partiel (S21.G00.40.078)" /> |
<FIELD name="ID_CODE_SUSPENSION" label="Motif de suspension (S21.G00.65.001)" /> |
<FIELD name="DATE_FIN_SUSPENSION" label="Fin de supension (S21.G00.65.003)" /> |
1103,6 → 1175,8 |
</element> |
<element refid="supplychain.order.item" nameClass="masculine" name="élément de commande" |
namePlural="éléments de commande"> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="NB_COLIS" label="Nb Colis" /> |
<FIELD name="POIDS_COLIS_NET" label="Pds Colis" /> |
<FIELD name="T_POIDS_COLIS_NET" label="Pds Colis Total" /> |
1153,6 → 1227,10 |
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" /> |
</element> |
<element refid="sales.order" nameClass="feminine" name="commande client" namePlural="commandes clients"> |
<FIELD name="FACTURATION_INTERNE" label="Facturation interne" /> |
<FIELD name="T_ACOMPTE" label="Acompte" /> |
<FIELD name="ID_COMMANDE_CLIENT_PRECEDENT" label="Commande précedente" /> |
<FIELD name="ID_TAXE_FRAIS_DOCUMENT" label="TVA sur frais documents" /> |
<FIELD name="FRAIS_DOCUMENT_HT" label="Frais de document HT" /> |
<FIELD name="DATE_LIVRAISON_PREV" label="Livraison prévue le" /> |
1189,6 → 1267,8 |
<FIELD name="DATE_LIVRAISON_REELLE" label="Date livraison réelle" /> |
</element> |
<element refid="sales.order.item" nameClass="masculine" name="article commandé" namePlural="articles commandés"> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" /> |
<FIELD name="ID_ECO_CONTRIBUTION" label="Code Eco-Contrib." /> |
<FIELD name="ECO_CONTRIBUTION" label="Dont Eco-Contrib." /> |
1367,6 → 1447,8 |
</element> |
<element refid="supplychain.order.demande.item" nameClass="masculine" name="élement de demande de prix" |
namePlural="élements de demandes de prix"> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" /> |
<FIELD name="ID_ECO_CONTRIBUTION" label="Code Eco-Contrib." /> |
<FIELD name="ECO_CONTRIBUTION" label="Dont Eco-Contrib." /> |
1440,6 → 1522,9 |
<FIELD name="REGION_ADMIN" label="Région administrative" /> |
</element> |
<element refid="sales.quote" nameClass="masculine" name="devis"> |
<FIELD name="TRANSFORMATION" label="Taux de transformation estimé" /> |
<FIELD name="DATE_LIVRAISON" label="Livraison prévue le" /> |
<FIELD name="ID_TAXE_FRAIS_DOCUMENT" label="TVA sur frais documents" /> |
<FIELD name="FRAIS_DOCUMENT_HT" label="Frais de document HT" /> |
<FIELD name="ID_TAXE_PORT" label="TVA sur Port" /> |
1508,6 → 1593,8 |
<FIELD name="T_ECO_CONTRIBUTION" label="Dont Eco-Contrib." /> |
</element> |
<element refid="sales.quote.item" nameClass="masculine" name="élément de devis" namePlural="éléments de devis"> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" /> |
<FIELD name="ID_ECO_CONTRIBUTION" label="Code Eco-Contrib." /> |
<FIELD name="ECO_CONTRIBUTION" label="Dont Eco-Contrib." /> |
1787,6 → 1874,8 |
<FIELD name="POIDS_COLIS_NET" label="Pds Colis" /> |
<FIELD name="T_POIDS_COLIS_NET" label="Pds Colis Total" /> |
<FIELD name="ID_COMPTE_PCE" label="Compte charge spécifique" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" /> |
<FIELD name="ID_ECO_CONTRIBUTION" label="Code Eco-Contrib." /> |
<FIELD name="ECO_CONTRIBUTION" label="Dont Eco-Contrib." /> |
1849,6 → 1938,7 |
<FIELD name="NET_IMP" label="Salaire net imposable" /> |
<FIELD name="NET_A_PAYER" label="Salaire net à payer" /> |
<FIELD name="CSG" label="Base CSG" /> |
<FIELD name="PERTE_TPT" label="Perte TPT" /> |
<FIELD name="ID_CUMULS_PAYE" label="Cumuls" /> |
<FIELD name="ACOMPTE" label="Acompte" /> |
<FIELD name="ID_MOIS" label="Mois" /> |
1968,6 → 2058,7 |
<FIELD name="TEL" label="Téléphone" /> |
<FIELD name="FAX" label="Fax" /> |
<FIELD name="ID_MODE_REGLEMENT" label="Mode de règlement par défaut" /> |
<FIELD name="CONDITIONS_PORT" label="Conditions frais de port" /> |
</element> |
<element refid="finance.accounting.FRAIS_DOCUMENT"> |
<FIELD name="CODE" label="Code" /> |
1976,11 → 2067,7 |
<FIELD name="MONTANT_HT" label="Montant HT" /> |
<FIELD name="MONTANT_TTC" label="Montant TTC" /> |
</element> |
<element refid="humanresources.payroll.conventions.code" nameClass="masculine" name="code de convention" |
namePlural="codes de conventions"> |
<FIELD name="CODE" label="Code" /> |
<FIELD name="NOM" label="Libellé" /> |
</element> |
<element refid="humanresources.payroll.info" nameClass="feminine" name="fiche d'informations salarié-paye" |
namePlural="fiches d'informations salariés-payes"> |
<FIELD name="ID_IDCC" label="Convention collective (*)" titlelabel="Convention collective" /> |
2082,6 → 2169,8 |
namePlural="numérotations automatiques"> |
<FIELD name="AFFAIRE_FORMAT" label="Format" /> |
<FIELD name="AFFAIRE_START" label="Prochain numéro" /> |
<FIELD name="ARTICLE_FORMAT" label="Format" /> |
<FIELD name="ARTICLE_START" label="Prochain numéro" /> |
<FIELD name="AVOIR_FORMAT" label="Format" /> |
<FIELD name="AVOIR_START" label="Prochain numéro" /> |
<FIELD name="AVOIR_F_FORMAT" label="Format" /> |
2444,6 → 2533,7 |
<FIELD name="TYPE_INTERVENTION" label="Type d'intervention" /> |
<FIELD name="ID_REFERENCE_CLIENT" label="Référence client" /> |
<FIELD name="ID_VERIFICATEUR" label="Vérificateur" /> |
<FIELD name="ID_VERIFICATEUR_SOUS_TRAITANCE" label="Sous-traitée par" /> |
<FIELD name="ID_MODELE" label="Modèle" /> |
<FIELD name="CONTROLE_TECHNIQUE" label="Facture CTC" /> |
<FIELD name="COMPTE_SERVICE_AUTO" label="Gestion automatique du compte de service" /> |
2452,6 → 2542,8 |
<FIELD name="ID_SDD_MESSAGE" label="Ordre de prélèvement SEPA" titlelabel="Prélèv. SEPA" /> |
</element> |
<element refid="sales.invoice.item" nameClass="masculine" name="article facturé" namePlural="articles facturés"> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" /> |
<FIELD name="ID_COMPTE_PCE" label="Compte vente spécifique" /> |
<FIELD name="ID_ECO_CONTRIBUTION" label="Code Eco-Contrib." /> |
2597,7 → 2689,14 |
<FIELD name="ID_TAXE" label="TVA" /> |
<FIELD name="ID_DEVISE" label="Devise" /> |
</element> |
<element refid="sales.product.qty.price"> |
<element refid="sales.price.promo.list" nameClass="masculine" name="tarif promotionnel"> |
<FIELD name="NOM" label="Tarif" /> |
<FIELD name="ID_TAXE" label="TVA" /> |
<FIELD name="ID_DEVISE" label="Devise" /> |
<FIELD name="START" label="Du" /> |
<FIELD name="END" label="Au" /> |
</element> |
<element refid="sales.product.qty.price" nameClass="masculine" name="tarif par quantité"> |
<FIELD name="QUANTITE" label="Qté (A partir de)" /> |
<FIELD name="POURCENT_REMISE" label="% de remise" /> |
<FIELD name="PRIX_METRIQUE_VT_1" label="Prix de vente HT remisé" /> |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/Gestion.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
100,7 → 100,7 |
public class Gestion { |
public static final File MODULES_DIR = new File("Modules"); |
static final String MODULES_DIR_NAME = "Modules"; |
/** |
* When this system property is set to <code>true</code>, Gestion will hide most of its normal |
316,6 → 316,7 |
ex2.printStackTrace(); |
} |
System.out.println("Application working directory folder : " + conf.getWD().getAbsolutePath()); |
System.out.println("Modules folders : " + conf.getModuleManager().getFolders().toString()); |
if (inWebStart()) { |
// needed since our classes aren't loaded by the same loader as the library classes |
Helper.setURLStreamHandlerFactory(); |
339,6 → 340,9 |
SQLRequestLog.setEnabled(true); |
} |
// columns order/visibility per company |
IListFrame.setConfDirFunction((elem) -> conf.getConfDir(elem.getTable().getDBRoot())); |
if (Boolean.valueOf(conf.getProperty("minimal", "false"))) { |
System.setProperty(MINIMAL_PROP, Boolean.TRUE.toString()); |
} |
584,6 → 588,7 |
// needed so that we can uninstall modules |
System.setProperty(SQLBase.ALLOW_OBJECT_REMOVAL, "true"); |
NewsChecker.check(pTOS, conf.getConfDir(), conf.getServer().getSQLSystem().equals(SQLSystem.H2)); |
} |
private static void saveProperties(File fTOS, Properties pTOS) { |
792,6 → 797,7 |
return realIp; |
} |
// TODO : n'est plus utilisé |
public static PostgreSQLFrame pgFrameStart = null; |
private static JDialog frameExit = null; |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/NewsChecker.java |
---|
New file |
0,0 → 1,316 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.config; |
import org.openconcerto.utils.Base64; |
import org.openconcerto.utils.FileUtils; |
import org.openconcerto.utils.JImage; |
import java.awt.BorderLayout; |
import java.awt.Color; |
import java.awt.Dimension; |
import java.awt.FlowLayout; |
import java.awt.Font; |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionListener; |
import java.awt.image.BufferedImage; |
import java.io.BufferedOutputStream; |
import java.io.BufferedReader; |
import java.io.ByteArrayInputStream; |
import java.io.ByteArrayOutputStream; |
import java.io.File; |
import java.io.FileOutputStream; |
import java.io.FileReader; |
import java.io.IOException; |
import java.io.InputStream; |
import java.io.PrintStream; |
import java.net.MalformedURLException; |
import java.net.URL; |
import java.net.URLConnection; |
import java.nio.charset.StandardCharsets; |
import java.security.MessageDigest; |
import java.text.SimpleDateFormat; |
import java.util.ArrayList; |
import java.util.Date; |
import java.util.List; |
import java.util.Properties; |
import javax.imageio.ImageIO; |
import javax.swing.BorderFactory; |
import javax.swing.JButton; |
import javax.swing.JFrame; |
import javax.swing.JPanel; |
import javax.swing.JTextArea; |
import javax.swing.JTextField; |
import javax.swing.SwingUtilities; |
import javax.swing.UIManager; |
import net.minidev.json.JSONObject; |
import net.minidev.json.parser.JSONParser; |
public class NewsChecker { |
public static class DateHash { |
Long t; |
String h; |
public DateHash(Long time, String hash) { |
this.t = time; |
this.h = hash; |
} |
} |
public static void check(Properties pTOS, File confDir, boolean useH2) { |
if (!confDir.exists()) { |
System.out.println("missing conf dir " + confDir.getAbsolutePath()); |
} |
final boolean hasCloud = pTOS.getProperty("hasCloud", "false").equals("true"); |
final int launchCounter = Integer.parseInt(pTOS.getProperty("launchCounter", "0")); |
Thread t = new Thread(new Runnable() { |
@Override |
public void run() { |
try { |
File historyFile = new File(confDir, "history.log"); |
if (!historyFile.exists()) { |
FileUtils.writeUTF8("", historyFile); |
} |
List<DateHash> history = new ArrayList<>(); |
long today = System.currentTimeMillis(); |
// 60 days |
long maxDate = today - 60 * 24 * 3600 * 1000; |
try (BufferedReader reader = new BufferedReader(new FileReader(historyFile))) { |
String line = reader.readLine(); |
while (line != null) { |
Long t = Long.parseLong(line); |
String h = reader.readLine(); |
if (t > maxDate) { |
history.add(new DateHash(t, h)); |
} |
line = reader.readLine(); |
} |
} catch (Exception e) { |
e.printStackTrace(); |
} |
byte[] data = download("https://www.ilm-informatique.fr/openconcerto/ocnews"); |
MessageDigest digester = MessageDigest.getInstance("SHA-256"); |
digester.update(data); |
String h = Base64.encodeBytes(digester.digest()); |
boolean found = false; |
for (DateHash d : history) { |
if (d.h.equals(h)) { |
found = true; |
break; |
} |
} |
DateHash newLine = new DateHash(System.currentTimeMillis(), h); |
history.add(newLine); |
if (!found) { |
final JSONParser jsonParser = new JSONParser(JSONParser.MODE_PERMISSIVE); |
final String jsonString = new String(data, StandardCharsets.UTF_8); |
JSONObject obj = (JSONObject) jsonParser.parse(jsonString); |
String title = obj.getOrDefault("title", "").toString(); |
String text = obj.getOrDefault("text", "").toString(); |
String imageURL = obj.getOrDefault("image", "").toString(); |
String end = obj.getOrDefault("end", "1/12/2133").toString(); |
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); |
Date dateEnd = df.parse(end); |
boolean includeCloud = (Boolean) obj.getOrDefault("include-cloud", Boolean.FALSE); |
boolean includeMono = (Boolean) obj.getOrDefault("include-mono", Boolean.FALSE); |
boolean includeMulti = (Boolean) obj.getOrDefault("include-multi", Boolean.FALSE); |
boolean isMono = useH2; |
boolean isMulti = !hasCloud && !isMono; |
int minLaunch = (Integer) obj.getOrDefault("min-launch", 0); |
if (launchCounter < minLaunch) { |
System.out.println("launch counter too small (" + launchCounter + ")"); |
} else { |
if (dateEnd.before(new Date())) { |
System.out.println("outdated news"); |
} else { |
if (includeCloud && hasCloud || includeMono && isMono || includeMulti && isMulti) { |
BufferedImage image = null; |
if (imageURL != null && imageURL.length() > 5) { |
try { |
byte[] imageData = download(imageURL); |
image = ImageIO.read(new ByteArrayInputStream(imageData)); |
} catch (Exception e) { |
e.printStackTrace(); |
} |
} |
showFrame(title, text, image, history, historyFile); |
} else { |
System.out.println("news not relevant"); |
} |
} |
} |
} else { |
System.out.println("news already displayed"); |
} |
} catch (Exception e) { |
e.printStackTrace(); |
} |
} |
private byte[] download(String u) throws MalformedURLException, IOException { |
URL url = new URL(u); |
URLConnection connection = url.openConnection(); |
InputStream is = connection.getInputStream(); |
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
byte[] buffer = new byte[2048]; |
int length = 0; |
while ((length = is.read(buffer)) != -1) { |
out.write(buffer, 0, length); |
} |
is.close(); |
out.close(); |
byte[] data = out.toByteArray(); |
return data; |
} |
}); |
t.setPriority(Thread.MIN_PRIORITY); |
t.setName("News checker"); |
t.setDaemon(true); |
t.start(); |
} |
protected static void showFrame(String title, String text, BufferedImage image, List<DateHash> history, File historyFile) { |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
JFrame f = new JFrame(); |
f.setIconImages(Gestion.getFrameIcon()); |
f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); |
if (title != null && !title.isEmpty()) { |
f.setTitle(title); |
} else { |
f.setTitle("OpenConcerto"); |
} |
JPanel p = new JPanel(); |
p.setBackground(Color.WHITE); |
p.setLayout(new BorderLayout()); |
if (image != null) { |
p.add(new JImage(image), BorderLayout.PAGE_START); |
} |
if (text != null && !text.isEmpty()) { |
final String t = text.replace("\\n", "\n"); |
final JTextArea ta = new JTextArea(t); |
ta.setBorder(BorderFactory.createLineBorder(Color.WHITE, 10)); |
Font font = new JTextField("hello").getFont(); |
font = font.deriveFont(font.getSize() + 2f); |
ta.setFont(font); |
ta.setEditable(false); |
p.add(ta, BorderLayout.CENTER); |
} |
final JButton bOk = new JButton(); |
bOk.setEnabled(false); |
Thread t = new Thread(new Runnable() { |
@Override |
public void run() { |
for (int i = 10; i > 0; i--) { |
final int c = i; |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
bOk.setText(String.valueOf(c) + "s"); |
} |
}); |
try { |
Thread.sleep(1000); |
} catch (InterruptedException e) { |
// Nothing |
} |
} |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
bOk.setText("OK"); |
bOk.setEnabled(true); |
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
} |
}); |
} |
}); |
t.start(); |
bOk.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
// save history |
if (history != null) { |
try (FileOutputStream fOp = new FileOutputStream(historyFile)) { |
PrintStream prt = new PrintStream(new BufferedOutputStream(fOp)); |
for (DateHash d : history) { |
prt.println(d.t); |
prt.println(d.h); |
} |
prt.close(); |
} catch (IOException e1) { |
e1.printStackTrace(); |
} |
System.out.println(historyFile.getAbsolutePath() + " saved"); |
} |
// close |
f.dispose(); |
} |
}); |
final FlowLayout flowLayout = new FlowLayout(FlowLayout.RIGHT); |
final JPanel pButtons = new JPanel(); |
pButtons.setLayout(flowLayout); |
pButtons.setOpaque(false); |
pButtons.add(bOk); |
p.add(pButtons, BorderLayout.PAGE_END); |
f.setContentPane(p); |
f.pack(); |
f.setMinimumSize(new Dimension(300, 400)); |
f.setLocationRelativeTo(null); |
f.setVisible(true); |
} |
}); |
} |
public static void main(String[] args) { |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
try { |
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
showFrame("Hello", "world\\nhhhf the window is enlarged or the center and the bottom.", null, null, null); |
// showFrame("Hello", "world\\nhhh", |
// ImageIO.read(this.getClass().getResourceAsStream("256.png")), null); |
} catch (Exception e) { |
e.printStackTrace(); |
} |
} |
}); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/mapping_fr.xml |
---|
7,9 → 7,13 |
<FIELD name="ID_CLIENT" label="Client" /> |
<FIELD name="POURCENT_REMISE" label="% remise" /> |
</element> |
<element refid="humanresources.payroll.conventions.code" nameClass="masculine" name="code de convention" |
namePlural="codes de conventions"> |
<FIELD name="CODE" label="Code" /> |
<FIELD name="NOM" label="Libellé" /> |
</element> |
<element refid="common.address" nameClass="feminine" name="adresse"> |
<FIELD name="RAISON_SOCIALE" label="Raison sociale" /> |
<FIELD name="RUE" label="Rue" /> |
262,8 → 266,13 |
<FIELD name="CAPITAL" label="Capital" /> |
<FIELD name="NUMERO_URSSAF" label="Identifiant personnel URSSAF" /> |
<FIELD name="ID_DEVISE" label="Devise" /> |
<FIELD name="ID_IDCC" label="Convention collective applicable" /> |
<FIELD name="ORG_PROTECTION_SOCIAL_ID" label="Siret URSSAF" /> |
<FIELD name="SEPA_CREDITOR_ID" label="Identifiant Créancier SEPA" /> |
<FIELD name="ID_MOTIF_NON_ASSUJETIS_TA" label="Motif non assuj. TA (S21.G00.44.004)" /> |
<FIELD name="ASSUJETTISSEMENT_TA" label="Assujettisement TA (S21.G00.44.001)" /> |
<FIELD name="ASSUJETTISSEMENT_CFP" label="Assujettisement CFP (S21.G00.44.001)" /> |
<FIELD name="ASSUJETTISSEMENT_CFP_CDD" label="Assujettisement CFP CDD (S21.G00.44.001)" /> |
</element> |
<element refid="document.template-type" nameClass="masculine" name="type de modèle" |
namePlural="types de modèles"> |
278,6 → 287,6 |
<FIELD name="FORMULE" label="Formule" /> |
<FIELD name="INFOS" label="Description" /> |
</element> |
</ROOT> |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/update/Updater_1_5.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
29,6 → 29,7 |
import org.openconcerto.erp.core.supplychain.stock.element.DepotStockSQLElement; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItem; |
import org.openconcerto.sql.changer.convert.AddMDFields; |
import org.openconcerto.sql.changer.convert.SetFKDefault; |
import org.openconcerto.sql.model.AliasedTable; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLField; |
41,6 → 42,7 |
import org.openconcerto.sql.model.SQLSyntax; |
import org.openconcerto.sql.model.SQLSystem; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.SQLUpdate; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.UpdateBuilder; |
140,6 → 142,14 |
tClient.fetchFields(); |
} |
if (!tClient.contains("ALERTE")) { |
final AlterTable alterClient = new AlterTable(tClient); |
alterClient.addVarCharColumn("ALERTE", 4096); |
tClient.getBase().getDataSource().execute(alterClient.asString()); |
tClient.getSchema().updateVersion(); |
tClient.fetchFields(); |
} |
final SQLTable tCompteClient = root.getTable("COMPTE_CLIENT_TRANSACTION"); |
if (!tCompteClient.contains("ID_MOUVEMENT")) { |
final AlterTable alterClient = new AlterTable(tCompteClient); |
817,7 → 827,7 |
String field = sqlField.getName(); |
if (!field.equalsIgnoreCase("ID_USER_COMMON_CREATE") && !field.equalsIgnoreCase("ID_USER_COMMON_MODIFY") && !field.equalsIgnoreCase("MODIFICATION_DATE") |
&& !field.equalsIgnoreCase("CREATION_DATE") && !field.equalsIgnoreCase("HEURE_TRAV")) { |
&& !field.equalsIgnoreCase("CREATION_DATE") && !field.equalsIgnoreCase("HEURE_TRAV") && !tableVarSal.contains(field + "_DEFAULT_VAL")) { |
alterB.addColumn(field + "_DEFAULT_VAL", "real DEFAULT 0"); |
} |
} |
859,6 → 869,14 |
root.getSchema().updateVersion(); |
} |
if (!tableFpaye.contains("PERTE_TPT")) { |
final AlterTable alterB = new AlterTable(tableFpaye); |
alterB.addDecimalColumn("PERTE_TPT", 16, 2, BigDecimal.ZERO, false); |
root.getBase().getDataSource().execute(alterB.asString()); |
root.refetchTable("FICHE_PAYE"); |
root.getSchema().updateVersion(); |
} |
SQLTable tableCpaye = root.findTable("CUMULS_PAYE"); |
if (!tableCpaye.contains("TAXE_CM_SAL_C")) { |
final AlterTable alterB = new AlterTable(tableCpaye); |
934,6 → 952,14 |
tableArticle.getSchema().updateVersion(); |
tableArticle.fetchFields(); |
} |
if (!tableArticle.contains("OPTION")) { |
final AlterTable alterArticle = new AlterTable(tableArticle); |
alterArticle.addBooleanColumn("OPTION", Boolean.FALSE, false); |
tableArticle.getBase().getDataSource().execute(alterArticle.asString()); |
tableArticle.getSchema().updateVersion(); |
tableArticle.fetchFields(); |
} |
SQLTable tableFournisseur = root.getTable("FOURNISSEUR"); |
if (!tableFournisseur.contains("NUMERO_TVA")) { |
final AlterTable alter = new AlterTable(tableFournisseur); |
943,6 → 969,13 |
tableFournisseur.getSchema().updateVersion(); |
tableFournisseur.fetchFields(); |
} |
if (!tableFournisseur.contains("CONDITIONS_PORT")) { |
final AlterTable alter = new AlterTable(tableFournisseur); |
alter.addVarCharColumn("CONDITIONS_PORT", 128); |
tableFournisseur.getBase().getDataSource().execute(alter.asString()); |
tableFournisseur.getSchema().updateVersion(); |
tableFournisseur.fetchFields(); |
} |
// POS |
final SQLTable caisseT = root.getTable("CAISSE"); |
1058,6 → 1091,31 |
root.getSchema().updateVersion(); |
} |
SQLTable tableCommandeAcompte = root.getTable("COMMANDE_CLIENT"); |
if (!tableCommandeAcompte.contains("T_ACOMPTE")) { |
final AlterTable alterB = new AlterTable(tableCommandeAcompte); |
alterB.addLongColumn("T_ACOMPTE", 0L, false); |
root.getBase().getDataSource().execute(alterB.asString()); |
root.refetchTable("COMMANDE_CLIENT"); |
root.getSchema().updateVersion(); |
SQLTable tableEncaisse = root.getTable("ENCAISSER_MONTANT"); |
final AlterTable alterC = new AlterTable(tableEncaisse); |
alterC.addForeignColumn("ID_COMMANDE_CLIENT", tableDevisAcompte); |
root.getBase().getDataSource().execute(alterC.asString()); |
root.refetchTable("ENCAISSER_MONTANT"); |
root.getSchema().updateVersion(); |
} |
if (!tableDevisAcompte.contains("DATE_LIVRAISON")) { |
final AlterTable alterB = new AlterTable(tableDevisAcompte); |
alterB.addColumn("DATE_LIVRAISON", "date"); |
alterB.addVarCharColumn("TRANSFORMATION", 200); |
root.getBase().getDataSource().execute(alterB.asString()); |
root.refetchTable("DEVIS"); |
root.getSchema().updateVersion(); |
} |
// Paye Simplifiée |
if (!tableFpaye.contains("ALLEGEMENT_COTISATION")) { |
final AlterTable alterB = new AlterTable(tableFpaye); |
1654,6 → 1712,7 |
} |
// Gestion multidepot |
final SQLTable userT = root.findTable("USER_COMMON"); |
{ |
// Ajout table depot |
if (!root.contains("DEPOT_STOCK")) { |
1661,7 → 1720,7 |
createTable.addVarCharColumn("CODE", 25); |
createTable.addVarCharColumn("NOM", 256); |
createTable.addVarCharColumn("UI_LOCK", 256); |
createTable.addForeignColumn("ID_USER_UI_LOCK", root.findTable("USER_COMMON")); |
createTable.addForeignColumn("ID_USER_UI_LOCK", userT); |
// sqlRowValues.put("UI_LOCK", "ro"); |
// sqlRowValues.put("ID_USER_UI_LOCK", 2); |
1867,7 → 1926,7 |
String field = sqlField.getName(); |
if (!field.equalsIgnoreCase("ID_USER_COMMON_CREATE") && !field.equalsIgnoreCase("ID_USER_COMMON_MODIFY") && !field.equalsIgnoreCase("MODIFICATION_DATE") |
&& !field.equalsIgnoreCase("CREATION_DATE") && !field.endsWith("_DEFAULT_VAL")) { |
&& !field.equalsIgnoreCase("CREATION_DATE") && !field.endsWith("_DEFAULT_VAL") && !tableVarSal.contains(field + "_CUMUL_VAL")) { |
alterB.addColumn(field + "_CUMUL_VAL", "real DEFAULT 0"); |
} |
} |
1885,6 → 1944,14 |
root.getSchema().updateVersion(); |
} |
if (!tableBL.contains("VERROU_FACTURATION")) { |
final AlterTable alterB = new AlterTable(tableBL); |
alterB.addBooleanColumn("VERROU_FACTURATION", Boolean.FALSE, false); |
root.getBase().getDataSource().execute(alterB.asString()); |
root.refetchTable("BON_DE_LIVRAISON"); |
root.getSchema().updateVersion(); |
} |
// fix stock |
{ |
SQLTable tableStock = root.getTable("STOCK"); |
1941,14 → 2008,16 |
} |
} |
SQLSelect selArt = new SQLSelect(); |
selArt.addSelectStar(tableArt); |
Where w = new Where(tableArt.getField("ID_STOCK"), "=", 1); |
selArt.setWhere(w); |
List<SQLRow> badStock = SQLRowListRSH.execute(selArt); |
for (SQLRow sqlRow : badStock) { |
initStock(sqlRow); |
} |
// Remove useless since 1.7.1 |
// SQLSelect selArt = new SQLSelect(); |
// selArt.addSelectStar(tableArt); |
// Where w = new Where(tableArt.getField("ID_STOCK"), "=", 1); |
// selArt.setWhere(w); |
// List<SQLRow> badStock = SQLRowListRSH.execute(selArt); |
// for (SQLRow sqlRow : badStock) { |
// initStock(sqlRow); |
// } |
} |
// Tarification client par quantite |
2096,7 → 2165,7 |
final SQLTable tableSalarie = root.getTable("SALARIE"); |
if (!tableSalarie.contains("ID_USER_COMMON")) { |
final AlterTable alter = new AlterTable(tableSalarie); |
alter.addForeignColumn("ID_USER_COMMON", root.findTable("USER_COMMON")); |
alter.addForeignColumn("ID_USER_COMMON", userT); |
exec(alter); |
root.refetchTable(tableSalarie.getName()); |
root.getSchema().updateVersion(); |
2420,6 → 2489,256 |
tableVF.fetchFields(); |
} |
SQLTable tableNumAuto = root.getTable("NUMEROTATION_AUTO"); |
if (!tableNumAuto.contains("ARTICLE_FORMAT")) { |
final AlterTable alterNumero = new AlterTable(tableNumAuto); |
alterNumero.addVarCharColumn("ARTICLE_FORMAT", 128); |
alterNumero.addIntegerColumn("ARTICLE_START", 1); |
root.getBase().getDataSource().execute(alterNumero.asString()); |
root.refetchTable("NUMEROTATION_AUTO"); |
root.getSchema().updateVersion(); |
} |
if (!tableArticle.contains("VIRTUEL")) { |
final SQLCreateTable createTableDeclinaisonCouleur = new SQLCreateTable(root, "ARTICLE_DECLINAISON_COULEUR"); |
createTableDeclinaisonCouleur.addVarCharColumn("NOM", 256); |
root.getBase().getDataSource().execute(createTableDeclinaisonCouleur.asString()); |
InstallationPanel.insertUndef(createTableDeclinaisonCouleur); |
root.refetchTable("ARTICLE_DECLINAISON_COULEUR"); |
root.getSchema().updateVersion(); |
final SQLCreateTable createTableDeclinaisonTaille = new SQLCreateTable(root, "ARTICLE_DECLINAISON_TAILLE"); |
createTableDeclinaisonTaille.addVarCharColumn("NOM", 256); |
root.getBase().getDataSource().execute(createTableDeclinaisonTaille.asString()); |
InstallationPanel.insertUndef(createTableDeclinaisonTaille); |
root.refetchTable("ARTICLE_DECLINAISON_TAILLE"); |
root.getSchema().updateVersion(); |
final AlterTable alter = new AlterTable(tableArticle); |
alter.addBooleanColumn("VIRTUEL", false, false); |
alter.addForeignColumn("ID_ARTICLE_VIRTUEL_PERE", tableArticle); |
alter.addForeignColumn("ID_ARTICLE_DECLINAISON_TAILLE", root.getTable("ARTICLE_DECLINAISON_TAILLE")); |
alter.addForeignColumn("ID_ARTICLE_DECLINAISON_COULEUR", root.getTable("ARTICLE_DECLINAISON_COULEUR")); |
tableArticle.getBase().getDataSource().execute(alter.asString()); |
tableArticle.getSchema().updateVersion(); |
tableArticle.fetchFields(); |
} |
for (String string : achatItems) { |
boolean alter = false; |
SQLTable tableItems = root.getTable(string); |
final AlterTable t = new AlterTable(tableItems); |
if (!tableItems.getFieldsName().contains("ID_ARTICLE_DECLINAISON_TAILLE")) { |
t.addForeignColumn("ID_ARTICLE_DECLINAISON_TAILLE", root.getTable("ARTICLE_DECLINAISON_TAILLE")); |
alter = true; |
} |
if (!tableItems.getFieldsName().contains("ID_ARTICLE_DECLINAISON_COULEUR")) { |
t.addForeignColumn("ID_ARTICLE_DECLINAISON_COULEUR", root.getTable("ARTICLE_DECLINAISON_COULEUR")); |
alter = true; |
} |
if (alter) { |
tableItems.getBase().getDataSource().execute(t.asString()); |
tableItems.getSchema().updateVersion(); |
tableItems.fetchFields(); |
} |
} |
for (String tableName : tableElementWithTable) { |
final SQLTable tableToDecl = root.getTable(tableName); |
boolean alter = false; |
final AlterTable alterDecl = new AlterTable(tableToDecl); |
if (!tableToDecl.getFieldsName().contains("ID_ARTICLE_DECLINAISON_TAILLE")) { |
alterDecl.addForeignColumn("ID_ARTICLE_DECLINAISON_TAILLE", root.getTable("ARTICLE_DECLINAISON_TAILLE")); |
alter = true; |
} |
if (!tableToDecl.getFieldsName().contains("ID_ARTICLE_DECLINAISON_COULEUR")) { |
alterDecl.addForeignColumn("ID_ARTICLE_DECLINAISON_COULEUR", root.getTable("ARTICLE_DECLINAISON_COULEUR")); |
alter = true; |
} |
if (alter) { |
tableToDecl.getBase().getDataSource().execute(alterDecl.asString()); |
tableToDecl.getSchema().updateVersion(); |
tableToDecl.fetchFields(); |
} |
} |
// Création de la table Tarif promotion |
if (!root.contains("TARIF_PROMOTION")) { |
SQLCreateTable createTarif = new SQLCreateTable(root, "TARIF_PROMOTION"); |
createTarif.addVarCharColumn("NOM", 256); |
createTarif.addColumn("START", "date"); |
createTarif.addColumn("END", "date"); |
root.getBase().getDataSource().execute(createTarif.asString()); |
InstallationPanel.insertUndef(createTarif); |
tableDevis.getSchema().updateVersion(); |
root.refetchTable(createTarif.getName()); |
} |
// Création de la table article Tarif promotion |
if (!root.contains("ARTICLE_TARIF_PROMOTION")) { |
SQLCreateTable createTarif = new SQLCreateTable(root, "ARTICLE_TARIF_PROMOTION"); |
createTarif.addForeignColumn("ID_DEVISE", root.findTable("DEVISE", true)); |
createTarif.addForeignColumn("ID_TAXE", root.findTable("TAXE", true)); |
createTarif.addForeignColumn("ID_TARIF_PROMOTION", root.findTable("TARIF_PROMOTION", true)); |
createTarif.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true)); |
createTarif.addIntegerColumn("QTE", 1); |
createTarif.addDecimalColumn("PV_HT", 16, 6, BigDecimal.ZERO, false); |
createTarif.addDecimalColumn("PV_TTC", 16, 6, BigDecimal.ZERO, false); |
createTarif.addDecimalColumn("PRIX_METRIQUE_VT_1", 16, 6, BigDecimal.ZERO, false); |
createTarif.addDecimalColumn("PRIX_METRIQUE_VT_2", 16, 6, BigDecimal.ZERO, false); |
createTarif.addDecimalColumn("PRIX_METRIQUE_VT_3", 16, 6, BigDecimal.ZERO, false); |
root.getBase().getDataSource().execute(createTarif.asString()); |
InstallationPanel.insertUndef(createTarif); |
tableDevis.getSchema().updateVersion(); |
root.refetchTable(createTarif.getName()); |
} |
if (!root.contains("TAXE_CATEGORIE_COMPTABLE")) { |
final SQLCreateTable createTableTaxeCat = new SQLCreateTable(root, "TAXE_CATEGORIE_COMPTABLE"); |
createTableTaxeCat.addForeignColumn("ID_CATEGORIE_COMPTABLE", root.getTable("CATEGORIE_COMPTABLE")); |
createTableTaxeCat.addForeignColumn("ID_TAXE", root.getTable("TAXE")); |
createTableTaxeCat.addForeignColumn("ID_COMPTE_PCE_VENTE", root.getTable("COMPTE_PCE")); |
createTableTaxeCat.addForeignColumn("ID_COMPTE_PCE_ACHAT", root.getTable("COMPTE_PCE")); |
try { |
root.getBase().getDataSource().execute(createTableTaxeCat.asString()); |
InstallationPanel.insertUndef(createTableTaxeCat); |
root.refetchTable("TAXE_CATEGORIE_COMPTABLE"); |
root.getSchema().updateVersion(); |
} catch (SQLException ex) { |
throw new IllegalStateException("Erreur lors de la création de la table " + "TAXE_CATEGORIE_COMPTABLE", ex); |
} |
} |
if (!root.contains("LOT_RECEPTION")) { |
SQLCreateTable createLotReception = new SQLCreateTable(root, "LOT_RECEPTION"); |
createLotReception.addDateAndTimeColumn("DATE_RECEPTION"); |
createLotReception.addVarCharColumn("FOURNISSEUR", 256); |
createLotReception.addVarCharColumn("ARTICLE", 256); |
createLotReception.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true)); |
createLotReception.addForeignColumn("ID_DEPOT_STOCK", root.findTable("DEPOT_STOCK", true)); |
createLotReception.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false); |
createLotReception.addVarCharColumn("NUMERO_LOT", 256); |
createLotReception.addVarCharColumn("NUMERO_SERIE", 256); |
createLotReception.addDateAndTimeColumn("DLC"); |
createLotReception.addDateAndTimeColumn("DLUO"); |
createLotReception.addForeignColumn("ID_BON_RECEPTION_ELEMENT", root.findTable("BON_RECEPTION_ELEMENT", true)); |
root.getBase().getDataSource().execute(createLotReception.asString()); |
InstallationPanel.insertUndef(createLotReception); |
SQLCreateTable createLotLivraison = new SQLCreateTable(root, "LOT_LIVRAISON"); |
createLotLivraison.addDateAndTimeColumn("DATE_LIVRAISON"); |
createLotLivraison.addVarCharColumn("CLIENT", 256); |
createLotLivraison.addVarCharColumn("ARTICLE", 256); |
createLotLivraison.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true)); |
createLotLivraison.addForeignColumn("ID_DEPOT_STOCK", root.findTable("DEPOT_STOCK", true)); |
createLotLivraison.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false); |
createLotLivraison.addVarCharColumn("NUMERO_LOT", 256); |
createLotLivraison.addVarCharColumn("NUMERO_SERIE", 256); |
createLotLivraison.addDateAndTimeColumn("DLC"); |
createLotLivraison.addDateAndTimeColumn("DLUO"); |
createLotLivraison.addForeignColumn("ID_BON_DE_LIVRAISON_ELEMENT", root.findTable("BON_DE_LIVRAISON_ELEMENT", true)); |
root.getBase().getDataSource().execute(createLotLivraison.asString()); |
InstallationPanel.insertUndef(createLotLivraison); |
} |
if (!root.contains("LOT")) { |
SQLCreateTable createLot = new SQLCreateTable(root, "LOT"); |
createLot.addForeignColumn("ID_STOCK", root.findTable("STOCK", true)); |
createLot.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false); |
createLot.addVarCharColumn("NUMERO_LOT", 256); |
createLot.addVarCharColumn("NUMERO_SERIE", 256); |
createLot.addDateAndTimeColumn("DLC"); |
createLot.addDateAndTimeColumn("DLUO"); |
root.getBase().getDataSource().execute(createLot.asString()); |
InstallationPanel.insertUndef(createLot); |
SQLCreateTable createTransfertStock = new SQLCreateTable(root, "TRANSFERT_STOCK"); |
createTransfertStock.addDateAndTimeColumn("DATE"); |
createTransfertStock.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true)); |
createTransfertStock.addForeignColumn("ID_DEPOT_STOCK_SOURCE", root.findTable("DEPOT_STOCK", true)); |
createTransfertStock.addForeignColumn("ID_DEPOT_STOCK_DEST", root.findTable("DEPOT_STOCK", true)); |
createTransfertStock.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false); |
createTransfertStock.addVarCharColumn("NUMEROS_SERIE", 50000); |
createTransfertStock.addVarCharColumn("NUMEROS_LOT", 50000); |
createTransfertStock.addVarCharColumn("CONTEXTE", 256); |
root.getBase().getDataSource().execute(createTransfertStock.asString()); |
InstallationPanel.insertUndef(createTransfertStock); |
final AlterTable alterArticle = new AlterTable(tableArticle); |
alterArticle.addBooleanColumn("NUMERO_LOT_REQUIS", false, false); |
alterArticle.addBooleanColumn("NUMERO_SERIE_REQUIS", false, false); |
alterArticle.addBooleanColumn("DLC_REQUIS", false, false); |
alterArticle.addBooleanColumn("DLUO_REQUIS", false, false); |
tableArticle.getBase().getDataSource().execute(alterArticle.asString()); |
tableArticle.getSchema().updateVersion(); |
tableArticle.fetchFields(); |
final AlterTable alterBonReceptionElement = new AlterTable(root.getTable("BON_RECEPTION_ELEMENT")); |
alterBonReceptionElement.addForeignColumn("ID_LOT", createLot); |
tableArticle.getBase().getDataSource().execute(alterBonReceptionElement.asString()); |
final AlterTable alterBonLivraisonElement = new AlterTable(root.getTable("BON_DE_LIVRAISON")); |
alterBonLivraisonElement.addForeignColumn("ID_LOT", createLot); |
tableArticle.getBase().getDataSource().execute(alterBonLivraisonElement.asString()); |
tableArticle.getSchema().updateVersion(); |
root.refetch(); |
} |
SQLTable tableBR = root.getTable("BON_RECEPTION"); |
SQLTable tableModele = root.getTable("MODELE"); |
if (!tableBR.contains("ID_MODELE")) { |
AlterTable a = new AlterTable(tableBR); |
a.addForeignColumn("ID_MODELE", tableModele); |
root.getBase().getDataSource().execute(a.asString()); |
tableBR.getSchema().updateVersion(); |
root.refetchTable(tableBR.getName()); |
} |
SQLTable typeModele = tableModele.getForeignTable("ID_TYPE_MODELE"); |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(typeModele.getKey()); |
sel.setWhere(new Where(typeModele.getField("TABLE"), "=", "BON_RECEPTION")); |
List<SQLRow> l = SQLRowListRSH.execute(sel); |
if (l.isEmpty()) { |
SQLRowValues rowVals = new SQLRowValues(typeModele); |
rowVals.put("TABLE", "BON_RECEPTION"); |
rowVals.put("NOM", "Bon de réception"); |
rowVals.put("DEFAULT_MODELE", "BonReception"); |
rowVals.commit(); |
} |
// Fix undefined |
new SetFKDefault(root.getDBSystemRoot()).changeAll(root); |
List<SQLUpdate> ups = new ArrayList<>(); |
if (userT.getUndefinedIDNumber() != null) { |
for (SQLField userF : root.getDBSystemRoot().getGraph().getReferentKeys(userT)) { |
if (userF.getTable().getDBRoot() == root) { |
SQLUpdate up = new SQLUpdate(Where.isNull(userF)); |
up.add(userF, userT.getUndefinedIDNumber()); |
ups.add(up); |
} |
} |
} |
if (!ups.isEmpty()) { |
SQLUpdate.executeMultipleWithBatch(root.getDBSystemRoot(), ups); |
System.err.println("Updater_1_5.update() fixed " + ups.size() + " error(s) on FK to USER_COMMON"); |
} else { |
System.err.println("Updater_1_5.update() no error on FK to USER_COMMON"); |
} |
} |
public static void initStock(SQLRow rowArticle, int idDepot) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/MinimalMenuConfiguration.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
42,9 → 42,7 |
final Group fileMenu = new Group(MainFrame.FILE_MENU); |
fileMenu.addItem("backup"); |
if (!Gestion.MAC_OS_X) { |
fileMenu.addItem("quit"); |
} |
fileMenu.addItem(MainFrame.QUIT_MENU_ITEM); |
res.add(fileMenu); |
if (rights.haveRight(LockAdminUserRight.LOCK_MENU_ADMIN)) { |
54,7 → 52,7 |
} |
final Group helpMenu = new Group(MainFrame.HELP_MENU); |
helpMenu.addItem("information"); |
helpMenu.addItem(MainFrame.ABOUT_MENU_ITEM); |
res.add(helpMenu); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/InProgressFrame.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,7 → 15,12 |
import org.openconcerto.ui.ReloadPanel; |
import java.awt.Color; |
import java.awt.FlowLayout; |
import java.awt.Font; |
import java.awt.Graphics2D; |
import java.awt.RenderingHints; |
import java.awt.SplashScreen; |
import javax.swing.JDialog; |
import javax.swing.JLabel; |
27,6 → 32,25 |
} |
public void show(String title) { |
try { |
final SplashScreen splash = SplashScreen.getSplashScreen(); |
if (splash != null) { |
Graphics2D g = splash.createGraphics(); |
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_GASP); |
g.setColor(Color.WHITE); |
g.fillRect(0, (int) splash.getSize().getHeight() - 24, (int) splash.getSize().getWidth(), 24); |
g.setFont(g.getFont().deriveFont(Font.BOLD).deriveFont(11f)); |
g.setColor(Color.DARK_GRAY); |
g.drawString(title, 20, ((int) splash.getSize().getHeight()) - 8); |
splash.update(); |
return; |
} |
} catch (Throwable e) { |
// OpenJDK bug on linux |
e.printStackTrace(); |
} |
setTitle("Veuillez patienter"); |
JPanel p = new JPanel(); |
p.setLayout(new FlowLayout(FlowLayout.LEADING, 5, 5)); |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/MenuAndActions.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
130,7 → 130,7 |
// check and modify group |
final Group groupDesc = this.getGroup().followPath(path, true); |
final Item child = groupDesc.getChildFromID(actionID); |
final Item child = groupDesc.getDescFromID(actionID); |
if (!canReplace && child != null) { |
throw new IllegalStateException("ID exists : " + child); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/InstallationPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
19,9 → 19,11 |
import org.openconcerto.erp.core.sales.quote.element.EtatDevisSQLElement; |
import org.openconcerto.erp.modules.ModuleManager; |
import org.openconcerto.erp.modules.ModuleReference; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.erp.rights.DepotStockViewRightEditor; |
import org.openconcerto.sql.changer.convert.AddFK; |
import org.openconcerto.sql.changer.convert.AddMDFields; |
import org.openconcerto.sql.changer.convert.ChangeIDToInt; |
import org.openconcerto.sql.changer.convert.MergeTable; |
import org.openconcerto.sql.changer.correct.CorrectOrder; |
import org.openconcerto.sql.changer.correct.FixSerial; |
import org.openconcerto.sql.element.GroupSQLComponent; |
141,20 → 143,6 |
System.setProperty(SQLSchema.NOAUTO_CREATE_METADATA, "false"); |
final ComptaPropsConfiguration conf = ComptaPropsConfiguration.create(true); |
final DBSystemRoot systemRoot = conf.getSystemRoot(); |
if (systemRoot.getChild(conf.getRootNameValue().getValue()) == null) { |
conf.destroy(); |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
up.setEnabled(true); |
bar.setValue(bar.getMaximum()); |
JOptionPane.showMessageDialog(InstallationPanel.this, "Votre base de données n'est pas initialisée"); |
} |
}); |
return; |
} |
updateDatabase(conf); |
conf.destroy(); |
3568,7 → 3556,7 |
patchFieldElt1Dot3(table, root); |
} |
private void updateSocieteSchema(final Configuration conf, final DBRoot root) throws IOException, Exception { |
private void updateSocieteSchema(final DBRoot root) throws IOException, Exception { |
final DBSystemRoot sysRoot = root.getDBSystemRoot(); |
final SQLDataSource ds = sysRoot.getDataSource(); |
System.out.println("InstallationPanel.InstallationPanel() UPDATE COMMERCIAL " + root); |
3672,7 → 3660,7 |
final List<ChangeTable<?>> changes = new ArrayList<ChangeTable<?>>(); |
final ModuleManager instance = new ModuleManager(); |
instance.setup(root, conf); |
instance.setRoot(root); |
final Collection<ModuleReference> refs = instance.getModulesInstalledRemotely(); |
final Set<String> allUsedTable = new HashSet<String>(); |
for (ModuleReference ref : refs) { |
3681,10 → 3669,6 |
} |
System.out.println("Tables created by modules:" + allUsedTable); |
final Set<String> notMigrated = instance.migrateOldTransientDirs(); |
if (!notMigrated.isEmpty()) |
System.out.println("Couldn't migrate old backed up/failed modules: " + notMigrated); |
final List<String> alterRequests = ChangeTable.cat(changes, root.getName()); |
try { |
for (final String req : alterRequests) { |
3758,6 → 3742,19 |
rowValsUserRight.commit(); |
} |
if (!codes.contains(DepotStockViewRightEditor.ID_RIGHT)) { |
SQLRowValues rowVals = new SQLRowValues(table); |
rowVals.put("CODE", DepotStockViewRightEditor.ID_RIGHT); |
rowVals.put("NOM", "Voir le stock d'un dépôt"); |
String desc = "Autorise un utilisateur à visualiser le stock d'un dépôt."; |
rowVals.put("DESCRIPTION", desc); |
SQLRow row = rowVals.commit(); |
SQLRowValues rowValsUserRight = new SQLRowValues(table.getTable("USER_RIGHT")); |
rowValsUserRight.put("ID_RIGHT", row.getID()); |
rowValsUserRight.put("HAVE_RIGHT", Boolean.TRUE); |
rowValsUserRight.commit(); |
} |
if (!codes.contains("MENU_ACCESS")) { |
SQLRowValues rowVals = new SQLRowValues(table); |
rowVals.put("CODE", "MENU_ACCESS"); |
3818,6 → 3815,7 |
rowValsUserRight.put("HAVE_RIGHT", Boolean.TRUE); |
rowValsUserRight.commit(); |
} |
// if (!codes.contains("MODIF_PRODUCT_KIT")) { |
// SQLRowValues rowVals = new SQLRowValues(table); |
// rowVals.put("CODE", "MODIF_PRODUCT_KIT"); |
4210,25 → 4208,23 |
public void updateDatabase(final ComptaPropsConfiguration conf) { |
try { |
final DBSystemRoot systemRoot = conf.getSystemRoot(); |
System.err.println("SystemRoot:" + systemRoot); |
final DBRoot rootCommon = conf.getRoot(); |
System.err.println("Root:" + rootCommon); |
final SQLDataSource ds = conf.getSystemRoot().getDataSource(); |
System.err.println("SystemRoot:" + conf.getSystemRoot()); |
System.err.println("Root:" + conf.getRoot()); |
final SQLDataSource ds = systemRoot.getDataSource(); |
// FixUnbounded varchar |
fixUnboundedVarchar(rootCommon); |
fixUnboundedVarchar(conf.getRoot()); |
// FIXME DROP CONSTRAINT UNIQUE ORDRE ON |
// CONTACT_FOURNISSEUR |
checkCompteDefault(rootCommon); |
checkCompteDefault(conf.getRoot()); |
updateSocieteTable(rootCommon); |
updateVille(rootCommon.getTable("ADRESSE")); |
updateSocieteTable(conf.getRoot()); |
updateVille(conf.getRoot().getTable("ADRESSE")); |
// Champ user 1.4.1 |
final SQLTable tableUser = rootCommon.getTable("USER_COMMON"); |
final SQLTable tableUser = conf.getRoot().getTable("USER_COMMON"); |
if (tableUser != null) { |
final AlterTable alter = new AlterTable(tableUser); |
boolean alterUser = false; |
4243,46 → 4239,56 |
if (alterUser) { |
final String req = alter.asString(); |
rootCommon.getDBSystemRoot().getDataSource().execute(req); |
rootCommon.refetchTable(tableUser.getName()); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
conf.getRoot().refetchTable(tableUser.getName()); |
conf.getRoot().getSchema().updateVersion(); |
} |
} |
// Champ Paye |
final SQLTable tableCaisse = rootCommon.getTable("CAISSE_COTISATION"); |
final SQLTable tableCaisse = conf.getRoot().getTable("CAISSE_COTISATION"); |
if (!tableCaisse.contains("NUMERO_COMPTE_PCE")) { |
final AlterTable alter = new AlterTable(tableCaisse); |
alter.addVarCharColumn("NUMERO_COMPTE_PCE", 128); |
alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128); |
final String req = alter.asString(); |
rootCommon.getDBSystemRoot().getDataSource().execute(req); |
rootCommon.refetchTable(tableCaisse.getName()); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
conf.getRoot().refetchTable(tableCaisse.getName()); |
conf.getRoot().getSchema().updateVersion(); |
} |
final SQLTable tableRC = rootCommon.getTable("RUBRIQUE_COTISATION"); |
final SQLTable tableRC = conf.getRoot().getTable("RUBRIQUE_COTISATION"); |
if (!tableRC.contains("PART_CSG_SANS_ABATTEMENT")) { |
final AlterTable alter = new AlterTable(tableRC); |
alter.addBooleanColumn("PART_CSG_SANS_ABATTEMENT", Boolean.FALSE, false); |
final String req = alter.asString(); |
rootCommon.getDBSystemRoot().getDataSource().execute(req); |
rootCommon.refetchTable(tableRC.getName()); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
conf.getRoot().refetchTable(tableRC.getName()); |
conf.getRoot().getSchema().updateVersion(); |
} |
// if (!tableRC.contains("DATE_DEBUT_REGUL")) { |
// final AlterTable alter = new AlterTable(tableRC); |
// alter.addColumn("DATE_DEBUT_REGUL", "date"); |
// alter.addColumn("DATE_FIN_REGUL", "date"); |
// final String req = alter.asString(); |
// conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
// conf.getRoot().refetchTable(tableRC.getName()); |
// conf.getRoot().getSchema().updateVersion(); |
// } |
// Paye simplifiee |
List<SQLRow> rowRubriqueReduGvt = new ArrayList<>(); |
{ |
final SQLTable tableRCom = rootCommon.getTable("RUBRIQUE_COMM"); |
final SQLTable tableRCom = conf.getRoot().getTable("RUBRIQUE_COMM"); |
if (!tableRCom.contains("REDUCTION_GVT_COM")) { |
final AlterTable alter = new AlterTable(tableRCom); |
alter.addBooleanColumn("REDUCTION_GVT_COM", Boolean.FALSE, false); |
final String req = alter.asString(); |
rootCommon.getDBSystemRoot().getDataSource().execute(req); |
rootCommon.refetchTable(tableRCom.getName()); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
conf.getRoot().refetchTable(tableRCom.getName()); |
conf.getRoot().getSchema().updateVersion(); |
SQLRowValues rowValsCommChom = new SQLRowValues(tableRCom); |
rowValsCommChom.put("TAUX_SAL", "1.45;"); |
4321,13 → 4327,13 |
rowRubriqueReduGvt.add(rowValsCommCSG.commit()); |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(rootCommon.getTable("PROFIL_PAYE").getKey()); |
sel.addSelect(conf.getRoot().getTable("PROFIL_PAYE").getKey()); |
List<SQLRow> rowsProfil = SQLRowListRSH.execute(sel); |
int pos = 70; |
for (SQLRow rowRub : rowRubriqueReduGvt) { |
for (SQLRow rowProfil : rowsProfil) { |
SQLRowValues rowValsRubGvt = new SQLRowValues(rootCommon.getTable("PROFIL_PAYE_ELEMENT")); |
SQLRowValues rowValsRubGvt = new SQLRowValues(conf.getRoot().getTable("PROFIL_PAYE_ELEMENT")); |
rowValsRubGvt.put("ID_PROFIL_PAYE", rowProfil.getID()); |
rowValsRubGvt.put("POSITION", pos); |
rowValsRubGvt.put("IDSOURCE", rowRub.getID()); |
4339,14 → 4345,14 |
} |
} |
final SQLTable tableRB = rootCommon.getTable("RUBRIQUE_BRUT"); |
final SQLTable tableRB = conf.getRoot().getTable("RUBRIQUE_BRUT"); |
if (!tableRB.contains("AVANTAGE_NATURE")) { |
final AlterTable alter = new AlterTable(tableRB); |
alter.addBooleanColumn("AVANTAGE_NATURE", Boolean.FALSE, false); |
final String req = alter.asString(); |
rootCommon.getDBSystemRoot().getDataSource().execute(req); |
rootCommon.refetchTable(tableRB.getName()); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
conf.getRoot().refetchTable(tableRB.getName()); |
conf.getRoot().getSchema().updateVersion(); |
} |
if (!tableRC.contains("LIGNE_PAYE_SIMPLIFIEE")) { |
4355,9 → 4361,9 |
alter.addBooleanColumn("ALLEGEMENT_COTISATION", Boolean.FALSE, false); |
alter.addVarCharColumn("LIGNE_PAYE_SIMPLIFIEE", 256); |
final String req = alter.asString(); |
rootCommon.getDBSystemRoot().getDataSource().execute(req); |
rootCommon.refetchTable(tableRC.getName()); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
conf.getRoot().refetchTable(tableRC.getName()); |
conf.getRoot().getSchema().updateVersion(); |
Map<String, String> liaison = new HashMap<String, String>(); |
liaison.put("COTCSA", LignePayeSimplifiee.SANTE_SECURITE.getId()); |
liaison.put("COTMALADIE", LignePayeSimplifiee.SANTE_SECURITE.getId()); |
4406,9 → 4412,9 |
liaison.put("COT_PENIBLE", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId()); |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(rootCommon.findTable("RUBRIQUE_COTISATION").getField("CODE")); |
sel.addSelect(rootCommon.findTable("RUBRIQUE_COTISATION").getField("NOM")); |
sel.addSelect(rootCommon.findTable("RUBRIQUE_COTISATION").getKey()); |
sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getField("CODE")); |
sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getField("NOM")); |
sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getKey()); |
List<SQLRow> rubCotis = SQLRowListRSH.execute(sel); |
for (SQLRow sqlRow : rubCotis) { |
4423,15 → 4429,15 |
} |
} |
final SQLTable tableRnet = rootCommon.getTable("RUBRIQUE_NET"); |
final SQLTable tableRnet = conf.getRoot().getTable("RUBRIQUE_NET"); |
if (!tableRnet.contains("NUMERO_COMPTE_PCE_CHARGES")) { |
final AlterTable alter = new AlterTable(tableRnet); |
alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128); |
final String req = alter.asString(); |
rootCommon.getDBSystemRoot().getDataSource().execute(req); |
rootCommon.refetchTable(tableRnet.getName()); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
conf.getRoot().refetchTable(tableRnet.getName()); |
conf.getRoot().getSchema().updateVersion(); |
} |
if (!tableRC.contains("PART_PAT_IMPOSABLE")) { |
4438,9 → 4444,9 |
final AlterTable alter = new AlterTable(tableRC); |
alter.addBooleanColumn("PART_PAT_IMPOSABLE", Boolean.FALSE, false); |
final String req = alter.asString(); |
rootCommon.getDBSystemRoot().getDataSource().execute(req); |
rootCommon.refetchTable(tableRC.getName()); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
conf.getRoot().refetchTable(tableRC.getName()); |
conf.getRoot().getSchema().updateVersion(); |
} |
if (!tableRC.contains("REDUCTION_FILLON")) { |
4447,21 → 4453,21 |
final AlterTable alter = new AlterTable(tableRC); |
alter.addBooleanColumn("REDUCTION_FILLON", Boolean.FALSE, false); |
final String req = alter.asString(); |
rootCommon.getDBSystemRoot().getDataSource().execute(req); |
rootCommon.refetchTable(tableRC.getName()); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
conf.getRoot().refetchTable(tableRC.getName()); |
conf.getRoot().getSchema().updateVersion(); |
} |
// Vérification des droits existants |
checkRights(rootCommon); |
checkRights(conf.getRoot()); |
if (!rootCommon.contains("DEVISE")) { |
if (!conf.getRoot().contains("DEVISE")) { |
System.out.println("InstallationPanel.InstallationPanel() ADD DEVISE"); |
try { |
SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() { |
@Override |
public Object create() throws SQLException { |
final SQLCreateTable createDevise = new SQLCreateTable(rootCommon, "DEVISE"); |
final SQLCreateTable createDevise = new SQLCreateTable(conf.getRoot(), "DEVISE"); |
createDevise.addVarCharColumn("CODE", 128); |
createDevise.addVarCharColumn("NOM", 128); |
createDevise.addVarCharColumn("LIBELLE", 128); |
4470,7 → 4476,7 |
createDevise.addDecimalColumn("TAUX_COMMERCIAL", 16, 8, BigDecimal.ONE, false); |
ds.execute(createDevise.asString()); |
insertUndef(createDevise); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getSchema().updateVersion(); |
return null; |
} |
}); |
4477,8 → 4483,8 |
} catch (Exception ex) { |
throw new IllegalStateException("Erreur lors de la création de la table DEVISE", ex); |
} |
} else if (!rootCommon.getTable("DEVISE").contains("TAUX_COMMERCIAL")) { |
final SQLTable tDevise = rootCommon.getTable("DEVISE"); |
} else if (!conf.getRoot().getTable("DEVISE").contains("TAUX_COMMERCIAL")) { |
final SQLTable tDevise = conf.getRoot().getTable("DEVISE"); |
final AlterTable alterDevise = new AlterTable(tDevise); |
alterDevise.addDecimalColumn("TAUX_COMMERCIAL", 16, 8, BigDecimal.ONE, false); |
ds.execute(alterDevise.asString()); |
4485,7 → 4491,7 |
tDevise.getSchema().updateVersion(); |
} |
if (!rootCommon.contains("TYPE_MODELE")) { |
if (!conf.getRoot().contains("TYPE_MODELE")) { |
System.out.println("InstallationPanel.InstallationPanel() ADD TYPE_MODELE"); |
try { |
SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() { |
4492,7 → 4498,7 |
@Override |
public Object create() throws SQLException { |
final SQLCreateTable createTypeModele = new SQLCreateTable(rootCommon, "TYPE_MODELE"); |
final SQLCreateTable createTypeModele = new SQLCreateTable(conf.getRoot(), "TYPE_MODELE"); |
createTypeModele.addVarCharColumn("NOM", 128); |
createTypeModele.addVarCharColumn("TABLE", 128); |
createTypeModele.addVarCharColumn("DEFAULT_MODELE", 128); |
4500,9 → 4506,9 |
insertUndef(createTypeModele); |
rootCommon.getSchema().updateVersion(); |
conf.getRoot().getSchema().updateVersion(); |
rootCommon.refetch(); |
conf.getRoot().refetch(); |
return null; |
} |
4512,7 → 4518,7 |
// ('FR', 'Français', 1.000), ('EN', |
// 'Anglais', 2.000) |
final List<String> values = new ArrayList<String>(); |
final SQLBase base = rootCommon.getBase(); |
final SQLBase base = conf.getRoot().getBase(); |
for (int i = 0; i < type.length; i += 3) { |
final int order = values.size() + 1; |
4519,8 → 4525,8 |
values.add("(" + base.quoteString(type[i]) + ", " + base.quoteString(type[i + 1]) + ", " + base.quoteString(type[i + 2]) + ", " + order + ")"); |
} |
final String valuesStr = CollectionUtils.join(values, ", "); |
final String insertVals = "INSERT INTO " + rootCommon.getTable("TYPE_MODELE").getSQLName().quote() + "(" + SQLBase.quoteIdentifier("NOM") + ", " + SQLBase.quoteIdentifier("TABLE") |
+ ", " + SQLBase.quoteIdentifier("DEFAULT_MODELE") + ", " + SQLBase.quoteIdentifier(SQLSyntax.ORDER_NAME) + ") VALUES" + valuesStr; |
final String insertVals = "INSERT INTO " + conf.getRoot().getTable("TYPE_MODELE").getSQLName().quote() + "(" + SQLBase.quoteIdentifier("NOM") + ", " |
+ SQLBase.quoteIdentifier("TABLE") + ", " + SQLBase.quoteIdentifier("DEFAULT_MODELE") + ", " + SQLBase.quoteIdentifier(SQLSyntax.ORDER_NAME) + ") VALUES" + valuesStr; |
ds.execute(insertVals); |
} catch (Exception ex) { |
4528,25 → 4534,64 |
} |
} |
SQLTable.setUndefID(rootCommon.getSchema(), "DEVISE", 1); |
SQLTable.setUndefID(rootCommon.getSchema(), "TYPE_MODELE", 1); |
SQLTable.setUndefID(conf.getRoot().getSchema(), "DEVISE", 1); |
SQLTable.setUndefID(conf.getRoot().getSchema(), "TYPE_MODELE", 1); |
// DSN |
final DSNInstallationUtils dsnUtils = new DSNInstallationUtils(); |
dsnUtils.updateDSNCommonTable(rootCommon); |
SQLRow rowRubNetPAS = createPasCommon(rootCommon); |
dsnUtils.updateDSNCommonTable(conf.getRoot()); |
SQLRow rowRubNetPAS = createPasCommon(conf.getRoot()); |
// ECo contribution |
final EcoContributionInstallationUtils ecoUtils = new EcoContributionInstallationUtils(); |
ecoUtils.updateEcoCommonTable(rootCommon); |
ecoUtils.updateEcoCommonTable(conf.getRoot()); |
// we need to upgrade all roots |
// /////////////////////////// |
systemRoot.mapAllRoots(); |
systemRoot.refetch(); |
conf.getSystemRoot().mapAllRoots(); |
conf.getSystemRoot().refetch(); |
final Set<String> childrenNames = systemRoot.getChildrenNames(); |
// Merge IDCC |
final SQLTable societeCommon = conf.getRoot().getTable("SOCIETE_COMMON"); |
if (!societeCommon.contains("ID_IDCC")) { |
SQLCreateTable createIDCCCommon = new SQLCreateTable(conf.getRoot(), "IDCC"); |
createIDCCCommon.addVarCharColumn("CODE", 45, false, "''", true); |
createIDCCCommon.addVarCharColumn("NOM", 2048, false, "''", true); |
AddMDFields.addFields(createIDCCCommon, conf.getRoot().getTable("USER_COMMON")); |
societeCommon.getDBRoot().createTable(createIDCCCommon); |
societeCommon.getDBRoot().refetchTable("IDCC"); |
AlterTable alter = new AlterTable(societeCommon); |
alter.addForeignColumn("ID_IDCC", conf.getRoot().getTable("IDCC")); |
societeCommon.getDBRoot().getDBSystemRoot().getDataSource().execute(alter.asString()); |
societeCommon.getDBRoot().refetchTable("SOCIETE_COMMON"); |
} |
final Set<String> childrenNames = conf.getSystemRoot().getChildrenNames(); |
MergeTable mergeIDCC = new MergeTable(conf.getRoot().getDBSystemRoot()); |
mergeIDCC.setDestTable(conf.getRoot().getTable("IDCC")); |
final List<String> mdFields = Arrays.asList("ID_USER_COMMON_CREATE", "ID_USER_COMMON_MODIFY", "CREATION_DATE", "MODIFICATION_DATE"); |
for (final String childName : childrenNames) { |
final DBRoot root = conf.getSystemRoot().getRoot(childName); |
if (!root.getName().contains("Common") && root.contains("IDCC")) { |
final SQLTable table = root.getTable("IDCC"); |
AlterTable alter = new AlterTable(table); |
alter.alterColumnNullable("ARCHIVE", false); |
// Drop MD Fields to be sure having same column properties |
for (String field : mdFields) { |
alter.dropColumn(field); |
} |
root.getDBSystemRoot().getDataSource().execute(alter.asString()); |
root.refetchTable("IDCC"); |
new AddMDFields(root.getDBSystemRoot()).change(table); |
mergeIDCC.change(table); |
} |
} |
// final Set<String> childrenNames = conf.getSystemRoot().getChildrenNames(); |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
4568,9 → 4613,9 |
} |
}); |
i++; |
final DBRoot root = systemRoot.getRoot(childName); |
final DBRoot root = conf.getSystemRoot().getRoot(childName); |
try { |
systemRoot.getDataSource().execute("CREATE LANGUAGE plpgsql;"); |
conf.getSystemRoot().getDataSource().execute("CREATE LANGUAGE plpgsql;"); |
} catch (Exception e) { |
System.err.println("Warning: cannot add language plpgsql" + e.getMessage()); |
} |
4601,7 → 4646,7 |
fixUnboundedNumeric(root); |
fixCompletion(root); |
try { |
updateSocieteSchema(conf, root); |
updateSocieteSchema(root); |
} catch (Exception e) { |
throw new SQLException(e); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/ModuleManager.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
54,6 → 54,7 |
import org.openconcerto.sql.utils.SQLUtils.SQLFactory; |
import org.openconcerto.sql.view.list.IListeAction; |
import org.openconcerto.ui.SwingThreadUtils; |
import org.openconcerto.utils.BaseDirs; |
import org.openconcerto.utils.CollectionMap2.Mode; |
import org.openconcerto.utils.CollectionUtils; |
import org.openconcerto.utils.ExceptionHandler; |
225,6 → 226,8 |
// final (thus safely published) and thread-safe |
private final FactoriesByID factories; |
@GuardedBy("this") |
private List<File> folders = Collections.emptyList(); |
// to avoid starting twice the same module |
// we synchronize the whole install/start and stop/uninstall |
@GuardedBy("this") |
316,6 → 319,41 |
// *** factories (thread-safe) |
public final void setFolders(final File... dirs) { |
this.setFolders(Arrays.asList(dirs)); |
} |
// The system directories should be before the user directories. |
// This order is important for getFolderToWrite() and allow the user modules to replace the |
// system ones. |
public final void setFolders(final List<File> dirs) { |
final List<File> absolutes = new ArrayList<>(dirs.size()); |
for (final File dir : dirs) { |
final File abs = dir.getAbsoluteFile(); |
this.addFactories(abs); |
absolutes.add(abs); |
} |
synchronized (this) { |
this.folders = Collections.unmodifiableList(absolutes); |
} |
} |
public synchronized final List<File> getFolders() { |
return this.folders; |
} |
public static final File getFolderToWrite(final List<File> dirs) { |
// Try to install in system directory first, then fall back to user directory. |
for (final File dir : dirs) { |
try { |
return BaseDirs.getFolderToWrite(dir); |
} catch (IOException e) { |
// try next one |
} |
} |
return null; |
} |
public final int addFactories(final File dir) { |
if (!dir.exists()) { |
L.warning("Module factory directory not found: " + dir.getAbsolutePath()); |
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/AvailableModulesPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
32,6 → 32,7 |
import java.text.MessageFormat; |
import java.util.Collection; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Set; |
import javax.swing.AbstractAction; |
227,20 → 228,15 |
JOptionPane.showMessageDialog(panel, "Impossible d'installer le module. Le fichier n'est pas un module."); |
return; |
} |
final File dir = Gestion.MODULES_DIR; |
// TODO test symlink in Java 7 |
if (!dir.isDirectory()) { |
if (dir.exists()) { |
JOptionPane.showMessageDialog(panel, "Le fichier existe mais n'est pas un dossier : " + dir.getAbsolutePath()); |
return; |
final List<File> dirs = panel.getModuleManager().getFolders(); |
final File dir = ModuleManager.getFolderToWrite(dirs); |
if (dir == null) { |
if (dirs.isEmpty()) { |
JOptionPane.showMessageDialog(panel, "Aucun dossier configuré"); |
} else { |
try { |
FileUtils.mkdir_p(dir); |
} catch (IOException e) { |
JOptionPane.showMessageDialog(panel, "Impossible de créer le dossier des modules : " + dir.getAbsolutePath()); |
return; |
} |
JOptionPane.showMessageDialog(panel, "Impossible de créer le dossier des modules : " + dirs); |
} |
return; |
} |
File out = null; |
if (dir.canWrite()) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/modules/ModuleLauncher.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
16,10 → 16,12 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.config.Gestion; |
import org.openconcerto.erp.modules.ModulePackager.ModuleFiles; |
import org.openconcerto.utils.FileUtils; |
import org.openconcerto.utils.BaseDirs; |
import java.io.File; |
import java.io.IOException; |
import java.nio.file.Files; |
import java.nio.file.StandardCopyOption; |
/** |
* Package a module from a project and launch it. The system property {@link #MODULE_DIR_PROP} must |
50,10 → 52,6 |
// always update dist/ to avoid out of date problems |
final File jar = ModulePackager.createDist(moduleFiles); |
// to avoid out of date modules from OpenConcerto (e.g. when launching this module, the jars |
// of MODULES_DIR are used for dependencies) |
FileUtils.mkdir_p(Gestion.MODULES_DIR); |
FileUtils.copyFile(jar, new File(Gestion.MODULES_DIR, jar.getName())); |
final PropsModuleFactory factory; |
if (launchFromPackage) { |
68,7 → 66,14 |
} |
Gestion.main(args); |
final ModuleManager moduleManager = ComptaPropsConfiguration.getInstanceCompta().getModuleManager(); |
// to avoid out of date modules from OpenConcerto (e.g. when launching this module, the jars |
// of MODULES_DIR are used for dependencies) |
final File modulesDir = BaseDirs.getFolderToWrite(moduleManager.getFolders().get(0)); |
Files.copy(jar.toPath(), modulesDir.toPath().resolve(jar.getName()), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES); |
// add after main() otherwise we could be overwritten by an older jar |
ComptaPropsConfiguration.getInstanceCompta().getModuleManager().addFactoryAndStart(factory, false); |
moduleManager.addFactoryAndStart(factory, false); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/action/AboutAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,7 → 15,6 |
import org.openconcerto.erp.config.Benchmark; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.config.Gestion; |
import org.openconcerto.sql.ui.InfoPanel; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.JLabelBold; |
30,7 → 29,6 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionListener; |
import java.io.File; |
import java.io.IOException; |
import javax.swing.AbstractAction; |
import javax.swing.Action; |
115,18 → 113,14 |
p.add(new JLabel(dbPath), c); |
} |
c.gridy++; |
try { |
c.gridx = 0; |
c.weightx = 0; |
c.anchor = GridBagConstraints.EAST; |
p.add(new JLabelBold("Dossier des modules : "), c); |
c.gridx++; |
c.weightx = 1; |
c.anchor = GridBagConstraints.WEST; |
p.add(new JLabel(Gestion.MODULES_DIR.getCanonicalPath()), c); |
} catch (IOException e) { |
e.printStackTrace(); |
} |
c.gridx = 0; |
c.weightx = 0; |
c.anchor = GridBagConstraints.EAST; |
p.add(new JLabelBold("Dossiers des modules : "), c); |
c.gridx++; |
c.weightx = 1; |
c.anchor = GridBagConstraints.WEST; |
p.add(new JLabel(this.conf.getModuleManager().getFolders().toString()), c); |
return p; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/action/NouvelleConnexionAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
31,6 → 31,7 |
import org.openconcerto.erp.modules.ModuleManager; |
import org.openconcerto.erp.panel.ComptaTipsFrame; |
import org.openconcerto.erp.preferences.GestionClientPreferencePanel; |
import org.openconcerto.erp.rights.DepotStockViewRightEditor; |
import org.openconcerto.erp.rights.GroupUIComboRightEditor; |
import org.openconcerto.erp.rights.MenuComboRightEditor; |
import org.openconcerto.erp.utils.NXDatabaseAccessor; |
155,7 → 156,7 |
return; |
} |
MenuManager.setInstance( |
MenuManager.setInstance( |
(Gestion.isMinimalMode() ? new MinimalMenuConfiguration(comptaPropsConfiguration) : new DefaultMenuConfiguration(comptaPropsConfiguration)).createMenuAndActions()); |
final User user = UserManager.getInstance().getCurrentUser(); |
197,9 → 198,11 |
MenuComboRightEditor.register(); |
GroupUIComboRightEditor.register(); |
SQLTableRightEditor.register(); |
DepotStockViewRightEditor.register(); |
// even for quick login, check the license before displaying the main |
// frame |
MutableListComboPopupListener.setLockOverridable(rights.isSuperUser()); |
StatusPanel.getInstance().fireStatusChanged(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeBlSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
72,6 → 72,9 |
if (getSource().getTable().contains("ID_CATEGORIE_COMPTABLE") && getDestination().getTable().contains("ID_CATEGORIE_COMPTABLE")) { |
map(getSource().getField("ID_CATEGORIE_COMPTABLE"), getDestination().getField("ID_CATEGORIE_COMPTABLE")); |
} |
if (getSource().contains("ID_COMMERCIAL") && getDestination().contains("ID_COMMERCIAL")) { |
map(getSource().getField("ID_COMMERCIAL"), getDestination().getField("ID_COMMERCIAL")); |
} |
} |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/BonReceptionFactureFournisseurSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
45,6 → 45,13 |
@Override |
protected void merge(SQLRowAccessor srcRow, SQLRowValues rowVals) { |
super.merge(srcRow, rowVals); |
SQLRowAccessor rowFournisseur = srcRow.getNonEmptyForeign("ID_FOURNISSEUR"); |
if (rowFournisseur != null) { |
SQLRowAccessor rowCompte = rowFournisseur.getNonEmptyForeign("ID_COMPTE_PCE_CHARGE"); |
if (rowCompte != null) { |
rowVals.put("ID_COMPTE_PCE", rowCompte.getID()); |
} |
} |
// Merge elements |
final SQLTable tableElementSource = getSource().getTable("BON_RECEPTION_ELEMENT"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeFactureEltSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
20,7 → 20,9 |
public CommandeFactureEltSQLInjector(final DBRoot root) { |
super(root, "COMMANDE_CLIENT_ELEMENT", "SAISIE_VENTE_FACTURE_ELEMENT", false); |
createDefaultMap(); |
remove(getSource().getField("QTE_LIVREE"), getDestination().getField("QTE_LIVREE")); |
if (getSource().contains("QTE_LIVREE") && getDestination().contains("QTE_LIVREE")) { |
remove(getSource().getField("QTE_LIVREE"), getDestination().getField("QTE_LIVREE")); |
} |
if (getDestination().contains("ID_COMMANDE_CLIENT_ELEMENT")) { |
map(getSource().getKey(), getDestination().getField("ID_COMMANDE_CLIENT_ELEMENT")); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/DevisEltCmdEltSQLInjector.java |
---|
New file |
0,0 → 1,27 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.injector; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLInjector; |
public class DevisEltCmdEltSQLInjector extends SQLInjector { |
public DevisEltCmdEltSQLInjector(final DBRoot root) { |
super(root, "DEVIS_ELEMENT", "COMMANDE_CLIENT_ELEMENT", false); |
createDefaultMap(); |
if (getDestination().contains("ID_DEVIS_ELEMENT")) { |
map(getSource().getKey(), getDestination().getField("ID_DEVIS_ELEMENT")); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeFactureClientSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
32,6 → 32,9 |
if (tableCommande.contains("ID_TAXE_PORT")) { |
map(tableCommande.getField("ID_TAXE_PORT"), tableFacture.getField("ID_TAXE_PORT")); |
} |
if (tableCommande.contains("T_ACOMPTE")) { |
map(tableCommande.getField("T_ACOMPTE"), tableFacture.getField("T_ACOMPTE")); |
} |
if (tableCommande.contains("PORT_HT")) { |
map(tableCommande.getField("PORT_HT"), tableFacture.getField("PORT_HT")); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieAchat.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
49,7 → 49,7 |
// iniatilisation des valeurs de la map |
this.date = (Date) saisieRow.getObject("DATE"); |
this.nom = "Achat : " + rowFournisseur.getString("NOM") + " Facture : " + this.saisieRow.getObject("NUMERO_FACTURE").toString() + " " + saisieRow.getObject("NOM").toString(); |
this.nom = " Fourn. : " + rowFournisseur.getString("NOM") + " " + saisieRow.getObject("NOM").toString() + " Facture : " + this.saisieRow.getObject("NUMERO_FACTURE").toString(); |
this.putValue("DATE", this.date); |
AccountingRecordsProvider provider = AccountingRecordsProviderManager.get(ID); |
provider.putLabel(saisieRow, this.mEcritures); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieVenteFacture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,6 → 17,7 |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement; |
import org.openconcerto.erp.generationDoc.SheetXml; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProvider; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProviderManager; |
import org.openconcerto.erp.model.PrixTTC; |
140,13 → 141,20 |
SQLTable tableEchantillon = null; |
BigDecimal portHT = BigDecimal.valueOf(saisieRow.getLong("PORT_HT")).movePointLeft(2); |
BigDecimal fraisDocHT = BigDecimal.valueOf(saisieRow.getLong("FRAIS_DOCUMENT_HT")).movePointLeft(2); |
SQLRow taxeDoc = saisieRow.getNonEmptyForeign("ID_TAXE_FRAIS_DOCUMENT") == null ? TaxeCache.getCache().getFirstTaxe() |
: TaxeCache.getCache().getRowFromId(saisieRow.getForeignID("ID_TAXE_FRAIS_DOCUMENT")).asRow(); |
TotalCalculator calc; |
SQLRow taxePort = saisieRow.getNonEmptyForeign("ID_TAXE_PORT") == null ? TaxeCache.getCache().getFirstTaxe() |
: TaxeCache.getCache().getRowFromId(saisieRow.getForeignID("ID_TAXE_PORT")).asRow(); |
if (clientRow.getTable().contains("ID_COMPTE_PCE_PRODUIT") && !clientRow.isForeignEmpty("ID_COMPTE_PCE_PRODUIT")) { |
calc = getValuesFromElement(false, false, "T_PV_HT", saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, saisieRow.getForeign("ID_TAXE_PORT"), fraisDocHT, |
saisieRow.getForeign("ID_TAXE_FRAIS_DOCUMENT"), tableEchantillon, clientRow.getForeign("ID_COMPTE_PCE_PRODUIT")); |
calc = getValuesFromElement(false, false, "T_PV_HT", saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, taxePort, fraisDocHT, taxeDoc, tableEchantillon, |
clientRow.getForeign("ID_COMPTE_PCE_PRODUIT")); |
} else { |
calc = getValuesFromElement(saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, saisieRow.getForeign("ID_TAXE_PORT"), fraisDocHT, |
saisieRow.getForeign("ID_TAXE_FRAIS_DOCUMENT"), tableEchantillon); |
calc = getValuesFromElement(saisieRow, saisieVFTable.getTable("SAISIE_VENTE_FACTURE_ELEMENT"), portHT, taxePort, fraisDocHT, taxeDoc, tableEchantillon); |
} |
// On génére les ecritures si la facture n'est pas un acompte |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/Mouvement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
101,6 → 101,25 |
} |
public String asString() { |
StringBuilder s = new StringBuilder(); |
BigDecimal d = BigDecimal.ZERO; |
BigDecimal c = BigDecimal.ZERO; |
s.append("Mouvement N°"); |
s.append(this.numero); |
s.append("\n"); |
for (Ecriture e : this.ecritures) { |
s.append("D : " + e.getDebit()); |
s.append("\tC : " + e.getCredit()); |
d = d.add(e.getDebit()); |
c = c.add(e.getCredit()); |
s.append("\tS : " + (d.subtract(c)) + "\n"); |
} |
return s.toString(); |
} |
public boolean isEmpty() { |
return this.ecritures.isEmpty(); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementAchat.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
80,7 → 80,7 |
// this.nom = saisieRow.getObject("NOM").toString(); |
// si paiement comptant |
if ((modeRegRow.getInt("AJOURS") == 0) && (modeRegRow.getInt("LENJOUR") == 0)) { |
if (typeRegRow.getID() != TypeReglementSQLElement.INDEFINI && (modeRegRow.getInt("AJOURS") == 0) && (modeRegRow.getInt("LENJOUR") == 0)) { |
System.out.println("Règlement Comptant"); |
// test Cheque |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/PDFAttachment.java |
---|
New file |
0,0 → 1,45 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc; |
public class PDFAttachment { |
private String name; |
private String fileName; |
private byte[] bytes; |
private String mimetype; |
public PDFAttachment(String name, String fileName, byte[] bytes, String mimetype) { |
this.name = name; |
this.fileName = fileName; |
this.bytes = bytes; |
this.mimetype = mimetype; |
} |
public String getName() { |
return name; |
} |
public String getFileName() { |
return this.fileName; |
} |
public byte[] getBytes() { |
return this.bytes; |
} |
public String getMimetype() { |
return this.mimetype; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationListeColumnXML.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
151,50 → 151,9 |
lastColumn = sheet.resolveHint(oLastColTmp.toString() + 1).x + 1; |
} |
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, lastColumn, endPageLine); |
// int nbPage = fillTable(tableau, liste, sheet, mapStyle, true, style); |
// int firstLine = Integer.valueOf(tableau.getAttributeValue("firstLine")); |
// int endLine = Integer.valueOf(tableau.getAttributeValue("endLine")); |
// Object printRangeObj = sheet.getPrintRanges(); |
// |
// System.err.println("Nombre de page == " + nbPage); |
// if (nbPage == 1) { |
// fillTable(tableau, liste, sheet, mapStyle, false, style); |
// } else { |
// |
// if (printRangeObj != null) { |
// String s = printRangeObj.toString(); |
// String[] range = s.split(":"); |
// |
// for (int i = 0; i < range.length; i++) { |
// String string = range[i]; |
// range[i] = string.subSequence(string.indexOf('.') + 1, string.length()).toString(); |
// } |
// |
// int rowEnd = -1; |
// if (range.length > 1) { |
// rowEnd = sheet.resolveHint(range[1]).y + 1; |
// int rowEndNew = rowEnd * (nbPage + 1); |
// String sNew = s.replaceAll(String.valueOf(rowEnd), String.valueOf(rowEndNew)); |
// sheet.setPrintRanges(sNew); |
// System.err.println(" ****** Replace print ranges; Old:" + rowEnd + "--" + s + " New:" + |
// rowEndNew + "--" + sNew); |
// } |
// } |
// |
// // le nombre d'éléments ne tient pas dans le tableau du modéle |
// sheet.duplicateFirstRows(endLine, 1); |
// |
// int lineToAdd = endPageLine - endLine; |
// sheet.insertDuplicatedRows(firstLine, lineToAdd); |
// |
// // On duplique la premiere page si on a besoin de plus de deux pages |
// System.err.println("nbPage == " + nbPage); |
// if (nbPage > 2) { |
// sheet.duplicateFirstRows(endPageLine, nbPage - 2); |
// } |
fillTable(tableau, liste, sheet, mapStyle, false, style); |
// } |
} |
/** |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOXMLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
129,6 → 129,10 |
if (rmBreakLines) { |
res = (res == null ? res : res.toString().replaceAll("\n", ",")); |
} |
final String brk = this.elt.getAttributeValue("replaceWithBreakLine"); |
if (brk != null && brk.trim().length() > 0) { |
res = (res == null ? res : res.toString().replaceAll(brk, "\n")); |
} |
return res; |
} |
145,7 → 149,23 |
protected String getStringProposition(SQLRowAccessor rowProp) { |
return "Notre proposition " + rowProp.getString("NUMERO") + " du " + format.format(rowProp.getObject("DATE")); |
if (rowProp.getTable().getName().equalsIgnoreCase("AFFAIRE")) { |
final SQLRowAccessor nonEmptyForeignProp = rowProp.getNonEmptyForeign("ID_PROPOSITION"); |
String result = ""; |
if (rowProp.getString("NUMERO_PROPOSITION").trim().length() > 0) { |
return "Notre proposition " + rowProp.getString("NUMERO_PROPOSITION"); |
} |
if (nonEmptyForeignProp != null && !nonEmptyForeignProp.isUndefined()) { |
if (result.length() == 0) { |
result = "Notre proposition " + nonEmptyForeignProp.getString("NUMERO_PROPOSITION"); |
} |
result += " du " + format.format(rowProp.getObject("DATE")); |
} |
return result; |
} else { |
return "Notre proposition " + rowProp.getString("NUMERO") + " du " + format.format(rowProp.getObject("DATE")); |
} |
} |
215,4 → 235,8 |
public boolean isImage() { |
return this.elt.getAttributeValue("type").equalsIgnoreCase("image"); |
} |
public SQLElement getSQLElement() { |
return this.sqlElt; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/PrixUVProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
33,7 → 33,7 |
public Object getValue(SpreadSheetCellValueContext context) { |
final SQLRowAccessor row = context.getRow(); |
final BigDecimal pv = row.getBigDecimal("PV_HT"); |
if (pv.compareTo(BigDecimal.ZERO) == 0) { |
if (pv == null || pv.compareTo(BigDecimal.ZERO) == 0) { |
return null; |
} |
String result = decimalFormat.format(pv); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/AdresseFullClientValueProvider.java |
---|
21,10 → 21,12 |
private final int type; |
private final boolean withName; |
private final boolean noCountry; |
public AdresseFullClientValueProvider(int type, boolean withName) { |
public AdresseFullClientValueProvider(int type, boolean withName, boolean noCountry) { |
this.type = type; |
this.withName = withName; |
this.noCountry = noCountry; |
} |
@Override |
32,25 → 34,32 |
final SQLRowAccessor r = getAdresse(context.getRow(), this.type); |
String result = ""; |
if (this.withName) { |
result = context.getRow().getForeign("ID_CLIENT").getString("NOM") + "\n"; |
result = context.getRow().getForeign("ID_CLIENT").getString("NOM") + "\n\n"; |
} |
result = getFormattedAddress(r, result); |
result = getFormattedAddress(r, result, !this.noCountry); |
return result; |
} |
public static String getFormattedAddress(final SQLRowAccessor rAddress, String prefix) { |
return getFormattedAddress(rAddress, prefix, true); |
} |
public static String getFormattedAddress(final SQLRowAccessor rAddress, String prefix, boolean withCountry) { |
String result = prefix; |
if (getStringTrimmed(rAddress, "LIBELLE").length() > 0) { |
boolean notEmptyLib = getStringTrimmed(rAddress, "LIBELLE").length() > 0; |
if (notEmptyLib) { |
result = getStringTrimmed(rAddress, "LIBELLE") + "\n"; |
} |
if (getStringTrimmed(rAddress, "DEST").length() > 0) { |
boolean notEmptyDest = getStringTrimmed(rAddress, "DEST").length() > 0; |
if (notEmptyDest) { |
result = getStringTrimmed(rAddress, "DEST") + "\n"; |
} |
if (getStringTrimmed(rAddress, "RUE").length() > 0) { |
boolean notEmptyRue = getStringTrimmed(rAddress, "RUE").length() > 0; |
if (notEmptyRue) { |
result += getStringTrimmed(rAddress, "RUE") + "\n"; |
} |
result += "\n" + getStringTrimmed(rAddress, "CODE_POSTAL"); |
result += notEmptyDest && notEmptyLib && notEmptyLib ? ("\n" + getStringTrimmed(rAddress, "CODE_POSTAL")) : getStringTrimmed(rAddress, "CODE_POSTAL"); |
result += " "; |
if (rAddress.getTable().contains("DISTRICT")) { |
result += getStringTrimmed(rAddress, "DISTRICT") + " "; |
64,17 → 73,23 |
} |
} |
if (rAddress.getTable().contains("PROVINCE")) { |
result += "\n"; |
if (getStringTrimmed(rAddress, "PROVINCE").length() > 0) { |
String province = getStringTrimmed(rAddress, "PROVINCE"); |
boolean department = rAddress.getTable().contains("DEPARTEMENT"); |
if (province.length() > 0 || (department && getStringTrimmed(rAddress, "DEPARTEMENT").length() > 0)) { |
result += "\n"; |
} |
if (province.length() > 0) { |
result += getStringTrimmed(rAddress, ("PROVINCE")) + " "; |
} |
if (rAddress.getTable().contains("DEPARTEMENT")) { |
if (department && getStringTrimmed(rAddress, "DEPARTEMENT").length() > 0) { |
result += getStringTrimmed(rAddress, "DEPARTEMENT"); |
} |
} |
if (getStringTrimmed(rAddress, "PAYS").length() > 0) { |
if (withCountry && getStringTrimmed(rAddress, "PAYS").length() > 0) { |
result += "\n" + getStringTrimmed(rAddress, "PAYS"); |
} |
return result; |
88,11 → 103,17 |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("address.customer.full", new AdresseFullClientValueProvider(ADRESSE_PRINCIPALE, false)); |
SpreadSheetCellValueProviderManager.put("address.customer.invoice.full", new AdresseFullClientValueProvider(ADRESSE_FACTURATION, false)); |
SpreadSheetCellValueProviderManager.put("address.customer.shipment.full", new AdresseFullClientValueProvider(ADRESSE_LIVRAISON, false)); |
SpreadSheetCellValueProviderManager.put("address.customer.full.withname", new AdresseFullClientValueProvider(ADRESSE_PRINCIPALE, true)); |
SpreadSheetCellValueProviderManager.put("address.customer.invoice.full.withname", new AdresseFullClientValueProvider(ADRESSE_FACTURATION, true)); |
SpreadSheetCellValueProviderManager.put("address.customer.shipment.full.withname", new AdresseFullClientValueProvider(ADRESSE_LIVRAISON, true)); |
SpreadSheetCellValueProviderManager.put("address.customer.full", new AdresseFullClientValueProvider(ADRESSE_PRINCIPALE, false, false)); |
SpreadSheetCellValueProviderManager.put("address.customer.invoice.full", new AdresseFullClientValueProvider(ADRESSE_FACTURATION, false, false)); |
SpreadSheetCellValueProviderManager.put("address.customer.shipment.full", new AdresseFullClientValueProvider(ADRESSE_LIVRAISON, false, false)); |
SpreadSheetCellValueProviderManager.put("address.customer.full.nocountry", new AdresseFullClientValueProvider(ADRESSE_PRINCIPALE, false, true)); |
SpreadSheetCellValueProviderManager.put("address.customer.invoice.full.nocountry", new AdresseFullClientValueProvider(ADRESSE_FACTURATION, false, true)); |
SpreadSheetCellValueProviderManager.put("address.customer.shipment.full.nocountry", new AdresseFullClientValueProvider(ADRESSE_LIVRAISON, false, true)); |
SpreadSheetCellValueProviderManager.put("address.customer.full.withname", new AdresseFullClientValueProvider(ADRESSE_PRINCIPALE, true, false)); |
SpreadSheetCellValueProviderManager.put("address.customer.invoice.full.withname", new AdresseFullClientValueProvider(ADRESSE_FACTURATION, true, false)); |
SpreadSheetCellValueProviderManager.put("address.customer.shipment.full.withname", new AdresseFullClientValueProvider(ADRESSE_LIVRAISON, true, false)); |
SpreadSheetCellValueProviderManager.put("address.customer.full.withname.nocountry", new AdresseFullClientValueProvider(ADRESSE_PRINCIPALE, true, true)); |
SpreadSheetCellValueProviderManager.put("address.customer.invoice.full.withname.nocountry", new AdresseFullClientValueProvider(ADRESSE_FACTURATION, true, true)); |
SpreadSheetCellValueProviderManager.put("address.customer.shipment.full.withname.nocountry", new AdresseFullClientValueProvider(ADRESSE_LIVRAISON, true, true)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/PrixUnitaireProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
29,7 → 29,7 |
public Object getValue(SpreadSheetCellValueContext context) { |
final SQLRowAccessor row = context.getRow(); |
final BigDecimal pv = row.getBigDecimal("PV_HT"); |
if (pv.compareTo(BigDecimal.ZERO) == 0) { |
if (pv == null || pv.compareTo(BigDecimal.ZERO) == 0) { |
return null; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/MergedGlobalQtyTotalProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
34,8 → 34,9 |
public Object getValue(SpreadSheetCellValueContext context) { |
final SQLRowAccessor row = context.getRow(); |
// FIXME pb si on est dans achat avec le check PV_HT |
final BigDecimal pv = row.getBigDecimal("PV_HT"); |
if (pv.compareTo(BigDecimal.ZERO) == 0) { |
if (pv != null && pv.compareTo(BigDecimal.ZERO) == 0) { |
return null; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/QteLineDocProvider.java |
---|
New file |
0,0 → 1,71 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import java.math.BigDecimal; |
public class QteLineDocProvider extends UserInitialsValueProvider { |
protected enum TypePoidsDocProvider { |
POIDS_NET, POIDS_BRUT |
}; |
protected final TypePoidsDocProvider type; |
public QteLineDocProvider(TypePoidsDocProvider t) { |
this.type = t; |
} |
@Override |
public Object getValue(SpreadSheetCellValueContext context) { |
SQLRowAccessor sqlRowAccessor = context.getRow(); |
return getPoidsFromRow(sqlRowAccessor); |
} |
protected BigDecimal getPoidsFromRow(SQLRowAccessor sqlRowAccessor) { |
final BigDecimal nbColis; |
if (sqlRowAccessor.getObject("NB_COLIS") != null) { |
nbColis = new BigDecimal(sqlRowAccessor.getInt("NB_COLIS")); |
} else { |
nbColis = BigDecimal.ZERO; |
} |
final BigDecimal qteUV = sqlRowAccessor.getBigDecimal("QTE_UNITAIRE"); |
final BigDecimal qte = new BigDecimal(sqlRowAccessor.getInt("QTE")); |
final BigDecimal tare; |
if (sqlRowAccessor.getObject("TARE") != null) { |
tare = new BigDecimal(sqlRowAccessor.getInt("NB_COLIS")); |
} else { |
tare = BigDecimal.ZERO; |
} |
BigDecimal pdsNet = nbColis.multiply(qte).multiply(qteUV); |
if (this.type == TypePoidsDocProvider.POIDS_NET) { |
return pdsNet; |
} else { |
return pdsNet.add(tare.multiply(nbColis)); |
} |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.poids.net.line", new QteLineDocProvider(TypePoidsDocProvider.POIDS_NET)); |
SpreadSheetCellValueProviderManager.put("sales.poids.brut.line", new QteLineDocProvider(TypePoidsDocProvider.POIDS_BRUT)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/PrixUnitaireRemiseProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,6 → 13,7 |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
25,6 → 26,8 |
public static int UNITAIRE_REMISE = 0; |
public static int TOTAL_NON_ACOMPTE = 1; |
public static int UNITAIRE_REMISE_TTC = 2; |
public static int UNITAIRE_TTC = 3; |
public final int type; |
public PrixUnitaireRemiseProvider(int t) { |
34,8 → 37,10 |
@Override |
public Object getValue(SpreadSheetCellValueContext context) { |
SQLRowAccessor row = context.getRow(); |
if (this.type == UNITAIRE_REMISE) { |
return getPrixUnitaire(row); |
if (this.type == UNITAIRE_REMISE || this.type == UNITAIRE_REMISE_TTC) { |
return getPrixUnitaire(row, true); |
} else if (this.type == UNITAIRE_TTC) { |
return getPrixUnitaire(row, false); |
} else { |
return getPrixTotalOrigin(row); |
} |
43,8 → 48,11 |
public Object getPrixTotalOrigin(SQLRowAccessor row) { |
final BigDecimal pv = row.getBigDecimal("PV_HT"); |
if (pv == null) { |
return null; |
} |
BigDecimal remise = (BigDecimal) row.getObject("POURCENT_REMISE"); |
if (remise == null) { |
if (pv == null || remise == null) { |
remise = BigDecimal.ZERO; |
} |
BigDecimal acompte = BigDecimal.ONE; |
54,10 → 62,13 |
return result.multiply(row.getBigDecimal("QTE_UNITAIRE")).multiply(new BigDecimal(row.getInt("QTE"))).setScale(2, RoundingMode.HALF_UP); |
} |
public Object getPrixUnitaire(SQLRowAccessor row) { |
public Object getPrixUnitaire(SQLRowAccessor row, boolean withRemise) { |
final BigDecimal pv = row.getBigDecimal("PV_HT"); |
if (pv == null) { |
return null; |
} |
BigDecimal remise = (BigDecimal) row.getObject("POURCENT_REMISE"); |
if (remise == null) { |
if (remise == null || !withRemise) { |
remise = BigDecimal.ZERO; |
} |
BigDecimal acompte = BigDecimal.ONE; |
66,11 → 77,19 |
} |
BigDecimal result = BigDecimal.ONE.subtract(remise.movePointLeft(2)).multiply(pv, DecimalUtils.HIGH_PRECISION).multiply(acompte, DecimalUtils.HIGH_PRECISION); |
return result.setScale(2, RoundingMode.HALF_UP); |
if (this.type == UNITAIRE_REMISE_TTC) { |
float t = TaxeCache.getCache().getTauxFromId(row.getForeignID("ID_TAXE")); |
result = result.multiply(new BigDecimal(t).movePointLeft(2).add(BigDecimal.ONE)); |
} |
final BigDecimal setScale = result.setScale(2, RoundingMode.HALF_UP); |
return setScale; |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("PrixUnitaireTTC", new PrixUnitaireRemiseProvider(UNITAIRE_TTC)); |
SpreadSheetCellValueProviderManager.put("PrixUnitaireRemise", new PrixUnitaireRemiseProvider(UNITAIRE_REMISE)); |
SpreadSheetCellValueProviderManager.put("PrixUnitaireRemiseTTC", new PrixUnitaireRemiseProvider(UNITAIRE_REMISE_TTC)); |
SpreadSheetCellValueProviderManager.put("PrixTotalSansAcompte", new PrixUnitaireRemiseProvider(TOTAL_NON_ACOMPTE)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/QteTotalLineDocProvider.java |
---|
New file |
0,0 → 1,51 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLTable; |
import java.math.BigDecimal; |
import java.util.Collection; |
public class QteTotalLineDocProvider extends QteLineDocProvider { |
public QteTotalLineDocProvider(TypePoidsDocProvider t) { |
super(t); |
} |
@Override |
public Object getValue(SpreadSheetCellValueContext context) { |
SQLRowAccessor row = context.getRow(); |
final SQLTable table = row.getTable(); |
Collection<? extends SQLRowAccessor> cols = row.getReferentRows(table.getTable(table.getName() + "_ELEMENT")); |
BigDecimal total = BigDecimal.ZERO; |
for (SQLRowAccessor sqlRowAccessor : cols) { |
if (!sqlRowAccessor.getTable().contains("NIVEAU") || sqlRowAccessor.getInt("NIVEAU") == 1) { |
total = total.add(getPoidsFromRow(sqlRowAccessor)); |
} |
} |
return total; |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.poids.net.lines.sum", new QteTotalLineDocProvider(TypePoidsDocProvider.POIDS_NET)); |
SpreadSheetCellValueProviderManager.put("sales.poids.brut.lines.sum", new QteTotalLineDocProvider(TypePoidsDocProvider.POIDS_BRUT)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/QteTotalProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
31,7 → 31,7 |
BigDecimal pv = row.getBigDecimal("PV_HT"); |
if (pv.compareTo(BigDecimal.ZERO) == 0) { |
if (pv != null && pv.compareTo(BigDecimal.ZERO) == 0) { |
return null; |
} else { |
return result; |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/PaiementRemainedProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
65,6 → 65,7 |
long total = totalEch; |
if (t == Type.DONE) { |
total = r.getLong("T_TTC") - total; |
//TODO deduire T avoir |
} |
return new BigDecimal(total).movePointLeft(2); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/FormatedGlobalQtyTotalProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
27,7 → 27,7 |
private final boolean shortName, alwaysShowOnZeroQty, pieceName; |
public static enum Type { |
NORMAL, SHIPMENT |
NORMAL, SHIPMENT, REMAIND |
} |
public final Type type; |
46,16 → 46,34 |
public Object getValue(SpreadSheetCellValueContext context) { |
final SQLRowAccessor row = context.getRow(); |
final BigDecimal pv = row.getBigDecimal("PV_HT"); |
if (!this.alwaysShowOnZeroQty && pv.compareTo(BigDecimal.ZERO) == 0) { |
if (!this.alwaysShowOnZeroQty && pv != null && pv.compareTo(BigDecimal.ZERO) == 0) { |
return null; |
} |
final String field = this.type == Type.NORMAL ? "QTE" : "QTE_LIVREE"; |
final String field; |
if (this.type == Type.NORMAL) { |
field = "QTE"; |
} else if (row.getTable().contains("QTE_LIVREE")) { |
field = "QTE_LIVREE"; |
} else if (row.getTable().contains("QTE_ORIGINE")) { |
field = "QTE_ORIGINE"; |
} else { |
return null; |
} |
if (row.getObject(field) == null) { |
return null; |
} |
final int qte = row.getInt(field); |
int qte = row.getInt(field); |
if (this.type == Type.REMAIND) { |
if (row.getObject("QTE") != null) { |
if (field.equalsIgnoreCase("QTE_ORIGINE")) { |
qte = qte - row.getInt("QTE"); |
} else { |
qte = row.getInt("QTE") - qte; |
} |
} |
} |
if (!this.pieceName && row.getInt("ID_UNITE_VENTE") == UniteVenteArticleSQLElement.A_LA_PIECE) { |
return String.valueOf(qte); |
81,10 → 99,15 |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.deliver.short", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, true)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.deliver", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, false)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.deliver.short.with.quantity", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, true, true, true)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.remainder.short", new FormatedGlobalQtyTotalProvider(Type.REMAIND, true)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.remainder", new FormatedGlobalQtyTotalProvider(Type.REMAIND, false)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.remainder.short.with.quantity", new FormatedGlobalQtyTotalProvider(Type.REMAIND, true, true, true)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.short.with.quantity", new FormatedGlobalQtyTotalProvider(Type.NORMAL, true, true, true)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.short", new FormatedGlobalQtyTotalProvider(Type.NORMAL, true, false, true)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed", new FormatedGlobalQtyTotalProvider(Type.NORMAL, false, false, true)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.deliver.short", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, true, false, true)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.deliver", new FormatedGlobalQtyTotalProvider(Type.SHIPMENT, false, false, true)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.remainder.short", new FormatedGlobalQtyTotalProvider(Type.REMAIND, true, false, true)); |
SpreadSheetCellValueProviderManager.put("supplychain.element.qtyunit.alwaysnamed.remainder", new FormatedGlobalQtyTotalProvider(Type.REMAIND, false, false, true)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationListeXML.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
182,13 → 182,12 |
range[i] = string.subSequence(string.indexOf('.') + 1, string.length()).toString(); |
} |
int rowEnd = -1; |
if (range.length > 1) { |
rowEnd = sheet.resolveHint(range[1]).y + 1; |
int rowEndNew = rowEnd * (nbPage + 1); |
int rowEnd = sheet.resolveHint(range[1]).y + 1; |
int rowEndNew = rowEnd * nbPage; |
String sNew = s.replaceAll(String.valueOf(rowEnd), String.valueOf(rowEndNew)); |
sheet.setPrintRanges(sNew); |
System.err.println(" ****** Replace print ranges; Old:" + rowEnd + "--" + s + " New:" + rowEndNew + "--" + sNew); |
System.err.println("OOgenerationListXML ****** Replace print ranges; Old:" + rowEnd + "--" + s + " New:" + rowEndNew + "--" + sNew); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/SpreadSheetGeneratorCompta.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
71,7 → 71,10 |
System.err.println("Set Column Count to :: " + (colEnd + 1)); |
sheet.setColumnCount(colEnd + 1); |
} |
sheet.duplicateFirstRows(this.nbRowsPerPage, this.nbPage); |
if (this.nbPage < 1) { |
throw new IllegalArgumentException("invalid page count : " + this.nbPage); |
} |
sheet.duplicateFirstRows(this.nbRowsPerPage, this.nbPage - 1); |
Object printRangeObj = sheet.getPrintRanges(); |
if (printRangeObj != null) { |
82,13 → 85,12 |
range2[i] = string.subSequence(string.indexOf('.') + 1, string.length()).toString(); |
} |
int end = -1; |
if (range2.length > 1) { |
end = sheet.resolveHint(range2[1]).y + 1; |
long rowEndNew = end * (this.nbPage + 1); |
int end = sheet.resolveHint(range2[1]).y + 1; |
int rowEndNew = end * this.nbPage; |
String sNew = s.replaceAll(String.valueOf(end), String.valueOf(rowEndNew)); |
sheet.setPrintRanges(sNew); |
System.err.println(" ****** Replace print ranges; Old:" + end + "--" + s + " New:" + rowEndNew + "--" + sNew); |
System.err.println("SpreadSheetGenerator ****** Replace print ranges; Old:" + end + "--" + s + " New:" + rowEndNew + "--" + sNew); |
} |
} else { |
sheet.removePrintRanges(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOXMLCache.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
134,10 → 134,18 |
} else { |
for (SQLRowAccessor rowAccess : row) { |
if (rowAccess != null && !rowAccess.isUndefined()) { |
final Object[] array = tableForeign.getForeignKeys(rowAccess.getTable()).toArray(); |
final SQLField field1; |
if (array == null || array.length == 0) { |
field1 = tableForeign.getField("ID_" + tableForeign.getName().replaceAll("_ELEMENT", "")); |
} else { |
field1 = (SQLField) array[0]; |
} |
if (w == null) { |
w = new Where((SQLField) tableForeign.getForeignKeys(rowAccess.getTable()).toArray()[0], "=", rowAccess.getID()); |
w = new Where(field1, "=", rowAccess.getID()); |
} else { |
w = w.or(new Where((SQLField) tableForeign.getForeignKeys(rowAccess.getTable()).toArray()[0], "=", rowAccess.getID())); |
w = w.or(new Where(field1, "=", rowAccess.getID())); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/SheetUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
19,15 → 19,22 |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.FileUtils; |
import java.awt.Color; |
import java.awt.Desktop; |
import java.io.ByteArrayInputStream; |
import java.io.File; |
import java.io.FileOutputStream; |
import java.io.FilenameFilter; |
import java.io.IOException; |
import java.io.InputStream; |
import java.util.ArrayList; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.Comparator; |
import java.util.GregorianCalendar; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
import javax.swing.JOptionPane; |
import javax.swing.SwingUtilities; |
34,9 → 41,13 |
import org.apache.pdfbox.pdmodel.PDDocument; |
import org.apache.pdfbox.pdmodel.PDDocumentInformation; |
import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary; |
import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode; |
import org.apache.pdfbox.pdmodel.PDPage; |
import org.apache.pdfbox.pdmodel.PDPageContentStream; |
import org.apache.pdfbox.pdmodel.common.PDRectangle; |
import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification; |
import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile; |
import org.apache.pdfbox.pdmodel.graphics.form.PDFormXObject; |
import org.apache.pdfbox.util.Matrix; |
import org.jopendocument.model.OpenDocument; |
139,7 → 150,12 |
} |
public static void convert2PDF(final OpenDocument doc, final File pdfFileToCreate) throws Exception { |
convert2PDF(doc, pdfFileToCreate, Collections.emptyList()); |
} |
public static void convert2PDF(final OpenDocument doc, final File pdfFileToCreate, final List<PDFAttachment> attachments) throws Exception { |
assert (!SwingUtilities.isEventDispatchThread()); |
System.out.println("SheetUtils convert2PDF " + doc.getLoadedFile().getAbsolutePath() + " -> " + pdfFileToCreate.getAbsolutePath()); |
try { |
PDDocument document = new PDDocument(); |
PDDocumentInformation info = new PDDocumentInformation(); |
149,8 → 165,29 |
info.setModificationDate(Calendar.getInstance()); |
document.setDocumentInformation(info); |
FileOutputStream fileOutputStream = new FileOutputStream(pdfFileToCreate); |
// Attachments |
final PDEmbeddedFilesNameTreeNode efTree = new PDEmbeddedFilesNameTreeNode(); |
final Map<String, PDComplexFileSpecification> efMap = new HashMap<>(); |
for (final PDFAttachment att : attachments) { |
// first create the file specification, which holds the embedded file |
final PDComplexFileSpecification fs = new PDComplexFileSpecification(); |
fs.setFile(att.getFileName()); |
final InputStream is = new ByteArrayInputStream(att.getBytes()); |
final PDEmbeddedFile ef = new PDEmbeddedFile(document, is); |
// set some of the attributes of the embedded file |
ef.setSubtype(att.getMimetype()); |
ef.setSize(att.getBytes().length); |
ef.setCreationDate(new GregorianCalendar()); |
fs.setEmbeddedFile(ef); |
efMap.put(att.getName(), fs); |
} |
efTree.setNames(efMap); |
// attachments are stored as part of the "names" dictionary in the document catalog |
final PDDocumentNameDictionary names = new PDDocumentNameDictionary(document.getDocumentCatalog()); |
names.setEmbeddedFiles(efTree); |
document.getDocumentCatalog().setNames(names); |
PdfBoxGraphics2DFontTextDrawer fontTextDrawer = new PdfBoxGraphics2DFontTextDrawerDefaultFonts(); |
final File dir = new File("Fonts"); |
if (dir.exists()) { |
169,23 → 206,24 |
// Configure the renderer |
ODTRenderer renderer = new ODTRenderer(doc); |
renderer.setIgnoreMargins(false); |
renderer.setResizeFactor(100); |
renderer.setPaintMaxResolution(true); |
PDRectangle pageSize = PDRectangle.A4; |
// Scale the renderer to fit width or height |
final double widthFactor = renderer.getPrintWidth() / pageSize.getWidth(); |
final double heightFactor = renderer.getPrintHeight() / pageSize.getHeight(); |
renderer.setResizeFactor(Math.max(widthFactor, heightFactor)); |
final int resizeFactor = (int) Math.ceil(Math.max(widthFactor, heightFactor)); |
renderer.setResizeFactor(resizeFactor); |
// Print pages |
for (int i = 0; i < renderer.getPrintedPagesNumber(); i++) { |
PDPage page = new PDPage(pageSize); |
final PDPage page = new PDPage(pageSize); |
document.addPage(page); |
PdfBoxGraphics2D g2 = new PdfBoxGraphics2D(document, pageSize.getWidth(), pageSize.getHeight()); |
g2.setFontTextDrawer(fontTextDrawer); |
// centrage horizontal, alignement vertical en haut |
g2.translate((PageSize.A4.getWidth() - renderer.getPrintWidthInPixel()) / 2.0, 0); |
final double hMargin = (pageSize.getWidth() - renderer.getPageWidthInPixel()) / 2.0; |
g2.translate(hMargin, 0); |
// Render |
renderer.setCurrentPage(i); |
199,8 → 237,9 |
contentStream.transform(matrix); |
contentStream.drawForm(xform); |
contentStream.close(); |
} |
document.save(fileOutputStream); |
document.save(pdfFileToCreate); |
// Close the PDF document |
document.close(); |
226,4 → 265,12 |
final File f = new File(file.getParent(), name); |
return f; |
} |
public static void main(String[] args) throws Exception { |
// final OpenDocument doc = new OpenDocument(new File("Documents/Facture_FACT128.ods")); |
final OpenDocument doc = new OpenDocument(new File("../ODSViewer/documents/bug_marges_pdf/Devis.ods")); |
final File file = new File("out.pdf"); |
convert2PDF(doc, file); |
Desktop.getDesktop().open(file); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/SheetXml.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,9 → 15,12 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.ui.PreviewFrame; |
import org.openconcerto.erp.core.customerrelationship.mail.EmailTemplate; |
import org.openconcerto.erp.core.customerrelationship.mail.ValueListener; |
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet; |
import org.openconcerto.erp.core.sales.quote.report.PaypalStamper; |
import org.openconcerto.erp.generationDoc.element.TypeModeleSQLElement; |
import org.openconcerto.erp.model.MouseSheetXmlListeListener; |
import org.openconcerto.erp.preferences.PayPalPreferencePanel; |
import org.openconcerto.erp.storage.CloudStorageEngine; |
import org.openconcerto.erp.storage.StorageEngine; |
25,13 → 28,21 |
import org.openconcerto.openoffice.OOUtils; |
import org.jopendocument.link.Component; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLBase; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.EditPanel.EditMode; |
import org.openconcerto.ui.FrameUtil; |
import org.openconcerto.utils.Action; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.cc.ITransformer; |
import org.openconcerto.utils.i18n.Grammar; |
import org.openconcerto.utils.i18n.TranslationManager; |
import java.awt.GraphicsEnvironment; |
import java.awt.print.PrinterJob; |
49,7 → 60,9 |
import java.net.URLConnection; |
import java.net.URLEncoder; |
import java.nio.charset.StandardCharsets; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Collections; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
140,15 → 153,19 |
return this.elt; |
} |
public Future<SheetXml> showPrintAndExportAsynchronous(final boolean showDocument, final boolean printDocument, final boolean exportToPDF) { |
return showPrintAndExportAsynchronous(showDocument, printDocument, exportToPDF, Collections.emptyList()); |
} |
/** |
* Show, print and export the document to PDF. This method is asynchronous, but is executed in a |
* single threaded queue shared with createDocument |
*/ |
public Future<SheetXml> showPrintAndExportAsynchronous(final boolean showDocument, final boolean printDocument, final boolean exportToPDF) { |
public Future<SheetXml> showPrintAndExportAsynchronous(final boolean showDocument, final boolean printDocument, final boolean exportToPDF, List<Action> actions) { |
final Callable<SheetXml> c = new Callable<SheetXml>() { |
@Override |
public SheetXml call() throws Exception { |
showPrintAndExport(showDocument, printDocument, exportToPDF); |
showPrintAndExport(showDocument, printDocument, exportToPDF, actions); |
return SheetXml.this; |
} |
}; |
156,6 → 173,55 |
} |
public Future<SheetXml> showPrintAndExportAsynchronous(final boolean showDocument, final boolean printDocument, final boolean exportToPDF, final SQLElement element, SQLRow row) { |
final Callable<SheetXml> c = new Callable<SheetXml>() { |
@Override |
public SheetXml call() throws Exception { |
final List<Action> actions = new ArrayList<>(); |
if (SheetXml.this instanceof AbstractSheetXml) { |
final SQLTable table = element.getTable(); |
final Action emailAction = new Action(TranslationManager.getInstance().getTranslationForAction("document.pdf.send.email")) { |
@Override |
public void run(Object source) { |
EmailTemplate.askTemplate(null, table.getDBRoot(), new ValueListener() { |
@Override |
public void valueSelected(Object value) { |
final MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(element, ((AbstractSheetXml) SheetXml.this).getClass()); |
l.sendMail((EmailTemplate) value, (AbstractSheetXml) SheetXml.this, true); |
} |
}); |
} |
}; |
actions.add(emailAction); |
} |
final Action modifyAction = new Action(TranslationManager.getInstance().getTranslationForAction("modify") + " " + element.getName().getVariant(Grammar.DEFINITE_ARTICLE_SINGULAR)) { |
@Override |
public void run(Object source) { |
if (source instanceof PreviewFrame) { |
((PreviewFrame) source).dispose(); |
} |
final SQLComponent component = element.createDefaultComponent(); |
final EditFrame f = new EditFrame(component, EditMode.MODIFICATION); |
f.selectionId(row.getID()); |
FrameUtil.show(f); |
} |
}; |
actions.add(modifyAction); |
showPrintAndExport(showDocument, printDocument, exportToPDF, actions); |
return SheetXml.this; |
} |
}; |
return runnableQueue.submit(c); |
} |
public static Future<?> submitInQueue(final Runnable r) { |
return runnableQueue.submit(r); |
162,13 → 228,21 |
} |
public void showPrintAndExport(final boolean showDocument, final boolean printDocument, boolean exportToPDF) { |
showPrintAndExport(showDocument, printDocument, exportToPDF, Boolean.getBoolean("org.openconcerto.oo.useODSViewer"), false); |
showPrintAndExport(showDocument, printDocument, exportToPDF, Boolean.getBoolean("org.openconcerto.oo.useODSViewer"), false, Collections.emptyList()); |
} |
public void showPrintAndExport(final boolean showDocument, final boolean printDocument, boolean exportToPDF, List<Action> actions) { |
showPrintAndExport(showDocument, printDocument, exportToPDF, Boolean.getBoolean("org.openconcerto.oo.useODSViewer"), false, actions); |
} |
public void showPrintAndExport(final boolean showDocument, final boolean printDocument, boolean exportToPDF, boolean useODSViewer, boolean exportPDFSynch) { |
showPrintAndExport(showDocument, printDocument, exportToPDF, useODSViewer, exportPDFSynch, Collections.emptyList()); |
} |
/** |
* Show, print and export the document to PDF. This method is synchronous |
*/ |
public void showPrintAndExport(final boolean showDocument, final boolean printDocument, boolean exportToPDF, boolean useODSViewer, boolean exportPDFSynch) { |
public void showPrintAndExport(final boolean showDocument, final boolean printDocument, boolean exportToPDF, boolean useODSViewer, boolean exportPDFSynch, List<Action> actions) { |
final File generatedFile = getGeneratedFile(); |
final File pdfFile = getGeneratedPDFFile(); |
200,7 → 274,7 |
final OpenDocument doc = new OpenDocument(generatedFile); |
if (showDocument) { |
showPreviewDocument(); |
showPreviewDocument(actions); |
} |
if (printDocument) { |
// Print ! |
262,88 → 336,17 |
throw new IllegalArgumentException("null PDF file"); |
} |
try { |
if (VenteFactureXmlSheet.TEMPLATE_ID.equals(getDefaultTemplateId())) { |
final SQLPreferences prefs = SQLPreferences.getMemCached(getElement().getTable().getDBRoot()); |
if (prefs.getBoolean(PayPalPreferencePanel.PAYPAL_INVOICE, false)) { |
try { |
final File inFile = File.createTempFile("oc_", pdfFile.getName()); |
SheetUtils.convert2PDF(doc, inFile); |
PaypalStamper s = new PaypalStamper(); |
int x = prefs.getInt(PayPalPreferencePanel.PAYPAL_INVOICE_X, 0); |
int y = prefs.getInt(PayPalPreferencePanel.PAYPAL_INVOICE_Y, 0); |
// Reference |
String ref = getSQLRow().getString("NUMERO"); |
// Montant : ex : 10.55 |
long cents = getSQLRow().getLong("NET_A_PAYER"); |
String amount = cents / 100 + "." + cents % 100; |
// Devise |
// TODO : autres devises |
String currency = "EUR"; |
// POST |
final URL url = new URL("https://cloud.openconcerto.org/payment"); |
final URLConnection con = url.openConnection(); |
final HttpURLConnection http = (HttpURLConnection) con; |
http.setRequestMethod("POST"); |
http.setDoOutput(true); |
http.setDefaultUseCaches(false); |
String hyperlink = null; |
// x-www-form-urlencoded |
final Map<String, String> arguments = new HashMap<>(); |
arguments.put("pI", prefs.get(PayPalPreferencePanel.PAYPAL_CLIENTID, "")); |
arguments.put("pS", prefs.get(PayPalPreferencePanel.PAYPAL_SECRET, "")); |
arguments.put("ref", ref); |
arguments.put("amount", amount); |
arguments.put("currency", currency); |
arguments.put("type", "paypal"); |
final StringJoiner sj = new StringJoiner("&"); |
for (Map.Entry<String, String> entry : arguments.entrySet()) { |
sj.add(URLEncoder.encode(entry.getKey(), "UTF-8") + "=" + URLEncoder.encode(entry.getValue(), "UTF-8")); |
} |
final String postData = sj.toString(); |
System.err.println("SheetXml.createPDF() " + postData); |
byte[] out = postData.getBytes(StandardCharsets.UTF_8); |
int length = out.length; |
http.setFixedLengthStreamingMode(length); |
http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); |
http.connect(); |
try (OutputStream os = http.getOutputStream()) { |
os.write(out); |
} |
if (http.getResponseCode() != 401) { |
InputStream is = http.getInputStream(); |
InputStreamReader isr = new InputStreamReader(is); |
int numCharsRead; |
char[] charArray = new char[1024]; |
StringBuilder sb = new StringBuilder(); |
while ((numCharsRead = isr.read(charArray)) > 0) { |
sb.append(charArray, 0, numCharsRead); |
} |
// |
hyperlink = sb.toString(); |
} |
s.addLink(inFile, pdfFile, x, y, hyperlink); |
} catch (Exception e) { |
e.printStackTrace(); |
SheetUtils.convert2PDF(doc, pdfFile); |
} |
} else { |
SheetUtils.convert2PDF(doc, pdfFile); |
} |
} else { |
SheetUtils.convert2PDF(doc, pdfFile); |
} |
} catch (Throwable e) { |
SheetUtils.convert2PDF(doc, pdfFile); |
} catch (Exception e) { |
ExceptionHandler.handle("Impossible de créer le PDF " + pdfFile.getAbsolutePath(), e); |
} |
if (!pdfFile.canRead()) { |
ExceptionHandler.handle("Le fichier PDF " + pdfFile.getAbsolutePath() + " ne peut être lu."); |
} |
storeWithStorageEngines(generatedFile, pdfFile, storagePath); |
} |
protected void storeWithStorageEngines(final File generatedFile, final File pdfFile, String storagePath) { |
List<StorageEngine> engines = StorageEngines.getInstance().getActiveEngines(); |
for (StorageEngine storageEngine : engines) { |
if (storageEngine.isConfigured() && storageEngine.allowAutoStorage()) { |
490,12 → 493,12 |
File f = getGeneratedPDFFile(); |
if (!f.exists()) { |
getOrCreateDocumentFile(); |
showPrintAndExport(false, false, true, useODSViewer, true); |
showPrintAndExport(false, false, true, useODSViewer, true, Collections.emptyList()); |
return f; |
} else { |
File fODS = getOrCreateDocumentFile(); |
if (fODS.lastModified() > f.lastModified()) { |
showPrintAndExport(false, false, true, useODSViewer, true); |
showPrintAndExport(false, false, true, useODSViewer, true, Collections.emptyList()); |
} |
return f; |
} |
547,13 → 550,13 |
} |
public void showPreviewDocument() throws Exception { |
showPreviewDocument(null, null); |
showPreviewDocument(Collections.emptyList()); |
} |
public void showPreviewDocument(String actionName, Runnable r) throws Exception { |
public void showPreviewDocument(List<Action> actions) throws Exception { |
File f = null; |
f = getOrCreateDocumentFile(); |
PreviewFrame.show(f, actionName, r); |
PreviewFrame.show(f, actions); |
} |
public void printDocument() { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/EtatVentesXmlSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
30,6 → 30,7 |
import org.openconcerto.sql.model.SQLSelectJoin; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.utils.ListMap; |
import org.openconcerto.utils.Tuple2; |
import java.math.BigDecimal; |
146,12 → 147,18 |
// Stock |
SQLRowValues rowValsArtStock = new SQLRowValues(foreignTableArticle); |
rowValsArtStock.putNulls("ID", "CODE", "NOM"); |
rowValsArtStock.putRowValues("ID_STOCK").putNulls("QTE_REEL", "QTE_TH", "QTE_MIN", "QTE_RECEPT_ATTENTE", "QTE_LIV_ATTENTE"); |
SQLRowValues rowValsStock = new SQLRowValues(tableFactureElement.getTable("STOCK")); |
rowValsStock.putNulls("QTE_REEL", "QTE_TH", "QTE_MIN", "QTE_RECEPT_ATTENTE", "QTE_LIV_ATTENTE").put("ID_ARTICLE", rowValsArtStock); |
SQLRowValuesListFetcher fetcherStock = SQLRowValuesListFetcher.create(rowValsArtStock); |
List<SQLRowValues> resultStock = fetcherStock.fetch(); |
Map<Integer, SQLRowValues> mapStock = new HashMap<>(); |
ListMap<Integer, SQLRowValues> mapStock = new ListMap<>(); |
for (SQLRowValues sqlRowValues : resultStock) { |
mapStock.put(sqlRowValues.getID(), sqlRowValues); |
final Set<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableFactureElement.getTable("STOCK").getField("ID_ARTICLE")); |
for (SQLRowValues sqlRowValues2 : referentRows) { |
mapStock.add(sqlRowValues.getID(), sqlRowValues2); |
} |
} |
// Requete Pour obtenir les quantités pour chaque type de réglement |
324,17 → 331,28 |
mValuesStock.put("NOM", nom); |
mValuesStock.put("QTE", a.qte); |
if (mapStock.containsKey(articleID)) { |
SQLRowValues rowValsArt = mapStock.get(articleID); |
if (rowValsArt.getObject("ID_STOCK") != null && !rowValsArt.isForeignEmpty("ID_STOCK")) { |
SQLRowAccessor rowValsStock = rowValsArt.getForeign("ID_STOCK"); |
mValuesStock.put("QTE_TH", rowValsStock.getObject("QTE_TH")); |
mValuesStock.put("QTE_REEL", rowValsStock.getObject("QTE_REEL")); |
mValuesStock.put("QTE_MIN", rowValsStock.getObject("QTE_MIN")); |
mValuesStock.put("QTE_RECEPT_ATTENTE", rowValsStock.getObject("QTE_RECEPT_ATTENTE")); |
mValuesStock.put("QTE_LIV_ATTENTE", rowValsStock.getObject("QTE_LIV_ATTENTE")); |
List<SQLRowValues> rowValsArt = mapStock.get(articleID); |
BigDecimal totalTh = BigDecimal.ZERO; |
BigDecimal totalReel = BigDecimal.ZERO; |
BigDecimal min = BigDecimal.ZERO; |
BigDecimal attentR = BigDecimal.ZERO; |
BigDecimal attenteL = BigDecimal.ZERO; |
for (SQLRowValues rowStock : rowValsArt) { |
totalTh = totalTh.add(new BigDecimal(rowStock.getFloat("QTE_TH"))); |
totalReel = totalReel.add(new BigDecimal(rowStock.getFloat("QTE_REEL"))); |
min = min.add(new BigDecimal(rowStock.getFloat("QTE_MIN"))); |
attentR = attentR.add(new BigDecimal(rowStock.getFloat("QTE_RECEPT_ATTENTE"))); |
attenteL = attenteL.add(new BigDecimal(rowStock.getFloat("QTE_LIV_ATTENTE"))); |
} |
mValuesStock.put("QTE_TH", totalTh); |
mValuesStock.put("QTE_REEL", totalReel); |
mValuesStock.put("QTE_MIN", min); |
mValuesStock.put("QTE_RECEPT_ATTENTE", attentR); |
mValuesStock.put("QTE_LIV_ATTENTE", attenteL); |
styleStock.put(listValuesStock.size(), "Normal"); |
listValuesStock.add(mValuesStock); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/OptionDocProcessor.java |
---|
New file |
0,0 → 1,78 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.gestcomm; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.utils.cc.ITransformer; |
import org.openconcerto.utils.DecimalUtils; |
import java.math.BigDecimal; |
import java.util.ArrayList; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Set; |
public class OptionDocProcessor implements ITransformer<List<SQLRowAccessor>, List<SQLRowAccessor>> { |
@Override |
public List<SQLRowAccessor> transformChecked(List<SQLRowAccessor> input) { |
List<SQLRowValues> resultRowValues = new ArrayList(input.size()); |
SQLRowValues lastRowNonOptionnal = null; |
Set<SQLRowValues> recalculPrixUnitaire = new HashSet<SQLRowValues>(); |
for (SQLRowAccessor sqlRowAccessor : input) { |
final SQLRowAccessor nonEmptyForeign = sqlRowAccessor.getNonEmptyForeign("ID_ARTICLE"); |
final SQLRowValues asRowValues = sqlRowAccessor.asRowValues(); |
if (lastRowNonOptionnal != null && nonEmptyForeign != null && nonEmptyForeign.getBoolean("OPTION")) { |
lastRowNonOptionnal.put("T_PV_HT", lastRowNonOptionnal.getBigDecimal("T_PV_HT").add(asRowValues.getBigDecimal("T_PV_HT"))); |
lastRowNonOptionnal.put("T_PV_TTC", lastRowNonOptionnal.getBigDecimal("T_PV_TTC").add(asRowValues.getBigDecimal("T_PV_TTC"))); |
recalculPrixUnitaire.add(lastRowNonOptionnal); |
asRowValues.put("PRIX_METRIQUE_VT_1", null); |
asRowValues.put("PV_HT", null); |
asRowValues.put("T_PV_HT", null); |
asRowValues.put("T_PV_TTC", null); |
asRowValues.putEmptyLink("ID_TAXE"); |
} else { |
lastRowNonOptionnal = asRowValues; |
} |
resultRowValues.add(asRowValues); |
} |
List<SQLRowAccessor> result = new ArrayList(input.size()); |
for (SQLRowValues sqlRowValues : resultRowValues) { |
if (recalculPrixUnitaire.contains(sqlRowValues)) { |
String fieldQte = sqlRowValues.getTable().getName().startsWith("BON_DE_LIVRAISON") ? "QTE_LIVREE" : "QTE"; |
BigDecimal qte = sqlRowValues.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(sqlRowValues.getInt(fieldQte), DecimalUtils.HIGH_PRECISION)); |
if (qte.signum() != 0) { |
BigDecimal totalHT = sqlRowValues.getBigDecimal("T_PV_HT"); |
final BigDecimal remisePercent = sqlRowValues.getBigDecimal("POURCENT_REMISE"); |
if (remisePercent != null && remisePercent.signum() > 0) { |
totalHT = totalHT.divide(BigDecimal.ONE.subtract(remisePercent.movePointLeft(2)), org.openconcerto.utils.DecimalUtils.HIGH_PRECISION); |
} |
BigDecimal unitPrice = totalHT.divide(qte, DecimalUtils.HIGH_PRECISION); |
sqlRowValues.put("PV_HT", unitPrice); |
sqlRowValues.put("PRIX_METRIQUE_VT_1", unitPrice); |
} |
} |
result.add(sqlRowValues); |
} |
return result; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/ReleveChequeEmisSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
83,5 → 83,6 |
// Total |
this.mCell.put("L45", new Double(GestionDevise.currencyToString(montantTotal, false))); |
this.nbPage = 1; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/AvoirClientXmlSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
38,6 → 38,7 |
super(row); |
this.printer = PrinterNXProps.getInstance().getStringProperty("BonPrinter"); |
this.elt = Configuration.getInstance().getDirectory().getElement("AVOIR_CLIENT"); |
this.setPostProcess(new OptionDocProcessor()); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOXMLField.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
60,6 → 60,9 |
this.row = row; |
if ((this.row == null || !this.row.getTable().getSchema().getName().equalsIgnoreCase("Common")) && base != null && base.equalsIgnoreCase("COMMON")) { |
this.row = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete(); |
if (!this.row.getString("DATABASE_NAME").equalsIgnoreCase(row.getTable().getDBRoot().getName())) { |
this.row = this.row.getTable().getRow(Integer.valueOf(row.getTable().getDBRoot().getName().replaceAll("OpenConcerto", ""))); |
} |
} |
if (this.row == null) { |
this.row = sqlElt.getTable().getRow(id); |
530,7 → 533,7 |
private Object getTraduction() { |
if (this.rowLanguage == null || this.rowLanguage.isUndefined()) { |
return null; |
return this.row.getObject(this.elt.getAttributeValue("name")); |
} |
int id = ReferenceArticleSQLElement.getIdForCNM(row.asRowValues(), false); |
SQLTable table = Configuration.getInstance().getBase().getTable("ARTICLE_DESIGNATION"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationXML.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
257,16 → 257,21 |
lastColumn = sheet.resolveHint(oLastColTmp.toString() + 1).x + 1; |
} |
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, lastColumn, endPageLine); |
int firstLine = Integer.parseInt(tableau.getAttributeValue("firstLine")); |
int endLine = Integer.parseInt(tableau.getAttributeValue("endLine")); |
Object printRangeObj = sheet.getPrintRanges(); |
final Map<String, Map<Integer, String>> mapStyle; |
if (tableau.getAttributeValue("table").equalsIgnoreCase("TVA")) { |
fillTaxeDocumentMap(tableau, sheet, mapStyle, false); |
mapStyle = null; |
fillTaxeDocumentMap(tableau, sheet, false); |
return; |
} else { |
mapStyle = searchStyle(sheet, firstLine, lastColumn, endLine); |
} |
int nbPage = fillTable(tableau, row, sheet, mapStyle, true, rowLanguage); |
int firstLine = Integer.parseInt(tableau.getAttributeValue("firstLine")); |
int endLine = Integer.parseInt(tableau.getAttributeValue("endLine")); |
Object printRangeObj = sheet.getPrintRanges(); |
System.err.println("Nombre de page == " + nbPage); |
if (nbPage == 1) { |
281,10 → 286,9 |
range[i] = string.subSequence(string.indexOf('.') + 1, string.length()).toString(); |
} |
int rowEnd = -1; |
if (range.length > 1) { |
rowEnd = sheet.resolveHint(range[1]).y + 1; |
int rowEndNew = rowEnd * (nbPage); |
int rowEnd = sheet.resolveHint(range[1]).y + 1; |
int rowEndNew = rowEnd * nbPage; |
String sNew = s.replaceAll(String.valueOf(rowEnd), String.valueOf(rowEndNew)); |
sheet.setPrintRanges(sNew); |
System.err.println(" ****** Replace print ranges; Old:" + rowEnd + "--" + s + " New:" + rowEndNew + "--" + sNew); |
752,7 → 756,7 |
return nbCellule; |
} |
private void fillTaxeDocumentMap(Element tableau, Sheet sheet, Map<String, Map<Integer, String>> mapStyle, boolean test) { |
private void fillTaxeDocumentMap(Element tableau, Sheet sheet, boolean test) { |
int line = Integer.parseInt(tableau.getAttributeValue("firstLine")); |
List<Element> listElts = tableau.getChildren("element"); |
892,7 → 896,13 |
// on divise en 2 cellules si il y a des retours à la ligne |
if (controleMultiline && value != null && value.toString().indexOf('\n') >= 0) { |
String[] values = value.toString().split("\n"); |
String[] values; |
if (cell.getRowsSpanned() < 2) { |
// TODO : mettre une option pour splitter ou pas |
values = value.toString().split("\n"); |
} else { |
values = new String[] { value.toString() }; |
} |
Point p = sheet.resolveHint(location); |
int y = 0; |
1030,7 → 1040,7 |
/** |
* parcourt l'ensemble de la feuille pour trouver les style définit |
*/ |
private Map<String, Map<Integer, String>> searchStyle(Sheet sheet, int colEnd, int rowEnd) { |
private Map<String, Map<Integer, String>> searchStyle(Sheet sheet, int rowDeb, int colEnd, int rowEnd) { |
if (cacheStyle.get(sheet) != null) { |
return cacheStyle.get(sheet); |
1043,8 → 1053,10 |
System.err.println("End column search : " + columnCount); |
int rowCount = (rowEnd > 0) ? rowEnd : sheet.getRowCount(); |
int start = (rowDeb - 1 > 0) ? rowDeb - 1 : 0; |
System.err.println("End row search : " + rowCount); |
for (int i = 0; i < rowCount; i++) { |
for (int i = start; i < rowCount; i++) { |
int x = 0; |
Map<Integer, String> mapCellStyle = new HashMap<>(); |
String style = ""; |
1119,12 → 1131,13 |
Object oLastColTmp = tableau.getAttributeValue("lastColumn"); |
int lastColumn = -1; |
int endPageLine = Integer.parseInt(tableau.getAttributeValue("endPageLine")); |
if (oLastColTmp != null) { |
lastColumn = sheet.resolveHint(oLastColTmp.toString() + 1).x + 1; |
} |
int firstLine = Integer.parseInt(tableau.getAttributeValue("firstLine")); |
int endLine = Integer.parseInt(tableau.getAttributeValue("endLine")); |
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, lastColumn, endPageLine); |
Map<String, Map<Integer, String>> mapStyle = searchStyle(sheet, firstLine, lastColumn, endLine); |
int nbPage = fillTable(tableau, row, sheet, mapStyle, true, rowLanguage); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOXMLTableElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
83,47 → 83,20 |
} |
public List<? extends SQLRowAccessor> getRows() { |
SQLTable tableElt = Configuration.getInstance().getRoot().findTable(this.tableau.getAttributeValue("table")); |
String foreignTableName = this.tableau.getAttributeValue("table"); |
SQLTable tableElt = null; |
if (!this.row.isEmpty()) { |
SQLTable tableRow = this.row.get(0).getTable(); |
if (tableRow.getDBRoot().contains(foreignTableName)) { |
tableElt = tableRow.getDBRoot().getTable(foreignTableName); |
} else { |
tableElt = Configuration.getInstance().getRoot().findTable(foreignTableName); |
} |
} |
if (tableElt != null) { |
// // #if gestionnx |
// Set<SQLField> fields = |
// tablePourcentService.getForeignKeys(tableElt); |
// |
// if (((ComptaPropsConfiguration) |
// Configuration.getInstance()).customerIsPreventec() && fields != |
// null && fields.size() > 0) { |
// SQLSelect sel = new |
// SQLSelect(Configuration.getInstance().getBase()); |
// |
// sel.addSelectStar(tableElt); |
// Set<SQLField> fieldsElt = |
// tableElt.getForeignKeys(this.row.getTable()); |
// Where w = new Where(fieldsElt.iterator().next(), "=", |
// this.row.getTable().getKey()); |
// w = w.and(new Where(fields.iterator().next(), "=", |
// tableElt.getKey())); |
// w = w.and(new Where(this.row.getTable().getKey(), "=", |
// this.row.getID())); |
// sel.setWhere(w); |
// sel.addFieldOrder(tablePourcentService.getField("ID_VERIFICATEUR")); |
// sel.addFieldOrder(fields.iterator().next()); |
// List<SQLRow> l = (List<SQLRow>) |
// Configuration.getInstance().getBase().getDataSource().execute(sel.asString(), |
// SQLRowListRSH.createFromSelect(sel, tableElt)); |
// |
// // Suppression des doublons |
// List<SQLRow> list = new ArrayList<SQLRow>(); |
// for (SQLRow sqlRow : l) { |
// if (!list.contains(sqlRow)) { |
// list.add(sqlRow); |
// } |
// } |
// return list; |
// } |
// // #endif |
return cache.getReferentRows(this.row, tableElt, this.tableau.getAttributeValue("groupBy"), this.tableau.getAttributeValue("orderBy"), |
Boolean.valueOf(this.tableau.getAttributeValue("expandNomenclature")), this.tableau.getAttributeValue("foreignField"), |
Boolean.valueOf(this.tableau.getAttributeValue("excludeZeroQty"))); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/reports/history/ui/HistoriqueClientFrame.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
57,6 → 57,7 |
mapList.put("Relances", Arrays.asList("RELANCE")); |
mapList.put("Devis", Arrays.asList("DEVIS")); |
mapList.put("Commandes", Arrays.asList("COMMANDE_CLIENT")); |
mapList.put("Bons de livraison", Arrays.asList("BON_DE_LIVRAISON")); |
mapList.put("Avoirs", Arrays.asList("AVOIR_CLIENT")); |
mapList.put("Articles facturés", Arrays.asList("SAISIE_VENTE_FACTURE_ELEMENT")); |
mapList.put("Articles proposés", Arrays.asList("DEVIS_ELEMENT")); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/reports/history/ui/ListeHistoriquePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
224,7 → 224,7 |
for (TableModelListener listener : l) { |
liste.getListe().getTableModel().addTableModelListener(listener); |
if (elementSheet.get(liste.getElement()) != null) { |
liste.getListe().addIListeActions(new MouseSheetXmlListeListener(elementSheet.get(liste.getElement())).getRowActions()); |
liste.getListe().addIListeActions(new MouseSheetXmlListeListener(liste.getElement(), elementSheet.get(liste.getElement())).getRowActions()); |
} |
} |
} |
462,6 → 462,11 |
}, true); |
actionDrop.setPredicate(IListeEvent.createSelectionCountPredicate(0, Integer.MAX_VALUE)); |
liste.getListe().addIListeAction(actionDrop); |
} else if (createTableSource.getPrimaryTable().getName().endsWith("_ELEMENT")) { |
liste.setAddVisible(false); |
liste.setShowReadOnlyFrameOnDoubleClick(false); |
liste.setModifyVisible(false); |
liste.setDeleteVisible(false); |
} |
} |
469,7 → 474,7 |
setRenderer(liste); |
if (elementSheet.get(liste.getElement()) != null) { |
liste.getListe().addIListeActions(new MouseSheetXmlListeListener(elementSheet.get(liste.getElement())).getRowActions()); |
liste.getListe().addIListeActions(new MouseSheetXmlListeListener(liste.getElement(), elementSheet.get(liste.getElement())).getRowActions()); |
} |
liste.getListe().getModel().setCellsEditable(false); |
liste.setOpaque(false); |
556,7 → 561,13 |
@Override |
public void ancestorRemoved(AncestorEvent event) { |
ListeHistoriquePanel.this.vectListePanel.clear(); |
ListeHistoriquePanel.this.mapListener = null; |
ListeHistoriquePanel.this.jListePanel.removeListSelectionListener(ListeHistoriquePanel.this.listListener); |
ListeHistoriquePanel.this.jListePanel.removeAllTableListener(); |
ListeHistoriquePanel.this.jListePanel = null; |
ListeHistoriquePanel.this.listFieldMap = null; |
ListeHistoriquePanel.this.whereList = null; |
} |
}); |
602,6 → 613,14 |
} |
public SQLRowAccessor getSelectedRow() { |
// FIXME null pointer avec historique client frame, surement un pb de garbage |
if (this.jListePanel == null) { |
return null; |
} |
if (this.jListePanel.getModel() == null) { |
return null; |
} |
return this.jListePanel.getModel().getRowAt(this.jListePanel.getSelectedIndex()); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/credit/action/ListeDesAvoirsFournisseurAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
69,7 → 69,7 |
final IListFrame frame = new IListFrame(panel); |
frame.getPanel().setAddVisible(true); |
frame.getPanel().getListe().addIListeActions(new MouseSheetXmlListeListener(AvoirFournisseurXmlSheet.class).getRowActions()); |
frame.getPanel().getListe().addIListeActions(new MouseSheetXmlListeListener(element, AvoirFournisseurXmlSheet.class).getRowActions()); |
frame.getPanel().getListe().setModificationAllowed(false); |
return frame; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/purchase/importer/FacturXExporter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,7 → 13,9 |
package org.openconcerto.erp.core.supplychain.purchase.importer; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.finance.payment.element.ModeDeReglementSQLElement; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
23,6 → 25,7 |
import org.openconcerto.sql.model.Where; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.text.DecimalFormat; |
import java.text.DecimalFormatSymbols; |
import java.text.SimpleDateFormat; |
90,11 → 93,7 |
rowValsToFetch.putRowValues("ID_MODE_REGLEMENT").putNulls("COMPTANT", "AJOURS", "LENJOUR", "DATE_FACTURE", "FIN_MOIS").putRowValues("ID_TYPE_REGLEMENT").putNulls("NOM"); |
SQLRowValues putRowValuesClient = rowValsToFetch.putRowValues("ID_CLIENT"); |
putRowValuesClient.putNulls("NOM", "RESPONSABLE", "SIRET", "NUMERO_TVA", "MAIL", "TEL"); |
if (putRowValuesClient.getTable().contains("ID_CLIENT")) { |
this.useCommonClient = true; |
putRowValuesClient.putRowValues("ID_CLIENT").putNulls("NOM", "RESPONSABLE", "SIRET", "NUMERO_TVA", "MAIL", "TEL").putRowValues("ID_ADRESSE").putNulls("RUE", "VILLE", "CODE_POSTAL", |
"PAYS"); |
} |
putRowValuesClient.putRowValues("ID_ADRESSE").putNulls("RUE", "VILLE", "CODE_POSTAL", "PAYS"); |
putRowValuesClient.putRowValues("ID_ADRESSE_F").putNulls("RUE", "VILLE", "CODE_POSTAL", "PAYS"); |
rowValsToFetch.putRowValues("ID_ADRESSE").putNulls("RUE", "VILLE", "CODE_POSTAL", "PAYS"); |
186,7 → 185,7 |
final BigDecimal pHT, pTTC, totalHTLigne, totalTTCLigne; |
SQLRowAccessor taxeItem = rowItem.getForeign("ID_TAXE"); |
BigDecimal taxValue = new BigDecimal(taxeItem.getFloat("TAUX")).setScale(2); |
BigDecimal taxValue = new BigDecimal(taxeItem.getFloat("TAUX")).setScale(2, RoundingMode.HALF_UP); |
if (rowItem.getInt("NIVEAU") != 1) { |
pHT = BigDecimal.ZERO; |
pTTC = BigDecimal.ZERO; |
671,19 → 670,24 |
if (code == null || code.length() != 13) { |
return false; |
} |
int checkdigit = 0; |
for (int i = 1; i < 12; i += 2) { |
checkdigit += Integer.valueOf(code.substring(i, i + 1)); |
try { |
int checkdigit = 0; |
for (int i = 1; i < 12; i += 2) { |
checkdigit += Integer.valueOf(code.substring(i, i + 1)); |
} |
checkdigit *= 3; |
for (int i = 0; i < 11; i += 2) { |
checkdigit += Integer.valueOf(code.substring(i, i + 1)); |
} |
checkdigit %= 10; |
if (checkdigit != 0) { |
checkdigit = 10 - checkdigit; |
} |
return Integer.valueOf(code.substring(12, 13)).intValue() == checkdigit; |
} catch (Exception e) { |
// if not digits, parse error |
return false; |
} |
checkdigit *= 3; |
for (int i = 0; i < 11; i += 2) { |
checkdigit += Integer.valueOf(code.substring(i, i + 1)); |
} |
checkdigit %= 10; |
if (checkdigit != 0) { |
checkdigit = 10 - checkdigit; |
} |
return Integer.valueOf(code.substring(12, 13)).intValue() == checkdigit; |
} |
private String resolveCountryCode(String pays) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/component/FactureFournisseurSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
805,14 → 805,14 |
// Création des articles |
this.table.createArticle(idFacture, this.getElement()); |
final SQLRow rowA = getTable().getRow(idFacture); |
new GenerationMvtFactureFournisseur(rowA); |
final SQLRow row = getTable().getRow(idFacture); |
new GenerationMvtFactureFournisseur(row); |
final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(rowA); |
final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
commitAvoir(null, rowA); |
commitAvoir(null, row); |
return idFacture; |
} |
850,7 → 850,7 |
} |
final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
commitAvoir(rowFactureOld, row); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/component/CommandeSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
23,6 → 23,7 |
import org.openconcerto.erp.core.common.ui.TotalPanel; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement; |
import org.openconcerto.erp.core.supplychain.order.element.CommandeSQLElement; |
import org.openconcerto.erp.core.supplychain.order.element.DemandeAchatItemSQLElement; |
import org.openconcerto.erp.core.supplychain.order.ui.CommandeItemTable; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater; |
700,7 → 701,7 |
final JPanel panelPoids = new JPanel(new GridBagLayout()); |
GridBagConstraints cPoids = new DefaultGridBagConstraints(); |
cPoids.weightx = 0; |
panelPoids.add(new JLabel(getLabelFor("T_POIDS")), cPoids); |
panelPoids.add(new JLabel(getLabelFor("T_POIDS"), SwingConstants.RIGHT), cPoids); |
cPoids.weightx = 1; |
textPoidsTotal.setEnabled(false); |
textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT); |
728,14 → 729,48 |
ElementComboBox comboTaxePort = new ElementComboBox(false, 10); |
if (getTable().contains("PORT_HT")) { |
addSQLObject(textPortHT, "PORT_HT"); |
final JPanel panelPoids = new JPanel(new GridBagLayout()); |
GridBagConstraints cPort = new DefaultGridBagConstraints(); |
cPort.gridx = 0; |
cPort.fill = GridBagConstraints.NONE; |
cPort.fill = GridBagConstraints.HORIZONTAL; |
cPort.weightx = 0; |
panelPoids.add(new JLabel(getLabelFor("PORT_HT")), cPort); |
// Condition frais de port |
if (getTable().getForeignTable("ID_FOURNISSEUR").contains("CONDITIONS_PORT")) { |
cPort.gridwidth = 2; |
final JLabel labelConditionPort = new JLabel(); |
labelConditionPort.setVisible(false); |
panelPoids.add(labelConditionPort, cPort); |
fourn.addModelListener("wantedID", (evt) -> { |
int wantedID = fourn.getWantedID(); |
if (wantedID != SQLRow.NONEXISTANT_ID && wantedID >= SQLRow.MIN_VALID_ID) { |
final SQLRow rowF = getTable().getForeignTable("ID_FOURNISSEUR").getRow(wantedID); |
final String conditions = rowF.getString("CONDITIONS_PORT"); |
if (conditions.trim().length() > 0) { |
labelConditionPort.setText(conditions); |
labelConditionPort.setVisible(true); |
} else { |
labelConditionPort.setText(""); |
labelConditionPort.setVisible(false); |
} |
} else { |
labelConditionPort.setText(""); |
labelConditionPort.setVisible(false); |
} |
}); |
cPort.gridwidth = 1; |
cPort.gridy++; |
} |
addSQLObject(textPortHT, "PORT_HT"); |
cPort.gridx = 0; |
cPort.fill = GridBagConstraints.HORIZONTAL; |
cPort.weightx = 0; |
panelPoids.add(new JLabel(getLabelFor("PORT_HT"), SwingConstants.RIGHT), cPort); |
textPortHT.setHorizontalAlignment(JTextField.RIGHT); |
cPort.gridx++; |
cPort.weightx = 1; |
745,7 → 780,7 |
cPort.gridx = 0; |
cPort.weightx = 0; |
addRequiredSQLObject(comboTaxePort, "ID_TAXE_PORT"); |
panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT")), cPort); |
panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT"), SwingConstants.RIGHT), cPort); |
cPort.gridx++; |
cPort.weightx = 1; |
panelPoids.add(comboTaxePort, cPort); |
753,9 → 788,9 |
addSQLObject(textRemiseHT, "REMISE_HT"); |
cPort.gridy++; |
cPort.gridx = 0; |
cPort.fill = GridBagConstraints.NONE; |
cPort.fill = GridBagConstraints.HORIZONTAL; |
cPort.weightx = 0; |
panelPoids.add(new JLabel(getLabelFor("REMISE_HT")), cPort); |
panelPoids.add(new JLabel(getLabelFor("REMISE_HT"), SwingConstants.RIGHT), cPort); |
textRemiseHT.setHorizontalAlignment(JTextField.RIGHT); |
cPort.gridx++; |
cPort.weightx = 1; |
914,9 → 949,10 |
} |
// generation du document |
final CommandeXmlSheet sheet = new CommandeXmlSheet(getTable().getRow(idCommande)); |
final SQLRow row = getTable().getRow(idCommande); |
final CommandeXmlSheet sheet = new CommandeXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
// incrémentation du numéro auto |
if (NumerotationAutoSQLElement.getNextNumero(getElement().getClass()).equalsIgnoreCase(this.numeroUniqueCommande.getText().trim())) { |
934,6 → 970,8 |
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class); |
elt.updateStatus(getTable(), getTable().getTable("COMMANDE_ELEMENT"), idCommande); |
((CommandeSQLElement) getElement()).fireInsertedCmdListener(row); |
if (attempt > 0) { |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
1000,9 → 1038,10 |
elt.updateStatus(getTable(), getTable().getTable("COMMANDE_ELEMENT"), getSelectedID()); |
// generation du document |
final CommandeXmlSheet sheet = new CommandeXmlSheet(getTable().getRow(id)); |
final SQLRow row = getTable().getRow(id); |
final CommandeXmlSheet sheet = new CommandeXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/table/ChiffrageCommandeTable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
66,7 → 66,16 |
final List<SQLTableElement> list = new Vector<SQLTableElement>(); |
final SQLTableElement tableElementNom = new SQLTableElement(e.getTable().getField("NOM")); |
final SQLTableElement tableElementNom = new SQLTableElement(e.getTable().getField("NOM")) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
if (e.getTable().contains("ID_CATEGORIE_HEURE")) { |
return false; |
} else { |
return super.isCellEditable(vals, rowIndex, columnIndex); |
} |
} |
}; |
list.add(tableElementNom); |
if (e.getTable().contains("ID_TYPE_CMD")) { |
final SQLTableElement cat = new SQLTableElement(e.getTable().getField("ID_TYPE_CMD")); |
82,13 → 91,19 |
final SQLField fieldHA = e.getTable().getField("PA_HT"); |
final DeviseNumericCellEditor editorPAHT = new DeviseNumericCellEditor(fieldHA); |
final SQLTableElement pa = new SQLTableElement(fieldHA, BigDecimal.class, editorPAHT); |
final SQLTableElement pa = new SQLTableElement(fieldHA, BigDecimal.class, editorPAHT) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
if (e.getTable().contains("ID_CATEGORIE_HEURE")) { |
return false; |
} else { |
return super.isCellEditable(vals, rowIndex, columnIndex); |
} |
} |
}; |
DeviseTableCellRenderer renderer = new DeviseTableCellRenderer(); |
renderer.setHideZeroValue(true); |
pa.setRenderer(renderer); |
if (e.getTable().contains("ID_CATEGORIE_HEURE")) { |
pa.setEditable(false); |
} |
pa.setRenderer(renderer); |
list.add(pa); |
final SQLField fieldPV = e.getTable().getField("PV_HT"); |
102,6 → 117,15 |
protected Object getDefaultNullValue() { |
return BigDecimal.ZERO; |
} |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
if (e.getTable().contains("ID_CATEGORIE_HEURE")) { |
return vals.getObject("ID_CATEGORIE_HEURE") == null || vals.isForeignEmpty("ID_CATEGORIE_HEURE"); |
} else { |
return super.isCellEditable(vals, rowIndex, columnIndex); |
} |
} |
}; |
qteU.setRenderer(renderer); |
list.add(qteU); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/DemandePrixSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
23,6 → 23,7 |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.ElementSQLObject; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLBackgroundTableCache; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
30,6 → 31,7 |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.sqlobject.JUniqueTextField; |
import org.openconcerto.sql.ui.RadioButtons; |
import org.openconcerto.sql.users.UserManager; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.list.RowValuesTable; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
183,7 → 185,17 |
// this.add(boxEtat, c); |
// this.addView(boxEtat, "ID_ETAT_DEMANDE_PRIX"); |
c.gridx = 0; |
c.gridy++; |
c.weightx = 0; |
this.add(new JLabel(getLabelFor("ID_COMMERCIAL"), SwingConstants.RIGHT), c); |
c.gridx++; |
c.weightx = 1; |
final ElementComboBox boxCom = new ElementComboBox(); |
this.add(boxCom, c); |
this.addView(boxCom, "ID_COMMERCIAL", REQ); |
c.weightx = 0; |
c.gridheight = 1; |
c.gridx = 0; |
c.gridy++; |
470,9 → 482,10 |
// this.table.createArticle(idCommande, this.getElement()); |
// generation du document |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(getTable().getRow(idCommande)); |
final SQLRow row = getTable().getRow(idCommande); |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
sheet.showPrintAndExportAsynchronous(true, false, true, getElement(), row); |
// incrémentation du numéro auto |
if (NumerotationAutoSQLElement.getNextNumero(DemandePrixSQLElement.class).equalsIgnoreCase(this.field.getText().trim())) { |
522,9 → 535,10 |
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class); |
elt.updateStatus(getTable(), getTable().getTable("DEMANDE_PRIX_ELEMENT"), getSelectedID()); |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(getTable().getRow(getSelectedID())); |
final SQLRow row = getTable().getRow(getSelectedID()); |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
sheet.showPrintAndExportAsynchronous(true, false, true, getElement(), row); |
} |
532,6 → 546,15 |
protected SQLRowValues createDefaults() { |
SQLRowValues rowVals = new SQLRowValues(getTable()); |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(DemandePrixSQLElement.class)); |
SQLElement eltComm = getElement().getForeignElement("ID_COMMERCIAL"); |
int idUser = UserManager.getInstance().getCurrentUserID(); |
SQLRow rowsComm = SQLBackgroundTableCache.getInstance().getCacheForTable(eltComm.getTable()).getFirstRowContains(idUser, eltComm.getTable().getField("ID_USER_COMMON")); |
if (rowsComm != null) { |
rowVals.put("ID_COMMERCIAL", rowsComm.getID()); |
} |
if (getTable().getUndefinedID() == SQLRow.NONEXISTANT_ID) { |
rowVals.put("ID_ETAT_DEMANDE_PRIX", EtatDemandePrixSQLElement.EN_ATTENTE); |
} else { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/CommandeSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,6 → 17,7 |
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.edm.AttachmentAction; |
import org.openconcerto.erp.core.sales.order.ui.ReliquatCommandeTableModel; |
import org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent; |
import org.openconcerto.erp.core.supplychain.order.component.SaisieAchatSQLComponent; |
import org.openconcerto.erp.core.supplychain.receipt.component.BonReceptionSQLComponent; |
34,6 → 35,9 |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLSelectJoin; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.SQLTableEvent; |
import org.openconcerto.sql.model.SQLTableEvent.Mode; |
import org.openconcerto.sql.model.SQLTableModifiedListener; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.view.EditFrame; |
42,9 → 46,12 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.RowAction; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.ui.PanelFrame; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.cc.ITransformer; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.sql.SQLException; |
import java.util.ArrayList; |
54,6 → 61,9 |
import javax.swing.ImageIcon; |
import javax.swing.JFrame; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.JTable; |
import javax.swing.SwingWorker; |
import org.apache.commons.dbutils.handlers.ArrayListHandler; |
69,7 → 79,7 |
getRowActions().add(actionAttachment); |
} |
getRowActions().addAll(new MouseSheetXmlListeListener(CommandeXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, CommandeXmlSheet.class).getRowActions()); |
// Transfert vers BR |
PredicateRowAction bonAction = new PredicateRowAction(new AbstractAction() { |
155,6 → 165,32 |
}, false, "supplychain.order.valid"); |
tagValidAction.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(tagValidAction); |
// Reliquat |
PredicateRowAction reliquatAction = new PredicateRowAction(new AbstractAction() { |
public void actionPerformed(ActionEvent e) { |
JPanel panelReliquat = new JPanel(new GridBagLayout()); |
GridBagConstraints c = new GridBagConstraints(); |
final ReliquatCommandeTableModel dm = new ReliquatCommandeTableModel(IListe.get(e).getSelectedRowAccessor()); |
if (dm.getRowCount() > 0) { |
JTable table = new JTable(dm); |
JScrollPane comp = new JScrollPane(table); |
c.weightx = 1; |
c.weighty = 1; |
c.fill = GridBagConstraints.BOTH; |
panelReliquat.add(comp, c); |
PanelFrame frame = new PanelFrame(panelReliquat, "Reliquat commande"); |
frame.pack(); |
frame.setVisible(true); |
} else { |
JOptionPane.showMessageDialog(null, "Aucun reliquat restant"); |
} |
} |
}, false, "sales.order.reliquat.show"); |
reliquatAction.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(reliquatAction); |
} |
@Override |
193,6 → 229,22 |
return new CommandeSQLComponent(); |
} |
private final List<SQLTableModifiedListener> listenerCmdInserted = new ArrayList<>(); |
public void addInsertedCmdListener(SQLTableModifiedListener l) { |
this.listenerCmdInserted.add(l); |
} |
public void removeInsertedCmdListener(SQLTableModifiedListener l) { |
this.listenerCmdInserted.remove(l); |
} |
public void fireInsertedCmdListener(SQLRow row) { |
for (SQLTableModifiedListener sqlTableModifiedListener : this.listenerCmdInserted) { |
sqlTableModifiedListener.tableModified(new SQLTableEvent(row, Mode.ROW_ADDED, null)); |
} |
} |
public void transfertBR(final List<SQLRowValues> selectedRows) { |
EditFrame f = TransfertBaseSQLComponent.openTransfertFrame(selectedRows, "BON_RECEPTION"); |
219,6 → 271,7 |
} |
}); |
comp.loadQuantity(fetcher.fetch()); |
comp.removeZeroQtyLines(); |
} |
/** |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/CommandeElementSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,10 → 15,12 |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.ui.DeviseField; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.UISQLComponent; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.UpdateBuilder; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.users.UserManager; |
104,6 → 106,15 |
l.add("ID_STYLE"); |
l.add("CODE"); |
l.add("NOM"); |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVER_DECLINAISON, false)) { |
for (String fieldName : getTable().getFieldsName()) { |
if (fieldName.startsWith("ID_ARTICLE_DECLINAISON_")) { |
l.add(fieldName); |
} |
} |
} |
l.add("ID_COMMANDE"); |
l.add("ID_ARTICLE"); |
l.add("PA_HT"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/FactureFournisseurSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
22,6 → 22,7 |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.model.FieldPath; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.graph.Path; |
import org.openconcerto.sql.view.EditFrame; |
32,6 → 33,7 |
import org.openconcerto.sql.view.list.SQLTableModelSource; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.sql.view.list.action.ListEvent; |
import org.openconcerto.ui.table.PercentTableCellRenderer; |
import org.openconcerto.utils.CollectionUtils; |
import org.openconcerto.utils.DecimalUtils; |
52,7 → 54,7 |
public FactureFournisseurSQLElement() { |
super("FACTURE_FOURNISSEUR", "une facture fournisseur", "factures fournisseur"); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(FactureFournisseurXmlSheet.class); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, FactureFournisseurXmlSheet.class); |
mouseSheetXmlListeListener.setGenerateHeader(true); |
mouseSheetXmlListeListener.setShowHeader(true); |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions()); |
70,8 → 72,7 |
editFrame.setVisible(true); |
} |
}, true, "supplychain.invoice.clone") { |
public boolean enabledFor(IListeEvent evt) { |
List<? extends SQLRowAccessor> l = evt.getSelectedRows(); |
public boolean enabledFor(List<SQLRowValues> l) { |
return (l != null && l.size() == 1); |
} |
}; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/DemandePrixSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
57,35 → 57,6 |
@Override |
protected void _initTableSource(SQLTableModelSource source) { |
super._initTableSource(source); |
// { |
// BaseSQLTableModelColumn cmd = new BaseSQLTableModelColumn("Commande associée", |
// String.class) { |
// |
// @Override |
// protected Object show_(SQLRowAccessor r) { |
// Collection<? extends SQLRowAccessor> l = |
// r.getReferentRows(r.getTable().getTable("COMMANDE")); |
// String s = ""; |
// if (l != null && l.size() > 0) { |
// for (SQLRowAccessor sqlRowAccessor : l) { |
// s += sqlRowAccessor.getString("NUMERO") + " "; |
// } |
// } |
// |
// return s; |
// } |
// |
// @Override |
// public Set<FieldPath> getPaths() { |
// // TODO Raccord de méthode auto-généré |
// Path p = new Path(getTable()); |
// p = p.add(getTable().getTable("COMMANDE").getField("ID_DEMANDE_PRIX")); |
// |
// return CollectionUtils.createSet(new FieldPath(p, "NUMERO")); |
// } |
// }; |
// source.getColumns().add(cmd); |
// } |
} |
92,11 → 63,10 |
public DemandePrixSQLElement() { |
super("DEMANDE_PRIX"); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(DemandePrixSheetXML.class) { |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(this, DemandePrixSheetXML.class) { |
@Override |
protected String getMailObject(SQLRow row) { |
// TODO Raccord de méthode auto-généré |
return "Veuillez trouver en pièce jointe notre demande de prix."; |
} |
121,16 → 91,6 |
final CommandeSQLComponent sqlComponent = (CommandeSQLComponent) f.getPanel().getSQLComponent(); |
sqlComponent.select(inj.createRowValuesFrom(row.getID())); |
// SQLRowAccessor foreignRow = row.getForeign("ID_ADRESSE"); |
// if (foreignRow != null && !foreignRow.isUndefined()) { |
// ElementSQLObject obj = (ElementSQLObject) |
// sqlComponent.getView("ID_ADRESSE").getComp(); |
// obj.setCreated(true); |
// |
// SQLRowValues asRowValues = getLivraisonAdr(row.getForeign("ID_AFFAIRE")); |
// asRowValues.clearPrimaryKeys(); |
// obj.getSQLChild().select(asRowValues); |
// } |
sqlComponent.loadItem(sqlComponent.getRowValuesTablePanel(), Configuration.getInstance().getDirectory().getElement("DEMANDE_PRIX"), row.getID(), |
Configuration.getInstance().getDirectory().getElement("DEMANDE_PRIX_ELEMENT")); |
f.setVisible(true); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/receipt/component/BonReceptionSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
586,7 → 586,7 |
@Override |
public void run() { |
try { |
updateStock(idBonFinal); |
((BonReceptionSQLElement) getElement()).updateStock(idBonFinal); |
((BonReceptionSQLElement) getElement()).updateCmdElement(((BonReceptionSQLElement) getElement()).getCmdFrom(idBonFinal), idBonFinal); |
} catch (Exception e) { |
ExceptionHandler.handle("Update error", e); |
598,9 → 598,10 |
elt.updateStatus(getTable(), getTable().getTable("BON_RECEPTION_ELEMENT"), idBon); |
// generation du document |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(getTable().getRow(idBonFinal)); |
final SQLRow row = getTable().getRow(idBonFinal); |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
} catch (Exception e) { |
throw new IllegalStateException(e); |
671,6 → 672,16 |
} |
} |
public void removeZeroQtyLines() { |
int count = this.tableBonItem.getModel().getRowCount() - 1; |
for (int i = count; i >= 0; i--) { |
final SQLRowValues rowValuesAt = this.tableBonItem.getModel().getRowValuesAt(i); |
if (rowValuesAt.getInt("QTE") == 0) { |
this.tableBonItem.getModel().removeRowAt(i); |
} |
} |
} |
@Override |
public void update() { |
700,7 → 711,7 |
try { |
// Mise à jour du stock |
updateStock(id); |
((BonReceptionSQLElement) getElement()).updateStock(id); |
((BonReceptionSQLElement) getElement()).updateCmdElement(cmdFrom, id); |
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class); |
716,9 → 727,10 |
elt.updateStatus(getTable(), getTable().getTable("BON_RECEPTION_ELEMENT"), id); |
// generation du document |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(getTable().getRow(id)); |
final SQLRow row = getTable().getRow(id); |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
} |
} |
775,39 → 787,6 |
} |
} |
protected String getLibelleStock(SQLRowAccessor row, SQLRowAccessor rowElt) { |
return "Bon de réception N°" + row.getString("NUMERO"); |
} |
/** |
* Mise à jour des stocks pour chaque article composant du bon |
* |
* @throws SQLException |
*/ |
private void updateStock(int id) throws SQLException { |
SQLRow row = getTable().getRow(id); |
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() { |
@Override |
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) { |
return getLibelleStock(rowOrigin, rowElt); |
} |
}, row, row.getReferentRows(getTable().getTable("BON_RECEPTION_ELEMENT")), |
getTable().contains("CREATE_VIRTUAL_STOCK") && row.getBoolean("CREATE_VIRTUAL_STOCK") ? TypeStockUpdate.REAL_VIRTUAL_RECEPT : TypeStockUpdate.REAL_RECEPT); |
if (getTable().getDBRoot().contains("RELIQUAT_BR")) { |
List<SQLRow> l = row.getReferentRows(getTable().getTable("RELIQUAT_BR").getField("ID_BON_RECEPTION_ORIGINE")); |
for (SQLRow sqlRow : l) { |
stockUpdater.addReliquat(sqlRow.getForeign("ID_ARTICLE"), sqlRow.getInt("QTE"), sqlRow.getBigDecimal("QTE_UNITAIRE")); |
} |
} |
stockUpdater.update(); |
} |
@Override |
public void select(SQLRowAccessor r) { |
super.select(r); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/receipt/element/CodeFournisseurSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
14,10 → 14,8 |
package org.openconcerto.erp.core.supplychain.receipt.element; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.ui.DeviseField; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.UISQLComponent; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import java.util.ArrayList; |
import java.util.List; |
42,6 → 40,11 |
return l; |
} |
@Override |
protected String getParentFFName() { |
return "ID_ARTICLE"; |
} |
/* |
* (non-Javadoc) |
* |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/receipt/element/BonReceptionSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
51,6 → 51,10 |
import javax.swing.SwingWorker; |
import org.apache.commons.dbutils.handlers.ArrayListHandler; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater; |
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate; |
import org.openconcerto.sql.model.SQLRowAccessor; |
public class BonReceptionSQLElement extends ComptaSQLConfElement { |
112,7 → 116,7 |
getRowActions().add(actionsTRFA); |
getRowActions().add(actionTRSimple); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(BonReceptionXmlSheet.class); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, BonReceptionXmlSheet.class); |
mouseSheetXmlListeListener.setGenerateHeader(true); |
mouseSheetXmlListeListener.setShowHeader(true); |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions()); |
226,4 → 230,37 |
protected String createCodeSuffix() { |
return ".note"; |
} |
/** |
* Mise à jour des stocks pour chaque article composant du bon |
* |
* @throws SQLException |
*/ |
public void updateStock(int id) throws SQLException { |
SQLRow row = getTable().getRow(id); |
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() { |
@Override |
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) { |
return getLibelleStock(rowOrigin, rowElt); |
} |
}, row, row.getReferentRows(getTable().getTable("BON_RECEPTION_ELEMENT")), |
getTable().contains("CREATE_VIRTUAL_STOCK") && row.getBoolean("CREATE_VIRTUAL_STOCK") ? TypeStockUpdate.REAL_VIRTUAL_RECEPT : TypeStockUpdate.REAL_RECEPT); |
if (getTable().getDBRoot().contains("RELIQUAT_BR")) { |
List<SQLRow> l = row.getReferentRows(getTable().getTable("RELIQUAT_BR").getField("ID_BON_RECEPTION_ORIGINE")); |
for (SQLRow sqlRow : l) { |
stockUpdater.addReliquat(sqlRow.getForeign("ID_ARTICLE"), sqlRow.getInt("QTE"), sqlRow.getBigDecimal("QTE_UNITAIRE")); |
} |
} |
stockUpdater.update(); |
} |
public String getLibelleStock(SQLRowAccessor row, SQLRowAccessor rowElt) { |
return "Bon de réception N°" + row.getString("NUMERO"); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/product/element/ArticleFournisseurSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
33,7 → 33,7 |
public ArticleFournisseurSQLElement() { |
super("ARTICLE_FOURNISSEUR", "un article fournisseur", "articles fournisseurs"); |
getRowActions().addAll(new MouseSheetXmlListeListener(FicheArticleXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, FicheArticleXmlSheet.class).getRowActions()); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/EtatStockSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
32,6 → 32,7 |
import java.awt.event.ActionEvent; |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.Date; |
import java.util.List; |
49,8 → 50,8 |
@Override |
public void actionPerformed(ActionEvent e) { |
EtatStockSnapshotCreator creator = new EtatStockSnapshotCreator(getTable().getTable("DEPOT_STOCK").getRow(DepotStockSQLElement.DEFAULT_ID), new Date(), getTable().getDBRoot()); |
creator.create(); |
PanelFrame frame = new PanelFrame(new EtatStockCreationPanel(getDirectory().getElement(DepotStockSQLElement.class)), "Création état de stock"); |
FrameUtil.showPacked(frame); |
} |
}, true); |
action.setPredicate(IListeEvent.createSelectionCountPredicate(0, Integer.MAX_VALUE)); |
79,7 → 80,7 |
EtatStockInventaireXmlSheet sheet = new EtatStockInventaireXmlSheet(IListe.get(e).getSelectedRow().asRow()); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, false, false, false); |
sheet.showPrintAndExport(true, false, false, false, false, Collections.emptyList()); |
} catch (Exception e1) { |
ExceptionHandler.handle("Erreur lors de la création de l'inventaire", e1); |
} |
97,7 → 98,7 |
FrameUtil.showPacked(frame); |
} |
}, true); |
action.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
action.setPredicate(IListeEvent.createSelectionCountPredicate(0, Integer.MAX_VALUE)); |
getRowActions().add(action); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/InventaireFromEtatStockImporter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,16 → 18,22 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper.SupplierPriceField; |
import org.openconcerto.erp.importer.ArrayTableModel; |
import org.openconcerto.erp.importer.DataImporter; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowListRSH; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesCluster.StoreMode; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.utils.SQLUtils; |
import org.openconcerto.utils.Tuple2; |
import org.openconcerto.utils.Tuple3; |
import java.io.File; |
import java.io.IOException; |
34,6 → 40,7 |
import java.math.BigDecimal; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Calendar; |
import java.util.Collection; |
import java.util.Date; |
40,8 → 47,11 |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
import java.util.Map.Entry; |
import java.util.Set; |
import javax.swing.JOptionPane; |
import org.apache.commons.dbutils.ResultSetHandler; |
public class InventaireFromEtatStockImporter { |
49,9 → 59,45 |
private Map<String, SQLRowValues> kits = new HashMap<String, SQLRowValues>(); |
private List<String> codeKits = new ArrayList<String>(); |
private SQLRowAccessor depot; |
private static String FAMILLE = "Famille"; |
private static String CODE = "Code"; |
private static String NOM = "Nom"; |
private static String TAILLE = "Taille"; |
private static String COULEUR = "Couleur"; |
private static String QTE = "Qté réelle relevée"; |
private static String QTE_OPENCONCERTO = "QTE OpenConcerto"; |
private final Map<String, Integer> mapCouleur = new HashMap<String, Integer>(); |
private final Map<String, Integer> mapTaille = new HashMap<String, Integer>(); |
private final DBRoot root; |
private final SQLElement artElt; |
public InventaireFromEtatStockImporter(SQLRowAccessor depot) { |
public InventaireFromEtatStockImporter(SQLElement articleElt, SQLRowAccessor depot) { |
this.depot = depot; |
this.root = articleElt.getTable().getDBRoot(); |
this.artElt = articleElt; |
{ |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(articleElt.getTable().getTable("ARTICLE_DECLINAISON_COULEUR").getKey()); |
sel.addSelect(articleElt.getTable().getTable("ARTICLE_DECLINAISON_COULEUR").getField("NOM")); |
List<SQLRow> l = SQLRowListRSH.execute(sel); |
for (SQLRow sqlRow : l) { |
mapCouleur.put(sqlRow.getString("NOM").trim(), sqlRow.getID()); |
} |
} |
{ |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(articleElt.getTable().getTable("ARTICLE_DECLINAISON_TAILLE").getKey()); |
sel.addSelect(articleElt.getTable().getTable("ARTICLE_DECLINAISON_TAILLE").getField("NOM")); |
List<SQLRow> l = SQLRowListRSH.execute(sel); |
for (SQLRow sqlRow : l) { |
mapTaille.put(sqlRow.getString("NOM").trim(), sqlRow.getID()); |
} |
} |
} |
public void importArticles(File file, DBRoot root) throws IOException, SQLException { |
59,179 → 105,245 |
final SQLTable table = root.findTable("ARTICLE"); |
final SQLTable tableArtElt = root.findTable("ARTICLE_ELEMENT"); |
Map<String, Tuple2<SQLRowValues, SQLRowValues>> articles = getArticles(); |
// Récupération des couples articles/stocks existant |
fillArticles(); |
final DataImporter importer = new DataImporter(table) { |
@Override |
protected void customizeRowValuesToFetch(SQLRowValues vals) { |
// Matching des colonnes |
Map<String, Integer> columnMapping = new HashMap<String, Integer>(); |
columnMapping.put(CODE, null); |
columnMapping.put(NOM, null); |
columnMapping.put(TAILLE, null); |
columnMapping.put(FAMILLE, null); |
columnMapping.put(COULEUR, null); |
columnMapping.put(QTE, null); |
columnMapping.put(QTE_OPENCONCERTO, null); |
{ |
// Searching column index from column Header |
final DataImporter importer = new DataImporter(table); |
importer.setSkipFirstLine(false); |
ArrayTableModel m = importer.createModelFrom(file); |
List<Object> line = m.getLineValuesAt(0); |
for (int i = 0; i < line.size(); i++) { |
Object object = line.get(i); |
if (object != null) { |
for (String key : columnMapping.keySet()) { |
if (object.toString().equalsIgnoreCase(key)) { |
columnMapping.put(key, i); |
} |
} |
} |
} |
} |
vals.putRowValues("ID_STOCK").putNulls("ID", "QTE_REEL", "QTE_TH", "ID_DEPOT_STOCK"); |
String msg = "Colonnes importées : \n"; |
final SQLPreferences prefs = SQLPreferences.getMemCached(table.getDBRoot()); |
final boolean hasDeclinaison = prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVER_DECLINAISON, false); |
List<String> required; |
if (hasDeclinaison) { |
required = Arrays.asList(CODE, QTE, QTE_OPENCONCERTO, TAILLE, COULEUR); |
} else { |
required = Arrays.asList(CODE, QTE, QTE_OPENCONCERTO); |
} |
for (Entry<String, Integer> e : columnMapping.entrySet()) { |
if (e.getValue() != null) { |
msg += e.getKey() + " : " + getColumnName(e.getValue()) + "\n"; |
} else { |
if (required.contains(e.getKey())) { |
JOptionPane.showMessageDialog(null, "Aucune colonne " + e.getKey() + " trouvée, import annulé!\nCette colonne est obligatoire."); |
return; |
} |
msg += e.getKey() + " : non importée\n"; |
} |
}; |
importer.setSkipFirstLine(true); |
} |
msg += "\nVoulez vous continuer ?"; |
int a = JOptionPane.showConfirmDialog(null, msg); |
if (a == JOptionPane.YES_OPTION) { |
ArrayTableModel m = importer.createModelFrom(file); |
final DataImporter importer = new DataImporter(table) { |
@Override |
protected void customizeRowValuesToFetch(SQLRowValues vals) { |
Calendar c = Calendar.getInstance(); |
// c.set(Calendar.DAY_OF_MONTH, 1); |
// c.set(Calendar.MONTH, Calendar.JANUARY); |
// c.set(Calendar.HOUR_OF_DAY, 0); |
Date today = c.getTime(); |
vals.putRowValues("ID_STOCK").putNulls("ID", "QTE_REEL", "QTE_TH", "ID_DEPOT_STOCK"); |
} |
}; |
importer.setSkipFirstLine(true); |
// TODO ne pas vider les stocks des kits, recalculer les stocks des kits |
ArrayTableModel m = importer.createModelFrom(file); |
SQLRowValues rowVals = new SQLRowValues(table.getTable("ETAT_STOCK")); |
rowVals.put("DATE", today); |
rowVals.put("INVENTAIRE", Boolean.TRUE); |
rowVals.put("ID_DEPOT_STOCK", this.depot.getID()); |
SQLRow rowEtat = rowVals.commit(); |
Calendar c = Calendar.getInstance(); |
// c.set(Calendar.DAY_OF_MONTH, 1); |
// c.set(Calendar.MONTH, Calendar.JANUARY); |
// c.set(Calendar.HOUR_OF_DAY, 0); |
Date today = c.getTime(); |
for (int i = 1; i < m.getRowCount(); i++) { |
List<Object> o = m.getLineValuesAt(i); |
if (o.size() >= 5) { |
System.err.println(o); |
String code = o.get(1).toString(); |
if (code.trim().length() > 0) { |
// TODO ne pas vider les stocks des kits, recalculer les stocks des kits |
final String stringQty = o.get(4).toString(); |
Double qty = stringQty.trim().length() == 0 ? 0 : Double.valueOf(stringQty); |
final String stringQtyOld = o.get(3).toString(); |
float qtyOld = stringQtyOld.trim().length() == 0 ? 0 : Float.valueOf(stringQtyOld); |
SQLRowValues rowVals = new SQLRowValues(table.getTable("ETAT_STOCK")); |
rowVals.put("DATE", today); |
rowVals.put("INVENTAIRE", Boolean.TRUE); |
rowVals.put("ID_DEPOT_STOCK", this.depot.getID()); |
SQLRow rowEtat = rowVals.commit(); |
Tuple2<SQLRowValues, SQLRowValues> match = articles.get(code); |
if (match != null) { |
for (int i = 1; i < m.getRowCount(); i++) { |
List<Object> o = m.getLineValuesAt(i); |
if (o.size() >= 5) { |
System.err.println(o); |
String code = o.get(columnMapping.get(CODE)).toString(); |
if (code.trim().length() > 0) { |
SQLRowAccessor stockValues = match.get1(); |
final String stringQty = o.get(columnMapping.get(QTE)).toString(); |
Double qty = stringQty.trim().length() == 0 ? 0 : Double.valueOf(stringQty); |
final String stringQtyOld = o.get(columnMapping.get(QTE_OPENCONCERTO)).toString(); |
float qtyOld = stringQtyOld.trim().length() == 0 ? 0 : Float.valueOf(stringQtyOld); |
final SQLTable tableMvt = table.getTable("MOUVEMENT_STOCK"); |
SQLRowValues rowValsMvtStockClotureFermeture = new SQLRowValues(tableMvt); |
rowValsMvtStockClotureFermeture.put("QTE", -qtyOld); |
rowValsMvtStockClotureFermeture.put("NOM", "Clôture stock avant inventaire"); |
rowValsMvtStockClotureFermeture.put("ID_ARTICLE", match.get0().getID()); |
rowValsMvtStockClotureFermeture.put("DATE", today); |
rowValsMvtStockClotureFermeture.put("REEL", Boolean.TRUE); |
rowValsMvtStockClotureFermeture.put("ID_STOCK", stockValues.getID()); |
String couleur = ""; |
if (columnMapping.get(COULEUR) != null) { |
couleur = o.get(columnMapping.get(COULEUR)).toString(); |
} |
BigDecimal prc = getPRC(match.get0(), Math.round(qtyOld), today); |
if (prc == null) { |
prc = BigDecimal.ZERO; |
String taille = ""; |
if (columnMapping.get(TAILLE) != null) { |
taille = o.get(columnMapping.get(TAILLE)).toString(); |
} |
if (tableMvt.contains("PRICE")) { |
rowValsMvtStockClotureFermeture.put("PRICE", prc); |
} |
rowValsMvtStockClotureFermeture.put("CLOTURE", Boolean.TRUE); |
rowValsMvtStockClotureFermeture.put("ID_ETAT_STOCK", rowEtat.getID()); |
rowValsMvtStockClotureFermeture.getGraph().store(StoreMode.COMMIT, false); |
SQLRowValues rowValsItem = new SQLRowValues(table.getTable("ETAT_STOCK_ELEMENT")); |
rowValsItem.put("ID_ETAT_STOCK", rowEtat.getID()); |
rowValsItem.put("PA", prc); |
rowValsItem.put("PV", BigDecimal.ZERO); |
rowValsItem.put("QTE", qtyOld); |
rowValsItem.put("T_PA", prc.multiply(new BigDecimal(qtyOld))); |
rowValsItem.put("T_PV", BigDecimal.ZERO); |
rowValsItem.put("CODE", match.get0().getString("CODE")); |
rowValsItem.put("NOM", match.get0().getString("NOM")); |
rowValsItem.put("ID_ARTICLE", match.get0().getID()); |
rowValsItem.getGraph().store(StoreMode.COMMIT, false); |
// SQLRowAccessor match = findArticle(code, couleur, taille); |
SQLRowValues rowValsMvtStockClotureOuverture = new SQLRowValues(tableMvt); |
rowValsMvtStockClotureOuverture.put("QTE", qty); |
rowValsMvtStockClotureOuverture.put("NOM", "Mise en stock inventaire"); |
rowValsMvtStockClotureOuverture.put("ID_ETAT_STOCK", rowEtat.getID()); |
rowValsMvtStockClotureOuverture.put("ID_ARTICLE", match.get0().getID()); |
rowValsMvtStockClotureOuverture.put("DATE", today); |
rowValsMvtStockClotureOuverture.put("REEL", Boolean.TRUE); |
rowValsMvtStockClotureOuverture.put("ID_STOCK", stockValues.getID()); |
rowValsMvtStockClotureOuverture.put("OUVERTURE", Boolean.TRUE); |
if (tableMvt.contains("PRICE")) { |
rowValsMvtStockClotureOuverture.put("PRICE", getPRC(match.get0(), qty.intValue(), today)); |
} |
rowValsMvtStockClotureOuverture.getGraph().store(StoreMode.COMMIT, false); |
Tuple2<SQLRowValues, SQLRowValues> match = findArticle(code, couleur, taille); |
if (match != null) { |
// if (!match.isForeignEmpty("ID_STOCK")) { |
// match.getForeign("ID_STOCK").createEmptyUpdateRow().put("QTE_REEL", |
// qty).commit(); |
// } else { |
final SQLRowValues createEmptyUpdateRow = match.get1().createEmptyUpdateRow(); |
createEmptyUpdateRow.put("QTE_REEL", qty); |
createEmptyUpdateRow.getGraph().store(StoreMode.COMMIT, false); |
SQLRowAccessor stockValues = match.get1(); |
// } |
final SQLTable tableMvt = table.getTable("MOUVEMENT_STOCK"); |
SQLRowValues rowValsMvtStockClotureFermeture = new SQLRowValues(tableMvt); |
rowValsMvtStockClotureFermeture.put("QTE", -qtyOld); |
rowValsMvtStockClotureFermeture.put("NOM", "Clôture stock avant inventaire"); |
rowValsMvtStockClotureFermeture.put("ID_ARTICLE", match.get0().getID()); |
rowValsMvtStockClotureFermeture.put("DATE", today); |
rowValsMvtStockClotureFermeture.put("REEL", Boolean.TRUE); |
rowValsMvtStockClotureFermeture.put("ID_STOCK", stockValues.getID()); |
} else { |
System.err.println("Aucun article correspondant au code " + code); |
BigDecimal prc = getPRC(match.get0(), Math.round(qtyOld), today); |
if (prc == null) { |
prc = BigDecimal.ZERO; |
} |
if (tableMvt.contains("PRICE")) { |
rowValsMvtStockClotureFermeture.put("PRICE", prc); |
} |
rowValsMvtStockClotureFermeture.put("CLOTURE", Boolean.TRUE); |
rowValsMvtStockClotureFermeture.put("ID_ETAT_STOCK", rowEtat.getID()); |
rowValsMvtStockClotureFermeture.getGraph().store(StoreMode.COMMIT, false); |
SQLRowValues rowValsItem = new SQLRowValues(table.getTable("ETAT_STOCK_ELEMENT")); |
rowValsItem.put("ID_ETAT_STOCK", rowEtat.getID()); |
rowValsItem.put("PA", prc); |
rowValsItem.put("PV", BigDecimal.ZERO); |
rowValsItem.put("QTE", qtyOld); |
rowValsItem.put("T_PA", prc.multiply(new BigDecimal(qtyOld))); |
rowValsItem.put("T_PV", BigDecimal.ZERO); |
rowValsItem.put("CODE", match.get0().getString("CODE")); |
rowValsItem.put("NOM", match.get0().getString("NOM")); |
rowValsItem.put("ID_ARTICLE", match.get0().getID()); |
rowValsItem.getGraph().store(StoreMode.COMMIT, false); |
SQLRowValues rowValsMvtStockClotureOuverture = new SQLRowValues(tableMvt); |
rowValsMvtStockClotureOuverture.put("QTE", qty); |
rowValsMvtStockClotureOuverture.put("NOM", "Mise en stock inventaire"); |
rowValsMvtStockClotureOuverture.put("ID_ETAT_STOCK", rowEtat.getID()); |
rowValsMvtStockClotureOuverture.put("ID_ARTICLE", match.get0().getID()); |
rowValsMvtStockClotureOuverture.put("DATE", today); |
rowValsMvtStockClotureOuverture.put("REEL", Boolean.TRUE); |
rowValsMvtStockClotureOuverture.put("ID_STOCK", stockValues.getID()); |
rowValsMvtStockClotureOuverture.put("OUVERTURE", Boolean.TRUE); |
if (tableMvt.contains("PRICE")) { |
rowValsMvtStockClotureOuverture.put("PRICE", getPRC(match.get0(), qty.intValue(), today)); |
} |
rowValsMvtStockClotureOuverture.getGraph().store(StoreMode.COMMIT, false); |
// if (!match.isForeignEmpty("ID_STOCK")) { |
// match.getForeign("ID_STOCK").createEmptyUpdateRow().put("QTE_REEL", |
// qty).commit(); |
// } else { |
final SQLRowValues createEmptyUpdateRow = match.get1().createEmptyUpdateRow(); |
createEmptyUpdateRow.put("QTE_REEL", qty); |
createEmptyUpdateRow.getGraph().store(StoreMode.COMMIT, false); |
// } |
} else { |
System.err.println("Aucun article correspondant au code " + code); |
} |
} |
} |
} |
} |
/** |
* Mise à jour des kits |
*/ |
/** |
* Mise à jour des kits |
*/ |
List<String> reqs = new ArrayList<String>(); |
for (String code : codeKits) { |
System.err.println(code); |
SQLRowValues rowValsKit = kits.get(code); |
StockItem item = new StockItem(rowValsKit, rowValsKit.getForeign("ID_STOCK")); |
Collection<SQLRowValues> elts = rowValsKit.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT")); |
for (SQLRowValues sqlRowValues : elts) { |
if (sqlRowValues.getForeign("ID_ARTICLE") != null) { |
item.addItemComponent(new StockItemComponent(new StockItem(sqlRowValues.getForeign("ID_ARTICLE"), sqlRowValues.getForeign("ID_ARTICLE").getForeign("ID_STOCK")), |
sqlRowValues.getBigDecimal("QTE_UNITAIRE"), sqlRowValues.getInt("QTE"))); |
List<String> reqs = new ArrayList<String>(); |
for (String code : codeKits) { |
System.err.println(code); |
SQLRowValues rowValsKit = kits.get(code); |
StockItem item = new StockItem(rowValsKit, ProductComponent.findOrCreateStock(rowValsKit, depot)); |
Collection<SQLRowValues> elts = rowValsKit.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT")); |
for (SQLRowValues sqlRowValues : elts) { |
if (sqlRowValues.getForeign("ID_ARTICLE") != null) { |
item.addItemComponent( |
new StockItemComponent(new StockItem(sqlRowValues.getForeign("ID_ARTICLE"), ProductComponent.findOrCreateStock(sqlRowValues.getForeign("ID_ARTICLE"), depot)), |
sqlRowValues.getBigDecimal("QTE_UNITAIRE"), sqlRowValues.getInt("QTE"))); |
} |
} |
item.updateQtyFromChildren(); |
reqs.add(item.getUpdateRequest()); |
} |
item.updateQtyFromChildren(); |
reqs.add(item.getUpdateRequest()); |
} |
List<? extends ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(reqs.size()); |
for (String s : reqs) { |
handlers.add(null); |
List<? extends ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(reqs.size()); |
for (String s : reqs) { |
handlers.add(null); |
} |
// FIXME FIRE TABLE CHANGED TO UPDATE ILISTE ?? |
SQLUtils.executeMultiple(table.getDBSystemRoot(), reqs, handlers); |
/** |
* Mise à jour des prix mini |
*/ |
// for (SQLRowValues rowValsArt : rowValsArtNonSync) { |
// SQLRow rowArt = rowValsArt.asRow(); |
// List<SQLRow> rowsPVMin = |
// rowArt.getReferentRows(tableArtElt.getTable("ARTICLE_PRIX_MIN_VENTE")); |
// List<SQLRow> rowsPA = |
// rowArt.getReferentRows(tableArtElt.getTable("ARTICLE_TARIF_FOURNISSEUR")); |
// |
// // On récupére les derniers prix min valides |
// Map<Integer, SQLRow> mapLastValidRows = new HashMap<Integer, SQLRow>(); |
// for (SQLRow rowPVMin : rowsPVMin) { |
// final int qteMinPrice = rowPVMin.getInt("QTE"); |
// SQLRow rowValsLastValid = mapLastValidRows.get(qteMinPrice); |
// if (rowValsLastValid == null || rowValsLastValid.getDate("DATE") == null || |
// rowValsLastValid.getDate("DATE").before(rowPVMin.getDate("DATE"))) { |
// mapLastValidRows.put(qteMinPrice, rowPVMin); |
// } |
// } |
// |
// // On récupére les derniers Prix d'achat valide |
// Map<Integer, SQLRow> mapLastValidAchatRows = new HashMap<Integer, SQLRow>(); |
// for (SQLRow rowPA : rowsPA) { |
// final int qtePRC = rowPA.getInt("QTE"); |
// SQLRow rowValsLastValid = mapLastValidAchatRows.get(qtePRC); |
// if (rowValsLastValid == null || rowValsLastValid.getDate("DATE_PRIX") == null || |
// rowValsLastValid.getDate("DATE_PRIX").before(rowPA.getDate("DATE_PRIX"))) { |
// mapLastValidAchatRows.put(qtePRC, rowPA); |
// } |
// } |
// |
// // Mise à jour, si Prix < au prix min, du PRC et des prix min |
// for (Integer qte : mapLastValidAchatRows.keySet()) { |
// SQLRow rowVals = mapLastValidAchatRows.get(qte); |
// checkMinPrice(rowVals, mapLastValidRows.get(qte)); |
// } |
// } |
} |
// FIXME FIRE TABLE CHANGED TO UPDATE ILISTE ?? |
SQLUtils.executeMultiple(table.getDBSystemRoot(), reqs, handlers); |
/** |
* Mise à jour des prix mini |
*/ |
// for (SQLRowValues rowValsArt : rowValsArtNonSync) { |
// SQLRow rowArt = rowValsArt.asRow(); |
// List<SQLRow> rowsPVMin = |
// rowArt.getReferentRows(tableArtElt.getTable("ARTICLE_PRIX_MIN_VENTE")); |
// List<SQLRow> rowsPA = |
// rowArt.getReferentRows(tableArtElt.getTable("ARTICLE_TARIF_FOURNISSEUR")); |
// |
// // On récupére les derniers prix min valides |
// Map<Integer, SQLRow> mapLastValidRows = new HashMap<Integer, SQLRow>(); |
// for (SQLRow rowPVMin : rowsPVMin) { |
// final int qteMinPrice = rowPVMin.getInt("QTE"); |
// SQLRow rowValsLastValid = mapLastValidRows.get(qteMinPrice); |
// if (rowValsLastValid == null || rowValsLastValid.getDate("DATE") == null || |
// rowValsLastValid.getDate("DATE").before(rowPVMin.getDate("DATE"))) { |
// mapLastValidRows.put(qteMinPrice, rowPVMin); |
// } |
// } |
// |
// // On récupére les derniers Prix d'achat valide |
// Map<Integer, SQLRow> mapLastValidAchatRows = new HashMap<Integer, SQLRow>(); |
// for (SQLRow rowPA : rowsPA) { |
// final int qtePRC = rowPA.getInt("QTE"); |
// SQLRow rowValsLastValid = mapLastValidAchatRows.get(qtePRC); |
// if (rowValsLastValid == null || rowValsLastValid.getDate("DATE_PRIX") == null || |
// rowValsLastValid.getDate("DATE_PRIX").before(rowPA.getDate("DATE_PRIX"))) { |
// mapLastValidAchatRows.put(qtePRC, rowPA); |
// } |
// } |
// |
// // Mise à jour, si Prix < au prix min, du PRC et des prix min |
// for (Integer qte : mapLastValidAchatRows.keySet()) { |
// SQLRow rowVals = mapLastValidAchatRows.get(qte); |
// checkMinPrice(rowVals, mapLastValidRows.get(qte)); |
// } |
// } |
} |
private void checkMinPrice(SQLRow rowValsSuplierLastValid, SQLRow lastValidRow) { |
309,18 → 421,29 |
// return result; |
} |
private Map<String, Tuple2<SQLRowValues, SQLRowValues>> getArticles() throws SQLException { |
private final Map<String, Tuple2<SQLRowValues, SQLRowValues>> mapArticle = new HashMap<String, Tuple2<SQLRowValues, SQLRowValues>>(); |
private final Map<String, Tuple2<SQLRowValues, SQLRowValues>> mapArticleVirtuel = new HashMap<String, Tuple2<SQLRowValues, SQLRowValues>>(); |
private final Map<Tuple3<String, String, String>, Tuple2<SQLRowValues, SQLRowValues>> mapDeclArticle = new HashMap<Tuple3<String, String, String>, Tuple2<SQLRowValues, SQLRowValues>>(); |
private void fillArticles() throws SQLException { |
final SQLTable table = Configuration.getInstance().getRoot().findTable("ARTICLE"); |
SQLRowValues graph = new SQLRowValues(table); |
graph.put("ID", null); |
graph.put("CODE", null); |
graph.put("NOM", null); |
graph.put("NOM", null); |
graph.put("VIRTUEL", null); |
graph.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("ID", "NOM"); |
graph.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("ID", "NOM"); |
final SQLTable foreignTableStock = table.getForeignTable("ID_STOCK"); |
SQLRowValues graphStock = new SQLRowValues(foreignTableStock); |
graphStock.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
graphStock.put("ID_ARTICLE", graph); |
SQLRowValues graphStockArt = new SQLRowValues(foreignTableStock); |
graphStockArt.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
graph.put("ID_STOCK", graphStockArt); |
final SQLTable tableArtElt = table.getTable("ARTICLE_ELEMENT"); |
SQLRowValues artElt = new SQLRowValues(tableArtElt); |
artElt.put("ID", null); |
328,11 → 451,17 |
artElt.put("QTE_UNITAIRE", null); |
artElt.put("ID_ARTICLE_PARENT", graph); |
final SQLRowValues articleParent = artElt.putRowValues("ID_ARTICLE"); |
articleParent.putNulls("ID", "CODE", "NOM"); |
articleParent.putNulls("ID", "CODE", "NOM", "VIRTUEL"); |
articleParent.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("ID", "NOM"); |
articleParent.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("ID", "NOM"); |
SQLRowValues graphStockItem = new SQLRowValues(foreignTableStock); |
graphStockItem.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
graphStockItem.put("ID_ARTICLE", articleParent); |
SQLRowValues graphStockArtItem = new SQLRowValues(foreignTableStock); |
graphStockArtItem.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
articleParent.put("ID_STOCK", graphStockArtItem); |
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(graph); |
List<SQLRowValues> results = fetcher.fetch(); |
342,7 → 471,6 |
c.set(Calendar.DAY_OF_MONTH, 31); |
Date dEndYear = c.getTime(); |
Map<String, Tuple2<SQLRowValues, SQLRowValues>> vals = new HashMap<String, Tuple2<SQLRowValues, SQLRowValues>>(); |
for (SQLRowValues sqlRowValues : results) { |
final String code = sqlRowValues.getString("CODE"); |
354,11 → 482,25 |
rowValsStock = sqlRowValues2; |
} |
} |
if (rowValsStock == null) { |
rowValsStock = ProductComponent.findOrCreateStock(sqlRowValues, depot).asRowValues(); |
// if (rowValsStock == null) { |
// rowValsStock = ProductComponent.findOrCreateStock(sqlRowValues, depot).asRowValues(); |
// } |
if (sqlRowValues.getBoolean("VIRTUEL")) { |
mapArticleVirtuel.put(sqlRowValues.getString("CODE"), Tuple2.create(sqlRowValues, rowValsStock)); |
} |
vals.put(code, Tuple2.create(sqlRowValues, rowValsStock)); |
final SQLRowAccessor couleur = sqlRowValues.getObject("ID_ARTICLE_DECLINAISON_COULEUR") == null ? null : sqlRowValues.getNonEmptyForeign("ID_ARTICLE_DECLINAISON_COULEUR"); |
final SQLRowAccessor taille = sqlRowValues.getObject("ID_ARTICLE_DECLINAISON_TAILLE") == null ? null : sqlRowValues.getNonEmptyForeign("ID_ARTICLE_DECLINAISON_TAILLE"); |
if (couleur == null && taille == null) { |
mapArticle.put(sqlRowValues.getString("CODE"), Tuple2.create(sqlRowValues, rowValsStock)); |
} else if (couleur == null) { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), null, taille.getString("NOM")), Tuple2.create(sqlRowValues, rowValsStock)); |
} else if (taille == null) { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), couleur.getString("NOM"), null), Tuple2.create(sqlRowValues, rowValsStock)); |
} else { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), couleur.getString("NOM"), taille.getString("NOM")), Tuple2.create(sqlRowValues, rowValsStock)); |
} |
final Set<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT")); |
if (referentRows.size() == 0) { |
403,6 → 545,99 |
// } |
} |
} |
return vals; |
} |
private Tuple2<SQLRowValues, SQLRowValues> findArticle(String code, String couleur, String taille) throws SQLException { |
if (!mapCouleur.containsKey(couleur)) { |
SQLRowValues rowVals = new SQLRowValues(root.getTable("ARTICLE_DECLINAISON_COULEUR")); |
rowVals.put("NOM", couleur); |
mapCouleur.put(couleur, rowVals.commit().getID()); |
} |
if (!mapTaille.containsKey(taille)) { |
SQLRowValues rowVals = new SQLRowValues(root.getTable("ARTICLE_DECLINAISON_TAILLE")); |
rowVals.put("NOM", taille); |
mapTaille.put(taille, rowVals.commit().getID()); |
} |
Tuple2<SQLRowValues, SQLRowValues> t; |
if ((couleur == null || couleur.trim().length() == 0) && (taille == null || taille.trim().length() == 0)) { |
t = mapArticle.get(code); |
if (t.get1() == null) { |
t = Tuple2.create(t.get0(), ProductComponent.findOrCreateStock(t.get0(), depot).asRowValues()); |
mapArticle.put(code, t); |
} |
} else if (couleur == null || couleur.trim().length() == 0) { |
t = mapDeclArticle.get(Tuple3.create(code, null, taille.trim())); |
if (t == null) { |
SQLRowValues artRow = cloneFromArticle(mapArticleVirtuel.get(code).get0(), null, mapTaille.get(taille.trim())).asRowValues(); |
final SQLRowValues stockRow = ProductComponent.findOrCreateStock(artRow, depot).asRowValues(); |
t = Tuple2.create(artRow, stockRow); |
mapDeclArticle.put(Tuple3.create(code, null, taille.trim()), t); |
} else if (t.get1() == null) { |
t = Tuple2.create(t.get0(), ProductComponent.findOrCreateStock(t.get0(), depot).asRowValues()); |
mapDeclArticle.put(Tuple3.create(code, null, taille.trim()), t); |
} |
} else if (taille == null || taille.trim().length() == 0) { |
t = mapDeclArticle.get(Tuple3.create(code, couleur.trim(), null)); |
if (t == null) { |
SQLRowValues artRow = cloneFromArticle(mapArticleVirtuel.get(code).get0(), mapCouleur.get(couleur.trim()), null).asRowValues(); |
final SQLRowValues stockRow = ProductComponent.findOrCreateStock(artRow, depot).asRowValues(); |
t = Tuple2.create(artRow, stockRow); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), null), t); |
} else if (t.get1() == null) { |
t = Tuple2.create(t.get0(), ProductComponent.findOrCreateStock(t.get0(), depot).asRowValues()); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), null), t); |
} |
} else { |
t = mapDeclArticle.get(Tuple3.create(code, couleur.trim(), taille.trim())); |
if (t == null) { |
if (mapArticle.get(code) != null) { |
SQLRowValues artRow = cloneFromArticle(mapArticleVirtuel.get(code).get0(), mapCouleur.get(couleur.trim()), mapTaille.get(taille.trim())).asRowValues(); |
final SQLRowValues stockRow = ProductComponent.findOrCreateStock(artRow, depot).asRowValues(); |
t = Tuple2.create(artRow, stockRow); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), taille.trim()), t); |
} |
} else if (t.get1() == null) { |
t = Tuple2.create(t.get0(), ProductComponent.findOrCreateStock(t.get0(), depot).asRowValues()); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), taille.trim()), t); |
} |
} |
return t; |
} |
public SQLRow cloneFromArticle(SQLRowAccessor rArt, Integer idCouleur, Integer idTaille) throws SQLException { |
if (rArt == null) { |
return null; |
} |
SQLRowValues copy = artElt.createCopy(rArt.getID()); |
copy.put("VIRTUEL", Boolean.FALSE); |
copy.put("ID_ARTICLE_VIRTUEL_PERE", rArt.getID()); |
if (idCouleur != null) { |
copy.put("ID_ARTICLE_DECLINAISON_COULEUR", idCouleur); |
} |
if (idTaille != null) { |
copy.put("ID_ARTICLE_DECLINAISON_TAILLE", idTaille); |
} |
return copy.commit(); |
} |
private String getColumnName(int columnNumber) { |
int dividend = columnNumber; |
String columnName = ""; |
int modulo; |
while (dividend >= 0) { |
modulo = dividend % 26; |
columnName = String.valueOf((char) (65 + modulo)) + columnName; |
dividend = (int) ((dividend - modulo) / 26); |
if (dividend <= 0) { |
break; |
} else { |
dividend--; |
} |
} |
return columnName; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/EtatStockSnapshotCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
38,11 → 38,13 |
private final Date d; |
private final DBRoot root; |
private final SQLRowAccessor depot; |
private final boolean withAllProducts; |
public EtatStockSnapshotCreator(SQLRowAccessor depot, Date d, DBRoot root) { |
public EtatStockSnapshotCreator(SQLRowAccessor depot, Date d, DBRoot root, boolean withAllProducts) { |
this.d = d; |
this.depot = depot; |
this.root = root; |
this.withAllProducts = withAllProducts; |
} |
public void create() { |
51,7 → 53,7 |
SQLSelect sel = new SQLSelect(); |
sel.addSelectStar(tableEtatStock); |
Where wEtat = new Where(tableEtatStock.getField("INVENTAIRE"), "=", Boolean.TRUE); |
wEtat = wEtat.and(new Where(tableEtatStock.getField("ID_DEPOT_STOCK"), "=", this.depot.getID())); |
wEtat = wEtat.and(new Where(tableEtatStock.getField("ID_DEPOT_STOCK"), "=", this.depot.getID())); |
sel.setWhere(wEtat); |
List<SQLRow> rowsEtatStock = SQLRowListRSH.execute(sel); |
Map<Integer, Integer> mapEtatStock = new HashMap<Integer, Integer>(); |
63,7 → 65,7 |
Where wMvt = new Where(tableMvtStock.getField("OUVERTURE"), "=", Boolean.TRUE); |
wMvt = wMvt.and(new Where(tableMvtStock.getField("ID_ETAT_STOCK"), "=", sqlRow.getID())); |
wMvt = wMvt.and(new Where(tableMvtStock.getField("ID_STOCK"), "=", tableStock.getKey())); |
wMvt = wMvt.and(new Where(tableStock.getField("ID_DEPOT_STOCK"), "=", depot.getID())); |
wMvt = wMvt.and(new Where(tableStock.getField("ID_DEPOT_STOCK"), "=", depot.getID())); |
selMvt.setWhere(wMvt); |
Integer idMvt = (Integer) tableMvtStock.getDBSystemRoot().getDataSource().executeScalar(selMvt.asString()); |
if (idMvt != null) { |
73,17 → 75,17 |
Map<Integer, EtatStock> mapStockSnap = new HashMap<Integer, EtatStock>(); |
{ |
final SQLTable tableStock = this.root.getTable("MOUVEMENT_STOCK"); |
final SQLTable tableMvtStock = this.root.getTable("MOUVEMENT_STOCK"); |
final SQLRowValues vals = new SQLRowValues(tableStock); |
final SQLRowValues vals = new SQLRowValues(tableMvtStock); |
vals.put("QTE", null); |
if (tableStock.contains("PRICE")) { |
if (tableMvtStock.contains("PRICE")) { |
vals.put("PRICE", null); |
} |
vals.put("ID_ARTICLE", null); |
vals.putRowValues("ID_STOCK").putNulls("QTE_REEL").putRowValues("ID_DEPOT_STOCK").putNulls("ID", "NOM", "CODE"); |
// Calendar cal0116 = Calendar.getInstance(); |
// cal0116.set(2016, Calendar.JANUARY, 1, 0, 0, 0); |
// final Date dateDeb = cal0116.getTime(); |
92,7 → 94,7 |
SQLSelect selEtatD = new SQLSelect(); |
selEtatD.addSelectStar(tableEtatStock); |
Where wEtatD = new Where(tableEtatStock.getField("INVENTAIRE"), "=", Boolean.TRUE); |
wEtatD = wEtatD.and(new Where(tableEtatStock.getField("ID_DEPOT_STOCK"), "=", this.depot.getID())); |
wEtatD = wEtatD.and(new Where(tableEtatStock.getField("ID_DEPOT_STOCK"), "=", this.depot.getID())); |
selEtatD.setWhere(wEtatD); |
List<SQLRow> rowsEtatStockD = SQLRowListRSH.execute(selEtatD); |
SQLRow rowEtatStockDeb = null; |
121,15 → 123,15 |
@Override |
public SQLSelect transformChecked(SQLSelect sel) { |
Where w = (new Where(tableStock.getField("DATE"), "<=", d)); |
Where w = (new Where(tableMvtStock.getField("DATE"), "<=", d)); |
if (dateDeb != null) { |
w = w.and(new Where(tableStock.getField("DATE"), ">=", dateDeb)); |
w = w.and(new Where(tableStock.getKey(), ">=", idMvtStockDeb)); |
w = w.and(new Where(tableStock.getField("CLOTURE"), "!=", Boolean.TRUE)); |
w = w.and(new Where(tableMvtStock.getField("DATE"), ">=", dateDeb)); |
w = w.and(new Where(tableMvtStock.getKey(), ">=", idMvtStockDeb)); |
w = w.and(new Where(tableMvtStock.getField("CLOTURE"), "!=", Boolean.TRUE)); |
} |
w = w.and(new Where(tableStock.getField("REEL"), "=", Boolean.TRUE)); |
w = w.and(new Where(sel.getJoin(tableStock.getField("ID_STOCK")).getJoinedTable().getField("ID_DEPOT_STOCK"), "=", depot.getID())); |
w = w.and(new Where(tableMvtStock.getField("REEL"), "=", Boolean.TRUE)); |
w = w.and(new Where(sel.getJoin(tableMvtStock.getField("ID_STOCK")).getJoinedTable().getField("ID_DEPOT_STOCK"), "=", depot.getID())); |
sel.setWhere(w); |
return sel; |
149,7 → 151,7 |
EtatStock et = mapStockSnap.get(foreignIDArt); |
et.setQte(et.getQte().add(new BigDecimal(rowVF.getFloat("QTE")))); |
BigDecimal bigDecimal = BigDecimal.ZERO; |
if (tableStock.contains("PRICE")) { |
if (tableMvtStock.contains("PRICE")) { |
bigDecimal = rowVF.getBigDecimal("PRICE"); |
} |
et.setPa(bigDecimal); |
157,6 → 159,58 |
} |
} |
// Ajout des articles sans mouvement de stock sur la période |
final SQLTable tableStock = tableMvtStock.getTable("STOCK"); |
final SQLRowValues valsStock = new SQLRowValues(tableStock); |
valsStock.putRowValues("ID_ARTICLE").putNulls("CODE", "NOM", "OBSOLETE"); |
valsStock.putNulls("QTE_REEL").putRowValues("ID_DEPOT_STOCK").putNulls("ID", "NOM", "CODE"); |
SQLRowValuesListFetcher fetcherStock = SQLRowValuesListFetcher.create(valsStock); |
SQLTable tableArt = tableStock.getForeignTable("ID_ARTICLE"); |
fetcherStock.addSelTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
Where w = new Where(tableStock.getField("ID_DEPOT_STOCK"), "=", depot.getID()); |
w = w.and(new Where(input.getAlias(tableArt).getField("OBSOLETE"), "=", Boolean.FALSE)); |
input.setWhere(w); |
System.err.println(input.asString()); |
return input; |
} |
}, 0); |
List<SQLRowValues> resultAllStock = fetcherStock.fetch(); |
for (SQLRowValues sqlRowValues : resultAllStock) { |
final int foreignIDArt = sqlRowValues.getForeignID("ID_ARTICLE"); |
if (!mapStockSnap.containsKey(foreignIDArt)) { |
mapStockSnap.put(foreignIDArt, new EtatStock(sqlRowValues.getForeign("ID_ARTICLE"))); |
} |
} |
if (this.withAllProducts) { |
// Ajout de tous les articles non obsoletes |
final SQLRowValues valsArt = new SQLRowValues(tableArt); |
valsArt.putNulls("CODE", "NOM", "OBSOLETE"); |
SQLRowValuesListFetcher fetcherArt = SQLRowValuesListFetcher.create(valsArt); |
fetcherArt.addSelTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
Where w = new Where(tableArt.getField("VIRTUEL"), "=", Boolean.FALSE); |
w = w.and(new Where(tableArt.getField("OBSOLETE"), "=", Boolean.FALSE)); |
input.setWhere(w); |
System.err.println(input.asString()); |
return input; |
} |
}, 0); |
List<SQLRowValues> resultArt = fetcherArt.fetch(); |
for (SQLRowValues sqlRowValues : resultArt) { |
final int idArt = sqlRowValues.getID(); |
if (!mapStockSnap.containsKey(idArt)) { |
mapStockSnap.put(idArt, new EtatStock(sqlRowValues)); |
} |
} |
} |
SQLRowValues rowVals = new SQLRowValues(tableEtatStock); |
rowVals.put("DATE", d); |
rowVals.put("MONTANT_HA", totalHT); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/EtatStockCreationPanel.java |
---|
New file |
0,0 → 1,87 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
/* |
* Créé le 23 avr. 2012 |
*/ |
package org.openconcerto.erp.core.supplychain.stock.element; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.sqlobject.SQLRequestComboBox; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.JDate; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.util.Date; |
import javax.swing.AbstractAction; |
import javax.swing.JButton; |
import javax.swing.JCheckBox; |
import javax.swing.JLabel; |
import javax.swing.JPanel; |
public class EtatStockCreationPanel extends JPanel { |
public EtatStockCreationPanel(final SQLElement depotElt) { |
super(new GridBagLayout()); |
final SQLRequestComboBox boxDepot = new SQLRequestComboBox(false); |
boxDepot.uiInit(depotElt.createComboRequest()); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
JLabel labelCom = new JLabel("Dépôt "); |
this.add(labelCom, c); |
c.gridx++; |
this.add(boxDepot, c); |
c.gridx++; |
JLabel labelD = new JLabel("au"); |
this.add(labelD, c); |
final JDate dateDebut = new JDate(true); |
c.gridx++; |
this.add(dateDebut, c); |
final JCheckBox box = new JCheckBox("intégrer uniquement les articles du dépôt"); |
box.setSelected(true); |
c.gridx++; |
this.add(box, c); |
final JButton buttonValid = new JButton(new AbstractAction("Valider") { |
@Override |
public void actionPerformed(ActionEvent e) { |
SQLRowAccessor row = boxDepot.getSelectedRow(); |
final SQLRowAccessor rowDepot; |
if (row != null && !row.isUndefined()) { |
rowDepot = boxDepot.getSelectedRow(); |
} else { |
rowDepot = depotElt.getTable().getRow(DepotStockSQLElement.DEFAULT_ID); |
} |
Date d = dateDebut.getDate() == null ? new Date() : dateDebut.getDate(); |
EtatStockSnapshotCreator creator = new EtatStockSnapshotCreator(rowDepot, d, depotElt.getTable().getDBRoot(), !box.isSelected()); |
creator.create(); |
} |
}); |
c.gridx++; |
// buttonValid.setEnabled(false); |
this.add(buttonValid, c); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/StockSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,6 → 13,7 |
package org.openconcerto.erp.core.supplychain.stock.element; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.ui.PanelFrame; |
import org.openconcerto.erp.core.sales.product.action.InventairePanel; |
20,24 → 21,30 |
import org.openconcerto.erp.model.MouseSheetXmlListeListener; |
import org.openconcerto.sql.element.BaseSQLComponent; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLInjector; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.users.rights.UserRightsManager; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.FrameUtil; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ListMap; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.math.BigDecimal; |
import java.sql.SQLException; |
import java.util.Arrays; |
import java.util.Collection; |
47,6 → 54,7 |
import javax.swing.AbstractAction; |
import javax.swing.JLabel; |
import javax.swing.JOptionPane; |
import javax.swing.JTextField; |
public class StockSQLElement extends ComptaSQLConfElement { |
53,19 → 61,33 |
public StockSQLElement() { |
super("STOCK", "un stock", "stocks"); |
getRowActions().addAll(new MouseSheetXmlListeListener(FicheArticleXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, FicheArticleXmlSheet.class).getRowActions()); |
PredicateRowAction stock = new PredicateRowAction(new AbstractAction("Mettre à jour les stocks") { |
@Override |
public void actionPerformed(ActionEvent e) { |
if (UserRightsManager.getCurrentUserRights().canAdd(getTable().getDBRoot().getTable("STOCK"))) { |
final PanelFrame p = new PanelFrame(new InventairePanel(IListe.get(e), IListe.get(e).getSelectedRows()), "Mise à jour des stocks"); |
FrameUtil.show(p); |
} else { |
JOptionPane.showMessageDialog(null, "Vous n'avez les droits suffisants pour modifier manuellement les stocks!"); |
} |
} |
}, true, false); |
stock.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(stock); |
PanelFrame p = new PanelFrame(new InventairePanel(IListe.get(e), IListe.get(e).getSelectedRows()), "Mise à jour des stocks"); |
FrameUtil.show(p); |
PredicateRowAction cmd = new PredicateRowAction(new AbstractAction("Passer une commande") { |
@Override |
public void actionPerformed(ActionEvent e) { |
transfertCommande(IListe.get(e).getSelectedRowAccessors()); |
} |
}, true, false); |
stock.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(stock); |
cmd.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(cmd); |
} |
protected List<String> getListFields() { |
128,7 → 150,7 |
return rowStock; |
} |
public static SQLRowAccessor getStock(SQLRowAccessor rowValsSource) { |
public static SQLRowAccessor getStock(SQLRowAccessor rowValsSource) throws SQLException { |
SQLRowAccessor rowStock = null; |
final int idDepot; |
144,30 → 166,32 |
} |
idDepot = rowValsArt.getForeignID("ID_DEPOT_STOCK"); |
} |
SQLTable stockTable = rowValsSource.getTable().getTable("STOCK"); |
final int idArticle = rowValsSource.getForeignID("ID_ARTICLE"); |
DBRoot root = rowValsSource.getTable().getDBRoot(); |
SQLTable stockTable = root.getTable("STOCK"); |
SQLRowValues putRowValuesStock = new SQLRowValues(stockTable); |
putRowValuesStock.putNulls(stockTable.getTable().getFieldsName()); |
SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(putRowValuesStock); |
Where w = new Where(putRowValuesStock.getTable().getField("ID_DEPOT_STOCK"), "=", idDepot); |
Where w2 = new Where(putRowValuesStock.getTable().getField("ID_ARTICLE"), "=", rowValsSource.getForeignID("ID_ARTICLE")); |
Where w = new Where(stockTable.getField("ID_DEPOT_STOCK"), "=", idDepot); |
Where w2 = new Where(stockTable.getField("ID_ARTICLE"), "=", idArticle); |
Collection<SQLRowValues> rowValsResult = fetch.fetch(w.and(w2)); |
if (rowValsResult.isEmpty()) { |
SQLRowValues rowValsStock = new SQLRowValues(stockTable); |
rowValsStock.put("ID_ARTICLE", rowValsSource.getForeignID("ID_ARTICLE")); |
rowValsStock.put("ID_ARTICLE", idArticle); |
rowValsStock.put("ID_DEPOT_STOCK", idDepot); |
rowValsStock.put("QTE_TH", 0F); |
rowValsStock.put("QTE_REEL", 0F); |
rowValsStock.put("QTE_RECEPT_ATTENTE", 0F); |
rowValsStock.put("QTE_LIV_ATTENTE", 0F); |
try { |
rowStock = rowValsStock.insert(); |
if (idDepot == DepotStockSQLElement.DEFAULT_ID) { |
rowValsSource.getForeign("ID_ARTICLE").createEmptyUpdateRow().put("ID_STOCK", rowStock.getID()).commit(); |
} |
} catch (SQLException e) { |
ExceptionHandler.handle("Erreur lors la création du stock!", e); |
rowStock = rowValsStock.insert(); |
if (idDepot == DepotStockSQLElement.DEFAULT_ID) { |
rowValsSource.getForeign("ID_ARTICLE").createEmptyUpdateRow().put("ID_STOCK", rowStock.getID()).commit(); |
} |
} else if (rowValsResult.size() == 1) { |
rowStock = rowValsResult.iterator().next(); |
} else if (rowValsResult.size() > 1) { |
176,6 → 200,44 |
return rowStock; |
} |
/** |
* Stock d'un article dans un dépôt donné |
* |
* @param idDepot dépôt |
* @param idArticle article |
* @param createIfMissing initialisation du stock à 0 si n'existe pas |
* @return le stock (null si createIfMissing à false et que que le stock n'existe pas) |
*/ |
public SQLRow getStock(int idDepot, int idArticle, boolean createIfMissing) throws SQLException { |
final SQLTable stockTable = getTable(); |
final SQLRowValues putRowValuesStock = new SQLRowValues(stockTable); |
putRowValuesStock.putNulls(stockTable.getFieldsName()); |
final SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(putRowValuesStock); |
final Where w = new Where(stockTable.getField("ID_DEPOT_STOCK"), "=", idDepot); |
final Where w2 = new Where(stockTable.getField("ID_ARTICLE"), "=", idArticle); |
final Collection<SQLRowValues> rowValsResult = fetch.fetch(w.and(w2)); |
SQLRow result; |
if (rowValsResult.isEmpty()) { |
if (!createIfMissing) { |
return null; |
} |
final SQLRowValues rowValsStock = new SQLRowValues(stockTable); |
rowValsStock.put("ID_ARTICLE", idArticle); |
rowValsStock.put("ID_DEPOT_STOCK", idDepot); |
rowValsStock.put("QTE_TH", 0F); |
rowValsStock.put("QTE_REEL", 0F); |
rowValsStock.put("QTE_RECEPT_ATTENTE", 0F); |
rowValsStock.put("QTE_LIV_ATTENTE", 0F); |
result = rowValsStock.insert(); |
} else if (rowValsResult.size() == 1) { |
result = rowValsResult.iterator().next().asRow(); |
} else { |
throw new IllegalStateException("2 lignes de stocks pour le même dépôt! Article " + idArticle + " Depot " + idDepot); |
} |
return result; |
} |
/* |
* (non-Javadoc) |
* |
271,6 → 333,62 |
}; |
} |
/** |
* Transfert d'une commande en commande fournisseur |
* |
* @param commandeID |
*/ |
public void transfertCommande(List<SQLRowAccessor> rows) { |
ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() { |
@Override |
public void run() { |
SQLTable tableCmdElt = getDirectory().getElement("COMMANDE_ELEMENT").getTable(); |
SQLElement eltArticle = getDirectory().getElement("ARTICLE"); |
final ListMap<SQLRow, SQLRowValues> map = new ListMap<SQLRow, SQLRowValues>(); |
for (SQLRowAccessor sqlRow : rows) { |
SQLRowAccessor rowArticleFind = sqlRow.getForeign("ID_ARTICLE"); |
int qte = 1; |
BigDecimal qteUV = BigDecimal.ONE; |
qte = -Math.round(sqlRow.getFloat("QTE_TH") - sqlRow.getFloat("QTE_MIN")); |
SQLInjector inj = SQLInjector.getInjector(eltArticle.getTable(), tableCmdElt); |
SQLRowValues rowValsElt = new SQLRowValues(inj.createRowValuesFrom(rowArticleFind.asRow())); |
rowValsElt.put("ID_DEPOT_STOCK", sqlRow.getForeignID("ID_DEPOT_STOCK")); |
rowValsElt.put("QTE", qte); |
rowValsElt.put("QTE_UNITAIRE", qteUV); |
rowValsElt.put("T_POIDS", rowValsElt.getLong("POIDS") * rowValsElt.getInt("QTE")); |
// TODO récupérer le prix depuis les tarifs d'achat |
rowValsElt.put("T_PA_HT", ((BigDecimal) rowValsElt.getObject("PA_HT")).multiply(new BigDecimal(rowValsElt.getInt("QTE")), DecimalUtils.HIGH_PRECISION)); |
rowValsElt.put("T_PA_TTC", |
((BigDecimal) rowValsElt.getObject("T_PA_HT")).multiply(new BigDecimal((rowValsElt.getForeign("ID_TAXE").getFloat("TAUX") / 100.0 + 1.0)), DecimalUtils.HIGH_PRECISION)); |
final SQLRow fournisseur = rowArticleFind.asRow().getForeignRow("ID_FOURNISSEUR"); |
if (fournisseur != null && !fournisseur.isUndefined() && !rowArticleFind.isUndefined()) { |
SQLRowValues rowValsCode = new SQLRowValues(tableCmdElt.getForeignTable("ID_CODE_FOURNISSEUR")); |
rowValsCode.putNulls("ID"); |
final Where w = new Where(rowValsCode.getTable().getField("ID_ARTICLE"), "=", rowArticleFind.getID()) |
.and(new Where(rowValsCode.getTable().getField("ID_FOURNISSEUR"), "=", fournisseur.getID())); |
final List<SQLRowValues> fetch = SQLRowValuesListFetcher.create(rowValsCode).fetch(w); |
for (SQLRowValues sqlRowAccessor : fetch) { |
rowValsElt.put("ID_CODE_FOURNISSEUR", sqlRowAccessor.getID()); |
} |
} |
map.add(fournisseur, rowValsElt); |
} |
MouvementStockSQLElement.createCommandeF(map, null, ""); |
} |
}); |
} |
@Override |
protected String createCode() { |
return "supplychain.stock"; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/MouvementStockSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,8 → 17,10 |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.model.ProductComponent; |
import org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent; |
import org.openconcerto.erp.core.supplychain.order.ui.CommandeItemTable; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItem.TypeStockMouvement; |
import org.openconcerto.erp.core.supplychain.supplier.component.MouvementStockSQLComponent; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
26,10 → 28,14 |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.element.TreesOfSQLRows; |
import org.openconcerto.sql.model.ConnectionHandlerNoSetup; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLBackgroundTableCache; |
import org.openconcerto.sql.model.SQLBase; |
import org.openconcerto.sql.model.SQLDataSource; |
import org.openconcerto.sql.model.SQLInjector; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowListRSH; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLSelect; |
38,17 → 44,22 |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.ListSQLRequest; |
import org.openconcerto.sql.users.UserManager; |
import org.openconcerto.sql.utils.SQLUtils; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.EditPanel; |
import org.openconcerto.sql.view.EditPanel.EditMode; |
import org.openconcerto.sql.view.list.RowValuesTableModel; |
import org.openconcerto.ui.FrameUtil; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.ListMap; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.sql.SQLException; |
import java.text.SimpleDateFormat; |
import java.util.ArrayList; |
import java.util.Collection; |
import java.util.Date; |
import java.util.List; |
import java.util.Map.Entry; |
55,6 → 66,8 |
import javax.swing.JOptionPane; |
import javax.swing.SwingUtilities; |
import org.apache.commons.dbutils.ResultSetHandler; |
public class MouvementStockSQLElement extends ComptaSQLConfElement { |
public MouvementStockSQLElement() { |
119,9 → 132,16 |
// QTE_RECEPT_ATTENTE |
final ListMap<SQLRow, SQLRowValues> map = new ListMap<>(); |
final SQLTable tableCommandeElement = Configuration.getInstance().getBase().getTable("COMMANDE_ELEMENT"); |
final SQLElement elementStock = Configuration.getInstance().getDirectory().getElement("STOCK"); |
if (rowsMvt == null || rowsMvt.isEmpty()) { |
return map; |
} |
final DBRoot root = rowsMvt.iterator().next().getTable().getDBRoot(); |
final SQLTable tableCommandeElement = root.getTable("COMMANDE_ELEMENT"); |
final SQLTable tableStock = root.getTable("STOCK"); |
for (SQLRow rowMvtStock : rowsMvt) { |
boolean retour = rowMvtStock.getString("SOURCE") == null || rowMvtStock.getString("SOURCE").startsWith("AVOIR_CLIENT"); |
138,7 → 158,7 |
float qte = rowStock.getFloat("QTE_REEL"); |
float qteMvt = rowMvtStock.getFloat("QTE"); |
SQLRowValues rowVals = new SQLRowValues(elementStock.getTable()); |
SQLRowValues rowVals = new SQLRowValues(tableStock); |
float qteNvlle; |
float qteNvlleEnAttenteRecept = rowStock.getFloat("QTE_RECEPT_ATTENTE"); |
173,7 → 193,7 |
try { |
rowVals.update(rowStock.getID()); |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
SQLPreferences prefs = new SQLPreferences(root); |
boolean gestionStockMin = prefs.getBoolean(GestionArticleGlobalPreferencePanel.WARNING_STOCK_MIN, true); |
if (!archive && gestionStockMin && rowStock.getObject("QTE_MIN") != null && qteNvlle < rowStock.getFloat("QTE_MIN")) { |
203,7 → 223,7 |
float qte = rowStock.getFloat("QTE_TH"); |
float qteMvt = rowMvtStock.getFloat("QTE"); |
SQLRowValues rowVals = new SQLRowValues(elementStock.getTable()); |
SQLRowValues rowVals = new SQLRowValues(tableStock); |
float qteNvlle; |
float qteNvlleEnAttenteRecept = rowStock.getFloat("QTE_RECEPT_ATTENTE"); |
321,10 → 341,14 |
for (int i = 0; i < model.getRowCount(); i++) { |
final SQLRowValues rowValsCmdElt = model.getRowValuesAt(i); |
if (ReferenceArticleSQLElement.isReferenceEquals(rowValsCmdElt, rowValsElt)) { |
rowValsMatch = rowValsCmdElt; |
index = i; |
break; |
Number lineArticleNumber = rowValsCmdElt.contains("ID_ARTICLE") ? rowValsCmdElt.getNonEmptyForeignIDNumber("ID_ARTICLE") : null; |
Number lineToAddArticleNumber = rowValsElt.contains("ID_ARTICLE") ? rowValsElt.getNonEmptyForeignIDNumber("ID_ARTICLE") : null; |
if (lineToAddArticleNumber == null || lineArticleNumber == null || lineArticleNumber.equals(lineToAddArticleNumber)) { |
if (ReferenceArticleSQLElement.isReferenceEquals(rowValsCmdElt, rowValsElt)) { |
rowValsMatch = rowValsCmdElt; |
index = i; |
break; |
} |
} |
} |
if (rowValsMatch != null) { |
411,6 → 435,99 |
} |
} |
public void transfertStock(BigDecimal qteReel, final Date dateValue, final SQLRow selectedRowArticle, final SQLRow selectedRowDepotDepart, final SQLRow selectedRowDepotArrivee, |
final String labelTrStock) { |
final boolean usePrice = getTable().contains("PRICE"); |
try { |
SQLUtils.executeAtomic(selectedRowDepotDepart.getTable().getDBSystemRoot().getDataSource(), new ConnectionHandlerNoSetup<Object, SQLException>() { |
@Override |
public Object handle(SQLDataSource ds) throws SQLException { |
List<StockItem> stockItems = new ArrayList<StockItem>(); |
List<String> multipleRequestsHundred = new ArrayList<String>(100); |
{ |
// DEPART |
final SQLRowAccessor rowStockDepart = ProductComponent.findOrCreateStock(selectedRowArticle, selectedRowDepotDepart); |
StockItem item = new StockItem(selectedRowArticle, rowStockDepart); |
if (!item.isStockInit()) { |
SQLRowValues rowVals = new SQLRowValues(getTable().getTable("STOCK")); |
rowVals.put("ID_ARTICLE", selectedRowArticle.getID()); |
rowVals.put("ID_DEPOT_STOCK", selectedRowDepotDepart.getID()); |
rowVals.commit(); |
selectedRowArticle.fetchValues(); |
item = new StockItem(selectedRowArticle, rowStockDepart); |
} |
stockItems.add(item); |
double diff = -qteReel.doubleValue(); |
item.updateQty(diff, TypeStockMouvement.REEL); |
multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(labelTrStock, selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice)); |
item.updateQty(diff, TypeStockMouvement.THEORIQUE); |
multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(labelTrStock, selectedRowDepotDepart, selectedRowDepotArrivee), false, usePrice)); |
multipleRequestsHundred.add(item.getUpdateRequest()); |
} |
// ARRIVEE |
{ |
final SQLRowAccessor rowStockArrivee = ProductComponent.findOrCreateStock(selectedRowArticle, selectedRowDepotArrivee); |
StockItem item = new StockItem(selectedRowArticle, rowStockArrivee); |
if (!item.isStockInit()) { |
SQLRowValues rowVals = new SQLRowValues(getTable().getTable("STOCK")); |
rowVals.put("ID_ARTICLE", selectedRowArticle.getID()); |
rowVals.put("ID_DEPOT_STOCK", selectedRowDepotArrivee.getID()); |
rowVals.commit(); |
selectedRowArticle.fetchValues(); |
item = new StockItem(selectedRowArticle, rowStockArrivee); |
} |
stockItems.add(item); |
double diff = qteReel.doubleValue(); |
item.updateQty(diff, TypeStockMouvement.REEL); |
multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(labelTrStock, selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice)); |
item.updateQty(diff, TypeStockMouvement.THEORIQUE); |
multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(labelTrStock, selectedRowDepotDepart, selectedRowDepotArrivee), false, usePrice)); |
multipleRequestsHundred.add(item.getUpdateRequest()); |
} |
final int size = multipleRequestsHundred.size(); |
List<? extends ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(size); |
for (int i = 0; i < size; i++) { |
handlers.add(null); |
} |
SQLUtils.executeMultiple(selectedRowArticle.getTable().getDBSystemRoot(), multipleRequestsHundred, handlers); |
final DBRoot root = getTable().getDBRoot(); |
if (root.contains("ARTICLE_ELEMENT")) { |
// Mise à jour des stocks des nomenclatures |
ComposedItemStockUpdater comp = new ComposedItemStockUpdater(root, stockItems); |
comp.update(); |
} |
return null; |
} |
}); |
} catch (SQLException e1) { |
ExceptionHandler.handle("Stock update error", e1); |
} |
} |
private String getLabel(String label, SQLRowAccessor fromDepot, SQLRowAccessor toDepot) { |
return label + " de " + fromDepot.getString("NOM") + " vers " + toDepot.getString("NOM"); |
} |
private String getMvtRequest(Date time, BigDecimal prc, double qteFinal, StockItem item, String label, boolean reel, boolean usePrice) { |
String mvtStockTableQuoted = getTable().getSQLName().quote(); |
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
String mvtStockQuery = "INSERT INTO " + mvtStockTableQuoted + " (\"QTE\",\"DATE\",\"ID_ARTICLE\",\"ID_STOCK\",\"NOM\",\"REEL\",\"ORDRE\""; |
if (usePrice && prc != null) { |
mvtStockQuery += ",\"PRICE\""; |
} |
mvtStockQuery += ") VALUES(" + qteFinal + ",'" + dateFormat.format(time) + "'," + item.getArticle().getID() + "," + item.stock.getID() + ",'" + label + "'," + reel |
+ ", (SELECT (MAX(\"ORDRE\")+1) FROM " + mvtStockTableQuoted + ")"; |
if (usePrice && prc != null) { |
mvtStockQuery += "," + prc.setScale(6, RoundingMode.HALF_UP).toString(); |
} |
mvtStockQuery += ")"; |
return mvtStockQuery; |
} |
@Override |
protected String createCode() { |
return createCodeOfPackage() + ".transaction"; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/ImportInventairePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
92,7 → 92,8 |
@Override |
public void run() { |
final InventaireFromEtatStockImporter impoter = new InventaireFromEtatStockImporter(rowDepot); |
// FIXME ajouter une barre de progression |
final InventaireFromEtatStockImporter impoter = new InventaireFromEtatStockImporter(depotElt.getDirectory().getElement("ARTICLE"), rowDepot); |
try { |
SQLUtils.executeAtomic(depotElt.getTable().getDBSystemRoot().getDataSource(), new ConnectionHandlerNoSetup<Object, IOException>() { |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/EtatStockFromInventoryFileCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
16,11 → 16,19 |
import org.openconcerto.erp.core.sales.product.model.PriceByQty; |
import org.openconcerto.erp.importer.ArrayTableModel; |
import org.openconcerto.erp.importer.DataImporter; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowListRSH; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.utils.Tuple3; |
import java.io.File; |
import java.io.IOException; |
27,6 → 35,7 |
import java.math.BigDecimal; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Calendar; |
import java.util.Collection; |
import java.util.Date; |
33,8 → 42,11 |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
import java.util.Map.Entry; |
import java.util.Set; |
import javax.swing.JOptionPane; |
public class EtatStockFromInventoryFileCreator { |
// Map<String, SQLRowValues> kits = new HashMap<String, SQLRowValues>(); |
41,62 → 53,165 |
// List<String> codeKits = new ArrayList<String>(); |
// List<SQLRowValues> rowValsArtNonSync = new ArrayList<SQLRowValues>(); |
private static String FAMILLE = "Famille"; |
private static String CODE = "Code"; |
private static String NOM = "Nom"; |
private static String TAILLE = "Taille"; |
private static String COULEUR = "Couleur"; |
private static String QTE = "Qté réelle relevée"; |
private final Map<String, Integer> mapCouleur = new HashMap<String, Integer>(); |
private final Map<String, Integer> mapTaille = new HashMap<String, Integer>(); |
private final DBRoot root; |
private final SQLElement artElt; |
public EtatStockFromInventoryFileCreator(SQLElement artElt) { |
this.artElt = artElt; |
this.root = artElt.getTable().getDBRoot(); |
} |
public void importArticles(File file, Date d) throws IOException, SQLException { |
final SQLTable table = Configuration.getInstance().getRoot().findTable("ARTICLE"); |
Map<String, SQLRowValues> articles = getArticles(); |
final SQLTable table = this.root.findTable("ARTICLE"); |
final DataImporter importer = new DataImporter(table) { |
@Override |
protected void customizeRowValuesToFetch(SQLRowValues vals) { |
{ |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(table.getDBRoot().getTable("ARTICLE_DECLINAISON_COULEUR").getKey()); |
sel.addSelect(table.getDBRoot().getTable("ARTICLE_DECLINAISON_COULEUR").getField("NOM")); |
vals.putRowValues("ID_STOCK").putNulls("ID", "QTE_REEL", "QTE_TH"); |
List<SQLRow> l = SQLRowListRSH.execute(sel); |
for (SQLRow sqlRow : l) { |
mapCouleur.put(sqlRow.getString("NOM").trim(), sqlRow.getID()); |
} |
}; |
importer.setSkipFirstLine(true); |
} |
ArrayTableModel m = importer.createModelFrom(file); |
{ |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(table.getDBRoot().getTable("ARTICLE_DECLINAISON_TAILLE").getKey()); |
sel.addSelect(table.getDBRoot().getTable("ARTICLE_DECLINAISON_TAILLE").getField("NOM")); |
SQLRowValues rowValsEtatStock = new SQLRowValues(table.getTable("ETAT_STOCK")); |
rowValsEtatStock.put("DATE", d); |
SQLRow etatStock = rowValsEtatStock.commit(); |
BigDecimal total = BigDecimal.ZERO; |
for (int i = 0; i < m.getRowCount(); i++) { |
List<Object> o = m.getLineValuesAt(i); |
String code = o.get(0).toString(); |
if (code.trim().length() == 0) { |
break; |
List<SQLRow> l = SQLRowListRSH.execute(sel); |
for (SQLRow sqlRow : l) { |
mapTaille.put(sqlRow.getString("NOM").trim(), sqlRow.getID()); |
} |
final String stringQty = o.get(3).toString(); |
Integer qty = stringQty.trim().length() == 0 ? 0 : Integer.valueOf(stringQty); |
} |
SQLRowValues match = articles.get(code); |
if (match != null) { |
fillArticles(); |
SQLRowValues stockValues = new SQLRowValues(table.getTable("ETAT_STOCK_ELEMENT")); |
Map<String, Integer> columnMapping = new HashMap<String, Integer>(); |
columnMapping.put(CODE, null); |
columnMapping.put(NOM, null); |
columnMapping.put(TAILLE, null); |
columnMapping.put(FAMILLE, null); |
columnMapping.put(COULEUR, null); |
columnMapping.put(QTE, null); |
{ |
// Searching column index from column Header |
final DataImporter importer = new DataImporter(table); |
importer.setSkipFirstLine(false); |
ArrayTableModel m = importer.createModelFrom(file); |
List<Object> line = m.getLineValuesAt(0); |
for (int i = 0; i < line.size(); i++) { |
Object object = line.get(i); |
if (object != null) { |
for (String key : columnMapping.keySet()) { |
if (object.toString().equalsIgnoreCase(key)) { |
columnMapping.put(key, i); |
} |
} |
} |
} |
} |
final BigDecimal qtyB = new BigDecimal(qty); |
stockValues.put("QTE", qtyB); |
stockValues.put("NOM", match.getString("NOM")); |
stockValues.put("CODE", match.getString("CODE")); |
stockValues.put("ID_ARTICLE", match.getID()); |
final BigDecimal prc = getPRC(match, qty, d); |
stockValues.put("PA", prc); |
final BigDecimal totalElt = prc.multiply(qtyB); |
stockValues.put("T_PA", totalElt); |
stockValues.put("ID_ETAT_STOCK", etatStock.getID()); |
stockValues.commit(); |
String msg = "Colonnes importées : \n"; |
final SQLPreferences prefs = SQLPreferences.getMemCached(table.getDBRoot()); |
final boolean hasDeclinaison = prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVER_DECLINAISON, false); |
List<String> required; |
if (hasDeclinaison) { |
required = Arrays.asList(CODE, QTE, TAILLE, COULEUR); |
} else { |
required = Arrays.asList(CODE, QTE); |
} |
total = total.add(totalElt); |
for (Entry<String, Integer> e : columnMapping.entrySet()) { |
if (e.getValue() != null) { |
msg += e.getKey() + " : " + getColumnName(e.getValue()) + "\n"; |
} else { |
System.err.println("Aucun article correspondant au code " + code); |
if (required.contains(e.getKey())) { |
JOptionPane.showMessageDialog(null, "Aucune colonne " + e.getKey() + " trouvée, import annulé!\nCette colonne est obligatoire."); |
return; |
} |
msg += e.getKey() + " : non importée\n"; |
} |
} |
etatStock.createEmptyUpdateRow().put("MONTANT_HA", total).commit(); |
msg += "\nVoulez vous continuer ?"; |
int a = JOptionPane.showConfirmDialog(null, msg); |
if (a == JOptionPane.YES_OPTION) { |
final DataImporter importer = new DataImporter(table) { |
@Override |
protected void customizeRowValuesToFetch(SQLRowValues vals) { |
vals.putRowValues("ID_STOCK").putNulls("ID", "QTE_REEL", "QTE_TH"); |
} |
}; |
importer.setSkipFirstLine(true); |
ArrayTableModel m = importer.createModelFrom(file); |
SQLRowValues rowValsEtatStock = new SQLRowValues(table.getTable("ETAT_STOCK")); |
rowValsEtatStock.put("DATE", d); |
SQLRow etatStock = rowValsEtatStock.commit(); |
BigDecimal total = BigDecimal.ZERO; |
for (int i = 0; i < m.getRowCount(); i++) { |
List<Object> o = m.getLineValuesAt(i); |
String code = o.get(columnMapping.get(CODE)).toString(); |
if (code.trim().length() == 0) { |
break; |
} |
final String stringQty = o.get(columnMapping.get(QTE)).toString(); |
Integer qty = stringQty.trim().length() == 0 ? 0 : Integer.valueOf(stringQty); |
String couleur = ""; |
if (columnMapping.get(COULEUR) != null) { |
couleur = o.get(columnMapping.get(COULEUR)).toString(); |
} |
String taille = ""; |
if (columnMapping.get(TAILLE) != null) { |
taille = o.get(columnMapping.get(TAILLE)).toString(); |
} |
SQLRowAccessor match = findArticle(code, couleur, taille); |
if (match != null) { |
SQLRowValues stockValues = new SQLRowValues(table.getTable("ETAT_STOCK_ELEMENT")); |
final BigDecimal qtyB = new BigDecimal(qty); |
stockValues.put("QTE", qtyB); |
stockValues.put("NOM", match.getString("NOM")); |
stockValues.put("CODE", match.getString("CODE")); |
stockValues.put("ID_ARTICLE", match.getID()); |
final BigDecimal prc = getPRC(match, qty, d); |
stockValues.put("PA", prc); |
final BigDecimal totalElt = prc.multiply(qtyB); |
stockValues.put("T_PA", totalElt); |
stockValues.put("ID_ETAT_STOCK", etatStock.getID()); |
stockValues.commit(); |
total = total.add(totalElt); |
} else { |
System.err.println("Aucun article correspondant au code " + code); |
} |
} |
etatStock.createEmptyUpdateRow().put("MONTANT_HA", total).commit(); |
} |
} |
public BigDecimal getPRC(SQLRowValues rowVals, int qty, Date d) { |
public BigDecimal getPRC(SQLRowAccessor rowVals, int qty, Date d) { |
if (rowVals.getTable().getDBRoot().contains("ARTICLE_PRIX_REVIENT")) { |
SQLTable table = rowVals.getTable().getDBRoot().getTable("ARTICLE_PRIX_REVIENT"); |
Collection<SQLRow> prcs = rowVals.asRow().getReferentRows(table); |
126,7 → 241,10 |
} |
} |
private Map<String, SQLRowValues> getArticles() throws SQLException { |
private final Map<String, SQLRowAccessor> mapArticle = new HashMap<String, SQLRowAccessor>(); |
private final Map<Tuple3<String, String, String>, SQLRowAccessor> mapDeclArticle = new HashMap<Tuple3<String, String, String>, SQLRowAccessor>(); |
private void fillArticles() throws SQLException { |
final SQLTable table = Configuration.getInstance().getRoot().findTable("ARTICLE"); |
SQLRowValues graph = new SQLRowValues(table); |
graph.put("ID", null); |
135,6 → 253,8 |
graph.put("NOM", null); |
graph.put("PA_HT", null); |
graph.putRowValues("ID_STOCK").putNulls("ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
graph.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("ID", "NOM"); |
graph.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("ID", "NOM"); |
final SQLTable tableArtElt = table.getTable("ARTICLE_ELEMENT"); |
SQLRowValues artElt = new SQLRowValues(tableArtElt); |
142,24 → 262,110 |
artElt.put("QTE", null); |
artElt.put("QTE_UNITAIRE", null); |
artElt.put("ID_ARTICLE_PARENT", graph); |
artElt.putRowValues("ID_ARTICLE").putNulls("ID", "CODE", "NOM").putRowValues("ID_STOCK").putNulls("QTE_TH", "QTE_REEL", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
final SQLRowValues putRowValues = artElt.putRowValues("ID_ARTICLE"); |
putRowValues.putNulls("ID", "CODE", "NOM").putRowValues("ID_STOCK").putNulls("QTE_TH", "QTE_REEL", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
putRowValues.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("ID", "NOM"); |
putRowValues.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("ID", "NOM"); |
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(graph); |
List<SQLRowValues> results = fetcher.fetch(); |
Map<String, SQLRowValues> vals = new HashMap<String, SQLRowValues>(); |
for (SQLRowValues sqlRowValues : results) { |
final Set<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT")); |
// On ne prend que les articles simples |
if (referentRows.size() == 0) { |
final String code = sqlRowValues.getString("CODE"); |
vals.put(code, sqlRowValues); |
final SQLRowAccessor couleur = sqlRowValues.getObject("ID_ARTICLE_DECLINAISON_COULEUR") == null ? null : sqlRowValues.getNonEmptyForeign("ID_ARTICLE_DECLINAISON_COULEUR"); |
final SQLRowAccessor taille = sqlRowValues.getObject("ID_ARTICLE_DECLINAISON_TAILLE") == null ? null : sqlRowValues.getNonEmptyForeign("ID_ARTICLE_DECLINAISON_TAILLE"); |
if (couleur == null && taille == null) { |
mapArticle.put(sqlRowValues.getString("CODE"), sqlRowValues); |
} else if (couleur == null) { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), null, taille.getString("NOM")), sqlRowValues); |
} else if (taille == null) { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), couleur.getString("NOM"), null), sqlRowValues); |
} else { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), couleur.getString("NOM"), taille.getString("NOM")), sqlRowValues); |
} |
} else { |
} |
} |
return vals; |
} |
private SQLRowAccessor findArticle(String code, String couleur, String taille) throws SQLException { |
if (!mapCouleur.containsKey(couleur)) { |
SQLRowValues rowVals = new SQLRowValues(root.getTable("ARTICLE_DECLINAISON_COULEUR")); |
rowVals.put("NOM", couleur); |
mapCouleur.put(couleur, rowVals.commit().getID()); |
} |
if (!mapTaille.containsKey(taille)) { |
SQLRowValues rowVals = new SQLRowValues(root.getTable("ARTICLE_DECLINAISON_TAILLE")); |
rowVals.put("NOM", taille); |
mapTaille.put(taille, rowVals.commit().getID()); |
} |
SQLRowAccessor sqlRowAccessor; |
if ((couleur == null || couleur.trim().length() == 0) && (taille == null || taille.trim().length() == 0)) { |
sqlRowAccessor = mapArticle.get(code); |
} else if (couleur == null || couleur.trim().length() == 0) { |
sqlRowAccessor = mapDeclArticle.get(Tuple3.create(code, null, taille.trim())); |
if (sqlRowAccessor == null) { |
sqlRowAccessor = cloneFromArticle(mapArticle.get(code), null, mapTaille.get(taille.trim())); |
mapDeclArticle.put(Tuple3.create(code, null, taille.trim()), sqlRowAccessor); |
} |
} else if (taille == null || taille.trim().length() == 0) { |
sqlRowAccessor = mapDeclArticle.get(Tuple3.create(code, couleur.trim(), null)); |
if (sqlRowAccessor == null) { |
sqlRowAccessor = cloneFromArticle(mapArticle.get(code), mapCouleur.get(couleur.trim()), null); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), null), sqlRowAccessor); |
} |
} else { |
sqlRowAccessor = mapDeclArticle.get(Tuple3.create(code, couleur.trim(), taille.trim())); |
if (sqlRowAccessor == null) { |
if (mapArticle.get(code) != null) { |
sqlRowAccessor = cloneFromArticle(mapArticle.get(code), |
mapCouleur.get(couleur.trim()), mapTaille.get(taille.trim())); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), taille.trim()), sqlRowAccessor); |
} |
} |
} |
return sqlRowAccessor; |
} |
public SQLRow cloneFromArticle(SQLRowAccessor rArt, Integer idCouleur, Integer idTaille) throws SQLException { |
if (rArt == null) { |
return null; |
} |
SQLRowValues copy = artElt.createCopy(rArt.getID()); |
if (idCouleur != null) { |
copy.put("ID_ARTICLE_DECLINAISON_COULEUR", idCouleur); |
} |
if (idTaille != null) { |
copy.put("ID_ARTICLE_DECLINAISON_TAILLE", idTaille); |
} |
return copy.commit(); |
} |
private String getColumnName(int columnNumber) { |
int dividend = columnNumber; |
String columnName = ""; |
int modulo; |
while (dividend >= 0) { |
modulo = dividend % 26; |
columnName = String.valueOf((char) (65 + modulo)) + columnName; |
dividend = (int) ((dividend - modulo) / 26); |
if (dividend <= 0) { |
break; |
} else { |
dividend--; |
} |
} |
return columnName; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/action/ListeDesMouvementsStockAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,8 → 18,13 |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel; |
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.view.IListFrame; |
import org.openconcerto.sql.view.list.SQLTableModelSource; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.utils.cc.ITransformer; |
import java.awt.GridBagConstraints; |
import java.awt.event.ActionEvent; |
32,14 → 37,40 |
public class ListeDesMouvementsStockAction extends CreateIListFrameAbstractAction<MouvementStockSQLElement> { |
private final SQLRowAccessor rowArtFilter; |
public ListeDesMouvementsStockAction(final ComptaPropsConfiguration conf) { |
this(conf, null); |
} |
public ListeDesMouvementsStockAction(final ComptaPropsConfiguration conf, SQLRowAccessor rowArticleFilter) { |
super(conf, MouvementStockSQLElement.class); |
this.rowArtFilter = rowArticleFilter; |
} |
protected SQLTableModelSource createTableSource() { |
SQLTableModelSource source = this.getElem().createTableSource(); |
if (this.rowArtFilter != null && !this.rowArtFilter.isUndefined()) { |
source.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
input.setWhere(new Where(input.getTable("MOUVEMENT_STOCK").getField("ID_ARTICLE"), "=", ListeDesMouvementsStockAction.this.rowArtFilter.getID())); |
return input; |
} |
}); |
} |
return source; |
} |
@Override |
protected void initFrame(IListFrame frame) { |
super.initFrame(frame); |
if (this.rowArtFilter != null && !this.rowArtFilter.isUndefined()) { |
frame.setTextTitle("Mouvements de stocks, article " + this.rowArtFilter.getString("CODE") + " " + this.rowArtFilter.getString("NOM")); |
} |
final SQLElement element = getElem(); |
JTable table = frame.getPanel().getListe().getJTable(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/action/ListeDesStocksAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
16,8 → 16,7 |
import org.openconcerto.erp.action.CreateFrameAbstractAction; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.ui.IListTotalPanel; |
import org.openconcerto.erp.core.common.ui.ListeViewPanel; |
import org.openconcerto.erp.core.common.ui.PanelFrame; |
import org.openconcerto.erp.rights.DepotStockViewRightEditor; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.FieldPath; |
28,6 → 27,7 |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.model.graph.Path; |
import org.openconcerto.sql.users.rights.UserRightsManager; |
import org.openconcerto.sql.view.ListeAddPanel; |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn; |
import org.openconcerto.sql.view.list.IListe; |
34,6 → 34,7 |
import org.openconcerto.sql.view.list.SQLTableModelColumn; |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.PanelFrame; |
import org.openconcerto.utils.CollectionUtils; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.Tuple2; |
53,8 → 54,15 |
public class ListeDesStocksAction extends CreateFrameAbstractAction { |
private final boolean besoin; |
public ListeDesStocksAction() { |
this(false); |
} |
public ListeDesStocksAction(boolean b) { |
super(); |
this.besoin = b; |
this.putValue(Action.NAME, "Liste des stocks"); |
} |
67,79 → 75,97 |
List<SQLRow> rowsEtat = SQLBackgroundTableCache.getInstance().getCacheForTable(depotTable).getRows(); |
JTabbedPane tabs = new JTabbedPane(); |
boolean canViewAll = true; |
for (final SQLRow sqlRow : rowsEtat) { |
boolean canView = UserRightsManager.getCurrentUserRights().haveRight(DepotStockViewRightEditor.ID_RIGHT, String.valueOf(sqlRow.getID())); |
canViewAll &= canView; |
if (canView) { |
final SQLTableModelSourceOnline tableSource = eltStock.getTableSource(true); |
ListeAddPanel panel = createPanel(eltStock, stockTable, sqlRow); |
tabs.add(sqlRow.getString("NOM"), panel); |
} |
SQLTableModelColumn colStock; |
if (stockTable.getDBRoot().contains("ARTICLE_PRIX_REVIENT")) { |
colStock = tableSource.getColumn(tableSource.getColumns().size() - 2); |
} else { |
} |
colStock = new BaseSQLTableModelColumn("Valeur HT du stock", BigDecimal.class) { |
if (canViewAll && this.besoin) { |
tabs.insertTab("Global", null, createPanel(eltStock, stockTable, null), null, 0); |
} |
@Override |
protected Object show_(SQLRowAccessor stock) { |
JPanel panel = new JPanel(new GridBagLayout()); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
panel.add(tabs, c); |
return new PanelFrame(panel, "Liste des stocks"); |
} |
if (stock == null || stock.isUndefined()) { |
private ListeAddPanel createPanel(SQLElement eltStock, final SQLTable stockTable, final SQLRow sqlRow) { |
final SQLTableModelSourceOnline tableSource = eltStock.getTableSource(true); |
SQLTableModelColumn colStock; |
if (stockTable.getDBRoot().contains("ARTICLE_PRIX_REVIENT")) { |
colStock = tableSource.getColumn(tableSource.getColumns().size() - 2); |
} else { |
colStock = new BaseSQLTableModelColumn("Valeur HT du stock", BigDecimal.class) { |
@Override |
protected Object show_(SQLRowAccessor stock) { |
if (stock == null || stock.isUndefined()) { |
return BigDecimal.ZERO; |
} else { |
float qte = stock.getFloat("QTE_REEL"); |
BigDecimal ha = stock.getForeign("ID_ARTICLE").getBigDecimal("PA_HT"); |
BigDecimal total = ha.multiply(new BigDecimal(qte), DecimalUtils.HIGH_PRECISION); |
if (total.signum() == 1) { |
return total; |
} else { |
return BigDecimal.ZERO; |
} else { |
float qte = stock.getFloat("QTE_REEL"); |
BigDecimal ha = stock.getForeign("ID_ARTICLE").getBigDecimal("PA_HT"); |
BigDecimal total = ha.multiply(new BigDecimal(qte), DecimalUtils.HIGH_PRECISION); |
if (total.signum() == 1) { |
return total; |
} else { |
return BigDecimal.ZERO; |
} |
} |
} |
} |
@Override |
public Set<FieldPath> getPaths() { |
final SQLTable table = stockTable; |
Path p = new Path(table); |
Path p2 = new Path(table).addForeignField("ID_ARTICLE"); |
return CollectionUtils.createSet(new FieldPath(p2, "PA_HT")); |
} |
}; |
colStock.setRenderer(ComptaSQLConfElement.CURRENCY_RENDERER); |
tableSource.getColumns().add(colStock); |
} |
@Override |
public Set<FieldPath> getPaths() { |
final SQLTable table = stockTable; |
Path p2 = new Path(table).addForeignField("ID_ARTICLE"); |
return CollectionUtils.createSet(new FieldPath(p2, "PA_HT")); |
} |
}; |
colStock.setRenderer(ComptaSQLConfElement.CURRENCY_RENDERER); |
tableSource.getColumns().add(colStock); |
} |
tableSource.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() { |
tableSource.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
input.setWhere(new Where(input.getTable("STOCK").getField("ID_DEPOT_STOCK"), "=", sqlRow.getID())); |
return input; |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
Where w = sqlRow == null ? null : new Where(input.getTable("STOCK").getField("ID_DEPOT_STOCK"), "=", sqlRow.getID()); |
if (besoin) { |
w = Where.and(w, new Where(input.getTable("STOCK").getField("QTE_TH"), "<", input.getTable("STOCK").getField("QTE_MIN"))); |
} |
}); |
input.setWhere(w); |
return input; |
} |
}); |
final IListe liste = new IListe(tableSource); |
ListeAddPanel panel = new ListeAddPanel(eltStock, liste); |
panel.setAddVisible(false); |
panel.setDeleteVisible(false); |
List<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>> fields = new ArrayList<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>>(1); |
fields.add(Tuple2.create(colStock, IListTotalPanel.Type.SOMME)); |
final IListe liste = new IListe(tableSource); |
ListeAddPanel panel = new ListeAddPanel(eltStock, liste); |
panel.setAddVisible(false); |
panel.setDeleteVisible(false); |
List<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>> fields = new ArrayList<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>>(1); |
fields.add(Tuple2.create(colStock, IListTotalPanel.Type.SOMME)); |
IListTotalPanel total = new IListTotalPanel(liste, fields, null, "Total"); |
GridBagConstraints c2 = new DefaultGridBagConstraints(); |
c2.gridy = 4; |
c2.anchor = GridBagConstraints.EAST; |
c2.weightx = 0; |
c2.fill = GridBagConstraints.NONE; |
panel.add(total, c2); |
tabs.add(sqlRow.getString("NOM"), panel); |
} |
JPanel panel = new JPanel(new GridBagLayout()); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
panel.add(tabs, c); |
return new PanelFrame(panel, "Liste des stocks"); |
IListTotalPanel total = new IListTotalPanel(liste, fields, null, "Total"); |
GridBagConstraints c2 = new DefaultGridBagConstraints(); |
c2.gridy = 4; |
c2.anchor = GridBagConstraints.EAST; |
c2.weightx = 0; |
c2.fill = GridBagConstraints.NONE; |
panel.add(total, c2); |
return panel; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/supplier/component/FournisseurSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
217,6 → 217,20 |
this.addView(devise, "ID_DEVISE"); |
} |
if (getTable().contains("CONDITIONS_PORT")) { |
// Conditions frais port |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
this.add(new JLabel(getLabelFor("CONDITIONS_PORT"), SwingConstants.RIGHT), c); |
c.gridx++; |
c.weightx = 0.5; |
JTextField textCondPort = new JTextField(); |
this.add(textCondPort, c); |
this.addView(textCondPort, "CONDITIONS_PORT"); |
} |
if (getTable().contains("ALG_REGISTRE")) { |
c.gridy++; |
c.gridx = 0; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/RelanceSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
54,6 → 54,7 |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.List; |
import java.util.logging.Level; |
183,7 → 184,7 |
try { |
FicheRelanceSheet sheet = new FicheRelanceSheet(IListe.get(e).getSelectedRow().asRow().fetchNew(false)); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
sheet.showPrintAndExportAsynchronous(true, false, true, Collections.emptyList()); |
} catch (Exception ex) { |
ExceptionHandler.handle("Impression impossible", ex); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactItemTable.java.mine |
---|
New file |
0,0 → 1,150 |
package ilm.erp.core.customerrelationship.customer.element; |
import ilm.sql.Configuration; |
import ilm.sql.element.SQLElement; |
import ilm.sql.model.SQLRowValues; |
import ilm.sql.view.list.RowValuesTable; |
import ilm.sql.view.list.RowValuesTableControlPanel; |
import ilm.sql.view.list.RowValuesTableModel; |
import ilm.sql.view.list.RowValuesTableRenderer; |
import ilm.sql.view.list.SQLTableElement; |
import ilm.ui.FormatEditor; |
import ilm.utils.FormatGroup; |
import ilm.utils.convertor.DateToSQLConvertor; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.io.File; |
import java.text.DateFormat; |
import java.util.Date; |
import java.util.List; |
import java.util.Vector; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.ToolTipManager; |
public class ContactItemTable extends JPanel { |
private RowValuesTable table; |
final RowValuesTableControlPanel comp; |
public ContactItemTable(SQLRowValues defaultRow) { |
this(defaultRow, Configuration.getInstance().getDirectory().getElement(defaultRow.getTable())); |
} |
private ContactItemTable(SQLRowValues defaultRow, SQLElement elt) { |
this.setOpaque(false); |
this.setLayout(new GridBagLayout()); |
GridBagConstraints c = new GridBagConstraints(); |
c.gridwidth = 1; |
c.gridheight = 1; |
c.gridx = 0; |
c.gridy = 0; |
c.fill = GridBagConstraints.HORIZONTAL; |
c.weightx = 1; |
c.weighty = 0; |
List<SQLTableElement> list = new Vector<SQLTableElement>(); |
SQLTableElement tableElementTitre = new SQLTableElement(elt.getTable().getField("ID_TITRE_PERSONNEL")); |
list.add(tableElementTitre); |
SQLTableElement tableElementNom = new SQLTableElement(elt.getTable().getField("NOM")); |
list.add(tableElementNom); |
SQLTableElement tableElementPrenom = new SQLTableElement(elt.getTable().getField("PRENOM")); |
list.add(tableElementPrenom); |
SQLTableElement tableElementFonction = new SQLTableElement(elt.getTable().getField("FONCTION")); |
list.add(tableElementFonction); |
if (elt.getTable().contains("SERVICE")) { |
SQLTableElement tableElementService = new SQLTableElement(elt.getTable().getField("SERVICE")); |
list.add(tableElementService); |
} |
SQLTableElement tableElementTel = new SQLTableElement(elt.getTable().getField("TEL_DIRECT")); |
list.add(tableElementTel); |
SQLTableElement tableElementFax = new SQLTableElement(elt.getTable().getField("FAX")); |
list.add(tableElementFax); |
SQLTableElement tableElementTelP = new SQLTableElement(elt.getTable().getField("TEL_MOBILE")); |
list.add(tableElementTelP); |
SQLTableElement tableElementMail = new SQLTableElement(elt.getTable().getField("EMAIL")); |
list.add(tableElementMail); |
if (elt.getTable().contains("TYPE")) { |
SQLTableElement tableElementType = new SQLTableElement(elt.getTable().getField("TYPE")); |
list.add(tableElementType); |
} |
if (elt.getTable().contains("PAYS")) { |
SQLTableElement tableElementPays = new SQLTableElement(elt.getTable().getField("PAYS")); |
list.add(tableElementPays); |
} |
if (elt.getTable().contains("ENVOI_RAPPORT_MAIL")) { |
SQLTableElement tableElementEnvoiMail = new SQLTableElement(elt.getTable().getField("ENVOI_RAPPORT_MAIL")); |
list.add(tableElementEnvoiMail); |
} |
if (elt.getTable().contains("NO_MAILING")) { |
SQLTableElement tableElementNoMailing = new SQLTableElement(elt.getTable().getField("NO_MAILING")); |
list.add(tableElementNoMailing); |
} |
if (elt.getTable().contains("DATE_NAISSANCE")) { |
list.add(new SQLTableElement(elt.getTable().getField("DATE_NAISSANCE")) { |
private final DateToSQLConvertor conv = new DateToSQLConvertor(); |
{ |
this.setEditor(new FormatEditor( |
new FormatGroup(DateFormat.getDateInstance(DateFormat.SHORT), DateFormat.getDateInstance(DateFormat.MEDIUM), DateFormat.getDateInstance(DateFormat.LONG)))); |
} |
@Override |
public Object convertEditorValueToModel(Object value, SQLRowValues row) { |
return this.conv.convert((Date) value); |
} |
}); |
} |
final RowValuesTableModel model = new RowValuesTableModel(elt, list, elt.getTable().getField("NOM"), false, defaultRow); |
this.table = new RowValuesTable(model, new File(Configuration.getInstance().getConfDir(), "Table" + File.separator + "Table_Contact.xml")); |
ToolTipManager.sharedInstance().unregisterComponent(this.table); |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader()); |
this.comp = new RowValuesTableControlPanel(this.table); |
this.add(this.comp, c); |
c.gridy++; |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
this.add(new JScrollPane(this.table), c); |
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer()); |
} |
public void updateField(String field, int id) { |
this.table.updateField(field, id); |
} |
public void insertFrom(String field, SQLRowValues row) { |
this.table.insertFrom(field, row); |
} |
public void insertFrom(String field, int id) { |
this.table.insertFrom(field, id); |
} |
public RowValuesTableModel getModel() { |
return this.table.getRowValuesTableModel(); |
} |
public void setEditable(boolean b) { |
this.comp.setEditable(b); |
this.table.setEditable(b); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/AgenceSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
72,13 → 72,13 |
} |
return super.createEditor(id); |
} |
@Override |
protected Set<String> createRequiredNames() { |
final Set<String> required = new HashSet<>(); |
required.add("customerrelationship.customer.agency.designation"); |
return required; |
} |
} |
@Override |
public JComponent createLabel(String id) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/CustomerGroup.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
110,6 → 110,7 |
gInfo.addItem("CODE_FOURNISSEUR"); |
gInfo.addItem("REMIND_DATE"); |
gInfo.addItem("CONDITIONS_LIVRAISON", new LayoutHints(true, true, true, true, true, true, true, true)); |
gInfo.addItem("ALERTE", new LayoutHints(true, true, true, true, true, true, true, true)); |
gInfo.addItem("INFOS", new LayoutHints(true, true, true, true, true, true, true, true)); |
gInfo.addItem("COMMENTAIRES", new LayoutHints(true, true, true, true, true, true, true, true)); |
gInfo.addItem("OBSOLETE"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ClientNormalSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
25,8 → 25,10 |
import org.openconcerto.sql.model.FieldPath; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.model.graph.Path; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.ComboSQLRequest; |
import org.openconcerto.sql.request.ListSQLRequest; |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn; |
import org.openconcerto.sql.view.list.IListe; |
41,6 → 43,7 |
import java.awt.event.ActionEvent; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Collections; |
import java.util.List; |
import java.util.Set; |
71,7 → 74,7 |
final SQLRowAccessor row = IListe.get(e).fetchSelectedRow(); |
FicheClientXmlSheet sheet = new FicheClientXmlSheet(row.asRow()); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
sheet.showPrintAndExportAsynchronous(true, false, true, Collections.emptyList()); |
} |
}, false, "customerrelationship.customer.info.create"); |
actionFicheClient.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
208,6 → 211,12 |
} |
@Override |
protected void _initComboRequest(ComboSQLRequest req) { |
super._initComboRequest(req); |
req.setWhere(new Where(getTable().getField("OBSOLETE"), "=", Boolean.FALSE)); |
} |
/* |
* (non-Javadoc) |
* |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactItemTable.java.r30880 |
---|
New file |
0,0 → 1,149 |
package ilm.erp.core.customerrelationship.customer.element; |
import ilm.sql.Configuration; |
import ilm.sql.element.SQLElement; |
import ilm.sql.model.SQLRowValues; |
import ilm.sql.view.list.RowValuesTable; |
import ilm.sql.view.list.RowValuesTableControlPanel; |
import ilm.sql.view.list.RowValuesTableModel; |
import ilm.sql.view.list.RowValuesTableRenderer; |
import ilm.sql.view.list.SQLTableElement; |
import ilm.ui.FormatEditor; |
import ilm.utils.FormatGroup; |
import ilm.utils.convertor.DateToSQLConvertor; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.io.File; |
import java.text.DateFormat; |
import java.util.Date; |
import java.util.List; |
import java.util.Vector; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.ToolTipManager; |
public class ContactItemTable extends JPanel { |
private RowValuesTable table; |
final RowValuesTableControlPanel comp; |
public ContactItemTable(SQLRowValues defaultRow) { |
this(defaultRow, Configuration.getInstance().getDirectory().getElement(defaultRow.getTable())); |
} |
private ContactItemTable(SQLRowValues defaultRow, SQLElement elt) { |
this.setOpaque(false); |
this.setLayout(new GridBagLayout()); |
GridBagConstraints c = new GridBagConstraints(); |
c.gridwidth = 1; |
c.gridheight = 1; |
c.gridx = 0; |
c.gridy = 0; |
c.fill = GridBagConstraints.HORIZONTAL; |
c.weightx = 1; |
c.weighty = 0; |
List<SQLTableElement> list = new Vector<SQLTableElement>(); |
SQLTableElement tableElementTitre = new SQLTableElement(elt.getTable().getField("ID_TITRE_PERSONNEL")); |
list.add(tableElementTitre); |
SQLTableElement tableElementNom = new SQLTableElement(elt.getTable().getField("NOM")); |
list.add(tableElementNom); |
SQLTableElement tableElementPrenom = new SQLTableElement(elt.getTable().getField("PRENOM")); |
list.add(tableElementPrenom); |
SQLTableElement tableElementFonction = new SQLTableElement(elt.getTable().getField("FONCTION")); |
list.add(tableElementFonction); |
if (elt.getTable().contains("SERVICE")) { |
SQLTableElement tableElementService = new SQLTableElement(elt.getTable().getField("SERVICE")); |
list.add(tableElementService); |
} |
SQLTableElement tableElementTel = new SQLTableElement(elt.getTable().getField("TEL_DIRECT")); |
list.add(tableElementTel); |
SQLTableElement tableElementFax = new SQLTableElement(elt.getTable().getField("FAX")); |
list.add(tableElementFax); |
SQLTableElement tableElementTelP = new SQLTableElement(elt.getTable().getField("TEL_MOBILE")); |
list.add(tableElementTelP); |
SQLTableElement tableElementMail = new SQLTableElement(elt.getTable().getField("EMAIL")); |
list.add(tableElementMail); |
if (elt.getTable().contains("TYPE")) { |
SQLTableElement tableElementType = new SQLTableElement(elt.getTable().getField("TYPE")); |
list.add(tableElementType); |
} |
if (elt.getTable().contains("PAYS")) { |
SQLTableElement tableElementPays = new SQLTableElement(elt.getTable().getField("PAYS")); |
list.add(tableElementPays); |
} |
if (elt.getTable().contains("ENVOI_RAPPORT_MAIL")) { |
SQLTableElement tableElementEnvoiMail = new SQLTableElement(elt.getTable().getField("ENVOI_RAPPORT_MAIL")); |
list.add(tableElementEnvoiMail); |
} |
if (elt.getTable().contains("NO_MAILING")) { |
SQLTableElement tableElementNoMailing = new SQLTableElement(elt.getTable().getField("NO_MAILING")); |
list.add(tableElementNoMailing); |
} |
if (elt.getTable().contains("DATE_NAISSANCE")) { |
list.add(new SQLTableElement(elt.getTable().getField("DATE_NAISSANCE")) { |
private final DateToSQLConvertor conv = new DateToSQLConvertor(); |
{ |
this.setEditor(new FormatEditor( |
new FormatGroup(DateFormat.getDateInstance(DateFormat.SHORT), DateFormat.getDateInstance(DateFormat.MEDIUM), DateFormat.getDateInstance(DateFormat.LONG)))); |
} |
@Override |
public Object convertEditorValueToModel(Object value, SQLRowValues row) { |
return this.conv.convert((Date) value); |
} |
}); |
} |
final RowValuesTableModel model = new RowValuesTableModel(elt, list, elt.getTable().getField("NOM"), false, defaultRow); |
this.table = new RowValuesTable(model, new File(Configuration.getInstance().getConfDir(), "Table" + File.separator + "Table_Contact.xml")); |
ToolTipManager.sharedInstance().unregisterComponent(this.table); |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader()); |
this.comp = new RowValuesTableControlPanel(this.table); |
this.add(this.comp, c); |
c.gridy++; |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
this.add(new JScrollPane(this.table), c); |
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer()); |
} |
public void updateField(String field, int id) { |
this.table.updateField(field, id); |
} |
public void insertFrom(String field, SQLRowValues row) { |
this.table.insertFrom(field, row); |
} |
public void insertFrom(String field, int id) { |
this.table.insertFrom(field, id); |
} |
public RowValuesTableModel getModel() { |
return this.table.getRowValuesTableModel(); |
} |
public void setEditable(boolean b) { |
this.comp.setEditable(b); |
this.table.setEditable(b); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ClientNormalSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
24,6 → 24,7 |
import org.openconcerto.erp.core.finance.payment.component.ModeDeReglementSQLComponent; |
import org.openconcerto.erp.model.ISQLCompteSelector; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.erp.preferences.ModeReglementDefautPrefPanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.BaseSQLComponent; |
39,6 → 40,7 |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.UndefinedRowValuesCache; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.SQLRowItemView; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.sqlobject.JUniqueTextField; |
742,6 → 744,13 |
} |
} |
private void createCompteClientFromCodeAuto(int idClient) { |
final SQLRow rowClient = getTable().getRow(idClient); |
if (rowClient.isForeignEmpty("ID_COMPTE_PCE")) { |
createCompteClientAuto(idClient); |
} |
} |
private void createCompteClientAuto(int idClient) { |
SQLRowValues rowVals = getTable().getRow(idClient).createEmptyUpdateRow(); |
String initialClient = ""; |
803,6 → 812,10 |
if (this.boxGestionAutoCompte.isSelected()) { |
createCompteClientAuto(id); |
} |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.COMPTE_CLIENT_AUTO, Boolean.FALSE)) { |
createCompteClientFromCodeAuto(id); |
} |
return id; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/CustomerSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,17 → 13,23 |
package org.openconcerto.erp.core.customerrelationship.customer.element; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.edm.AttachmentAction; |
import org.openconcerto.erp.core.reports.history.ui.HistoriqueClientFrame; |
import org.openconcerto.erp.core.sales.product.element.ListeTarifClient; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.GlobalMapper; |
import org.openconcerto.sql.element.GroupSQLComponent; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.ListSQLRequest; |
import org.openconcerto.sql.request.SQLFieldTranslator; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.RowAction; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.ui.light.LightUIElement; |
import org.openconcerto.ui.light.LightUILine; |
31,7 → 37,9 |
import org.openconcerto.ui.light.SimpleTextLine; |
import java.awt.event.ActionEvent; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Set; |
import javax.swing.AbstractAction; |
60,8 → 68,35 |
actionHistory.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(actionHistory); |
RowAction actionTarif = new RowAction(new AbstractAction("Tarifs associés") { |
@Override |
public void actionPerformed(ActionEvent e) { |
final ListeTarifClient listeHistoCodeClient = new ListeTarifClient(((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete()); |
int idClient = IListe.get(e).getSelectedRowAccessor().getForeignID("ID_TARIF"); |
listeHistoCodeClient.getHistoriquePanel().selectIDinJList(idClient); |
listeHistoCodeClient.getFrame().setVisible(true); |
} |
}, true) { |
@Override |
public boolean enabledFor(List<SQLRowValues> selection) { |
if (selection != null && selection.size() == 1) { |
return !selection.get(0).isForeignEmpty("ID_TARIF"); |
} else { |
return false; |
} |
} |
}; |
getRowActions().add(actionTarif); |
} |
protected void _initListRequest(final ListSQLRequest req) { |
super._initListRequest(req); |
req.addToGraphToFetch("ID_TARIF"); |
} |
@Override |
public SQLComponent createComponent() { |
final GroupSQLComponent c = new CustomerSQLComponent(this); |
70,11 → 105,19 |
} |
@Override |
public Set<String> getReadOnlyFields() { |
Set<String> s = new HashSet<>(); |
return s; |
} |
@Override |
protected List<String> getListFields() { |
final List<String> fields = super.getListFields(); |
if (getTable().contains("GROUPE")) { |
fields.add("GROUPE"); |
} |
fields.add("ENCOURS_MAX"); |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.CATEGORIE_COMPTABLE_SPEC, false)) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactItemTable.java.r25937 |
---|
New file |
0,0 → 1,149 |
package ilm.erp.core.customerrelationship.customer.element; |
import ilm.sql.Configuration; |
import ilm.sql.element.SQLElement; |
import ilm.sql.model.SQLRowValues; |
import ilm.sql.view.list.RowValuesTable; |
import ilm.sql.view.list.RowValuesTableControlPanel; |
import ilm.sql.view.list.RowValuesTableModel; |
import ilm.sql.view.list.RowValuesTableRenderer; |
import ilm.sql.view.list.SQLTableElement; |
import ilm.ui.FormatEditor; |
import ilm.utils.FormatGroup; |
import ilm.utils.convertor.DateToSQLConvertor; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.io.File; |
import java.text.DateFormat; |
import java.util.Date; |
import java.util.List; |
import java.util.Vector; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.ToolTipManager; |
public class ContactItemTable extends JPanel { |
private RowValuesTable table; |
final RowValuesTableControlPanel comp; |
public ContactItemTable(SQLRowValues defaultRow) { |
this(defaultRow, Configuration.getInstance().getDirectory().getElement(defaultRow.getTable())); |
} |
private ContactItemTable(SQLRowValues defaultRow, SQLElement elt) { |
this.setOpaque(false); |
this.setLayout(new GridBagLayout()); |
GridBagConstraints c = new GridBagConstraints(); |
c.gridwidth = 1; |
c.gridheight = 1; |
c.gridx = 0; |
c.gridy = 0; |
c.fill = GridBagConstraints.HORIZONTAL; |
c.weightx = 1; |
c.weighty = 0; |
List<SQLTableElement> list = new Vector<SQLTableElement>(); |
SQLTableElement tableElementTitre = new SQLTableElement(elt.getTable().getField("ID_TITRE_PERSONNEL")); |
list.add(tableElementTitre); |
SQLTableElement tableElementNom = new SQLTableElement(elt.getTable().getField("NOM")); |
list.add(tableElementNom); |
SQLTableElement tableElementPrenom = new SQLTableElement(elt.getTable().getField("PRENOM")); |
list.add(tableElementPrenom); |
SQLTableElement tableElementFonction = new SQLTableElement(elt.getTable().getField("FONCTION")); |
list.add(tableElementFonction); |
if (elt.getTable().contains("SERVICE")) { |
SQLTableElement tableElementService = new SQLTableElement(elt.getTable().getField("SERVICE")); |
list.add(tableElementService); |
} |
SQLTableElement tableElementTel = new SQLTableElement(elt.getTable().getField("TEL_DIRECT")); |
list.add(tableElementTel); |
SQLTableElement tableElementFax = new SQLTableElement(elt.getTable().getField("FAX")); |
list.add(tableElementFax); |
SQLTableElement tableElementTelP = new SQLTableElement(elt.getTable().getField("TEL_MOBILE")); |
list.add(tableElementTelP); |
SQLTableElement tableElementMail = new SQLTableElement(elt.getTable().getField("EMAIL")); |
list.add(tableElementMail); |
if (elt.getTable().contains("TYPE")) { |
SQLTableElement tableElementType = new SQLTableElement(elt.getTable().getField("TYPE")); |
list.add(tableElementType); |
} |
if (elt.getTable().contains("PAYS")) { |
SQLTableElement tableElementPays = new SQLTableElement(elt.getTable().getField("PAYS")); |
list.add(tableElementPays); |
} |
if (elt.getTable().contains("ENVOI_RAPPORT_MAIL")) { |
SQLTableElement tableElementEnvoiMail = new SQLTableElement(elt.getTable().getField("ENVOI_RAPPORT_MAIL")); |
list.add(tableElementEnvoiMail); |
} |
if (elt.getTable().contains("NO_MAILING")) { |
SQLTableElement tableElementNoMailing = new SQLTableElement(elt.getTable().getField("NO_MAILING")); |
list.add(tableElementNoMailing); |
} |
list.add(new SQLTableElement(elt.getTable().getField("DATE_NAISSANCE")) { |
private final DateToSQLConvertor conv = new DateToSQLConvertor(); |
{ |
this.setEditor( |
new FormatEditor(new FormatGroup(DateFormat.getDateInstance(DateFormat.SHORT), DateFormat.getDateInstance(DateFormat.MEDIUM), DateFormat.getDateInstance(DateFormat.LONG)))); |
} |
@Override |
public Object convertEditorValueToModel(Object value, SQLRowValues row) { |
return this.conv.convert((Date) value); |
} |
}); |
final RowValuesTableModel model = new RowValuesTableModel(elt, list, elt.getTable().getField("NOM"), false, defaultRow); |
this.table = new RowValuesTable(model, new File(Configuration.getInstance().getConfDir(), "Table" + File.separator + "Table_Contact.xml")); |
ToolTipManager.sharedInstance().unregisterComponent(this.table); |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader()); |
this.comp = new RowValuesTableControlPanel(this.table); |
this.add(this.comp, c); |
c.gridy++; |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
this.add(new JScrollPane(this.table), c); |
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer()); |
} |
public void updateField(String field, int id) { |
this.table.updateField(field, id); |
} |
public void insertFrom(String field, SQLRowValues row) { |
this.table.insertFrom(field, row); |
} |
public void insertFrom(String field, int id) { |
this.table.insertFrom(field, id); |
} |
public RowValuesTableModel getModel() { |
return this.table.getRowValuesTableModel(); |
} |
public void setEditable(boolean b) { |
this.comp.setEditable(b); |
this.table.setEditable(b); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/element/SaisieKmSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
636,11 → 636,12 |
final TableRef aliasEcrTable = sel.getAlias(ecritureTable); |
final String quoteDebit = new SQLName(aliasEcrTable.getAlias(), "DEBIT").quote(); |
final String quoteCredit = new SQLName(aliasEcrTable.getAlias(), "CREDIT").quote(); |
sel.setWhere(Where.isNotNull(ecritureTable.getField("LETTRAGE")).and(new Where(ecritureTable.getField("LETTRAGE"), "!=", ""))); |
sel.setHaving(Where.createRaw("SUM (" + quoteCredit + ") != SUM(" + quoteDebit + ")", aliasEcrTable.getField("DEBIT"))); |
List<String> resultBadLettrage = getElement().getTable().getDBSystemRoot().getDataSource().executeCol(sel.asString()); |
if (resultBadLettrage != null && !resultBadLettrage.isEmpty()) { |
UpdateBuilder update = new UpdateBuilder(ecritureTable); |
update.setObject(ecritureTable.getField("LETTRAGE"), ""); |
update.setObject(ecritureTable.getField("DATE_LETTRAGE"), null); |
647,31 → 648,11 |
Where w = new Where(ecritureTable.getField("LETTRAGE"), resultBadLettrage); |
update.setWhere(w); |
getElement().getTable().getDBSystemRoot().getDataSource().execute(update.asString()); |
} |
} |
// Suppression des lettrages déséquilibré (ex : si on modifie un |
// montant d'une écriture lettrée) |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(ecritureTable.getField("LETTRAGE")); |
sel.addGroupBy(ecritureTable.getField("LETTRAGE")); |
final TableRef aliasEcrTable = sel.getAlias(ecritureTable); |
final String quoteDebit = new SQLName(aliasEcrTable.getAlias(), "DEBIT").quote(); |
final String quoteCredit = new SQLName(aliasEcrTable.getAlias(), "CREDIT").quote(); |
sel.setWhere(Where.isNotNull(ecritureTable.getField("LETTRAGE")).and(new Where(ecritureTable.getField("LETTRAGE"), "!=", ""))); |
sel.setHaving(Where.createRaw("SUM (" + quoteCredit + ") != SUM(" + quoteDebit + ")", aliasEcrTable.getField("DEBIT"))); |
List<String> resultBadLettrage = getTable().getDBSystemRoot().getDataSource().executeCol(sel.asString()); |
if (resultBadLettrage != null && !resultBadLettrage.isEmpty()) { |
UpdateBuilder update = new UpdateBuilder(ecritureTable); |
update.setObject(ecritureTable.getField("LETTRAGE"), ""); |
update.setObject(ecritureTable.getField("DATE_LETTRAGE"), null); |
Where w = new Where(ecritureTable.getField("LETTRAGE"), resultBadLettrage); |
update.setWhere(w); |
getTable().getDBSystemRoot().getDataSource().execute(update.asString()); |
} |
if (!listEcr.isEmpty()) { |
final EcritureSQLElement e = (EcritureSQLElement) Configuration.getInstance().getDirectory().getElement(ecritureTable); |
for (SQLRow sqlRow : listEcr) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/JournauxSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
279,9 → 279,9 |
this.nbPage++; |
} |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
if (this.nbPage < 1) { |
this.nbPage = 1; |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/VentilationAnalytiquePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
34,6 → 34,7 |
import java.beans.PropertyChangeListener; |
import java.io.File; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.Date; |
import java.util.concurrent.ExecutionException; |
113,7 → 114,7 |
VentilationAnalytiqueSheetXML sheet = new VentilationAnalytiqueSheetXML(dateDeb.getDate(), dateEnd.getDate(), poste); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, false); |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
} catch (InterruptedException e) { |
// TODO Auto-generated catch block |
e.printStackTrace(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/OpenConcerto_2000px.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/OpenConcerto_2000px.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/RepartitionAnalytiquePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
27,6 → 27,7 |
import java.awt.event.ActionEvent; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.util.Collections; |
import java.util.Date; |
import java.util.concurrent.ExecutionException; |
74,7 → 75,7 |
RepartitionAnalytiqueSheetXML sheet = new RepartitionAnalytiqueSheetXML(dateDeb.getDate(), dateEnd.getDate()); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, false); |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
} catch (InterruptedException e) { |
e.printStackTrace(); |
} catch (ExecutionException e) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/BalanceSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
433,9 → 433,8 |
} |
} |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
if (this.nbPage < 1) { |
this.nbPage = 1; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/PdfGenerator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,19 → 13,22 |
package org.openconcerto.erp.core.finance.accounting.report; |
import static org.openconcerto.task.config.ComptaBasePropsConfiguration.getStreamStatic; |
import org.openconcerto.erp.generationDoc.TemplateManager; |
import org.openconcerto.ui.preferences.TemplateProps; |
import org.openconcerto.utils.ExceptionHandler; |
import java.awt.Color; |
import java.io.File; |
import java.io.FileInputStream; |
import java.io.FileNotFoundException; |
import java.io.FileOutputStream; |
import java.io.IOException; |
import java.io.InputStream; |
import java.util.Calendar; |
import java.util.Date; |
import java.util.Map; |
import javax.swing.JOptionPane; |
import com.ibm.icu.text.SimpleDateFormat; |
import com.lowagie.text.Document; |
import com.lowagie.text.DocumentException; |
58,7 → 61,7 |
} |
PdfGenerator(String fileNameIn, String fileNameOut, String directoryOut) { |
this.fileNameIn = "/Configuration/Template/PDF/" + fileNameIn; |
this.fileNameIn = fileNameIn; |
this.fileNameOut = fileNameOut; |
this.directoryOut = new File(directoryOut, String.valueOf(Calendar.getInstance().get(Calendar.YEAR))); |
} |
75,7 → 78,7 |
this.cb.endText(); |
this.document.close(); |
} catch (FileNotFoundException e) { |
ExceptionHandler.handle("Impossible de générer le fichier. \n" + e, e); |
JOptionPane.showMessageDialog(null, "Impossible de générer le fichier.\nModèle PDF non trouvé : " + e.getMessage()); |
} |
} |
85,8 → 88,31 |
PdfReader reader = null; |
PdfWriter writer = null; |
try { |
reader = new PdfReader(getStreamStatic(this.fileNameIn)); |
InputStream in = TemplateManager.getInstance().getTemplate(fileNameIn); |
if (in == null) { |
File defaultFile = new File("Configuration/Template/PDF/" + fileNameIn); |
System.err.println("PdfGenerator.init() template " + fileNameIn + " not retrieved from TemplateManager"); |
if (defaultFile.exists()) { |
in = new FileInputStream(defaultFile); |
} else { |
System.err.println("PdfGenerator.init() template " + defaultFile.getAbsolutePath() + " not found in program directory"); |
} |
final String property = TemplateProps.getInstance().getProperty("LocationTemplate"); |
defaultFile = new File(property, fileNameIn); |
if (defaultFile.exists()) { |
in = new FileInputStream(defaultFile); |
} else { |
System.err.println("PdfGenerator.init() template " + defaultFile.getAbsolutePath() + " not found in template prefs directory"); |
} |
if (in == null) { |
throw new FileNotFoundException(fileNameIn); |
} |
} |
reader = new PdfReader(in); |
final Rectangle psize = reader.getPageSize(1); |
psize.setRight(psize.getRight() - this.templateOffsetX); |
psize.setTop(psize.getTop() - this.templateOffsetY); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/Map3310.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
24,6 → 24,7 |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.utils.GestionDevise; |
import java.io.File; |
import java.util.Date; |
import java.util.HashMap; |
import java.util.Map; |
186,8 → 187,12 |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
Gestion.openPDF(p.getGeneratedFile()); |
Map3310.this.bar.setValue(100); |
final File generatedFile = p.getGeneratedFile(); |
if (generatedFile != null) { |
Gestion.openPDF(generatedFile); |
} else { |
Map3310.this.bar.setValue(100); |
} |
} |
}); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/JournauxSheetXML.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
112,6 → 112,9 |
vals.put("DEBIT", null); |
vals.put("DATE", null); |
vals.put("NOM", null); |
if (tableEcriture.contains("NOM_PIECE")) { |
vals.put("NOM_PIECE", null); |
} |
final SQLRowValuesListFetcher fetcher = new SQLRowValuesListFetcher(vals); |
fetcher.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/GrandLivreSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
462,9 → 462,9 |
} |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
if (this.nbPage < 1) { |
this.nbPage = 1; |
} |
Date end = new Date(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/Map2033A.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
22,6 → 22,7 |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.utils.GestionDevise; |
import java.io.File; |
import java.text.DateFormat; |
import java.text.SimpleDateFormat; |
import java.util.Date; |
186,7 → 187,7 |
// 27688, 277" |
// S040=261+266...268+271+272+27682+274+27684+275+2761+27685+27688 |
long v040 = this.sommeCompte.sommeCompteFils("261", this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(266, 268, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompte(271, 275, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(2761, 2761, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompte(270, 275, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(2761, 2761, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.sommeCompteFils("27682", this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(27684, 27685, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.sommeCompteFils("27688", this.dateDebut, this.dateFin); |
685,10 → 686,11 |
long v156 = -this.sommeCompte.sommeCompteFils("160", this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("161", this.dateDebut, this.dateFin) |
- this.sommeCompte.soldeCompte(163, 166, true, this.dateDebut, this.dateFin) - this.sommeCompte.soldeCompte(1680, 1681, true, this.dateDebut, this.dateFin) |
- this.sommeCompte.soldeCompte(1682, 1682, true, this.dateDebut, this.dateFin) - this.sommeCompte.soldeCompte(1684, 1689, true, this.dateDebut, this.dateFin) |
- this.sommeCompte.sommeCompteFils("17", this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("426", this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompteCrediteur(450, 454, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompteCrediteur(456, 456, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompteCrediteur(458, 459, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompteCrediteur(512, 517, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompteCrediteur(518, 518, true, this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("519", this.dateDebut, this.dateFin); |
- this.sommeCompte.sommeCompteFils("19", this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("17", this.dateDebut, this.dateFin) |
- this.sommeCompte.sommeCompteFils("426", this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompteCrediteur(450, 454, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompteCrediteur(456, 456, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompteCrediteur(458, 459, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompteCrediteur(512, 517, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompteCrediteur(518, 518, true, this.dateDebut, this.dateFin) |
- this.sommeCompte.sommeCompteFils("519", this.dateDebut, this.dateFin); |
this.m.put("PASSIF3.25", GestionDevise.currencyToString(v156, false)); |
// 151 |
874,8 → 876,12 |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
Gestion.openPDF(p.getGeneratedFile()); |
Map2033A.this.bar.setValue(100); |
final File generatedFile = p.getGeneratedFile(); |
if (generatedFile != null) { |
Gestion.openPDF(generatedFile); |
} else { |
Map2033A.this.bar.setValue(100); |
} |
} |
}); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/GrandLivrePDF.java |
---|
New file |
0,0 → 1,754 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.core.finance.accounting.report; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement; |
import org.openconcerto.erp.rights.ComptaUserRight; |
import org.openconcerto.sql.element.SQLElementDirectory; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.users.rights.UserRightsManager; |
import org.openconcerto.utils.GestionDevise; |
import org.openconcerto.utils.cc.ITransformer; |
import java.awt.Color; |
import java.io.ByteArrayOutputStream; |
import java.io.File; |
import java.io.IOException; |
import java.io.InputStream; |
import java.text.DateFormat; |
import java.text.DecimalFormat; |
import java.text.DecimalFormatSymbols; |
import java.util.ArrayList; |
import java.util.Calendar; |
import java.util.Date; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Locale; |
import java.util.Map; |
import org.apache.commons.dbutils.handlers.ArrayListHandler; |
import org.apache.pdfbox.pdmodel.PDDocument; |
import org.apache.pdfbox.pdmodel.PDPage; |
import org.apache.pdfbox.pdmodel.PDPageContentStream; |
import org.apache.pdfbox.pdmodel.common.PDRectangle; |
import org.apache.pdfbox.pdmodel.font.PDType1Font; |
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject; |
public class GrandLivrePDF { |
public static final int MODEALL = 1; |
public static final int MODELETTREE = 2; |
public static final int MODENONLETTREE_PERIODE = 3; |
public static final int MODENONLETTREE_ALL = 4; |
private final SQLTable tableEcriture; |
private final SQLTable tableMvt; |
private final SQLTable tableCompte; |
private final DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT); |
private final SQLRow rowSociete; |
private final Date dateDu; |
private final Date dateAu; |
private final String compteDeb; |
private final String compteEnd; |
private final int lettrage; |
private boolean cumul = false; |
private boolean excludeCompteSolde = true; |
private boolean centralClient = false; |
private boolean centralFourn = false; |
private int idJrnlExclude = -1; |
private final List<Map<String, Object>> recapSousTotaux = new ArrayList<>(); |
private final SQLElementDirectory directory; |
public static final String TEMPLATE_ID = "GrandLivre"; |
public static final String TEMPLATE_PROPERTY_NAME = "LocationGrandLivre"; |
private static final int LINE_HEIGHT = 10; |
private static final float COL_1_SIZE = 34; |
private static final float COL_2_SIZE = 35; |
private static final float COL_3_SIZE = 35; |
private static final float COL_4_SIZE = 246; |
private static final float COL_5_SIZE = 50; |
private static final float COL_6_SIZE = COL_5_SIZE; |
private static final float COL_7_SIZE = 60; |
private static final float COL_1_X = 40; |
private static final float COL_2_X = COL_1_X + COL_1_SIZE; |
private static final float COL_3_X = COL_2_X + COL_2_SIZE; |
private static final float COL_4_X = COL_3_X + COL_3_SIZE; |
private static final float COL_5_X = COL_4_X + COL_4_SIZE; |
private static final float COL_6_X = COL_5_X + COL_5_SIZE; |
private static final float COL_7_X = COL_6_X + COL_6_SIZE; |
private final DecimalFormat decimalFormat = new DecimalFormat("#,##0.00", DecimalFormatSymbols.getInstance(Locale.FRANCE)); |
public GrandLivrePDF(ComptaPropsConfiguration conf, Date du, Date au, String compteDep, String compteEnd, int lettrage, boolean cumul, boolean excludeCptSolde, boolean centralClient, |
boolean centralFourn, int idJrnlExclude) { |
this.directory = conf.getDirectory(); |
this.rowSociete = conf.getRowSociete(); |
final DBRoot b = conf.getRootSociete(); |
this.tableEcriture = b.getTable("ECRITURE"); |
this.tableMvt = b.getTable("MOUVEMENT"); |
this.tableCompte = b.getTable("COMPTE_PCE"); |
final Calendar cal = Calendar.getInstance(); |
cal.setTime(au); |
this.idJrnlExclude = idJrnlExclude; |
this.dateAu = au; |
this.dateDu = du; |
this.compteDeb = compteDep.trim(); |
this.compteEnd = compteEnd.trim(); |
this.lettrage = lettrage; |
this.cumul = cumul; |
this.excludeCompteSolde = excludeCptSolde; |
this.centralClient = centralClient; |
this.centralFourn = centralFourn; |
} |
public void getGeneratedPDFFile(File f) throws IOException { |
final List<Integer> lCompteSolde; |
if (GrandLivrePDF.this.excludeCompteSolde) { |
lCompteSolde = getListeCompteSolde(); |
} else { |
lCompteSolde = null; |
} |
final Map<Integer, Long> mapCumul = getCumulsAnterieur(GrandLivrePDF.this.dateDu, lCompteSolde); |
final List<SQLRowValues> list = fetchEcritures(lCompteSolde); |
long totalDebit = 0; |
long totalCredit = 0; |
long sousTotalCredit = 0; |
long sousTotalDebit = 0; |
String nomCpt = ""; |
String numCpt = ""; |
int y = 0; |
final String companyName = this.rowSociete.getString("TYPE") + " " + this.rowSociete.getString("NOM"); |
final String title = "Compte : " + this.compteDeb + " à " + this.compteEnd + ". Période du " + this.dateFormatEcr.format(this.dateDu) + " au " + this.dateFormatEcr.format(this.dateAu); |
final Double doubleZero = Double.valueOf("0"); |
try (PDDocument doc = new PDDocument()) { |
PDPageContentStream contents = null; |
final int size = list.size(); |
for (int i = 0; i < size; i++) { |
if (y < 70) { |
final PDPage page = new PDPage(PDRectangle.A4); |
doc.addPage(page); |
if (contents != null) { |
contents.close(); |
} |
contents = new PDPageContentStream(doc, page); |
y = drawHeader(contents, companyName, title, true); |
} |
final SQLRowValues rowEcr = list.get(i); |
final int idCpt = rowEcr.getInt("ID_COMPTE_PCE"); |
nomCpt = rowEcr.getString("COMPTE_NOM"); |
numCpt = rowEcr.getString("COMPTE_NUMERO"); |
// Cumuls antérieurs |
// Titre |
String prevNum = (i == 0 ? null : list.get(i - 1).getString("COMPTE_NUMERO")); |
if (prevNum == null || (!prevNum.equals(numCpt) && (!this.centralFourn || !(prevNum.startsWith("401") && numCpt.startsWith("401"))) |
&& (!this.centralClient || !(prevNum.startsWith("411") && numCpt.startsWith("411"))))) { |
// Si on centralise les comptes clients ou fournisseurs on affiche |
// le compte 401 ou 411 |
if (this.centralClient && nomCpt.startsWith("411")) { |
nomCpt = "411"; |
numCpt = "Centralisation clients"; |
} |
if (this.centralFourn && nomCpt.startsWith("401")) { |
nomCpt = "401"; |
numCpt = "Centralisation fournisseurs"; |
} |
y = drawNomCompte(contents, y, numCpt, nomCpt); |
if (this.cumul) { |
Long longSolde = mapCumul.get(idCpt); |
if (longSolde == null) { |
longSolde = Long.valueOf(0); |
} |
long debitCumulAnt = 0; |
long creditCumulAnt = 0; |
if (longSolde > 0) { |
debitCumulAnt = longSolde; |
} else { |
creditCumulAnt = -longSolde; |
} |
final Double debit = debitCumulAnt == 0 ? doubleZero : Double.valueOf(GestionDevise.currencyToString(debitCumulAnt, false)); |
final Double credit = creditCumulAnt == 0 ? doubleZero : Double.valueOf(GestionDevise.currencyToString(creditCumulAnt, false)); |
final Double solde = longSolde == 0 ? doubleZero : Double.valueOf(GestionDevise.currencyToString(longSolde, false)); |
totalCredit += creditCumulAnt; |
totalDebit += debitCumulAnt; |
sousTotalCredit += creditCumulAnt; |
sousTotalDebit += debitCumulAnt; |
y = drawCumul(contents, y, debit, credit, solde); |
} |