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/jOpenDocument-1.4rc2.badSecurity.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/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/flatlaf-1.2.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/pdfbox2d.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 |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/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/fontbox-2.0.22.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/poi-3.17.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/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/poi-4.1.0.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/flatlaf-0.41.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/flatlaf-0.41.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/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/fontbox-2.0.19.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/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/pdfbox-2.0.19.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/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/mysql-connector-java-5.1.40-bin.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 |
---|
File deleted |
\ No newline at end of file |
/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/Default/VenteFactureTicket.xml |
---|
File deleted |
\ No newline at end of file |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureTicket.odsp |
---|
File deleted |
\ No newline at end of file |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingClient.xml |
---|
File deleted |
\ No newline at end of file |
/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/DepotCheque.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/VenteFactureTicket.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/SituationCompte.xml |
---|
File deleted |
\ No newline at end of file |
/trunk/OpenConcerto/Configuration/Template/Default/SituationCompte.odsp |
---|
File deleted |
\ No newline at end of file |
/trunk/OpenConcerto/Configuration/Template/Default/DepotCheque.odsp |
---|
File deleted |
\ No newline at end of file |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.odsp |
---|
File deleted |
\ No newline at end of file |
/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/DepotCheque.xml |
---|
File deleted |
\ No newline at end of file |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.xml |
---|
File deleted |
\ No newline at end of file |
/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 SIRET "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
</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/FactureFournisseur.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET " /> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN " /> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/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/DemandePrix.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
</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">58</sheet> |
<sheet number="0">57</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/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/AvoirF.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatVentes.xml |
---|
124,28 → 124,4 |
</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/CommandeClient.xml |
---|
24,7 → 24,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
62,7 → 62,7 |
<field name="NOM" /> |
</element> |
<element location="H10" type="fill"> |
<element location="I10" type="fill"> |
<field name="ID_CLIENT"> |
<field name="FORME_JURIDIQUE" /> |
<field name="NOM" /> |
69,7 → 69,7 |
</field> |
</element> |
<element location="H11" type="address.customer.full"> |
<element location="I11" 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/Configuration/Template/Default/DemandePrix.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/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 SIRET "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/CommandeClient.odsp |
---|
1,6 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">66</sheet> |
<sheet number="0">65</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/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/CommandeClient.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.odsp |
---|
1,7 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">65</sheet> |
<sheet number="0">61</sheet> |
</spliteveryrow> |
<resize percent="92"/> |
<offset x="23" y ="0"/> |
<offset x="20" y ="20"/> |
</odsp> |
/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/ExportArticle.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/BonReception.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/ListeFacture.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/ReportingVentes.ods |
---|
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 SIRET "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/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/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 SIRET "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/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 SIRET "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/BonReception.odsp |
---|
1,6 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">58</sheet> |
<sheet number="0">57</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/trunk/OpenConcerto/Configuration/Template/Default/DemandePrix.odsp |
---|
2,4 → 2,8 |
<spliteveryrow> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
</odsp> |
/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/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 SIRET "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
62,7 → 62,7 |
<field name="OBJET" /> |
</element> |
<element location="H10" type="fill"> |
<element location="I10" type="fill"> |
<field name="ID_CLIENT"> |
<field name="FORME_JURIDIQUE" /> |
<field name="NOM" /> |
69,7 → 69,7 |
</field> |
</element> |
<element location="H11" type="address.customer.full"> |
<element location="I11" type="address.customer.full"> |
</element> |
<element location="L63" type="fill"> |
/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/VenteFacture.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/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/RepartitionAnalytique.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/FichePaye.ods |
---|
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/Commande.odsp |
---|
1,6 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">58</sheet> |
<sheet number="0">57</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/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/Journaux.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/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="D58" type="fill"> |
<element location="D54" 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" type="cumulConges" /> |
<field name="ACQUIS" /> |
</field> |
</element> |
<element location="B6" type="replace" replacePattern="_"> |
122,159 → 122,79 |
</element> |
<element location="H54" type="fill"> |
<field name="NET_AVANT_PAS" /> |
<element location="I54" type="fill"> |
<field name="NET_A_PAYER" /> |
</element> |
<element location="I55" type="fill"> |
<field name="REDUCTION_GVT" /> |
</element> |
<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"> |
<element location="D58" type="fill"> |
<field name="SAL_BRUT" /> |
</element> |
<element location="E62" type="fill"> |
<element location="E58" type="fill"> |
<field name="COT_SAL" /> |
</element> |
<element location="F62" type="fill"> |
<element location="F58" type="fill"> |
<field name="COT_PAT" /> |
</element> |
<element location="G62" type="fill"> |
<element location="G58" type="fill"> |
<field name="AVANTAGE_NATURE" /> |
</element> |
<element location="H62" type="fill"> |
<element location="H58" type="fill"> |
<field name="NET_IMP" /> |
</element> |
<element location="I62" type="fill"> |
<element location="I58" type="fill"> |
<field name="ALLEGEMENT_COTISATION" /> |
</element> |
<element location="D63" type="fill"> |
<element location="D59" type="fill"> |
<field name="SAL_BRUT" type="cumulPaye" /> |
</element> |
<element location="E63" type="fill"> |
<element location="E59" type="fill"> |
<field name="COT_SAL" type="cumulPaye" /> |
</element> |
<element location="F63" type="fill"> |
<element location="F59" type="fill"> |
<field name="COT_PAT" type="cumulPaye" /> |
</element> |
<element location="G63" type="fill"> |
<element location="G59" type="fill"> |
<field name="AVANTAGE_NATURE" type="cumulPaye" /> |
</element> |
<element location="H63" type="fill"> |
<element location="H59" type="fill"> |
<field name="NET_IMP" type="cumulPaye" /> |
</element> |
<element location="I63" type="fill"> |
<element location="I59" type="fill"> |
<field name="ALLEGEMENT_COTISATION" type="cumulPaye" /> |
</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" |
<table endPageLine="61" 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="D" type="fill"> |
<element location="E" 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="MONTANT_SAL_AJ"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
<field name="TAUX_SAL" /> |
</element> |
<element location="G" type="fill"> |
<field name="MONTANT_SAL_DED"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
<field name="MONTANT_SAL_AJ" /> |
</element> |
<element location="H" type="fill"> |
<field name="TAUX_PAT"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
<field name="MONTANT_SAL_DED" /> |
</element> |
<element location="I" type="fill"> |
<field name="MONTANT_PAT"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
<!-- <element location="I" type="fill"> |
<field name="TAUX_PAT" type="Devise" /> |
</element> --> |
<element location="J" type="fill"> |
<field name="MONTANT_PAT" /> |
</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 SIRET "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/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/Avoir.xml |
---|
26,7 → 26,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
</element> |
/trunk/OpenConcerto/src/product.properties |
---|
1,5 → 1,5 |
NAME=OpenConcerto |
VERSION=1.7.1 |
VERSION=1.7.0 |
ORGANIZATION_NAME=OpenConcerto |
ORGANIZATION_ID=org.openconcerto |
/trunk/OpenConcerto/src/com/zimbra/common/util/BEncoding.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/gs1/ISO646.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/gs1/GS1AIElements.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/gs1/GS1ApplicationIdentifier.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/gs1/GS1ParseException.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/gs1/GS1Util.java |
---|
File deleted |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
224,7 → 224,7 |
for (TableModelListener listener : l) { |
liste.getListe().getTableModel().addTableModelListener(listener); |
if (elementSheet.get(liste.getElement()) != null) { |
liste.getListe().addIListeActions(new MouseSheetXmlListeListener(liste.getElement(), elementSheet.get(liste.getElement())).getRowActions()); |
liste.getListe().addIListeActions(new MouseSheetXmlListeListener(elementSheet.get(liste.getElement())).getRowActions()); |
} |
} |
} |
462,11 → 462,6 |
}, 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); |
} |
} |
474,7 → 469,7 |
setRenderer(liste); |
if (elementSheet.get(liste.getElement()) != null) { |
liste.getListe().addIListeActions(new MouseSheetXmlListeListener(liste.getElement(), elementSheet.get(liste.getElement())).getRowActions()); |
liste.getListe().addIListeActions(new MouseSheetXmlListeListener(elementSheet.get(liste.getElement())).getRowActions()); |
} |
liste.getListe().getModel().setCellsEditable(false); |
liste.setOpaque(false); |
561,13 → 556,7 |
@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; |
} |
}); |
613,14 → 602,6 |
} |
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/reports/history/ui/HistoriqueClientFrame.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
57,7 → 57,6 |
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/supplychain/product/element/ArticleFournisseurSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
33,7 → 33,7 |
public ArticleFournisseurSQLElement() { |
super("ARTICLE_FOURNISSEUR", "un article fournisseur", "articles fournisseurs"); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, FicheArticleXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(FicheArticleXmlSheet.class).getRowActions()); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/EtatStockCreationPanel.java |
---|
File deleted |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
38,13 → 38,11 |
private final Date d; |
private final DBRoot root; |
private final SQLRowAccessor depot; |
private final boolean withAllProducts; |
public EtatStockSnapshotCreator(SQLRowAccessor depot, Date d, DBRoot root, boolean withAllProducts) { |
public EtatStockSnapshotCreator(SQLRowAccessor depot, Date d, DBRoot root) { |
this.d = d; |
this.depot = depot; |
this.root = root; |
this.withAllProducts = withAllProducts; |
} |
public void create() { |
75,12 → 73,12 |
Map<Integer, EtatStock> mapStockSnap = new HashMap<Integer, EtatStock>(); |
{ |
final SQLTable tableMvtStock = this.root.getTable("MOUVEMENT_STOCK"); |
final SQLTable tableStock = this.root.getTable("MOUVEMENT_STOCK"); |
final SQLRowValues vals = new SQLRowValues(tableMvtStock); |
final SQLRowValues vals = new SQLRowValues(tableStock); |
vals.put("QTE", null); |
if (tableMvtStock.contains("PRICE")) { |
if (tableStock.contains("PRICE")) { |
vals.put("PRICE", null); |
} |
vals.put("ID_ARTICLE", null); |
123,15 → 121,15 |
@Override |
public SQLSelect transformChecked(SQLSelect sel) { |
Where w = (new Where(tableMvtStock.getField("DATE"), "<=", d)); |
Where w = (new Where(tableStock.getField("DATE"), "<=", d)); |
if (dateDeb != null) { |
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("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("REEL"), "=", Boolean.TRUE)); |
w = w.and(new Where(sel.getJoin(tableMvtStock.getField("ID_STOCK")).getJoinedTable().getField("ID_DEPOT_STOCK"), "=", depot.getID())); |
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())); |
sel.setWhere(w); |
return sel; |
151,7 → 149,7 |
EtatStock et = mapStockSnap.get(foreignIDArt); |
et.setQte(et.getQte().add(new BigDecimal(rowVF.getFloat("QTE")))); |
BigDecimal bigDecimal = BigDecimal.ZERO; |
if (tableMvtStock.contains("PRICE")) { |
if (tableStock.contains("PRICE")) { |
bigDecimal = rowVF.getBigDecimal("PRICE"); |
} |
et.setPa(bigDecimal); |
159,58 → 157,6 |
} |
} |
// 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/StockSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
13,7 → 13,6 |
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; |
21,30 → 20,24 |
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.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
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; |
54,7 → 47,6 |
import javax.swing.AbstractAction; |
import javax.swing.JLabel; |
import javax.swing.JOptionPane; |
import javax.swing.JTextField; |
public class StockSQLElement extends ComptaSQLConfElement { |
61,34 → 53,20 |
public StockSQLElement() { |
super("STOCK", "un stock", "stocks"); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, FicheArticleXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(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"); |
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); |
PredicateRowAction cmd = new PredicateRowAction(new AbstractAction("Passer une commande") { |
@Override |
public void actionPerformed(ActionEvent e) { |
transfertCommande(IListe.get(e).getSelectedRowAccessors()); |
} |
}, true, false); |
cmd.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(cmd); |
} |
protected List<String> getListFields() { |
return Arrays.asList("ID_ARTICLE", "QTE_MIN", "QTE_TH", "QTE_REEL", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE", "ID_DEPOT_STOCK"); |
150,7 → 128,7 |
return rowStock; |
} |
public static SQLRowAccessor getStock(SQLRowAccessor rowValsSource) throws SQLException { |
public static SQLRowAccessor getStock(SQLRowAccessor rowValsSource) { |
SQLRowAccessor rowStock = null; |
final int idDepot; |
166,32 → 144,30 |
} |
idDepot = rowValsArt.getForeignID("ID_DEPOT_STOCK"); |
} |
final int idArticle = rowValsSource.getForeignID("ID_ARTICLE"); |
DBRoot root = rowValsSource.getTable().getDBRoot(); |
SQLTable stockTable = root.getTable("STOCK"); |
SQLTable stockTable = rowValsSource.getTable().getTable("STOCK"); |
SQLRowValues putRowValuesStock = new SQLRowValues(stockTable); |
putRowValuesStock.putNulls(stockTable.getTable().getFieldsName()); |
SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(putRowValuesStock); |
Where w = new Where(stockTable.getField("ID_DEPOT_STOCK"), "=", idDepot); |
Where w2 = new Where(stockTable.getField("ID_ARTICLE"), "=", idArticle); |
Where w = new Where(putRowValuesStock.getTable().getField("ID_DEPOT_STOCK"), "=", idDepot); |
Where w2 = new Where(putRowValuesStock.getTable().getField("ID_ARTICLE"), "=", rowValsSource.getForeignID("ID_ARTICLE")); |
Collection<SQLRowValues> rowValsResult = fetch.fetch(w.and(w2)); |
if (rowValsResult.isEmpty()) { |
SQLRowValues rowValsStock = new SQLRowValues(stockTable); |
rowValsStock.put("ID_ARTICLE", idArticle); |
rowValsStock.put("ID_ARTICLE", rowValsSource.getForeignID("ID_ARTICLE")); |
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); |
} |
} else if (rowValsResult.size() == 1) { |
rowStock = rowValsResult.iterator().next(); |
} else if (rowValsResult.size() > 1) { |
200,44 → 176,6 |
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) |
* |
333,63 → 271,7 |
}; |
} |
/** |
* 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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
17,10 → 17,8 |
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; |
28,14 → 26,10 |
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; |
44,22 → 38,17 |
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; |
66,8 → 55,6 |
import javax.swing.JOptionPane; |
import javax.swing.SwingUtilities; |
import org.apache.commons.dbutils.ResultSetHandler; |
public class MouvementStockSQLElement extends ComptaSQLConfElement { |
public MouvementStockSQLElement() { |
132,16 → 119,9 |
// 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"); |
158,7 → 138,7 |
float qte = rowStock.getFloat("QTE_REEL"); |
float qteMvt = rowMvtStock.getFloat("QTE"); |
SQLRowValues rowVals = new SQLRowValues(tableStock); |
SQLRowValues rowVals = new SQLRowValues(elementStock.getTable()); |
float qteNvlle; |
float qteNvlleEnAttenteRecept = rowStock.getFloat("QTE_RECEPT_ATTENTE"); |
193,7 → 173,7 |
try { |
rowVals.update(rowStock.getID()); |
SQLPreferences prefs = new SQLPreferences(root); |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
boolean gestionStockMin = prefs.getBoolean(GestionArticleGlobalPreferencePanel.WARNING_STOCK_MIN, true); |
if (!archive && gestionStockMin && rowStock.getObject("QTE_MIN") != null && qteNvlle < rowStock.getFloat("QTE_MIN")) { |
223,7 → 203,7 |
float qte = rowStock.getFloat("QTE_TH"); |
float qteMvt = rowMvtStock.getFloat("QTE"); |
SQLRowValues rowVals = new SQLRowValues(tableStock); |
SQLRowValues rowVals = new SQLRowValues(elementStock.getTable()); |
float qteNvlle; |
float qteNvlleEnAttenteRecept = rowStock.getFloat("QTE_RECEPT_ATTENTE"); |
341,9 → 321,6 |
for (int i = 0; i < model.getRowCount(); i++) { |
final SQLRowValues rowValsCmdElt = model.getRowValuesAt(i); |
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; |
350,7 → 327,6 |
break; |
} |
} |
} |
if (rowValsMatch != null) { |
int qte = rowValsMatch.getInt("QTE"); |
435,100 → 411,7 |
} |
} |
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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
92,8 → 92,7 |
@Override |
public void run() { |
// FIXME ajouter une barre de progression |
final InventaireFromEtatStockImporter impoter = new InventaireFromEtatStockImporter(depotElt.getDirectory().getElement("ARTICLE"), rowDepot); |
final InventaireFromEtatStockImporter impoter = new InventaireFromEtatStockImporter(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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
16,19 → 16,11 |
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; |
35,7 → 27,6 |
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; |
42,11 → 33,8 |
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>(); |
53,102 → 41,11 |
// 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 = this.root.findTable("ARTICLE"); |
final SQLTable table = Configuration.getInstance().getRoot().findTable("ARTICLE"); |
Map<String, SQLRowValues> articles = getArticles(); |
{ |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(table.getDBRoot().getTable("ARTICLE_DECLINAISON_COULEUR").getKey()); |
sel.addSelect(table.getDBRoot().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(table.getDBRoot().getTable("ARTICLE_DECLINAISON_TAILLE").getKey()); |
sel.addSelect(table.getDBRoot().getTable("ARTICLE_DECLINAISON_TAILLE").getField("NOM")); |
List<SQLRow> l = SQLRowListRSH.execute(sel); |
for (SQLRow sqlRow : l) { |
mapTaille.put(sqlRow.getString("NOM").trim(), sqlRow.getID()); |
} |
} |
fillArticles(); |
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); |
} |
} |
} |
} |
} |
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); |
} |
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"; |
} |
} |
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) { |
166,25 → 63,14 |
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(); |
String code = o.get(0).toString(); |
if (code.trim().length() == 0) { |
break; |
} |
final String stringQty = o.get(columnMapping.get(QTE)).toString(); |
final String stringQty = o.get(3).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); |
SQLRowValues match = articles.get(code); |
if (match != null) { |
SQLRowValues stockValues = new SQLRowValues(table.getTable("ETAT_STOCK_ELEMENT")); |
209,9 → 95,8 |
} |
etatStock.createEmptyUpdateRow().put("MONTANT_HA", total).commit(); |
} |
} |
public BigDecimal getPRC(SQLRowAccessor rowVals, int qty, Date d) { |
public BigDecimal getPRC(SQLRowValues 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); |
241,10 → 126,7 |
} |
} |
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 { |
private Map<String, SQLRowValues> getArticles() throws SQLException { |
final SQLTable table = Configuration.getInstance().getRoot().findTable("ARTICLE"); |
SQLRowValues graph = new SQLRowValues(table); |
graph.put("ID", null); |
253,8 → 135,6 |
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); |
262,110 → 142,24 |
artElt.put("QTE", null); |
artElt.put("QTE_UNITAIRE", null); |
artElt.put("ID_ARTICLE_PARENT", graph); |
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"); |
artElt.putRowValues("ID_ARTICLE").putNulls("ID", "CODE", "NOM").putRowValues("ID_STOCK").putNulls("QTE_TH", "QTE_REEL", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
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 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); |
} |
final String code = sqlRowValues.getString("CODE"); |
vals.put(code, 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/element/EtatStockSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
32,7 → 32,6 |
import java.awt.event.ActionEvent; |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.Date; |
import java.util.List; |
50,8 → 49,8 |
@Override |
public void actionPerformed(ActionEvent e) { |
PanelFrame frame = new PanelFrame(new EtatStockCreationPanel(getDirectory().getElement(DepotStockSQLElement.class)), "Création état de stock"); |
FrameUtil.showPacked(frame); |
EtatStockSnapshotCreator creator = new EtatStockSnapshotCreator(getTable().getTable("DEPOT_STOCK").getRow(DepotStockSQLElement.DEFAULT_ID), new Date(), getTable().getDBRoot()); |
creator.create(); |
} |
}, true); |
action.setPredicate(IListeEvent.createSelectionCountPredicate(0, Integer.MAX_VALUE)); |
80,7 → 79,7 |
EtatStockInventaireXmlSheet sheet = new EtatStockInventaireXmlSheet(IListe.get(e).getSelectedRow().asRow()); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, false, false, false, Collections.emptyList()); |
sheet.showPrintAndExport(true, false, false, false, false); |
} catch (Exception e1) { |
ExceptionHandler.handle("Erreur lors de la création de l'inventaire", e1); |
} |
98,7 → 97,7 |
FrameUtil.showPacked(frame); |
} |
}, true); |
action.setPredicate(IListeEvent.createSelectionCountPredicate(0, Integer.MAX_VALUE)); |
action.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
18,22 → 18,16 |
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; |
40,7 → 34,6 |
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; |
47,11 → 40,8 |
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 { |
59,107 → 49,18 |
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(SQLElement articleElt, SQLRowAccessor depot) { |
public InventaireFromEtatStockImporter(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 { |
final SQLTable table = root.findTable("ARTICLE"); |
final SQLTable tableArtElt = root.findTable("ARTICLE_ELEMENT"); |
// Récupération des couples articles/stocks existant |
fillArticles(); |
Map<String, Tuple2<SQLRowValues, SQLRowValues>> articles = getArticles(); |
// 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); |
} |
} |
} |
} |
} |
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"; |
} |
} |
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) { |
189,27 → 90,15 |
List<Object> o = m.getLineValuesAt(i); |
if (o.size() >= 5) { |
System.err.println(o); |
String code = o.get(columnMapping.get(CODE)).toString(); |
String code = o.get(1).toString(); |
if (code.trim().length() > 0) { |
final String stringQty = o.get(columnMapping.get(QTE)).toString(); |
final String stringQty = o.get(4).toString(); |
Double qty = stringQty.trim().length() == 0 ? 0 : Double.valueOf(stringQty); |
final String stringQtyOld = o.get(columnMapping.get(QTE_OPENCONCERTO)).toString(); |
final String stringQtyOld = o.get(3).toString(); |
float qtyOld = stringQtyOld.trim().length() == 0 ? 0 : Float.valueOf(stringQtyOld); |
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); |
Tuple2<SQLRowValues, SQLRowValues> match = findArticle(code, couleur, taille); |
Tuple2<SQLRowValues, SQLRowValues> match = articles.get(code); |
if (match != null) { |
SQLRowAccessor stockValues = match.get1(); |
285,12 → 174,11 |
for (String code : codeKits) { |
System.err.println(code); |
SQLRowValues rowValsKit = kits.get(code); |
StockItem item = new StockItem(rowValsKit, ProductComponent.findOrCreateStock(rowValsKit, depot)); |
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"), ProductComponent.findOrCreateStock(sqlRowValues.getForeign("ID_ARTICLE"), depot)), |
item.addItemComponent(new StockItemComponent(new StockItem(sqlRowValues.getForeign("ID_ARTICLE"), sqlRowValues.getForeign("ID_ARTICLE").getForeign("ID_STOCK")), |
sqlRowValues.getBigDecimal("QTE_UNITAIRE"), sqlRowValues.getInt("QTE"))); |
} |
} |
343,8 → 231,8 |
// checkMinPrice(rowVals, mapLastValidRows.get(qte)); |
// } |
// } |
} |
} |
private void checkMinPrice(SQLRow rowValsSuplierLastValid, SQLRow lastValidRow) { |
boolean update = false; |
421,29 → 309,18 |
// return result; |
} |
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 { |
private Map<String, Tuple2<SQLRowValues, SQLRowValues>> getArticles() 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("VIRTUEL", null); |
graph.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("ID", "NOM"); |
graph.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("ID", "NOM"); |
graph.put("NOM", null); |
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); |
451,17 → 328,11 |
artElt.put("QTE_UNITAIRE", null); |
artElt.put("ID_ARTICLE_PARENT", graph); |
final SQLRowValues articleParent = artElt.putRowValues("ID_ARTICLE"); |
articleParent.putNulls("ID", "CODE", "NOM", "VIRTUEL"); |
articleParent.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("ID", "NOM"); |
articleParent.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("ID", "NOM"); |
articleParent.putNulls("ID", "CODE", "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(); |
471,6 → 342,7 |
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"); |
482,25 → 354,11 |
rowValsStock = sqlRowValues2; |
} |
} |
// if (rowValsStock == null) { |
// rowValsStock = ProductComponent.findOrCreateStock(sqlRowValues, depot).asRowValues(); |
// } |
if (sqlRowValues.getBoolean("VIRTUEL")) { |
mapArticleVirtuel.put(sqlRowValues.getString("CODE"), Tuple2.create(sqlRowValues, rowValsStock)); |
if (rowValsStock == null) { |
rowValsStock = ProductComponent.findOrCreateStock(sqlRowValues, depot).asRowValues(); |
} |
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)); |
} |
vals.put(code, Tuple2.create(sqlRowValues, rowValsStock)); |
final Set<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT")); |
if (referentRows.size() == 0) { |
545,99 → 403,6 |
// } |
} |
} |
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/action/ListeDesMouvementsStockAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
18,13 → 18,8 |
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; |
37,40 → 32,14 |
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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
16,7 → 16,8 |
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.rights.DepotStockViewRightEditor; |
import org.openconcerto.erp.core.common.ui.ListeViewPanel; |
import org.openconcerto.erp.core.common.ui.PanelFrame; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.FieldPath; |
27,7 → 28,6 |
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,7 → 34,6 |
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; |
54,15 → 53,8 |
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"); |
} |
75,32 → 67,9 |
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) { |
ListeAddPanel panel = createPanel(eltStock, stockTable, sqlRow); |
tabs.add(sqlRow.getString("NOM"), panel); |
} |
} |
if (canViewAll && this.besoin) { |
tabs.insertTab("Global", null, createPanel(eltStock, stockTable, null), null, 0); |
} |
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"); |
} |
private ListeAddPanel createPanel(SQLElement eltStock, final SQLTable stockTable, final SQLRow sqlRow) { |
final SQLTableModelSourceOnline tableSource = eltStock.getTableSource(true); |
SQLTableModelColumn colStock; |
131,6 → 100,7 |
@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")); |
} |
143,11 → 113,7 |
@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); |
input.setWhere(new Where(input.getTable("STOCK").getField("ID_DEPOT_STOCK"), "=", sqlRow.getID())); |
return input; |
} |
}); |
166,6 → 132,14 |
c2.weightx = 0; |
c2.fill = GridBagConstraints.NONE; |
panel.add(total, c2); |
return panel; |
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"); |
} |
} |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
217,20 → 217,6 |
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/supplychain/credit/action/ListeDesAvoirsFournisseurAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
69,7 → 69,7 |
final IListFrame frame = new IListFrame(panel); |
frame.getPanel().setAddVisible(true); |
frame.getPanel().getListe().addIListeActions(new MouseSheetXmlListeListener(element, AvoirFournisseurXmlSheet.class).getRowActions()); |
frame.getPanel().getListe().addIListeActions(new MouseSheetXmlListeListener(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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
13,9 → 13,7 |
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; |
25,7 → 23,6 |
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; |
93,7 → 90,11 |
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"); |
185,7 → 186,7 |
final BigDecimal pHT, pTTC, totalHTLigne, totalTTCLigne; |
SQLRowAccessor taxeItem = rowItem.getForeign("ID_TAXE"); |
BigDecimal taxValue = new BigDecimal(taxeItem.getFloat("TAUX")).setScale(2, RoundingMode.HALF_UP); |
BigDecimal taxValue = new BigDecimal(taxeItem.getFloat("TAUX")).setScale(2); |
if (rowItem.getInt("NIVEAU") != 1) { |
pHT = BigDecimal.ZERO; |
pTTC = BigDecimal.ZERO; |
670,7 → 671,6 |
if (code == null || code.length() != 13) { |
return false; |
} |
try { |
int checkdigit = 0; |
for (int i = 1; i < 12; i += 2) { |
checkdigit += Integer.valueOf(code.substring(i, i + 1)); |
684,11 → 684,7 |
checkdigit = 10 - checkdigit; |
} |
return Integer.valueOf(code.substring(12, 13)).intValue() == checkdigit; |
} catch (Exception e) { |
// if not digits, parse error |
return false; |
} |
} |
private String resolveCountryCode(String pays) { |
if (pays == null || pays.trim().length() == 0) { |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
23,7 → 23,6 |
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; |
701,7 → 700,7 |
final JPanel panelPoids = new JPanel(new GridBagLayout()); |
GridBagConstraints cPoids = new DefaultGridBagConstraints(); |
cPoids.weightx = 0; |
panelPoids.add(new JLabel(getLabelFor("T_POIDS"), SwingConstants.RIGHT), cPoids); |
panelPoids.add(new JLabel(getLabelFor("T_POIDS")), cPoids); |
cPoids.weightx = 1; |
textPoidsTotal.setEnabled(false); |
textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT); |
729,48 → 728,14 |
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.HORIZONTAL; |
cPort.fill = GridBagConstraints.NONE; |
cPort.weightx = 0; |
// 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); |
panelPoids.add(new JLabel(getLabelFor("PORT_HT")), cPort); |
textPortHT.setHorizontalAlignment(JTextField.RIGHT); |
cPort.gridx++; |
cPort.weightx = 1; |
780,7 → 745,7 |
cPort.gridx = 0; |
cPort.weightx = 0; |
addRequiredSQLObject(comboTaxePort, "ID_TAXE_PORT"); |
panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT"), SwingConstants.RIGHT), cPort); |
panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT")), cPort); |
cPort.gridx++; |
cPort.weightx = 1; |
panelPoids.add(comboTaxePort, cPort); |
788,9 → 753,9 |
addSQLObject(textRemiseHT, "REMISE_HT"); |
cPort.gridy++; |
cPort.gridx = 0; |
cPort.fill = GridBagConstraints.HORIZONTAL; |
cPort.fill = GridBagConstraints.NONE; |
cPort.weightx = 0; |
panelPoids.add(new JLabel(getLabelFor("REMISE_HT"), SwingConstants.RIGHT), cPort); |
panelPoids.add(new JLabel(getLabelFor("REMISE_HT")), cPort); |
textRemiseHT.setHorizontalAlignment(JTextField.RIGHT); |
cPort.gridx++; |
cPort.weightx = 1; |
949,10 → 914,9 |
} |
// generation du document |
final SQLRow row = getTable().getRow(idCommande); |
final CommandeXmlSheet sheet = new CommandeXmlSheet(row); |
final CommandeXmlSheet sheet = new CommandeXmlSheet(getTable().getRow(idCommande)); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
// incrémentation du numéro auto |
if (NumerotationAutoSQLElement.getNextNumero(getElement().getClass()).equalsIgnoreCase(this.numeroUniqueCommande.getText().trim())) { |
970,8 → 934,6 |
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() { |
1038,10 → 1000,9 |
elt.updateStatus(getTable(), getTable().getTable("COMMANDE_ELEMENT"), getSelectedID()); |
// generation du document |
final SQLRow row = getTable().getRow(id); |
final CommandeXmlSheet sheet = new CommandeXmlSheet(row); |
final CommandeXmlSheet sheet = new CommandeXmlSheet(getTable().getRow(id)); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
} |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
805,14 → 805,14 |
// Création des articles |
this.table.createArticle(idFacture, this.getElement()); |
final SQLRow row = getTable().getRow(idFacture); |
new GenerationMvtFactureFournisseur(row); |
final SQLRow rowA = getTable().getRow(idFacture); |
new GenerationMvtFactureFournisseur(rowA); |
final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(row); |
final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(rowA); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
commitAvoir(null, row); |
commitAvoir(null, rowA); |
return idFacture; |
} |
850,7 → 850,7 |
} |
final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
commitAvoir(rowFactureOld, 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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
66,16 → 66,7 |
final List<SQLTableElement> list = new Vector<SQLTableElement>(); |
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); |
} |
} |
}; |
final SQLTableElement tableElementNom = new SQLTableElement(e.getTable().getField("NOM")); |
list.add(tableElementNom); |
if (e.getTable().contains("ID_TYPE_CMD")) { |
final SQLTableElement cat = new SQLTableElement(e.getTable().getField("ID_TYPE_CMD")); |
91,19 → 82,13 |
final SQLField fieldHA = e.getTable().getField("PA_HT"); |
final DeviseNumericCellEditor editorPAHT = new DeviseNumericCellEditor(fieldHA); |
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); |
} |
} |
}; |
final SQLTableElement pa = new SQLTableElement(fieldHA, BigDecimal.class, editorPAHT); |
DeviseTableCellRenderer renderer = new DeviseTableCellRenderer(); |
renderer.setHideZeroValue(true); |
pa.setRenderer(renderer); |
if (e.getTable().contains("ID_CATEGORIE_HEURE")) { |
pa.setEditable(false); |
} |
list.add(pa); |
final SQLField fieldPV = e.getTable().getField("PV_HT"); |
117,15 → 102,6 |
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/CommandeSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
17,7 → 17,6 |
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; |
35,9 → 34,6 |
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; |
46,12 → 42,9 |
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; |
61,9 → 54,6 |
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; |
79,7 → 69,7 |
getRowActions().add(actionAttachment); |
} |
getRowActions().addAll(new MouseSheetXmlListeListener(this, CommandeXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(CommandeXmlSheet.class).getRowActions()); |
// Transfert vers BR |
PredicateRowAction bonAction = new PredicateRowAction(new AbstractAction() { |
165,34 → 155,8 |
}, 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 |
protected List<String> getListFields() { |
final List<String> l = new ArrayList<>(8); |
229,22 → 193,6 |
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"); |
271,7 → 219,6 |
} |
}); |
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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
15,12 → 15,10 |
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; |
106,15 → 104,6 |
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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
22,7 → 22,6 |
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; |
33,7 → 32,6 |
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; |
54,7 → 52,7 |
public FactureFournisseurSQLElement() { |
super("FACTURE_FOURNISSEUR", "une facture fournisseur", "factures fournisseur"); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, FactureFournisseurXmlSheet.class); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(FactureFournisseurXmlSheet.class); |
mouseSheetXmlListeListener.setGenerateHeader(true); |
mouseSheetXmlListeListener.setShowHeader(true); |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions()); |
72,7 → 70,8 |
editFrame.setVisible(true); |
} |
}, true, "supplychain.invoice.clone") { |
public boolean enabledFor(List<SQLRowValues> l) { |
public boolean enabledFor(IListeEvent evt) { |
List<? extends SQLRowAccessor> l = evt.getSelectedRows(); |
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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
57,6 → 57,35 |
@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); |
// } |
} |
63,10 → 92,11 |
public DemandePrixSQLElement() { |
super("DEMANDE_PRIX"); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(this, DemandePrixSheetXML.class) { |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(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."; |
} |
91,6 → 121,16 |
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/order/element/DemandePrixSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
23,7 → 23,6 |
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; |
31,7 → 30,6 |
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; |
185,17 → 183,7 |
// 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++; |
482,10 → 470,9 |
// this.table.createArticle(idCommande, this.getElement()); |
// generation du document |
final SQLRow row = getTable().getRow(idCommande); |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(row); |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(getTable().getRow(idCommande)); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true, getElement(), row); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
// incrémentation du numéro auto |
if (NumerotationAutoSQLElement.getNextNumero(DemandePrixSQLElement.class).equalsIgnoreCase(this.field.getText().trim())) { |
535,10 → 522,9 |
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class); |
elt.updateStatus(getTable(), getTable().getTable("DEMANDE_PRIX_ELEMENT"), getSelectedID()); |
final SQLRow row = getTable().getRow(getSelectedID()); |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(row); |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(getTable().getRow(getSelectedID())); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true, getElement(), row); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
} |
546,15 → 532,6 |
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/receipt/element/CodeFournisseurSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
14,8 → 14,10 |
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; |
40,11 → 42,6 |
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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
51,10 → 51,6 |
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 { |
116,7 → 112,7 |
getRowActions().add(actionsTRFA); |
getRowActions().add(actionTRSimple); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, BonReceptionXmlSheet.class); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(BonReceptionXmlSheet.class); |
mouseSheetXmlListeListener.setGenerateHeader(true); |
mouseSheetXmlListeListener.setShowHeader(true); |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions()); |
230,37 → 226,4 |
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/receipt/component/BonReceptionSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
586,7 → 586,7 |
@Override |
public void run() { |
try { |
((BonReceptionSQLElement) getElement()).updateStock(idBonFinal); |
updateStock(idBonFinal); |
((BonReceptionSQLElement) getElement()).updateCmdElement(((BonReceptionSQLElement) getElement()).getCmdFrom(idBonFinal), idBonFinal); |
} catch (Exception e) { |
ExceptionHandler.handle("Update error", e); |
598,10 → 598,9 |
elt.updateStatus(getTable(), getTable().getTable("BON_RECEPTION_ELEMENT"), idBon); |
// generation du document |
final SQLRow row = getTable().getRow(idBonFinal); |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(row); |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(getTable().getRow(idBonFinal)); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
} catch (Exception e) { |
throw new IllegalStateException(e); |
672,16 → 671,6 |
} |
} |
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() { |
711,7 → 700,7 |
try { |
// Mise à jour du stock |
((BonReceptionSQLElement) getElement()).updateStock(id); |
updateStock(id); |
((BonReceptionSQLElement) getElement()).updateCmdElement(cmdFrom, id); |
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class); |
727,10 → 716,9 |
elt.updateStatus(getTable(), getTable().getTable("BON_RECEPTION_ELEMENT"), id); |
// generation du document |
final SQLRow row = getTable().getRow(id); |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(row); |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(getTable().getRow(id)); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
} |
} |
787,7 → 775,40 |
} |
} |
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); |
if (this.tableBonReliquatItem != null) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactItemTable.java.r30880 |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactItemTable.java.r25937 |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactItemTable.java.mine |
---|
File deleted |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
54,7 → 54,6 |
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; |
184,7 → 183,7 |
try { |
FicheRelanceSheet sheet = new FicheRelanceSheet(IListe.get(e).getSelectedRow().asRow().fetchNew(false)); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true, Collections.emptyList()); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
} catch (Exception ex) { |
ExceptionHandler.handle("Impression impossible", ex); |
} |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
110,7 → 110,6 |
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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
25,10 → 25,8 |
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; |
43,7 → 41,6 |
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; |
74,7 → 71,7 |
final SQLRowAccessor row = IListe.get(e).fetchSelectedRow(); |
FicheClientXmlSheet sheet = new FicheClientXmlSheet(row.asRow()); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true, Collections.emptyList()); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
} |
}, false, "customerrelationship.customer.info.create"); |
actionFicheClient.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
211,12 → 208,6 |
} |
@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/ClientNormalSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
24,7 → 24,6 |
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; |
40,7 → 39,6 |
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; |
744,13 → 742,6 |
} |
} |
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 = ""; |
812,10 → 803,6 |
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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
13,23 → 13,17 |
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; |
37,9 → 31,7 |
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; |
68,36 → 60,9 |
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); |
c.startTabGroupAfter("customerrelationship.customer.identifier"); |
105,19 → 70,11 |
} |
@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/finance/tax/element/TaxeSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
14,19 → 14,13 |
package org.openconcerto.erp.core.finance.tax.element; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.sales.product.element.TaxeCatComptableSQLElement; |
import org.openconcerto.erp.core.sales.product.ui.TaxeCategorieComptableTable; |
import org.openconcerto.erp.model.ISQLCompteSelector; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.BaseSQLComponent; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.model.SQLDataSource; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.request.UpdateBuilder; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.utils.SQLUtils; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
37,13 → 31,11 |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionListener; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.List; |
import javax.swing.AbstractAction; |
import javax.swing.JButton; |
import javax.swing.JLabel; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
113,8 → 105,6 |
public SQLComponent createComponent() { |
return new BaseSQLComponent(this) { |
TaxeCategorieComptableTable tableCatComptable = new TaxeCategorieComptableTable(getElement().getDirectory().getElement(TaxeCatComptableSQLElement.class)); |
@Override |
protected void addViews() { |
219,15 → 209,12 |
ISQLCompteSelector compteDedIntra = new ISQLCompteSelector(); |
this.add(compteDedIntra, c); |
// Spacer |
c.gridy++; |
c.gridx = 0; |
c.weighty = 1; |
c.weightx = 1; |
c.fill = GridBagConstraints.BOTH; |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.anchor = GridBagConstraints.NORTHWEST; |
this.add(new JPanel(), c); |
this.add(createCategorieComptablePanel(), c); |
this.addSQLObject(compteCol, "ID_COMPTE_PCE_COLLECTE"); |
this.addSQLObject(compteDed, "ID_COMPTE_PCE_DED"); |
this.addSQLObject(compteVente, "ID_COMPTE_PCE_VENTE"); |
238,104 → 225,6 |
this.addRequiredSQLObject(fieldNom, "NOM"); |
this.addRequiredSQLObject(fieldTaux, "TAUX"); |
} |
@Override |
public void select(SQLRowAccessor r) { |
super.select(r); |
if (r != null) { |
this.tableCatComptable.getRowValuesTable().insertFrom(r); |
} |
} |
@Override |
public int insert(SQLRow order) { |
int id = super.insert(order); |
this.tableCatComptable.updateField("ID_TAXE", id); |
return id; |
} |
@Override |
public void update() { |
super.update(); |
this.tableCatComptable.updateField("ID_TAXE", getSelectedID()); |
} |
protected JPanel createCategorieComptablePanel() { |
JPanel panel = new JPanel(new GridBagLayout()); |
panel.setOpaque(false); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
// Ajout catégorie |
c.gridwidth = 1; |
c.weightx = 0; |
c.gridy++; |
c.gridx = 0; |
panel.add(new JLabel("Ajouter la catégorie "), c); |
final ElementComboBox boxCat = new ElementComboBox(); |
boxCat.init(getDirectory().getElement("CATEGORIE_COMPTABLE")); |
c.gridx++; |
panel.add(boxCat, c); |
c.fill = GridBagConstraints.NONE; |
c.gridx++; |
JButton buttonAjouter = new JButton("Ajouter"); |
buttonAjouter.setOpaque(false); |
panel.add(buttonAjouter, c); |
c.gridx++; |
JButton buttonSupprimer = new JButton("Supprimer"); |
buttonSupprimer.setOpaque(false); |
panel.add(buttonSupprimer, c); |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
c.gridy++; |
c.gridx = 0; |
c.fill = GridBagConstraints.BOTH; |
this.tableCatComptable.setOpaque(false); |
panel.add(this.tableCatComptable, c); |
// Listeners |
buttonAjouter.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
SQLRow rowCat = boxCat.getSelectedRow(); |
if (rowCat == null || rowCat.isUndefined()) { |
return; |
} |
int nbRows = tableCatComptable.getModel().getRowCount(); |
for (int i = 0; i < nbRows; i++) { |
SQLRowValues rowVals = tableCatComptable.getModel().getRowValuesAt(i); |
int idTarif = Integer.parseInt(rowVals.getObject("ID_CATEGORIE_COMPTABLE").toString()); |
if (idTarif == rowCat.getID()) { |
JOptionPane.showMessageDialog(null, "Impossible d'ajouter.\nLa catégorie est déjà présente dans la liste!"); |
return; |
} |
} |
SQLRowValues rowVals = new SQLRowValues(Configuration.getInstance().getBase().getTable("TAXE_CATEGORIE_COMPTABLE")); |
if (getSelectedID() > 1) { |
rowVals.put("ID_TAXE", getSelectedID()); |
} |
rowVals.put("ID_CATEGORIE_COMPTABLE", rowCat.getID()); |
tableCatComptable.getModel().addRow(rowVals); |
} |
}); |
buttonSupprimer.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
tableCatComptable.removeSelectedRow(); |
} |
}); |
return panel; |
} |
}; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/tax/action/ReportingEcoContributionPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
26,7 → 26,6 |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.concurrent.ExecutionException; |
import javax.swing.AbstractAction; |
77,7 → 76,7 |
} catch (ExecutionException exn) { |
exn.printStackTrace(); |
} |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
sheet.showPrintAndExport(true, false, false); |
}; |
}.start(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/tax/action/ReportingTaxeComplementairePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
26,7 → 26,6 |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.concurrent.ExecutionException; |
import javax.swing.AbstractAction; |
77,7 → 76,7 |
} catch (ExecutionException exn) { |
exn.printStackTrace(); |
} |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
sheet.showPrintAndExport(true, false, false); |
}; |
}.start(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/component/EncaisserMontantSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
17,7 → 17,6 |
import org.openconcerto.erp.core.common.ui.DeviseField; |
import org.openconcerto.erp.core.finance.accounting.element.MouvementSQLElement; |
import org.openconcerto.erp.core.finance.payment.element.EncaisserMontantSQLElement; |
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement; |
import org.openconcerto.erp.core.finance.payment.ui.EncaisseMontantTable; |
import org.openconcerto.erp.preferences.ModeReglementDefautPrefPanel; |
import org.openconcerto.sql.Configuration; |
95,7 → 94,6 |
MouvementSQLElement element = getElement().getDirectory().getElement(MouvementSQLElement.class); |
SQLRowValues row1 = model.getRowValuesAt(0); |
if (row1.getObject("ID_MOUVEMENT_ECHEANCE") != null && !row1.isForeignEmpty("ID_MOUVEMENT_ECHEANCE")) { |
final int idScr = element.getSourceId(row1.getForeignID("ID_MOUVEMENT_ECHEANCE")); |
SQLTable tableMvt = element.getTable(); |
112,10 → 110,8 |
if (rowModeRegl != null) { |
System.err.println("Set mode de règlement"); |
int idTypeRegl = rowModeRegl.getInt("ID_TYPE_REGLEMENT"); |
SQLRowValues rowVals = new SQLRowValues(rowModeRegl.getTable()); |
if (idTypeRegl == TypeReglementSQLElement.VIREMENT || rowModeRegl.getForeign("ID_TYPE_REGLEMENT").getBoolean("ECHEANCE")) { |
idTypeRegl = TypeReglementSQLElement.VIREMENT; |
} |
SQLTable tableModeRegl = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT").getTable(); |
SQLRowValues rowVals = new SQLRowValues(tableModeRegl); |
rowVals.put("ID_TYPE_REGLEMENT", idTypeRegl); |
rowVals.put("COMPTANT", Boolean.TRUE); |
rowVals.put("AJOURS", 0); |
200,9 → 196,6 |
final ElementComboBox comboD = new ElementComboBox(); |
this.addSQLObject(comboD, "ID_DEVIS"); |
final ElementComboBox comboc = new ElementComboBox(); |
this.addSQLObject(comboc, "ID_COMMANDE_CLIENT"); |
// Nom |
c.gridy++; |
c.gridx = 0; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/component/ModeDeReglementSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
322,9 → 322,9 |
this.panelEcheance.add(new JLabel("A"), c); |
c.gridx++; |
c.gridwidth = 1; |
this.comboA.setMinimumSize(new Dimension(80, this.comboA.getMinimumSize().height)); |
this.comboA.setPreferredSize(new Dimension(80, this.comboA.getMinimumSize().height)); |
this.comboA.setMaximumSize(new Dimension(80, this.comboA.getMinimumSize().height)); |
this.comboA.setMinimumSize(new Dimension(60, this.comboA.getMinimumSize().height)); |
this.comboA.setPreferredSize(new Dimension(60, this.comboA.getMinimumSize().height)); |
this.comboA.setMaximumSize(new Dimension(60, this.comboA.getMinimumSize().height)); |
this.comboA.addValueListener(new PropertyChangeListener() { |
@Override |
367,9 → 367,9 |
this.panelEcheance.add(this.buttonLe, c); |
c.gridx++; |
this.comboLe.setMinimumSize(new Dimension(80, this.comboLe.getMinimumSize().height)); |
this.comboLe.setPreferredSize(new Dimension(80, this.comboLe.getMinimumSize().height)); |
this.comboLe.setMaximumSize(new Dimension(80, this.comboLe.getMinimumSize().height)); |
this.comboLe.setMinimumSize(new Dimension(60, this.comboLe.getMinimumSize().height)); |
this.comboLe.setPreferredSize(new Dimension(60, this.comboLe.getMinimumSize().height)); |
this.comboLe.setMaximumSize(new Dimension(60, this.comboLe.getMinimumSize().height)); |
this.comboLe.addValueListener(new PropertyChangeListener() { |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/element/DepotChequeSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
34,7 → 34,7 |
public DepotChequeSQLElement() { |
super("DEPOT_CHEQUE", "un dépot de chèque", "dépots de chèque"); |
MouseSheetXmlListeListener listener = new MouseSheetXmlListeListener(this, DepotChequeXmlSheet.class); |
MouseSheetXmlListeListener listener = new MouseSheetXmlListeListener(DepotChequeXmlSheet.class); |
getRowActions().addAll(listener.getRowActions()); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/element/ChequeAEncaisserSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
33,7 → 33,6 |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.Date; |
import java.util.List; |
82,7 → 81,7 |
public void print(final List<Integer> listeCheque, final boolean preview, final Date d) { |
ReleveChequeSheet sheet = new ReleveChequeSheet(listeCheque, d, preview); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true, Collections.emptyList()); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
} |
@Override |
108,6 → 107,7 |
} |
l.add("MONTANT"); |
final SQLTable mvtT = getTable().getForeignTable("ID_MOUVEMENT"); |
showAs.show(mvtT, "ID_PIECE"); |
showAs.show(mvtT.getForeignTable("ID_PIECE"), "NOM"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/element/EncaisserMontantSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
72,7 → 72,6 |
public void actionPerformed(ActionEvent e) { |
final SQLRow selRow = IListe.get(e).getSelectedRow().asRow(); |
if (selRow.getBoolean("ACOMPTE")) { |
if (!selRow.isForeignEmpty("ID_DEVIS")) { |
int idDevis = selRow.getForeignID("ID_DEVIS"); |
try { |
archive(selRow.getID()); |
83,20 → 82,8 |
e1.printStackTrace(); |
ExceptionHandler.handle("Erreur lors de l'annulation de l'acompte!", e1); |
} |
} else if (!selRow.isForeignEmpty("ID_COMMANDE_CLIENT")) { |
int idDevis = selRow.getForeignID("ID_COMMANDE_CLIENT"); |
try { |
archive(selRow.getID()); |
String up = "UPDATE " + getTable().getTable("COMMANDE_CLIENT").getSQLName().quote() + " set \"T_ACOMPTE\"=(SELECT COALESCE(SUM(\"MONTANT\"),0) from " |
+ getTable().getSQLName().quote() + " where \"ID_COMMANDE_CLIENT\"=" + idDevis + " AND \"ARCHIVE\"=0) where \"ID\"=" + idDevis; |
getTable().getDBSystemRoot().getDataSource().execute(up); |
} catch (SQLException e1) { |
e1.printStackTrace(); |
ExceptionHandler.handle("Erreur lors de l'annulation de l'acompte!", e1); |
} |
} |
} |
} |
}, false); |
actionClient.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(actionClient); |
131,10 → 118,7 |
@Override |
public Set<String> getReadOnlyFields() { |
Set<String> s = new HashSet<>(); |
s.add("ACOMPTE"); |
s.add("ID_CLIENT"); |
return s; |
return Collections.singleton("ID_CLIENT"); |
} |
@Override |
175,47 → 159,22 |
// On rétablit les échéances |
for (SQLRow row : trees.getRows()) { |
for (SQLRow rowEncaisseItems : row.getReferentRows(row.getTable().getTable("ENCAISSER_MONTANT_ELEMENT").getField("ID_ENCAISSER_MONTANT"))) { |
for (SQLRow rowEncaisse : row.getReferentRows()) { |
SQLRow rowEch = rowEncaisseItems.getForeignRow("ID_ECHEANCE_CLIENT"); |
SQLRow rowEch = rowEncaisse.getForeignRow("ID_ECHEANCE_CLIENT"); |
// SI une echeance est associée (paiement non comptant) |
if (rowEch.getID() > 1) { |
SQLRowValues rowVals = rowEch.createEmptyUpdateRow(); |
rowVals.put("REGLE", Boolean.FALSE); |
if (rowEch.getBoolean("REGLE")) { |
rowVals.put("MONTANT", rowEncaisseItems.getLong("MONTANT_REGLE")); |
rowVals.put("MONTANT", rowEncaisse.getLong("MONTANT_REGLE")); |
} else { |
rowVals.put("MONTANT", rowEch.getLong("MONTANT") + rowEncaisseItems.getLong("MONTANT_REGLE")); |
rowVals.put("MONTANT", rowEch.getLong("MONTANT") + rowEncaisse.getLong("MONTANT_REGLE")); |
} |
rowVals.update(); |
} |
Configuration.getInstance().getDirectory().getElement(rowEncaisseItems.getTable()).archive(rowEncaisseItems); |
Configuration.getInstance().getDirectory().getElement(rowEncaisse.getTable()).archive(rowEncaisse); |
} |
if (row.getBoolean("ACOMPTE")) { |
if (!row.isForeignEmpty("ID_DEVIS")) { |
int idDevis = row.getForeignID("ID_DEVIS"); |
try { |
archive(row.getID()); |
String up = "UPDATE " + getTable().getTable("DEVIS").getSQLName().quote() + " set \"T_ACOMPTE\"=(SELECT COALESCE(SUM(\"MONTANT\"),0) from " + getTable().getSQLName().quote() |
+ " where \"ID_DEVIS\"=" + idDevis + " AND \"ARCHIVE\"=0) where \"ID_DEVIS\"=" + idDevis; |
getTable().getDBSystemRoot().getDataSource().execute(up); |
} catch (SQLException e1) { |
e1.printStackTrace(); |
ExceptionHandler.handle("Erreur lors de l'annulation de l'acompte!", e1); |
} |
} else if (!row.isForeignEmpty("ID_COMMANDE_CLIENT")) { |
int idDevis = row.getForeignID("ID_COMMANDE_CLIENT"); |
try { |
archive(row.getID()); |
String up = "UPDATE " + getTable().getTable("COMMANDE_CLIENT").getSQLName().quote() + " set \"T_ACOMPTE\"=(SELECT COALESCE(SUM(\"MONTANT\"),0) from " |
+ getTable().getSQLName().quote() + " where \"ID_COMMANDE_CLIENT\"=" + idDevis + " AND \"ARCHIVE\"=0) where \"ID\"=" + idDevis; |
getTable().getDBSystemRoot().getDataSource().execute(up); |
} catch (SQLException e1) { |
e1.printStackTrace(); |
ExceptionHandler.handle("Erreur lors de l'annulation de l'acompte!", e1); |
} |
} |
} |
// On supprime les mouvements |
SQLSelect sel = new SQLSelect(getTable().getBase()); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/action/ListeDesEncaissementsAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
56,7 → 56,7 |
if (source == this.buttonEffacer) { |
List<SQLRowValues> rowValsSel = this.getListe().getSelectedRows(); |
if ((rowValsSel.size() == 1 && rowValsSel.get(0).getBoolean("ACOMPTE")) || isEncaissementEditable(rowValsSel, "effacer")) { |
if (isEncaissementEditable(rowValsSel, "effacer")) { |
super.handleAction(source, evt); |
} |
} else if (source == this.buttonModifier) { |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
636,12 → 636,11 |
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); |
648,9 → 647,29 |
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()) { |
/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/GrandLivrePDF.java |
---|
File deleted |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
433,8 → 433,9 |
} |
} |
if (this.nbPage < 1) { |
this.nbPage = 1; |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
} |
} |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
13,22 → 13,19 |
package org.openconcerto.erp.core.finance.accounting.report; |
import org.openconcerto.erp.generationDoc.TemplateManager; |
import org.openconcerto.ui.preferences.TemplateProps; |
import static org.openconcerto.task.config.ComptaBasePropsConfiguration.getStreamStatic; |
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; |
61,7 → 58,7 |
} |
PdfGenerator(String fileNameIn, String fileNameOut, String directoryOut) { |
this.fileNameIn = fileNameIn; |
this.fileNameIn = "/Configuration/Template/PDF/" + fileNameIn; |
this.fileNameOut = fileNameOut; |
this.directoryOut = new File(directoryOut, String.valueOf(Calendar.getInstance().get(Calendar.YEAR))); |
} |
78,7 → 75,7 |
this.cb.endText(); |
this.document.close(); |
} catch (FileNotFoundException e) { |
JOptionPane.showMessageDialog(null, "Impossible de générer le fichier.\nModèle PDF non trouvé : " + e.getMessage()); |
ExceptionHandler.handle("Impossible de générer le fichier. \n" + e, e); |
} |
} |
88,31 → 85,8 |
PdfReader reader = null; |
PdfWriter writer = null; |
try { |
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); |
reader = new PdfReader(getStreamStatic(this.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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
24,7 → 24,6 |
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; |
187,13 → 186,9 |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
final File generatedFile = p.getGeneratedFile(); |
if (generatedFile != null) { |
Gestion.openPDF(generatedFile); |
} else { |
Gestion.openPDF(p.getGeneratedFile()); |
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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
112,9 → 112,6 |
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/Map2033A.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
22,7 → 22,6 |
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; |
187,7 → 186,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(270, 275, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(2761, 2761, 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.sommeCompteFils("27682", this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(27684, 27685, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.sommeCompteFils("27688", this.dateDebut, this.dateFin); |
686,11 → 685,10 |
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("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.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 |
876,13 → 874,9 |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
final File generatedFile = p.getGeneratedFile(); |
if (generatedFile != null) { |
Gestion.openPDF(generatedFile); |
} else { |
Gestion.openPDF(p.getGeneratedFile()); |
Map2033A.this.bar.setValue(100); |
} |
} |
}); |
} |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
462,9 → 462,9 |
} |
if (this.nbPage < 1) { |
this.nbPage = 1; |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
} |
Date end = new Date(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/Map2033B.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
22,7 → 22,6 |
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; |
388,7 → 387,8 |
* CHARGES FINANCIERES |
******************************************************************************************/ |
// 294 SommeSolde( 66, 66* )+SommeSolde( 686, 686* ) |
long v294 = this.sommeCompte.soldeCompte(660, 669, true, this.dateDeb, this.dateFin) + this.sommeCompte.soldeCompte(686, 686, true, this.dateDeb, this.dateFin); |
long v294 = this.sommeCompte.soldeCompte(661, 661, true, this.dateDeb, this.dateFin) + this.sommeCompte.soldeCompte(686, 686, true, this.dateDeb, this.dateFin) |
+ this.sommeCompte.soldeCompte(664, 668, true, this.dateDeb, this.dateFin); |
this.m.put("PCHARGES3.23", GestionDevise.currencyToString(v294, false)); |
// 246 |
440,7 → 440,7 |
this.m.put("T1.41", GestionDevise.currencyToString(v374, false)); |
// 378 SommeSoldeCredit( 44566 ) |
long v378 = this.sommeCompte.soldeCompteDebiteur(4456, 4456, true, this.dateDeb, this.dateFin); |
long v378 = this.sommeCompte.soldeCompteDebiteur(44566, 44566, true, this.dateDeb, this.dateFin); |
this.m.put("T1.42", GestionDevise.currencyToString(v378, false)); |
SwingUtilities.invokeLater(new Runnable() { |
508,13 → 508,9 |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
final File generatedFile = p.getGeneratedFile(); |
if (generatedFile != null) { |
Gestion.openPDF(generatedFile); |
} else { |
Gestion.openPDF(p.getGeneratedFile()); |
Map2033B.this.bar.setValue(100); |
} |
} |
}); |
} |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
279,9 → 279,9 |
this.nbPage++; |
} |
if (this.nbPage < 1) { |
this.nbPage = 1; |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
} |
} |
} |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
34,7 → 34,6 |
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; |
114,7 → 113,7 |
VentilationAnalytiqueSheetXML sheet = new VentilationAnalytiqueSheetXML(dateDeb.getDate(), dateEnd.getDate(), poste); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
sheet.showPrintAndExport(true, false, false); |
} catch (InterruptedException e) { |
// TODO Auto-generated catch block |
e.printStackTrace(); |
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
27,7 → 27,6 |
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; |
75,7 → 74,7 |
RepartitionAnalytiqueSheetXML sheet = new RepartitionAnalytiqueSheetXML(dateDeb.getDate(), dateEnd.getDate()); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
sheet.showPrintAndExport(true, false, false); |
} catch (InterruptedException e) { |
e.printStackTrace(); |
} catch (ExecutionException e) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/action/ImportEcritureRImportAction.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/action/ImpressionGrandLivreAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
29,7 → 29,7 |
@Override |
public JFrame createFrame() { |
final PanelFrame panelFrame = new PanelFrame(new ImpressionGrandLivrePanel(), "Grand livre"); |
final PanelFrame panelFrame = new PanelFrame(new ImpressionGrandLivrePanel(), "Impression du grand livre"); |
return panelFrame; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ImportEcritureRImportPanel.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/GenerationPointagePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
27,7 → 27,6 |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.util.Calendar; |
import java.util.Collections; |
import javax.swing.JButton; |
import javax.swing.JFrame; |
100,7 → 99,7 |
int year = Integer.valueOf(this.spinYear.getValue().toString()); |
PointageXmlSheet sheet = new PointageXmlSheet(mois, year); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true, Collections.emptyList()); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
} else { |
if (e.getSource() == this.close) { |
((JFrame) SwingUtilities.getRoot(this)).dispose(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/GrandLivrePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
203,8 → 203,10 |
String req = sel.asString() + " GROUP BY \"COMPTE_PCE\".\"ID\",\"COMPTE_PCE\".\"NUMERO\",\"COMPTE_PCE\".\"NOM\" ORDER BY \"COMPTE_PCE\".\"NUMERO\""; |
System.out.println(req); |
List myList = (List) base.getDataSource().execute(req, new ArrayListHandler()); |
Object ob = base.getDataSource().execute(req, new ArrayListHandler()); |
List myList = (List) ob; |
JLabel labelTotalClasse = new JLabel(); |
labelTotalClasse.setOpaque(false); |
if (!myList.isEmpty()) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ImpressionJournalPayePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
17,7 → 17,6 |
import org.openconcerto.utils.ExceptionHandler; |
import java.awt.event.ActionEvent; |
import java.util.Collections; |
public class ImpressionJournalPayePanel extends ImpressionPayePanel { |
29,7 → 28,7 |
final JournalPaieXmlSheet bSheet = new JournalPaieXmlSheet(selMoisDeb.getSelectedId(), selMoisEnd.getSelectedId(), Integer.valueOf(textAnnee.getText())); |
try { |
bSheet.createDocument(); |
bSheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
bSheet.showPrintAndExport(true, false, false); |
} catch (Exception originalExn) { |
ExceptionHandler.handle("Erreur lors de l'impression du journal de paye", originalExn); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/LettragePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
139,8 → 139,11 |
this.selCompte = new ISQLCompteSelector(); |
SQLElement eltCpt = directory.getElement("COMPTE_PCE"); |
final ComboSQLRequest createComboRequest = eltCpt.createComboRequest(); |
Where w = createTierWhere(eltCpt); |
createComboRequest.setWhere(w); |
String function = "REGEXP"; |
if (Configuration.getInstance().getBase().getServer().getSQLSystem() == SQLSystem.POSTGRESQL) { |
function = "~"; |
} |
createComboRequest.setWhere(new Where(eltCpt.getTable().getField("NUMERO"), function, "^4.*$")); |
this.selCompte.init(eltCpt, createComboRequest); |
this.selCompte.setValue(idCompte); |
149,22 → 152,6 |
c.gridwidth = GridBagConstraints.REMAINDER; |
this.add(this.selCompte, c); |
c.gridx = 0; |
c.gridy++; |
final JCheckBox boxLimitCompteTier = new JCheckBox("Limiter aux comptes de classe 4"); |
boxLimitCompteTier.setSelected(true); |
boxLimitCompteTier.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
if (boxLimitCompteTier.isSelected()) { |
selCompte.getRequest().setWhere(w); |
} else { |
selCompte.getRequest().setWhere(null); |
} |
} |
}); |
this.add(boxLimitCompteTier, c); |
c.gridwidth = 1; |
// Gestion du lettrage |
674,7 → 661,7 |
}); |
// Changement de compte |
this.selCompte.addModelListener("wantedID", new PropertyChangeListener() { |
this.selCompte.addValueListener(new PropertyChangeListener() { |
public void propertyChange(PropertyChangeEvent evt) { |
changeListRequest(); |
740,16 → 727,6 |
return Configuration.getInstance().getDirectory().getElement(NumerotationAutoSQLElement.class).getNextCodeLettragePartiel(); |
} |
private Where createTierWhere(final SQLElement eltCpt) { |
String function = "REGEXP"; |
if (eltCpt.getTable().getBase().getServer().getSQLSystem() == SQLSystem.POSTGRESQL) { |
function = "~"; |
} |
Where w = new Where(eltCpt.getTable().getField("NUMERO"), function, "^4.*$"); |
return w; |
} |
private String getNextCodeLettrage() { |
return Configuration.getInstance().getDirectory().getElement(NumerotationAutoSQLElement.class).getNextCodeLettrage(); |
} |
1017,7 → 994,7 |
* sélection |
*/ |
private void changeListRequest() { |
Object idCpt = this.selCompte.getWantedID(); |
Object idCpt = this.selCompte.getSelectedId(); |
SQLRow row = this.tableComptePCE.getRow(Integer.valueOf(idCpt.toString())); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ImportEcritureFECPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
47,7 → 47,7 |
super(new GridBagLayout()); |
JLabel label = new JLabel("Import depuis un fichier au format FEC."); |
final JButton button = new JButton("Sélectionnez le ficher"); |
final JButton button = new JButton("Sélectionner le ficher"); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
c.gridwidth = 2; |
this.add(label, c); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ImpressionGrandLivrePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
15,7 → 15,7 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.config.Gestion; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivrePDF; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivreSheet; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivreSheetXML; |
import org.openconcerto.erp.generationDoc.SpreadSheetGeneratorListener; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
25,8 → 25,6 |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.JDate; |
import org.openconcerto.ui.JLabelBold; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.FileUtils; |
import java.awt.FlowLayout; |
import java.awt.GridBagConstraints; |
35,18 → 33,16 |
import java.awt.event.ActionListener; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.io.File; |
import java.io.IOException; |
import java.text.SimpleDateFormat; |
import java.util.Date; |
import java.util.concurrent.ExecutionException; |
import javax.swing.AbstractAction; |
import javax.swing.ButtonGroup; |
import javax.swing.JButton; |
import javax.swing.JCheckBox; |
import javax.swing.JFileChooser; |
import javax.swing.JFrame; |
import javax.swing.JLabel; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
import javax.swing.JProgressBar; |
import javax.swing.JRadioButton; |
58,15 → 54,13 |
public class ImpressionGrandLivrePanel extends JPanel implements SpreadSheetGeneratorListener { |
private final JDate dateDeb; |
private final JDate dateEnd; |
private JButton validPDF; |
private JButton validODS; |
private final JDate dateDeb, dateEnd; |
private JButton valid; |
private JButton annul; |
private JCheckBox checkImpr; |
private JCheckBox checkVisu; |
private JTextField compteDeb, compteEnd; |
private int mode = GrandLivrePDF.MODEALL; |
private int mode = GrandLivreSheet.MODEALL; |
private JProgressBar bar = new JProgressBar(0, 3); |
public ImpressionGrandLivrePanel() { |
73,9 → 67,8 |
this.setLayout(new GridBagLayout()); |
final GridBagConstraints c = new DefaultGridBagConstraints(); |
final ComptaPropsConfiguration comptaPropsConfiguration = (ComptaPropsConfiguration) Configuration.getInstance(); |
SQLRow rowSociete = comptaPropsConfiguration.getRowSociete(); |
SQLRow rowExercice = comptaPropsConfiguration.getBase().getTable("EXERCICE_COMMON").getRow(rowSociete.getInt("ID_EXERCICE_COMMON")); |
SQLRow rowSociete = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete(); |
SQLRow rowExercice = Configuration.getInstance().getBase().getTable("EXERCICE_COMMON").getRow(rowSociete.getInt("ID_EXERCICE_COMMON")); |
this.dateDeb = new JDate(); |
this.dateEnd = new JDate(); |
84,7 → 77,7 |
c.weightx = 0; |
this.add(new JLabel("Période du", SwingConstants.RIGHT), c); |
c.gridx++; |
c.weightx = 0; |
c.weightx = 1; |
this.add(this.dateDeb, c); |
// Chargement des valeurs par défaut |
String valueDateDeb = DefaultNXProps.getInstance().getStringProperty("GrandLivreDateDeb"); |
171,25 → 164,25 |
// Radio mode |
JRadioButton radioAll = new JRadioButton(new AbstractAction("Toutes") { |
public void actionPerformed(ActionEvent e) { |
mode = GrandLivrePDF.MODEALL; |
mode = GrandLivreSheet.MODEALL; |
} |
}); |
JRadioButton radioLettree = new JRadioButton(new AbstractAction("Lettrées") { |
public void actionPerformed(ActionEvent e) { |
mode = GrandLivrePDF.MODELETTREE; |
mode = GrandLivreSheet.MODELETTREE; |
} |
}); |
JRadioButton radioNonLettree = new JRadioButton(new AbstractAction("Non lettrées") { |
public void actionPerformed(ActionEvent e) { |
mode = GrandLivrePDF.MODENONLETTREE_ALL; |
mode = GrandLivreSheet.MODENONLETTREE_ALL; |
} |
}); |
JRadioButton radioNonLettreePeridod = new JRadioButton(new AbstractAction("Non lettrées sur la période") { |
public void actionPerformed(ActionEvent e) { |
mode = GrandLivrePDF.MODENONLETTREE_PERIODE; |
mode = GrandLivreSheet.MODENONLETTREE_PERIODE; |
} |
}); |
232,13 → 225,17 |
this.bar.setStringPainted(true); |
this.add(this.bar, c); |
this.validPDF = new JButton("PDF"); |
this.validODS = new JButton("Tableur"); |
this.valid = new JButton("Valider"); |
this.annul = new JButton("Fermer"); |
this.checkImpr = new JCheckBox("Impression"); |
this.checkVisu = new JCheckBox("Visualisation"); |
// OK, Cancel |
// Print & View |
final JPanel panelPrintView = new JPanel(new FlowLayout(FlowLayout.LEADING, 2, 0)); |
panelPrintView.add(this.checkImpr); |
panelPrintView.add(this.checkVisu); |
this.checkImpr.setSelected(true); |
c.gridx = 0; |
c.gridy++; |
c.gridwidth = 4; |
246,98 → 243,68 |
c.weighty = 1; |
c.fill = GridBagConstraints.NONE; |
c.anchor = GridBagConstraints.SOUTHEAST; |
this.add(panelPrintView, c); |
// OK, Cancel |
c.gridy++; |
c.weightx = 0; |
c.weighty = 0; |
JPanel panelOkCancel = new JPanel(); |
panelOkCancel.add(this.validODS); |
panelOkCancel.add(this.validPDF); |
panelOkCancel.add(this.valid); |
panelOkCancel.add(this.annul); |
this.add(panelOkCancel, c); |
this.checkValidity(); |
this.validPDF.addActionListener(new ActionListener() { |
this.valid.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
JFileChooser chooser = new JFileChooser(); |
SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy"); |
chooser.setSelectedFile(new File("Grand livre " + df.format(new Date()) + ".pdf")); |
int r = chooser.showSaveDialog(ImpressionGrandLivrePanel.this); |
if (r == JFileChooser.APPROVE_OPTION) { |
validPDF.setEnabled(false); |
validODS.setEnabled(false); |
valid.setEnabled(false); |
bar.setString(null); |
bar.setValue(0); |
// un fichier a été choisi (sortie par OK) |
// nom du fichier choisi |
final File file = chooser.getSelectedFile(); |
bar.setValue(1); |
new Thread(new Runnable() { |
public void run() { |
final GrandLivreSheetXML bSheet = new GrandLivreSheetXML(dateDeb.getDate(), dateEnd.getDate(), compteDeb.getText().trim(), compteEnd.getText().trim(), mode, |
boxCumulsAnts.isSelected(), !boxCompteSolde.isSelected(), boxCentralClient.isSelected(), boxCentralFourn.isSelected(), comboJrnl.getSelectedId()); |
try { |
final GrandLivrePDF bSheet = new GrandLivrePDF(comptaPropsConfiguration, dateDeb.getDate(), dateEnd.getDate(), compteDeb.getText().trim(), compteEnd.getText().trim(), |
mode, boxCumulsAnts.isSelected(), !boxCompteSolde.isSelected(), boxCentralClient.isSelected(), boxCentralFourn.isSelected(), comboJrnl.getSelectedId()); |
bar.setValue(1); |
bSheet.getGeneratedPDFFile(file); |
bar.setValue(2); |
SwingUtilities.invokeLater(new Runnable() { |
bSheet.createDocument(); |
@Override |
public void run() { |
Gestion.openPDF(file); |
} |
}); |
if (bSheet.getSize() == 0) { |
JOptionPane.showMessageDialog(ImpressionGrandLivrePanel.this, "Aucune écriture trouvée"); |
} catch (Exception exn) { |
ExceptionHandler.handle("Erreur de génération du grand livre", exn); |
exn.printStackTrace(); |
} finally { |
taskEnd(); |
} |
} |
}).start(); |
} |
} else { |
} |
}); |
this.validODS.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
validPDF.setEnabled(false); |
validODS.setEnabled(false); |
bar.setString(null); |
bar.setValue(0); |
// un fichier a été choisi (sortie par OK) |
// nom du fichier choisi |
new Thread(new Runnable() { |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
try { |
final GrandLivreSheetXML bSheet = new GrandLivreSheetXML(dateDeb.getDate(), dateEnd.getDate(), compteDeb.getText().trim(), compteEnd.getText().trim(), mode, |
boxCumulsAnts.isSelected(), !boxCompteSolde.isSelected(), boxCentralClient.isSelected(), boxCentralFourn.isSelected(), comboJrnl.getSelectedId()); |
bar.setValue(1); |
final File file = bSheet.getOrCreateDocumentFile(); |
bar.setValue(2); |
SwingUtilities.invokeLater(new Runnable() { |
// bSheet.showPrintAndExport(false, false, true, true); |
@Override |
public void run() { |
try { |
FileUtils.openFile(file); |
} catch (IOException e) { |
ExceptionHandler.handle("Erreur lors de l'ouverture du grand livre.", e); |
} |
} |
}); |
try { |
// bSheet.getOrCreatePDFDocumentFile(true); |
bSheet.getOrCreatePDFDocumentFile(true, true); |
Gestion.openPDF(bSheet.getGeneratedPDFFile()); |
} catch (Exception exn) { |
ExceptionHandler.handle("Erreur de génération du grand livre", exn); |
// TODO Bloc catch auto-généré |
exn.printStackTrace(); |
} |
} |
} catch (InterruptedException exn) { |
// TODO Bloc catch auto-généré |
exn.printStackTrace(); |
} catch (ExecutionException exn) { |
// TODO Bloc catch auto-généré |
exn.printStackTrace(); |
} finally { |
taskEnd(); |
} |
} |
}).start(); |
} |
}); |
this.annul.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
((JFrame) SwingUtilities.getRoot(ImpressionGrandLivrePanel.this)).dispose(); |
} |
395,23 → 362,19 |
Date beginDate = this.dateDeb.getDate(); |
Date endDate = this.dateEnd.getDate(); |
this.validODS.setEnabled(true); |
this.validPDF.setEnabled(true); |
// System.err.println("Check validity between "); |
this.valid.setEnabled(true); |
if (beginDate == null || endDate == null) { |
this.validODS.setEnabled(false); |
this.validPDF.setEnabled(false); |
this.valid.setEnabled(false); |
} else { |
if (this.compteDeb.getText().trim().length() == 0 || this.compteEnd.getText().trim().length() == 0) { |
this.validODS.setEnabled(false); |
this.validPDF.setEnabled(false); |
this.valid.setEnabled(false); |
} else { |
if (this.compteDeb.getText().trim().compareToIgnoreCase(this.compteEnd.getText().trim()) > 0) { |
this.validODS.setEnabled(false); |
this.validPDF.setEnabled(false); |
this.valid.setEnabled(false); |
} else { |
if (beginDate.after(endDate)) { |
this.validODS.setEnabled(false); |
this.validPDF.setEnabled(false); |
this.valid.setEnabled(false); |
} |
} |
} |
441,7 → 404,6 |
public void taskEnd() { |
bar.setValue(3); |
bar.setString("Terminée"); |
validPDF.setEnabled(true); |
validODS.setEnabled(true); |
valid.setEnabled(true); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/PointagePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
37,12 → 37,11 |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.FontUtils; |
import org.openconcerto.ui.JDate; |
import org.openconcerto.ui.JLabelBold; |
import org.openconcerto.ui.TitledSeparator; |
import org.openconcerto.ui.warning.JLabelWarning; |
import org.openconcerto.utils.text.SimpleDocumentListener; |
import java.awt.Color; |
import java.awt.Component; |
import java.awt.Dimension; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
93,6 → 92,7 |
private final SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete(); |
private final SQLTable tableEcr = this.base.getTable("ECRITURE"); |
private final SQLTable tableCpt = this.base.getTable("COMPTE_PCE"); |
private final static int allEcriture = 0; |
private final static int ecriturePointee = 1; |
147,22 → 147,31 |
} |
}.execute(); |
// c.fill = GridBagConstraints.NONE; |
c.weightx = 1; |
c.gridx++; |
c.gridwidth = 2; |
c.fill = GridBagConstraints.NONE; |
c.gridwidth = GridBagConstraints.REMAINDER; |
this.add(this.selCompte, c); |
// Gestion du pointage |
c.insets = new Insets(2, 2, 1, 2); |
TitledSeparator sepGestionPointage = new TitledSeparator("Gestion du pointage"); |
c.fill = GridBagConstraints.HORIZONTAL; |
c.gridy++; |
c.gridx = 0; |
this.add(sepGestionPointage, c); |
// Panel Selection du mode d'affichage des ecritures |
c.gridy++; |
c.gridx = 0; |
c.gridwidth = 1; |
c.gridheight = 1; |
c.weightx = 0; |
c.fill = GridBagConstraints.HORIZONTAL; |
// Numero de releve |
final JLabel labelReleve = new JLabel("N° de relevé"); |
// c.anchor = GridBagConstraints.EAST; |
JLabel labelReleve = new JLabel("N° de relevé"); |
labelReleve.setHorizontalAlignment(SwingConstants.RIGHT); |
this.add(labelReleve, c); |
170,14 → 179,15 |
c.gridx++; |
c.weightx = 0; |
c.fill = GridBagConstraints.NONE; |
c.anchor = GridBagConstraints.WEST; |
this.add(this.codePointage, c); |
// Warning si aucun code rentré |
c.gridx++; |
c.fill = GridBagConstraints.NONE; |
c.fill = GridBagConstraints.HORIZONTAL; |
createPanelWarning(); |
c.gridwidth = 1; |
c.weightx = 0; |
createPanelWarning(); |
c.weightx = 1; |
this.add(this.warningPanel, c); |
// Date de pointage |
184,7 → 194,6 |
// MAYBE si date invalide grisée le bouton pointer |
JLabel labelDate = new JLabel("Date de pointage"); |
labelDate.setHorizontalAlignment(SwingConstants.RIGHT); |
c.fill = GridBagConstraints.HORIZONTAL; |
c.gridx = 0; |
c.gridy++; |
c.gridwidth = 1; |
237,13 → 246,11 |
cCheck.gridx++; |
cCheck.gridwidth = 1; |
this.fieldEcart.setEditable(false); |
panelCheckValue.add(this.fieldEcart, cCheck); |
c.gridx++; |
c.gridwidth = 1; |
c.gridwidth = 3; |
c.weightx = 1; |
c.fill = GridBagConstraints.HORIZONTAL; |
this.add(panelCheckValue, c); |
this.fieldSoldeA.getDocument().addDocumentListener(new SimpleDocumentListener() { |
261,11 → 268,11 |
} |
}); |
JLabelBold sepPeriode = new JLabelBold("Liste des écritures"); |
TitledSeparator sepPeriode = new TitledSeparator("Filtre "); |
c.gridy++; |
c.gridx = 0; |
c.anchor = GridBagConstraints.WEST; |
c.gridwidth = 3; |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.fill = GridBagConstraints.HORIZONTAL; |
this.add(sepPeriode, c); |
274,12 → 281,12 |
c.weightx = 0; |
c.gridwidth = 1; |
c.gridx = 0; |
final JLabel labelEcr = new JLabel("Etats"); |
final JLabel labelEcr = new JLabel("Ecritures"); |
labelEcr.setHorizontalAlignment(SwingConstants.RIGHT); |
this.add(labelEcr, c); |
c.gridx++; |
c.fill = GridBagConstraints.NONE; |
c.gridwidth = 2; |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.weightx = 1; |
this.add(panelSelectEcritures, c); |
c.fill = GridBagConstraints.HORIZONTAL; |
319,9 → 326,16 |
c.weightx = 1; |
c.fill = GridBagConstraints.NONE; |
c.gridwidth = 2; |
c.gridwidth = GridBagConstraints.REMAINDER; |
this.add(panelPeriode, c); |
TitledSeparator sepEcriture = new TitledSeparator("Ecritures "); |
c.gridy++; |
c.gridx = 0; |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.fill = GridBagConstraints.HORIZONTAL; |
this.add(sepEcriture, c); |
// Liste des ecritures |
final EcritureSQLElement ecritureElem = directory.getElement(EcritureSQLElement.class); |
this.ecriturePanel = new ListPanelEcritures(ecritureElem, new IListe(ecritureElem.createPointageTableSource())); |
331,16 → 345,114 |
c.weighty = 1; |
c.weightx = 1; |
c.fill = GridBagConstraints.BOTH; |
c.gridwidth = 3; |
c.gridwidth = GridBagConstraints.REMAINDER; |
this.ecriturePanel.getListe().setPreferredSize(new Dimension(this.ecriturePanel.getListe().getPreferredSize().width, 200)); |
this.add(this.ecriturePanel, c); |
// JTable Totaux |
c.gridy++; |
c.gridx = 0; |
c.weighty = 0; |
this.add(createBottomPanel(), c); |
c.weightx = 1; |
c.fill = GridBagConstraints.BOTH; |
c.gridwidth = 4; |
c.gridheight = 3; |
this.model = new PointageModel(this.selCompte.getSelectedId(), this); |
JTable table = new JTable(this.model); |
table.setRowHeight(FontUtils.getPreferredRowHeight(table)); |
// AlternateTableCellRenderer.setAllColumns(table); |
final DeviseNiceTableCellRenderer cellRenderer = new DeviseNiceTableCellRenderer(); |
for (int i = 0; i < table.getColumnCount(); i++) { |
// if (table.getColumnClass(i) == Long.class || table.getColumnClass(i) == |
// BigInteger.class) { |
table.getColumnModel().getColumn(i).setCellRenderer(cellRenderer); |
// }else{ |
// |
// } |
} |
JScrollPane sPane = new JScrollPane(table); |
// TODO Gerer la taille des colonnes |
Dimension d = new Dimension(table.getPreferredSize().width, table.getPreferredSize().height + table.getTableHeader().getPreferredSize().height + 4); |
sPane.setPreferredSize(d); |
this.add(sPane, c); |
// Legende |
c.gridx += 4; |
c.gridwidth = 1; |
c.anchor = GridBagConstraints.WEST; |
c.fill = GridBagConstraints.NONE; |
c.weightx = 0; |
this.add(createPanelLegende(), c); |
// Validation des ecritures pointées |
this.boxValidEcriture = new JCheckBox("Valider les écritures pointées"); |
c.gridx++; |
c.gridheight = 1; |
c.gridwidth = GridBagConstraints.REMAINDER; |
this.add(this.boxValidEcriture, c); |
// Bouton Pointer |
c.anchor = GridBagConstraints.SOUTHEAST; |
this.buttonPointer = new JButton("Pointer"); |
c.gridwidth = 1; |
c.gridheight = 1; |
c.weightx = 0; |
c.gridx = 5; |
c.gridy++; |
c.fill = GridBagConstraints.NONE; |
this.add(this.buttonPointer, c); |
// Bouton Depointer |
JButton buttonDepointer = new JButton("Dépointer"); |
c.gridx++; |
c.weightx = 0; |
this.add(buttonDepointer, c); |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.gridheight = 1; |
c.weightx = 0; |
c.gridx = 5; |
c.gridy++; |
c.fill = GridBagConstraints.NONE; |
c.anchor = GridBagConstraints.EAST; |
JButton buttonClose = new JButton("Fermer"); |
buttonClose.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
((Window) SwingUtilities.getRoot(PointagePanel.this)).dispose(); |
} |
}); |
this.add(buttonClose, c); |
this.buttonPointer.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
int[] rowIndex = PointagePanel.this.ecriturePanel.getListe().getJTable().getSelectedRows(); |
for (int i = 0; i < rowIndex.length; i++) { |
System.err.println("Action pointage sur " + i); |
actionPointage(rowIndex[i]); |
} |
} |
}); |
buttonDepointer.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
int[] rowIndex = PointagePanel.this.ecriturePanel.getListe().getJTable().getSelectedRows(); |
for (int i = 0; i < rowIndex.length; i++) { |
System.err.println("Action depointage sur " + i); |
actionDepointage(rowIndex[i]); |
} |
} |
}); |
// Changement de compte |
this.selCompte.addModelListener("wantedID", new PropertyChangeListener() { |
this.selCompte.addValueListener(new PropertyChangeListener() { |
public void propertyChange(PropertyChangeEvent evt) { |
changeListRequest(); |
418,96 → 530,6 |
this.buttonPointer.setEnabled((this.codePointage.getText().trim().length() != 0)); |
} |
private Component createBottomPanel() { |
JPanel p = new JPanel(); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
p.setLayout(new GridBagLayout()); |
// JTable Totaux |
c.weighty = 1; |
c.weightx = 1; |
c.gridheight = 3; |
c.fill = GridBagConstraints.BOTH; |
this.model = new PointageModel(this.selCompte.getSelectedId(), this); |
JTable table = new JTable(this.model); |
table.setRowHeight(FontUtils.getPreferredRowHeight(table)); |
final DeviseNiceTableCellRenderer cellRenderer = new DeviseNiceTableCellRenderer(); |
for (int i = 0; i < table.getColumnCount(); i++) { |
table.getColumnModel().getColumn(i).setCellRenderer(cellRenderer); |
} |
JScrollPane sPane = new JScrollPane(table); |
// TODO Gerer la taille des colonnes |
Dimension d = new Dimension(table.getPreferredSize().width, table.getPreferredSize().height + table.getTableHeader().getPreferredSize().height + 4); |
sPane.setPreferredSize(d); |
p.add(sPane, c); |
// Legende |
c.gridx++; |
c.anchor = GridBagConstraints.WEST; |
c.fill = GridBagConstraints.NONE; |
c.weightx = 0; |
p.add(createPanelLegende(), c); |
// Validation des ecritures pointées |
this.boxValidEcriture = new JCheckBox("Valider les écritures pointées"); |
c.gridx++; |
c.gridheight = 1; |
c.gridwidth = 2; |
p.add(this.boxValidEcriture, c); |
// Bouton Pointer |
c.anchor = GridBagConstraints.SOUTHEAST; |
this.buttonPointer = new JButton("Pointer"); |
c.gridwidth = 1; |
c.gridy++; |
c.fill = GridBagConstraints.NONE; |
p.add(this.buttonPointer, c); |
// Bouton Depointer |
JButton buttonDepointer = new JButton("Dépointer"); |
c.gridx++; |
p.add(buttonDepointer, c); |
c.gridy++; |
c.fill = GridBagConstraints.NONE; |
c.anchor = GridBagConstraints.EAST; |
JButton buttonClose = new JButton("Fermer"); |
buttonClose.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
((Window) SwingUtilities.getRoot(PointagePanel.this)).dispose(); |
} |
}); |
p.add(buttonClose, c); |
this.buttonPointer.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
int[] rowIndex = PointagePanel.this.ecriturePanel.getListe().getJTable().getSelectedRows(); |
for (int i = 0; i < rowIndex.length; i++) { |
actionPointage(rowIndex[i]); |
} |
} |
}); |
buttonDepointer.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
int[] rowIndex = PointagePanel.this.ecriturePanel.getListe().getJTable().getSelectedRows(); |
for (int i = 0; i < rowIndex.length; i++) { |
actionDepointage(rowIndex[i]); |
} |
} |
}); |
return p; |
} |
/* Menu clic Droit */ |
private void actionMenuDroit(final MouseEvent mE) { |
JPopupMenu menu = new JPopupMenu(); |
514,6 → 536,7 |
menu.add(new AbstractAction("Voir la source") { |
public void actionPerformed(ActionEvent e) { |
int rowIndex = PointagePanel.this.ecriturePanel.getListe().getJTable().rowAtPoint(mE.getPoint()); |
int id = PointagePanel.this.ecriturePanel.getListe().idFromIndex(rowIndex); |
527,6 → 550,7 |
if (this.codePointage.getText().trim().length() != 0) { |
menu.add(new AbstractAction("Pointer") { |
public void actionPerformed(ActionEvent e) { |
int rowIndex = PointagePanel.this.ecriturePanel.getListe().getJTable().rowAtPoint(mE.getPoint()); |
actionPointage(rowIndex); |
} |
535,6 → 559,7 |
menu.add(new AbstractAction("Dépointer") { |
public void actionPerformed(ActionEvent e) { |
int rowIndex = PointagePanel.this.ecriturePanel.getListe().getJTable().rowAtPoint(mE.getPoint()); |
actionDepointage(rowIndex); |
} |
612,7 → 637,7 |
} |
public ListPanelEcritures getEcriturePanel() { |
return this.ecriturePanel; |
return ecriturePanel; |
} |
// Pointe la ligne passée en parametre |
643,7 → 668,7 |
* sélection |
*/ |
private void changeListRequest() { |
Object idCpt = this.selCompte.getWantedID(); |
Object idCpt = this.selCompte.getSelectedId(); |
// filtre de selection |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ImpressionJournauxPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
16,7 → 16,7 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.config.Gestion; |
import org.openconcerto.erp.core.finance.accounting.model.SelectJournauxModel; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivrePDF; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivreSheet; |
import org.openconcerto.erp.core.finance.accounting.report.JournauxMoisSheet; |
import org.openconcerto.erp.core.finance.accounting.report.JournauxSheet; |
import org.openconcerto.erp.core.finance.accounting.report.JournauxSheetXML; |
42,7 → 42,6 |
import java.awt.event.MouseEvent; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.io.File; |
import java.util.Calendar; |
import java.util.Date; |
71,9 → 70,8 |
private JButton annul; |
private JCheckBox checkCentralMois; |
private JCheckBox checkAncienModele; |
private JTextField compteDeb; |
private JTextField compteEnd; |
private int mode = GrandLivrePDF.MODEALL; |
private JTextField compteDeb, compteEnd; |
private int mode = GrandLivreSheet.MODEALL; |
private JProgressBar bar = new JProgressBar(0, 3); |
public ImpressionJournauxPanel() { |
82,6 → 80,8 |
SQLRow rowSociete = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete(); |
SQLRow rowExercice = Configuration.getInstance().getBase().getTable("EXERCICE_COMMON").getRow(rowSociete.getInt("ID_EXERCICE_COMMON")); |
// this.isValidated = false; |
this.dateDeb = new JDate(); |
this.dateEnd = new JDate(); |
this.tableJrnl = new JTable(new SelectJournauxModel()); |
162,22 → 162,22 |
// Radio mode |
JRadioButton radioAll = new JRadioButton(new AbstractAction("Toutes") { |
public void actionPerformed(ActionEvent e) { |
ImpressionJournauxPanel.this.mode = GrandLivrePDF.MODEALL; |
// TODO Auto-generated method stub |
mode = GrandLivreSheet.MODEALL; |
} |
}); |
JRadioButton radioLettree = new JRadioButton(new AbstractAction("Lettrées") { |
public void actionPerformed(ActionEvent e) { |
ImpressionJournauxPanel.this.mode = GrandLivrePDF.MODELETTREE; |
// TODO Auto-generated method stub |
mode = GrandLivreSheet.MODELETTREE; |
} |
}); |
JRadioButton radioNonLettree = new JRadioButton(new AbstractAction("Non lettrées") { |
public void actionPerformed(ActionEvent e) { |
ImpressionJournauxPanel.this.mode = GrandLivrePDF.MODENONLETTREE_PERIODE; |
// TODO Auto-generated method stub |
mode = GrandLivreSheet.MODENONLETTREE_PERIODE; |
} |
}); |
JPanel panelMode = new JPanel(); |
207,6 → 207,10 |
// Ancien modele |
this.checkAncienModele = new JCheckBox("Ancien modèle"); |
// c.gridy++; |
// c.gridx += 2; |
// c.gridwidth = GridBagConstraints.REMAINDER; |
// this.add(this.checkAncienModele, c); |
// Progress bar |
c.gridwidth = GridBagConstraints.REMAINDER; |
251,7 → 255,6 |
} else if (checkCentralMois.isSelected()) { |
JournauxSheet bSheet; |
bSheet = new JournauxMoisSheet(idS, dateDeb.getDate(), dateEnd.getDate(), mode); |
final SpreadSheetGeneratorCompta generator = new SpreadSheetGeneratorCompta(bSheet, "Journal_" + Calendar.getInstance().getTimeInMillis(), false, true); |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
261,9 → 264,7 |
}); |
} else { |
for (int i = 0; i < idS.length; i++) { |
final JournauxSheetXML xmlSheet = new JournauxSheetXML(idS[i], dateDeb.getDate(), dateEnd.getDate(), mode, compteDeb.getText().trim(), compteEnd.getText().trim()); |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
bar.setValue(2); |
272,9 → 273,7 |
try { |
xmlSheet.createDocument(); |
xmlSheet.getOrCreatePDFDocumentFile(false, true); |
final File generatedPDFFile = xmlSheet.getGeneratedPDFFile(); |
if (generatedPDFFile != null) |
Gestion.openPDF(generatedPDFFile); |
Gestion.openPDF(xmlSheet.getGeneratedPDFFile()); |
} catch (Exception exn) { |
ExceptionHandler.handle("Erreur lors de la création du journal !", exn); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/model/CurrencyConverter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
122,16 → 122,10 |
// Clean date |
final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC")); |
c.setTimeInMillis(date.getTime()); |
c.set(Calendar.HOUR_OF_DAY, 23); |
c.set(Calendar.MINUTE, 59); |
c.set(Calendar.SECOND, 59); |
c.set(Calendar.MILLISECOND, 59); |
// Limit pour récupérer le taux de la veille pour le taux réel |
if (!useBiased) { |
c.add(Calendar.DAY_OF_MONTH, -1); |
} |
c.set(Calendar.HOUR_OF_DAY, 0); |
c.set(Calendar.MINUTE, 0); |
c.set(Calendar.SECOND, 0); |
c.set(Calendar.MILLISECOND, 0); |
final Date d = c.getTime(); |
// Get conversion info |
209,9 → 203,6 |
cacheNotBiased.put(key, Tuple2.create(r1, r2)); |
} |
} |
if (r1.equals(BigDecimal.ZERO)) { |
r1 = BigDecimal.ONE; |
} |
final BigDecimal result = amount.multiply(r2, DecimalUtils.HIGH_PRECISION).divide(r1, DecimalUtils.HIGH_PRECISION); |
return result; |
} |
225,8 → 216,8 |
w = w.and(new Where(t.getField("DATE"), "<=", d)); |
select.setWhere(w); |
select.addFieldOrder(t.getField("DATE"), Order.desc()); |
// On ne veut que le plus récent |
select.setLimit(1); |
// Limit pour récupérer le taux de la veille |
select.setLimit(2); |
final List<SQLRow> rows = SQLRowListRSH.execute(select); |
return rows; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/model/PointageModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
242,7 → 242,7 |
final Long valueArrive = arrive.getValue(); |
final Long valueDepart = depart.getValue(); |
if (valueArrive != null && valueDepart != null) { |
ecart.setValue(valueArrive - valueDepart - PointageModel.this.debitNonPointe + PointageModel.this.creditNonPointe); |
ecart.setValue(valueArrive - valueDepart + PointageModel.this.debitNonPointe - PointageModel.this.creditNonPointe); |
} else { |
ecart.setValue(null); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/MotifNonAssujettisTASQLElement.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CodeCaisseCongesPayesSQLElement.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/ArretChomageIntemperieSQLElement.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/SalarieSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
117,24 → 117,8 |
actionNewContrat.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
this.getRowActions().add(actionNewContrat); |
PredicateRowAction actionVarEdit = new PredicateRowAction(new AbstractAction("Editer les variables de période") { |
@Override |
public void actionPerformed(ActionEvent e) { |
final SQLRowAccessor rowSelected = IListe.get(e).getSelectedRow(); |
final SQLElement infosPayeElement = getDirectory().getElement("VARIABLE_SALARIE"); |
EditFrame f = new EditFrame(infosPayeElement, EditMode.MODIFICATION); |
final Integer rowVar = rowSelected.asRow().getForeignID("ID_VARIABLE_SALARIE"); |
f.getSQLComponent().select(rowVar); |
FrameUtil.show(f); |
} |
}, true); |
actionVarEdit.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
this.getRowActions().add(actionVarEdit); |
} |
protected List<String> getListFields() { |
final List<String> l = new ArrayList<String>(); |
l.add("CODE"); |
233,7 → 217,7 |
c.gridy++; |
this.add(labelUser, c); |
c.gridx++; |
c.weightx = 1; |
c.weightx = 0; |
c.fill = GridBagConstraints.NONE; |
this.add(comboUser, c); |
this.addView(comboUser, "ID_USER_COMMON"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/ContratSalarieSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
273,32 → 273,6 |
} |
} |
// ccode congés payés |
JLabel labelCodeConges = new JLabel(getLabelFor("ID_CODE_CAISSE_CONGES_PAYES")); |
labelCodeConges.setHorizontalAlignment(SwingConstants.RIGHT); |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
this.add(labelCodeConges, c); |
c.gridx++; |
c.weightx = 1; |
ElementComboBox boxConges = new ElementComboBox(true); |
this.add(boxConges, c); |
this.addView(boxConges, "ID_CODE_CAISSE_CONGES_PAYES"); |
// Statut profesionnel |
JLabel labelTauxProf = new JLabel(getLabelFor("TAUX_FRAIS_PROFESSIONNELS")); |
labelTauxProf.setHorizontalAlignment(SwingConstants.RIGHT); |
JTextField tauxProf = new JTextField(); |
c.gridx++; |
c.weightx = 0; |
this.add(labelTauxProf, c); |
c.gridx++; |
c.weightx = 1; |
this.add(tauxProf, c); |
this.addView(tauxProf, "TAUX_FRAIS_PROFESSIONNELS"); |
// Code Arrco, agirc retirés du contrat et ajoutés dans les caisses de cotisations |
// Code UGRR |
451,55 → 425,54 |
this.add(textDateFin, c); |
addSQLObject(textDateFin, "DATE_PREV_FIN"); |
// Déplacer dans les arrets chomage intempérie |
// JLabel labelAmen = new JLabel(getLabelFor("ID_CODE_AMENAGEMENT_PARTIEL")); |
// labelAmen.setHorizontalAlignment(SwingConstants.RIGHT); |
// ElementComboBox selAmen = new ElementComboBox(); |
// selAmen.setInfoIconVisible(false); |
// c.gridy++; |
// c.gridx = 0; |
// c.weightx = 0; |
// this.add(labelAmen, c); |
// c.gridx++; |
// c.weightx = 1; |
// this.add(selAmen, c); |
// this.addSQLObject(selAmen, "ID_CODE_AMENAGEMENT_PARTIEL"); |
// |
// JLabel labelSupsension = new JLabel(getLabelFor("ID_CODE_SUSPENSION")); |
// labelSupsension.setHorizontalAlignment(SwingConstants.RIGHT); |
// ElementComboBox selSupsension = new ElementComboBox(); |
// selSupsension.setInfoIconVisible(false); |
// c.gridx++; |
// c.weightx = 0; |
// this.add(labelSupsension, c); |
// c.gridx++; |
// c.weightx = 1; |
// this.add(selSupsension, c); |
// this.addSQLObject(selSupsension, "ID_CODE_SUSPENSION"); |
// |
// JLabel labelDateDebutSusp = new JLabel(getLabelFor("DATE_DEBUT_SUSPENSION")); |
// labelDateDebutSusp.setHorizontalAlignment(SwingConstants.RIGHT); |
// JDate textDateDebutSups = new JDate(); |
// c.gridy++; |
// c.gridx = 0; |
// c.weightx = 0; |
// this.add(labelDateDebutSusp, c); |
// c.gridx++; |
// c.weightx = 1; |
// this.add(textDateDebutSups, c); |
// this.addSQLObject(textDateDebutSups, "DATE_DEBUT_SUSPENSION"); |
// |
// JLabel labelDateFinSups = new JLabel(getLabelFor("DATE_FIN_SUSPENSION")); |
// labelDateFinSups.setHorizontalAlignment(SwingConstants.RIGHT); |
// JDate textDateFinSuspension = new JDate(); |
// c.gridx++; |
// c.weightx = 0; |
// this.add(labelDateFinSups, c); |
// c.gridx++; |
// c.weightx = 1; |
// this.add(textDateFinSuspension, c); |
// this.addSQLObject(textDateFinSuspension, "DATE_FIN_SUSPENSION"); |
JLabel labelAmen = new JLabel(getLabelFor("ID_CODE_AMENAGEMENT_PARTIEL")); |
labelAmen.setHorizontalAlignment(SwingConstants.RIGHT); |
ElementComboBox selAmen = new ElementComboBox(); |
selAmen.setInfoIconVisible(false); |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
this.add(labelAmen, c); |
c.gridx++; |
c.weightx = 1; |
this.add(selAmen, c); |
this.addSQLObject(selAmen, "ID_CODE_AMENAGEMENT_PARTIEL"); |
JLabel labelSupsension = new JLabel(getLabelFor("ID_CODE_SUSPENSION")); |
labelSupsension.setHorizontalAlignment(SwingConstants.RIGHT); |
ElementComboBox selSupsension = new ElementComboBox(); |
selSupsension.setInfoIconVisible(false); |
c.gridx++; |
c.weightx = 0; |
this.add(labelSupsension, c); |
c.gridx++; |
c.weightx = 1; |
this.add(selSupsension, c); |
this.addSQLObject(selSupsension, "ID_CODE_SUSPENSION"); |
JLabel labelDateDebutSusp = new JLabel(getLabelFor("DATE_DEBUT_SUSPENSION")); |
labelDateDebutSusp.setHorizontalAlignment(SwingConstants.RIGHT); |
JDate textDateDebutSups = new JDate(); |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
this.add(labelDateDebutSusp, c); |
c.gridx++; |
c.weightx = 1; |
this.add(textDateDebutSups, c); |
this.addSQLObject(textDateDebutSups, "DATE_DEBUT_SUSPENSION"); |
JLabel labelDateFinSups = new JLabel(getLabelFor("DATE_FIN_SUSPENSION")); |
labelDateFinSups.setHorizontalAlignment(SwingConstants.RIGHT); |
JDate textDateFinSuspension = new JDate(); |
c.gridx++; |
c.weightx = 0; |
this.add(labelDateFinSups, c); |
c.gridx++; |
c.weightx = 1; |
this.add(textDateFinSuspension, c); |
this.addSQLObject(textDateFinSuspension, "DATE_FIN_SUSPENSION"); |
this.addRequiredSQLObject(selCodeCatSocio, "ID_CODE_EMPLOI"); |
this.addRequiredSQLObject(selContratTravail, "ID_CODE_CONTRAT_TRAVAIL"); |
this.addRequiredSQLObject(selDroitContrat, "ID_CODE_DROIT_CONTRAT"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/FichePayeSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
64,7 → 64,6 |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.Date; |
import java.util.List; |
87,7 → 86,7 |
public FichePayeSQLElement() { |
super("FICHE_PAYE", "une fiche de paye", "fiches de paye"); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(this, FichePayeSheetXML.class); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(FichePayeSheetXML.class); |
getRowActions().addAll(l.getRowActions()); |
PredicateRowAction actionCumuls = new PredicateRowAction(new AbstractAction("Détails cumuls et variables") { |
111,7 → 110,7 |
FichePayeSheetXML sheet = new FichePayeSheetXML(row, false); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, true, Collections.emptyList()); |
sheet.showPrintAndExport(true, false, true); |
} catch (Exception e1) { |
ExceptionHandler.handle("Erreur lors de la création du document.", e1); |
} |
439,18 → 438,6 |
textCice.setEnabled(false); |
this.addSQLObject(textCice, "CICE"); |
// Perte Temps Partiel Thérapeutique |
cPanel.gridx = 0; |
cPanel.gridy++; |
cPanel.weightx = 0; |
JLabel labelTPT = new JLabel(getLabelFor("PERTE_TPT")); |
panelTotal.add(labelTPT, cPanel); |
JTextField textTPT = new JTextField(10); |
cPanel.gridx++; |
cPanel.weightx = 1; |
panelTotal.add(textTPT, cPanel); |
this.addSQLObject(textTPT, "PERTE_TPT"); |
c.gridx = 0; |
c.gridy++; |
c.fill = GridBagConstraints.HORIZONTAL; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CodeIdccSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
13,12 → 13,10 |
package org.openconcerto.erp.core.humanresources.payroll.element; |
import org.openconcerto.sql.model.DBRoot; |
public class CodeIdccSQLElement extends AbstractCodeSQLElement { |
public class CodeIdccSQLElement extends AbstractCodeCommonSQLElement { |
public CodeIdccSQLElement(final DBRoot root) { |
super(root.getTable("IDCC"), "un code de convention", "codes de conventions"); |
public CodeIdccSQLElement() { |
super("IDCC", "un code de convention", "codes de conventions"); |
} |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CaisseCotisationSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
31,7 → 31,6 |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.List; |
289,7 → 288,6 |
super.update(); |
this.table.getModel().updateField("ID_CAISSE_COTISATION", getSelectedID()); |
} |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/report/LivrePayeSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
356,12 → 356,15 |
} |
this.nbPage = new Double(Math.ceil((double) (mapSal.keySet().size() + 1) / (nbSalPerPage))).intValue(); |
if (this.nbPage < 1) { |
this.nbPage = 1; |
} |
System.err.println("Nombre de page " + this.nbPage); |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
} |
} |
private Object fillLine(Map mapSalRub, int idRub, Map mapSal, int numSal, Map mapTotal, boolean pat) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/report/EtatChargesPayeSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
267,10 → 267,12 |
this.nbPage = mapCaisse.size(); |
if (this.nbPage < 1) { |
this.nbPage = 1; |
} |
System.err.println("Nombre de page " + this.nbPage); |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/report/FichePayeSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
197,11 → 197,6 |
this.printer = PrinterNXProps.getInstance().getStringProperty("FichePayePrinter"); |
} |
@Override |
public int getNbPage() { |
return 1; |
} |
protected void createMap() { |
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.SHORT); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/action/ListeDesFichesDePayeAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
87,7 → 87,7 |
final SQLRow rowFiche = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getTable("FICHE_PAYE").getRow(frame.getPanel().getListe().getSelectedId()); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(elt, FichePayeSheetXML.class); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(FichePayeSheetXML.class); |
for (RowAction action : l.getRowActions()) { |
menuDroit.add(action.getAction()); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/url-icon.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
30,7 → 30,7 |
@Override |
public void actionPerformed(ActionEvent e) { |
SQLRowAccessor row = IListe.get(e).getSelectedRowAccessor(); |
SQLRowAccessor row = IListe.get(e).getSelectedRow(); |
if (foreignField != null) { |
row = row.getForeign(foreignField); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/Attachment.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
30,7 → 30,6 |
private int sourceId; |
private int parentId; |
private boolean encrypted; |
public static final String MIMETYPE_URL = "application/url-mime-type"; |
public static final String MIMETYPE_FOLDER = "inode/directory"; |
public Attachment(SQLRowValues rowAttachment) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/FilePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
89,8 → 89,6 |
image = new JImage(this.getClass().getResource("xlsx-icon.png")); |
} else if (type.equals(Attachment.MIMETYPE_FOLDER)) { |
image = new JImage(this.getClass().getResource("folder-icon.png")); |
} else if (type.equals(Attachment.MIMETYPE_URL) || type.equals("application/x-mswinurl")) { |
image = new JImage(this.getClass().getResource("url-icon.png")); |
} else { |
image = new JImage(this.getClass().getResource("data-icon.png")); |
} |
370,17 → 368,12 |
// FileName |
c.gridx = 0; |
c.weightx = 0; |
if (attachment.getMimeType().equals(Attachment.MIMETYPE_URL)) { |
p.add(new JLabel("URL : ", SwingConstants.RIGHT), c); |
} else { |
p.add(new JLabel("Fichier original : ", SwingConstants.RIGHT), c); |
} |
c.gridx++; |
c.weightx = 1; |
p.add(new JLabel(attachment.getFileName()), c); |
c.gridy++; |
// Size |
if (!attachment.getMimeType().equals(Attachment.MIMETYPE_URL)) { |
c.gridx = 0; |
c.weightx = 0; |
p.add(new JLabel("Taille : ", SwingConstants.RIGHT), c); |
387,7 → 380,7 |
c.gridx++; |
c.weightx = 1; |
p.add(new JLabel(attachment.getFileSize() + " octets"), c); |
} |
// Spacer |
c.gridx = 1; |
c.gridy++; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
26,7 → 26,6 |
import java.awt.Color; |
import java.awt.Component; |
import java.awt.Desktop; |
import java.awt.Dimension; |
import java.awt.FileDialog; |
import java.awt.FlowLayout; |
44,8 → 43,6 |
import java.awt.event.MouseEvent; |
import java.io.File; |
import java.io.IOException; |
import java.net.URI; |
import java.net.URISyntaxException; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Collection; |
215,8 → 212,6 |
toolbar.add(addFolderButton); |
final JButton addFileButton = new JButton("Ajouter un fichier"); |
toolbar.add(addFileButton); |
final JButton addURLButton = new JButton("Ajouter une URL"); |
toolbar.add(addURLButton); |
final JProgressBar progressBar = new JProgressBar(0, 100); |
progressBar.setValue(100); |
265,24 → 260,6 |
} |
}); |
addURLButton.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
final Frame frame = SwingThreadUtils.getAncestorOrSelf(Frame.class, (Component) e.getSource()); |
final String fileName = JOptionPane.showInputDialog(frame, "Veuillez entrer votre URL"); |
if (fileName != null) { |
AttachmentUtils utils = new AttachmentUtils(); |
try { |
utils.createURL(fileName, rowSource, idParent); |
} catch (SQLException e1) { |
JOptionPane.showMessageDialog(null, "Impossible de créer l'URL.", "Erreur", JOptionPane.ERROR_MESSAGE); |
} |
initUI(); |
} |
} |
}); |
ScrollablePanel files = new ScrollablePanel() { |
@Override |
public Dimension getPreferredSize() { |
333,12 → 310,6 |
if (e.getClickCount() == 2) { |
if (a.isFolder()) { |
openFolder(a); |
} else if( a.getMimeType().equals(Attachment.MIMETYPE_URL) ) { |
try { |
Desktop.getDesktop().browse(new URI(a.getFileName())); |
} catch (IOException | URISyntaxException e1) { |
ExceptionHandler.handle("Malformation URL", e1); |
} |
} else { |
final Thread t = new Thread() { |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
50,7 → 50,6 |
import javax.crypto.spec.GCMParameterSpec; |
import javax.crypto.spec.SecretKeySpec; |
import javax.swing.JOptionPane; |
import javax.swing.SwingUtilities; |
public class AttachmentUtils { |
242,22 → 241,6 |
table.getDBSystemRoot().getDataSource().execute(insert.asString()); |
} |
public void createURL(String url, SQLRowAccessor rowSource, int idParent) throws SQLException { |
final SQLRowValues rowValsAttachment = new SQLRowValues(rowSource.getTable().getTable("ATTACHMENT")); |
rowValsAttachment.put("SOURCE_TABLE", rowSource.getTable().getName()); |
rowValsAttachment.put("SOURCE_ID", rowSource.getID()); |
rowValsAttachment.put("ID_PARENT", idParent); |
rowValsAttachment.put("NAME", url); |
rowValsAttachment.put("SOURCE_TABLE", rowSource.getTable().getName()); |
rowValsAttachment.put("SOURCE_ID", rowSource.getID()); |
rowValsAttachment.put("MIMETYPE", Attachment.MIMETYPE_URL); |
rowValsAttachment.put("FILENAME", url); |
rowValsAttachment.put("FILESIZE", 0); |
rowValsAttachment.put("STORAGE_PATH", ""); |
rowValsAttachment.put("STORAGE_FILENAME", ""); |
rowValsAttachment.commit(); |
} |
public File getFile(Attachment attachment) { |
final ComptaPropsConfiguration config = ComptaPropsConfiguration.getInstanceCompta(); |
309,17 → 292,7 |
return null; |
} |
} else { |
if (SwingUtilities.isEventDispatchThread()) { |
JOptionPane.showMessageDialog(null, "Le fichier n'existe pas sur le serveur!\n" + fileIn.getAbsolutePath(), "Erreur fichier", JOptionPane.ERROR_MESSAGE); |
} else { |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
JOptionPane.showMessageDialog(null, "Le fichier n'existe pas sur le serveur!\n" + fileIn.getAbsolutePath(), "Erreur fichier", JOptionPane.ERROR_MESSAGE); |
} |
}); |
} |
return null; |
} |
} catch (IOException e1) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/component/ReferenceArticleSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
15,7 → 15,6 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement; |
import org.openconcerto.erp.core.common.ui.CodeFournisseurItemTable; |
import org.openconcerto.erp.core.common.ui.TotalPanel; |
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter; |
27,7 → 26,6 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper; |
import org.openconcerto.erp.core.sales.product.ui.ArticleCategorieComptableTable; |
import org.openconcerto.erp.core.sales.product.ui.ArticleDesignationTable; |
import org.openconcerto.erp.core.sales.product.ui.ArticlePromotionTable; |
import org.openconcerto.erp.core.sales.product.ui.ArticleTarifTable; |
import org.openconcerto.erp.core.sales.product.ui.ProductItemListTable; |
import org.openconcerto.erp.core.sales.product.ui.ProductQtyPriceListTable; |
47,7 → 45,6 |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.ComboSQLRequest; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.sqlobject.SQLTextCombo; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
55,7 → 52,6 |
import org.openconcerto.ui.JDate; |
import org.openconcerto.ui.TitledSeparator; |
import org.openconcerto.ui.component.ITextArea; |
import org.openconcerto.ui.component.InteractionMode; |
import org.openconcerto.ui.preferences.DefaultProps; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
74,7 → 70,6 |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Date; |
import java.util.List; |
97,25 → 92,23 |
protected JTextField textPVHT, textPVTTC, textPAHT; |
protected JTextField textMetrique1VT, textMetrique1HA; |
private final JCheckBox boxService = new JCheckBox(getLabelFor("SERVICE")); |
private final JCheckBox checkObs = new JCheckBox(getLabelFor("OBSOLETE")); |
private JTextField textNom; |
private JTextField textCode; |
private JTextField textPoids; |
private JTextField textValMetrique1, textValMetrique2, textValMetrique3; |
private DocumentListener htDocListener, ttcDocListener, detailsListener; |
private PropertyChangeListener propertyChangeListener; |
private PropertyChangeListener taxeListener; |
private final ElementComboBox comboSelTaxe = new ElementComboBox(false, 10); |
private final ElementComboBox comboSelModeVente = new ElementComboBox(false, 25); |
private JLabel labelMetriqueHA1 = new JLabel(getLabelFor("PRIX_METRIQUE_HA_1"), SwingConstants.RIGHT); |
private JLabel labelMetriqueVT1 = new JLabel(getLabelFor("PRIX_METRIQUE_VT_1"), SwingConstants.RIGHT); |
protected final JCheckBox boxService = new JCheckBox(getLabelFor("SERVICE")); |
protected final JCheckBox checkObs = new JCheckBox(getLabelFor("OBSOLETE")); |
protected JTextField textNom, textCode; |
protected JTextField textPoids; |
protected JTextField textValMetrique1, textValMetrique2, textValMetrique3; |
protected DocumentListener htDocListener, ttcDocListener, detailsListener; |
protected PropertyChangeListener propertyChangeListener; |
protected PropertyChangeListener taxeListener; |
protected final ElementComboBox comboSelTaxe = new ElementComboBox(false, 10); |
protected final ElementComboBox comboSelModeVente = new ElementComboBox(false, 25); |
protected JLabel labelMetriqueHA1 = new JLabel(getLabelFor("PRIX_METRIQUE_HA_1"), SwingConstants.RIGHT); |
protected JLabel labelMetriqueVT1 = new JLabel(getLabelFor("PRIX_METRIQUE_VT_1"), SwingConstants.RIGHT); |
protected ArticleDesignationTable tableDes = new ArticleDesignationTable(); |
protected ArticleCodeClientTable tableCodeClient = new ArticleCodeClientTable(); |
protected ArticleTarifTable tableTarifVente = new ArticleTarifTable(this); |
protected ArticlePromotionTable tableTarifPromotionVente = new ArticlePromotionTable(this); |
protected final ArticleCategorieComptableTable tableCatComptable = new ArticleCategorieComptableTable();; |
protected ArticleCategorieComptableTable tableCatComptable = new ArticleCategorieComptableTable(); |
protected SupplierPriceListTable tableFourSec = new SupplierPriceListTable(); |
protected ProductQtyPriceListTable tableTarifQteVente = new ProductQtyPriceListTable(this); |
125,8 → 118,6 |
protected ElementComboBox boxCR; |
protected JCheckBox boxMargeWithCR; |
protected List<ElementComboBox> boxesDeclinaison = new ArrayList<>(); |
protected DocumentListener pieceHAArticle = new SimpleDocumentListener() { |
@Override |
265,28 → 256,19 |
if (r != null && r.getID() > getTable().getUndefinedID()) { |
this.checkObs.setVisible(true); |
this.tableTarifVente.setArticleValues(r); |
selectModeVente(r.getForeignID("ID_MODE_VENTE_ARTICLE")); |
} else { |
if (r == null || !r.contains("CODE") || r.getString("CODE") == null || r.getString("CODE").trim().length() == 0) { |
this.textCode.setText(getElement().getDirectory().getElement(NumerotationAutoSQLElement.class).getNextNumero(getElement().getClass())); |
} |
} |
this.tableTarifVente.getRowValuesTable().insertFrom(r); |
this.tableTarifPromotionVente.getRowValuesTable().insertFrom(r); |
this.tableCatComptable.getRowValuesTable().insertFrom(r); |
this.tableFourSec.getRowValuesTable().insertFrom(r); |
this.tableTarifQteVente.getRowValuesTable().insertFrom(r); |
this.tableTarifVente.insertFrom("ID_ARTICLE", r.getID()); |
this.tableCatComptable.insertFrom("ID_ARTICLE", r.getID()); |
this.tableFourSec.insertFrom("ID_ARTICLE", r.getID()); |
this.tableTarifQteVente.insertFrom("ID_ARTICLE", r.getID()); |
if (this.tableBom != null) { |
this.tableBom.getRowValuesTable().getRowValuesTableModel().insertFrom(r, getTable().getTable("ARTICLE_ELEMENT").getField("ID_ARTICLE_PARENT")); |
this.tableBom.insertFrom("ID_ARTICLE_PARENT", r.getID()); |
} |
this.tableDes.getRowValuesTable().insertFrom(r); |
this.tableCodeClient.getRowValuesTable().insertFrom(r); |
this.tableDes.insertFrom("ID_ARTICLE", r.getID()); |
this.tableCodeClient.insertFrom("ID_ARTICLE", r.getID()); |
if (this.codeFournisseurTable != null) { |
this.codeFournisseurTable.getModel().insertFrom(r); |
this.codeFournisseurTable.insertFrom("ID_ARTICLE", r.getID()); |
} |
for (ElementComboBox elementComboBox : boxesDeclinaison) { |
elementComboBox.setEnabled(r != null && r.getNonEmptyForeign("ID_ARTICLE_VIRTUEL_PERE") != null ? InteractionMode.READ_WRITE : InteractionMode.DISABLED); |
selectModeVente(r.getForeignID("ID_MODE_VENTE_ARTICLE")); |
} |
} |
450,8 → 432,6 |
pane.add("Tarifs de vente spéciaux", createTarifPanel()); |
pane.add("Tarifs de vente par quantité", createTarifQtePanel()); |
pane.add("Tarifs promotionnels", createTarifPromotionPanel()); |
if (this.tableBom != null) { |
pane.add("Nomenclature", createBOMpanel()); |
} |
461,11 → 441,6 |
pane.add("Descriptif", createDescriptifPanel()); |
pane.add("Désignations multilingues", createDesignationPanel()); |
pane.add("Désignations clients", createCodeClientPanel()); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVER_DECLINAISON, false)) { |
pane.add("Déclinaison", createDeclinaisonPanel()); |
} |
pane.add("Comptabilité", createComptaPanel()); |
pane.add(getLabelFor("INFOS"), createInfosPanel()); |
526,28 → 501,16 |
panel.add(textTare, c); |
addView(textTare, "TARE"); |
// c.gridy++; |
// c.gridx = 0; |
// c.weightx = 0; |
// JLabel labelDLC = new JLabel(getLabelFor("DLC")); |
// panel.add(labelDLC, c); |
// c.weightx = 1; |
// c.gridx++; |
// JDate dateDLC = new JDate(); |
// panel.add(dateDLC, c); |
// addView(dateDLC, "DLC"); |
c.weightx = 0; |
c.gridy++; |
c.gridx = 0; |
JLabel labelOption = new JLabel(getLabelFor("OPTION")); |
c.fill = GridBagConstraints.BOTH; |
panel.add(labelOption, c); |
c.weightx = 0; |
JLabel labelDLC = new JLabel(getLabelFor("DLC")); |
panel.add(labelDLC, c); |
c.weightx = 1; |
c.gridx++; |
JCheckBox boxOption = new JCheckBox(); |
panel.add(boxOption, c); |
this.addSQLObject(boxOption, "OPTION"); |
JDate dateDLC = new JDate(); |
panel.add(dateDLC, c); |
addView(dateDLC, "DLC"); |
c.weightx = 0; |
c.gridy++; |
797,69 → 760,6 |
return panel; |
} |
protected Component createDeclinaisonPanel() { |
JPanel panel = new JPanel(new GridBagLayout()); |
panel.setOpaque(false); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
c.weighty = 0; |
c.weightx = 0; |
panel.add(new JLabel(getLabelFor("ID_ARTICLE_VIRTUEL_PERE")), c); |
c.gridx++; |
c.weightx = 1; |
final ElementComboBox boxPere = new ElementComboBox(); |
panel.add(boxPere, c); |
final ComboSQLRequest reqVir = getElement().createComboRequest(); |
reqVir.setWhere(new Where(getElement().getTable().getField("VIRTUEL"), "=", Boolean.TRUE)); |
boxPere.init(getElement(), reqVir); |
this.addView(boxPere, "ID_ARTICLE_VIRTUEL_PERE"); |
c.gridx = 0; |
c.gridy++; |
List<String> declFiels = new ArrayList<String>(); |
for (String string : getTable().getFieldsName()) { |
if (string.startsWith("ID_ARTICLE_DECLINAISON_")) { |
declFiels.add(string); |
} |
} |
this.boxesDeclinaison.clear(); |
for (String field : declFiels) { |
c.weightx = 0; |
if (c.gridx == 4) { |
c.gridx = 0; |
c.gridy++; |
} |
panel.add(new JLabel(getLabelFor(field)), c); |
c.gridx++; |
c.weightx = 1; |
ElementComboBox box1 = new ElementComboBox(); |
final SQLElement declElement = getElement().getForeignElement(field); |
box1.init(declElement, declElement.createComboRequest()); |
box1.setEnabled(InteractionMode.DISABLED); |
panel.add(box1, c); |
this.addView(box1, field); |
this.boxesDeclinaison.add(box1); |
c.gridx++; |
} |
boxPere.addModelListener("wantedID", new PropertyChangeListener() { |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
for (ElementComboBox elementComboBox : boxesDeclinaison) { |
elementComboBox.setEnabled(boxPere.getWantedID() != SQLRow.NONEXISTANT_ID ? InteractionMode.READ_WRITE : InteractionMode.DISABLED); |
} |
} |
}); |
return panel; |
} |
protected Component createStockPanel() { |
JPanel panel = new JPanel(new GridBagLayout()); |
panel.setOpaque(false); |
920,27 → 820,7 |
this.addView(fieldQteAchat, "QTE_ACHAT"); |
} |
// |
c.gridy++; |
c.gridx = 1; |
c.weightx = 1; |
JCheckBox DLCrequis = new JCheckBox("DLC requis"); |
panel.add(DLCrequis, c); |
addView(DLCrequis, "DLC_REQUIS"); |
c.gridy++; |
JCheckBox DLUOrequis = new JCheckBox("DLUO requis"); |
panel.add(DLUOrequis, c); |
addView(DLUOrequis, "DLUO_REQUIS"); |
c.gridy++; |
JCheckBox numeroLotRequis = new JCheckBox("n° de lot requis"); |
panel.add(numeroLotRequis, c); |
addView(numeroLotRequis, "NUMERO_LOT_REQUIS"); |
c.gridy++; |
JCheckBox numeroSerieRequis = new JCheckBox("n° de série requis"); |
panel.add(numeroSerieRequis, c); |
addView(numeroSerieRequis, "NUMERO_SERIE_REQUIS"); |
c.gridy++; |
c.weighty = 1; |
c.weightx = 1; |
c.fill = GridBagConstraints.BOTH; |
1247,76 → 1127,6 |
return panel; |
} |
protected JPanel createTarifPromotionPanel() { |
JPanel panel = new JPanel(new GridBagLayout()); |
panel.setOpaque(false); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
// Ajout tarif |
c.gridwidth = 1; |
c.weightx = 0; |
c.gridy++; |
c.gridx = 0; |
panel.add(new JLabel("Ajouter la promotion"), c); |
final ElementComboBox boxTarif = new ElementComboBox(); |
boxTarif.init(Configuration.getInstance().getDirectory().getElement("TARIF_PROMOTION")); |
c.gridx++; |
panel.add(boxTarif, c); |
c.fill = GridBagConstraints.NONE; |
c.gridx++; |
JButton buttonAjouter = new JButton("Ajouter"); |
buttonAjouter.setOpaque(false); |
panel.add(buttonAjouter, c); |
c.gridx++; |
JButton buttonSupprimer = new JButton("Supprimer"); |
buttonSupprimer.setOpaque(false); |
panel.add(buttonSupprimer, c); |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
c.gridy++; |
c.gridx = 0; |
c.fill = GridBagConstraints.BOTH; |
this.tableTarifPromotionVente.setOpaque(false); |
panel.add(this.tableTarifPromotionVente, c); |
// Listeners |
buttonAjouter.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
SQLRow rowTarif = boxTarif.getSelectedRow(); |
if (rowTarif == null || rowTarif.isUndefined()) { |
return; |
} |
SQLRowValues rowVals = new SQLRowValues(Configuration.getInstance().getBase().getTable("ARTICLE_TARIF_PROMOTION")); |
if (getSelectedID() > 1) { |
rowVals.put("ID_ARTICLE", getSelectedID()); |
} |
rowVals.put("ID_TARIF_PROMOTION", rowTarif.getID()); |
rowVals.put("PRIX_METRIQUE_VT_1", BigDecimal.ZERO); |
rowVals.put("PV_HT", BigDecimal.ZERO); |
rowVals.put("PV_TTC", BigDecimal.ZERO); |
tableTarifPromotionVente.getModel().addRow(rowVals); |
} |
}); |
buttonSupprimer.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
tableTarifPromotionVente.removeSelectedRow(); |
} |
}); |
return panel; |
} |
protected JPanel createCategorieComptablePanel() { |
JPanel panel = new JPanel(new GridBagLayout()); |
panel.setOpaque(false); |
1876,8 → 1686,6 |
this.tableCatComptable.updateField("ID_ARTICLE", selectedID); |
this.tableFourSec.updateField("ID_ARTICLE", selectedID); |
this.tableTarifQteVente.updateField("ID_ARTICLE", selectedID); |
this.tableTarifPromotionVente.updateField("ID_ARTICLE", selectedID); |
if (this.tableBom != null) { |
this.tableBom.updateField("ID_ARTICLE_PARENT", selectedID); |
} |
2010,7 → 1818,6 |
this.tableCatComptable.updateField("ID_ARTICLE", id); |
this.tableFourSec.updateField("ID_ARTICLE", id); |
this.tableTarifQteVente.updateField("ID_ARTICLE", id); |
this.tableTarifPromotionVente.updateField("ID_ARTICLE", id); |
if (this.tableBom != null) { |
this.tableBom.updateField("ID_ARTICLE_PARENT", id); |
} |
2021,26 → 1828,6 |
} |
((ReferenceArticleSQLElement) getElement()).initStock(id); |
ReferenceArticleSQLElement.updateDateAchat(getTable(), getTable().getRow(id)); |
// incrémentation du numéro auto |
if (NumerotationAutoSQLElement.getNextNumero(getElement().getClass(), new Date()).equalsIgnoreCase(this.textCode.getText().trim())) { |
final SQLTable tableNum = getElement().getDirectory().getElement(NumerotationAutoSQLElement.class).getTable(); |
SQLRowValues rowVals = new SQLRowValues(tableNum); |
final SQLRow rowNumAuto = tableNum.getRow(2); |
if (rowNumAuto.getObject("ARTICLE_START") != null) { |
int val = rowNumAuto.getInt("ARTICLE_START"); |
val++; |
rowVals.put("ARTICLE_START", new Integer(val)); |
try { |
rowVals.update(2); |
} catch (SQLException e) { |
e.printStackTrace(); |
} |
} |
} |
return id; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/TailleCouleurTableModel.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/TaxeCatComptableSQLElement.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/NouvellesDeclinaisonsFrame.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/ArticleDeclinaisonSQLElement.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/LotSQLElement.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/ListeTarifClient.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/ArticleTarifPromotionSQLElement.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/ListeDesLotsAction.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/ReferenceArticleSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
16,20 → 16,12 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.config.update.Updater_1_5; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement; |
import org.openconcerto.erp.core.common.ui.NumberCellRenderer; |
import org.openconcerto.erp.core.edm.AttachmentAction; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.core.reports.history.ui.HistoriqueArticleFrame; |
import org.openconcerto.erp.core.sales.product.action.InitializeStockPanel; |
import org.openconcerto.erp.core.sales.product.action.InventairePanel; |
import org.openconcerto.erp.core.sales.product.component.ReferenceArticleSQLComponent; |
import org.openconcerto.erp.core.sales.product.model.ProductComponent; |
import org.openconcerto.erp.core.supplychain.stock.action.ListeDesMouvementsStockAction; |
import org.openconcerto.erp.core.supplychain.stock.element.ComposedItemStockUpdater; |
import org.openconcerto.erp.core.supplychain.stock.element.DepotStockSQLElement; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItem; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItem.TypeStockMouvement; |
import org.openconcerto.erp.generationDoc.gestcomm.FicheArticleXmlSheet; |
import org.openconcerto.erp.model.MouseSheetXmlListeListener; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
37,11 → 29,7 |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.ConnectionHandlerNoSetup; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.DBSystemRoot; |
import org.openconcerto.sql.model.FieldPath; |
import org.openconcerto.sql.model.SQLDataSource; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowListRSH; |
52,52 → 40,30 |
import org.openconcerto.sql.model.graph.Path; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.ComboSQLRequest; |
import org.openconcerto.sql.request.ComboSQLRequest.KeepMode; |
import org.openconcerto.sql.request.ListSQLRequest; |
import org.openconcerto.sql.users.rights.UserRightsManager; |
import org.openconcerto.sql.utils.SQLUtils; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.EditPanel.EditMode; |
import org.openconcerto.sql.view.ListeAddPanel; |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn; |
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.sql.view.list.SQLTableModelColumn; |
import org.openconcerto.sql.view.list.SQLTableModelSource; |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline; |
import org.openconcerto.sql.view.list.action.ListEvent; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.FrameUtil; |
import org.openconcerto.ui.PanelFrame; |
import org.openconcerto.utils.CollectionUtils; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.ListMap; |
import org.openconcerto.utils.Tuple2; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
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.HashSet; |
import java.util.List; |
import java.util.Set; |
import javax.swing.AbstractAction; |
import javax.swing.JFrame; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
import javax.swing.JTabbedPane; |
import org.apache.commons.dbutils.ResultSetHandler; |
import org.apache.commons.dbutils.handlers.ArrayListHandler; |
public class ReferenceArticleSQLElement extends ComptaSQLConfElement { |
114,41 → 80,21 |
public ReferenceArticleSQLElement() { |
super("ARTICLE", "un article", "articles"); |
NumerotationAutoSQLElement.addClass(this.getClass(), "ARTICLE"); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, FicheArticleXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(FicheArticleXmlSheet.class).getRowActions()); |
this.stock = new PredicateRowAction(new AbstractAction("Mettre à jour les stocks") { |
@Override |
public void actionPerformed(ActionEvent e) { |
if (UserRightsManager.getCurrentUserRights().canAdd(getTable().getDBRoot().getTable("STOCK"))) { |
try { |
final List<SQLRowAccessor> selectedRows = IListe.get(e).getSelectedRowAccessors(); |
final List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows(); |
List<SQLRowAccessor> l = new ArrayList<SQLRowAccessor>(); |
for (SQLRowAccessor sqlRowValues : selectedRows) { |
final SQLRowAccessor stock = sqlRowValues.asRow().getNonEmptyForeign("ID_STOCK"); |
if (stock != null) { |
l.add(stock); |
} else { |
SQLRowValues rowValsArt = sqlRowValues.createEmptyUpdateRow(); |
SQLRowValues insert = rowValsArt.putRowValues("ID_STOCK"); |
insert.put("ID_ARTICLE", sqlRowValues.getID()); |
insert.put("ID_DEPOT_STOCK", DepotStockSQLElement.DEFAULT_ID); |
l.add(rowValsArt.commit().getForeign("ID_STOCK")); |
for (SQLRowValues sqlRowValues : selectedRows) { |
l.add(sqlRowValues.asRow().getForeign("ID_STOCK")); |
} |
} |
PanelFrame p = new PanelFrame(new InventairePanel(IListe.get(e), l), "Mise à jour des stocks"); |
FrameUtil.show(p); |
} catch (SQLException e1) { |
ExceptionHandler.handle("Erreur lors de la mise à jour du stock", e1); |
} |
} else { |
JOptionPane.showMessageDialog(null, "Vous n'avez les droits suffisants pour modifier manuellement les stocks!"); |
} |
} |
}, true, false); |
155,115 → 101,6 |
stock.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(stock); |
final SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false) && UserRightsManager.getCurrentUserRights().canAdd(getTable().getDBRoot().getTable("STOCK"))) { |
RowAction actionConvVirtuel = new PredicateRowAction(new AbstractAction("Initialiser les stocks") { |
@Override |
public void actionPerformed(ActionEvent e) { |
PanelFrame frame = new PanelFrame(new InitializeStockPanel(ReferenceArticleSQLElement.this, IListe.get(e).getSelectedRowAccessors()), "Initialisation du stock"); |
FrameUtil.showPacked(frame); |
} |
}, true, false).setPredicate(ListEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(actionConvVirtuel); |
} |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVER_DECLINAISON, false)) { |
RowAction actionConvVirtuel = new RowAction(new AbstractAction("Convertir en article virtuel") { |
@Override |
public void actionPerformed(ActionEvent e) { |
final SQLRowAccessor selectedRow = IListe.get(e).getSelectedRowAccessor(); |
try { |
selectedRow.createEmptyUpdateRow().put("VIRTUEL", Boolean.TRUE).commit(); |
} catch (SQLException e1) { |
ExceptionHandler.handle("Erreur lors de la conversion de l'article en virtuel", e1); |
} |
} |
}, true, false) { |
@Override |
public boolean enabledFor(ListEvent evt) { |
final List<? extends SQLRowAccessor> selection = evt.getSelectedRowAccessors(); |
if (selection.size() == 1) { |
return !selection.get(0).getBoolean("VIRTUEL") && selection.get(0).isForeignEmpty("ID_ARTICLE_VIRTUEL_PERE"); |
} |
return false; |
} |
}; |
getRowActions().add(actionConvVirtuel); |
RowAction actionCreateDecl = new RowAction(new AbstractAction("Créer une déclinaison") { |
@Override |
public void actionPerformed(ActionEvent e) { |
SQLRowValues rowVals = ReferenceArticleSQLElement.this.createCopy(IListe.get(e).getSelectedId()); |
ListMap<SQLTable, SQLRow> children = ReferenceArticleSQLElement.this.getChildrenRows(IListe.get(e).getSelectedRowAccessor().asRow()); |
for (SQLRow child : children.allValues()) { |
if (!child.getTable().getName().equals("STOCK")) { |
Configuration.getInstance().getDirectory().getElement(child.getTable()).createCopy(child, false, rowVals); |
} |
} |
rowVals.put("ID_ARTICLE_VIRTUEL_PERE", IListe.get(e).getSelectedId()); |
rowVals.put("VIRTUEL", Boolean.FALSE); |
rowVals.putEmptyLink("ID_STOCK"); |
EditFrame f = new EditFrame(createComponent(), EditMode.CREATION); |
f.getSQLComponent().select(rowVals); |
FrameUtil.show(f); |
} |
}, true, false) { |
@Override |
public boolean enabledFor(ListEvent evt) { |
final List<? extends SQLRowAccessor> selection = evt.getSelectedRowAccessors(); |
if (selection.size() == 1) { |
return selection.get(0).getBoolean("VIRTUEL"); |
} |
return false; |
} |
}; |
getRowActions().add(actionCreateDecl); |
RowAction actionCreateDecls = new RowAction(new AbstractAction("Créer des déclinaisons") { |
@Override |
public void actionPerformed(ActionEvent e) { |
SQLRowValues rowVals = ReferenceArticleSQLElement.this.createCopy(IListe.get(e).getSelectedId()); |
final SQLRow selectedRow = IListe.get(e).getSelectedRowAccessor().asRow(); |
ListMap<SQLTable, SQLRow> children = ReferenceArticleSQLElement.this.getChildrenRows(selectedRow); |
for (SQLRow child : children.allValues()) { |
if (!child.getTable().getName().equals("STOCK")) { |
Configuration.getInstance().getDirectory().getElement(child.getTable()).createCopy(child, false, rowVals); |
} |
} |
rowVals.put("ID_ARTICLE_VIRTUEL_PERE", IListe.get(e).getSelectedId()); |
rowVals.put("VIRTUEL", Boolean.FALSE); |
rowVals.putEmptyLink("ID_STOCK"); |
NouvellesDeclinaisonsFrame f = new NouvellesDeclinaisonsFrame(ReferenceArticleSQLElement.this, selectedRow); |
f.pack(); |
f.setLocationRelativeTo(null); |
FrameUtil.show(f); |
} |
}, false, true) { |
@Override |
public boolean enabledFor(ListEvent evt) { |
final List<? extends SQLRowAccessor> selection = evt.getSelectedRowAccessors(); |
if (selection.size() == 1) { |
return selection.get(0).getBoolean("VIRTUEL"); |
} |
return false; |
} |
}; |
getRowActions().add(actionCreateDecls); |
} |
PredicateRowAction history = new PredicateRowAction(new AbstractAction("Historique") { |
@Override |
276,28 → 113,6 |
history.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(history); |
PredicateRowAction mvtStock = new PredicateRowAction(new AbstractAction("Consulter les mouvements de stocks") { |
@Override |
public void actionPerformed(ActionEvent e) { |
JFrame frame = new ListeDesMouvementsStockAction(ComptaPropsConfiguration.getInstanceCompta(), IListe.get(e).getSelectedRowAccessor()).getFrame(); |
frame.setVisible(true); |
} |
}, false, true); |
mvtStock.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(mvtStock); |
if (ComptaPropsConfiguration.getInstanceCompta().isExperimental()) { |
PredicateRowAction batches = new PredicateRowAction(new AbstractAction("Lots et numéros de série") { |
@Override |
public void actionPerformed(ActionEvent e) { |
ListeDesLotsAction action = new ListeDesLotsAction(ReferenceArticleSQLElement.this.getDirectory(), IListe.get(e).getSelectedRowAccessor()); |
action.actionPerformed(e); |
} |
}, false, true); |
batches.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(batches); |
} |
PredicateRowAction clone = new PredicateRowAction(new AbstractAction("Dupliquer") { |
@Override |
304,7 → 119,7 |
public void actionPerformed(ActionEvent e) { |
SQLRowValues rowVals = ReferenceArticleSQLElement.this.createCopy(IListe.get(e).getSelectedId()); |
ListMap<SQLTable, SQLRow> children = ReferenceArticleSQLElement.this.getChildrenRows(IListe.get(e).getSelectedRowAccessor().asRow()); |
ListMap<SQLTable, SQLRow> children = ReferenceArticleSQLElement.this.getChildrenRows(IListe.get(e).getSelectedRow().asRow()); |
for (SQLRow child : children.allValues()) { |
Configuration.getInstance().getDirectory().getElement(child.getTable()).createCopy(child, false, rowVals); |
} |
321,51 → 136,11 |
actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(actionAttachment); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVER_DECLINAISON, false)) { |
PredicateRowAction actionADeclinaison = new PredicateRowAction(new AbstractAction("Gérer les déclinaisons") { |
@Override |
public void actionPerformed(ActionEvent e) { |
List<SQLElement> declElts = new ArrayList<>(); |
for (SQLTable table : getTable().getDBRoot().getTables()) { |
if (table.getName().startsWith("ARTICLE_DECLINAISON_")) { |
declElts.add(getDirectory().getElement(table)); |
} |
} |
JTabbedPane tabs = new JTabbedPane(); |
for (SQLElement elt : declElts) { |
final IListe liste = new IListe(elt.createTableSource()); |
ListeAddPanel panel = new ListeAddPanel(elt, liste); |
tabs.add(elt.getPluralName(), 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); |
PanelFrame frame = new PanelFrame(panel, "Liste des déclinaisons"); |
FrameUtil.showPacked(frame); |
} |
}, true); |
actionADeclinaison.setPredicate(IListeEvent.createTotalRowCountPredicate(0, Integer.MAX_VALUE)); |
getRowActions().add(actionADeclinaison); |
} |
} |
@Override |
protected SQLTableModelSourceOnline instantiateTableSourceOnline(ListSQLRequest req) { |
return new SQLTableModelSourceOnline(req, this, KeepMode.ROW); |
} |
@Override |
protected synchronized void _initTableSource(final SQLTableModelSource source) { |
super._initTableSource(source); |
source.getReq().addToGraphToFetch("ID_ARTICLE_VIRTUEL_PERE", "VIRTUEL", "ID_DEPOT_STOCK"); |
source.init(); |
final SQLTableModelColumn pvHA1Col = source.getColumn(getTable().getField("PRIX_METRIQUE_HA_1")); |
if (pvHA1Col != null) { |
390,35 → 165,6 |
paHTCol.setRenderer(CURRENCY_RENDERER); |
} |
final SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false)) { |
final BaseSQLTableModelColumn colStockGlobal = new BaseSQLTableModelColumn("Stock Global", BigDecimal.class) { |
@Override |
protected Object show_(SQLRowAccessor r) { |
BigDecimal totalQte = BigDecimal.ZERO; |
Collection<? extends SQLRowAccessor> stockElt = r.getReferentRows(getTable().getTable("STOCK").getField("ID_ARTICLE")); |
for (SQLRowAccessor rowElt : stockElt) { |
BigDecimal qteCmd = new BigDecimal(rowElt.getFloat("QTE_REEL")); |
totalQte = totalQte.add(qteCmd); |
} |
return totalQte; |
} |
@Override |
public Set<FieldPath> getPaths() { |
Path p2 = new Path(getTable()).add(getTable().getTable("STOCK").getField("ID_ARTICLE")); |
return CollectionUtils.createSet(new FieldPath(p2, "QTE_REEL")); |
} |
}; |
colStockGlobal.setRenderer(new NumberCellRenderer()); |
source.getColumns().add(colStockGlobal); |
} |
if (getTable().getDBRoot().contains("ARTICLE_ELEMENT") && !getTable().getDBRoot().contains("TARIF_AGENCE")) { |
source.getColumns().add(new BaseSQLTableModelColumn("Type", String.class) { |
445,13 → 191,6 |
} |
} |
@Override |
public Set<String> getReadOnlyFields() { |
Set<String> s = new HashSet<>(); |
s.add("ID_ARTICLE_VIRTUEL_PERE"); |
return s; |
} |
protected List<String> getListFields() { |
final List<String> l = new ArrayList<String>(); |
471,20 → 210,12 |
} |
l.add("PA_HT"); |
l.add("PV_HT"); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.SHOW_LIST_TAXE, false)) { |
l.add("ID_TAXE"); |
} |
l.add("PV_TTC"); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.SHOW_LIST_COMPTE, false)) { |
l.add("ID_COMPTE_PCE"); |
l.add("ID_COMPTE_PCE_ACHAT"); |
} |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.SHOW_LIST_FAMILLE, false)) { |
l.add("ID_FAMILLE_ARTICLE"); |
} |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.SHOW_LIST_FOURNISSEUR, false)) { |
l.add("ID_FOURNISSEUR"); |
} |
l.add("POIDS"); |
l.add("SKU"); |
508,18 → 239,7 |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.SHOW_PRODUCT_BAR_CODE, false)) { |
res.add(null, "CODE_BARRE"); |
} |
List<String> fieldDecl = new ArrayList<>(); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVER_DECLINAISON, false)) { |
for (String fieldName : getTable().getFieldsName()) { |
if (fieldName.startsWith("ID_ARTICLE_DECLINAISON_")) { |
fieldDecl.add(fieldName); |
} |
} |
} |
res.addAll(null, "CODE", "NOM", "ID_FAMILLE_ARTICLE", "ID_FOURNISSEUR"); |
res.addAll(null, fieldDecl); |
res.addAll(null, "CODE", "NOM", "ID_FAMILLE_ARTICLE"); |
return res; |
} |
532,13 → 252,6 |
} |
l.add("NOM"); |
List<String> fieldDecl = new ArrayList<>(); |
for (String fieldName : getTable().getFieldsName()) { |
if (fieldName.startsWith("ID_ARTICLE_DECLINAISON_")) { |
fieldDecl.add(fieldName); |
} |
} |
l.addAll(fieldDecl); |
l.add("PA_HT"); |
l.add("PV_HT"); |
l.add("DERNIER_DATE_ACHAT"); |
740,14 → 453,6 |
if (matchingArticles.size() > 0) { |
idArticle = matchingArticles.get(0).getID(); |
} else { |
Collection<SQLRowValues> refTarif = row.getReferentRows(row.getTable().getTable("ARTICLE_TARIF_FOURNISSEUR")); |
if (!refTarif.isEmpty()) { |
for (SQLRowValues sqlRowValues : refTarif) { |
SQLRowValues rowValsTarif = new SQLRowValues(sqlRowValues); |
rowValsTarif.put("ID_ARTICLE", vals); |
} |
} |
SQLRow rowNew = vals.insert(); |
idArticle = rowNew.getID(); |
} |
838,8 → 543,7 |
protected void _initComboRequest(ComboSQLRequest req) { |
super._initComboRequest(req); |
req.addToGraphToFetch("ID_DEPOT_STOCK"); |
req.setWhere(new Where(getTable().getField("VIRTUEL"), "=", Boolean.FALSE)); |
// req.addForeignToGraphToFetch("ID_DEPOT_STOCK", Arrays.asList("ID")); |
} |
static public void updateDateAchat(final SQLTable tableArticle, final SQLRow article) { |
858,141 → 562,4 |
tableArticle.getDBSystemRoot().getDataSource().execute(up); |
} |
/** |
* Création des déclinaisons tailles/couleurs à partir de l'article virtuel passé en parametre |
* |
* @param idArticlePere |
* @param tupleTailleCouleur |
* @throws SQLException |
*/ |
public void createDeclinaison(int idArticlePere, List<Tuple2<SQLRow, SQLRow>> tupleTailleCouleur) throws SQLException { |
final SQLRow row = getTable().getRow(idArticlePere); |
if (!row.getBoolean("VIRTUEL")) { |
throw new IllegalArgumentException("L'article n'est pas un article virtuel"); |
} |
ListMap<SQLTable, SQLRow> children = ReferenceArticleSQLElement.this.getChildrenRows(row); |
for (Tuple2<SQLRow, SQLRow> t : tupleTailleCouleur) { |
SQLRowValues rowVals = ReferenceArticleSQLElement.this.createCopy(idArticlePere); |
for (SQLRow child : children.allValues()) { |
Configuration.getInstance().getDirectory().getElement(child.getTable()).createCopy(child, false, rowVals); |
} |
rowVals.put("ID_ARTICLE_VIRTUEL_PERE", idArticlePere); |
rowVals.put("VIRTUEL", Boolean.FALSE); |
rowVals.put("ID_ARTICLE_DECLINAISON_TAILLE", t.get0().getID()); |
rowVals.put("ID_ARTICLE_DECLINAISON_COULEUR", t.get1().getID()); |
rowVals.commit(); |
} |
} |
public void transfert(final List<Tuple2<SQLRow, BigDecimal>> articles, final SQLRowAccessor selectedRowDepotDepart, final SQLRowAccessor selectedRowDepotArrivee, final String label, |
final Date dateValue) { |
final SQLTable mvtStockTable = getTable().getDBRoot().findTable("MOUVEMENT_STOCK"); |
List<String> multipleRequestsHundred = new ArrayList<String>(100); |
boolean usePrice = mvtStockTable.contains("PRICE"); |
List<StockItem> stockItems = new ArrayList<StockItem>(); |
try { |
final DBSystemRoot dbSystemRoot = selectedRowDepotDepart.getTable().getDBSystemRoot(); |
SQLUtils.executeAtomic(dbSystemRoot.getDataSource(), new ConnectionHandlerNoSetup<Object, SQLException>() { |
@Override |
public Object handle(SQLDataSource ds) throws SQLException { |
for (Tuple2<SQLRow, BigDecimal> t : articles) { |
SQLRow selectedRowArticle = t.get0(); |
BigDecimal qteReel = t.get1(); |
{ |
// DEPART |
final SQLRowAccessor rowStockDepart = ProductComponent.findOrCreateStock(selectedRowArticle, selectedRowDepotDepart); |
StockItem item = new StockItem(selectedRowArticle, rowStockDepart); |
if (!item.isStockInit()) { |
SQLRowValues rowVals = new SQLRowValues(mvtStockTable.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(label, selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice)); |
item.updateQty(diff, TypeStockMouvement.THEORIQUE); |
multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label, 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(mvtStockTable.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(label, selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice)); |
item.updateQty(diff, TypeStockMouvement.THEORIQUE); |
multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label, 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(dbSystemRoot, multipleRequestsHundred, handlers); |
final DBRoot root = mvtStockTable.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) { |
final SQLTable mvtStockTable = getTable().getDBRoot().findTable("MOUVEMENT_STOCK"); |
final String mvtStockTableQuoted = mvtStockTable.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; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/ArticleTarifSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
14,29 → 14,17 |
package org.openconcerto.erp.core.sales.product.element; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.sql.element.BaseSQLComponent; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.sqlobject.SQLRequestComboBox; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.StringUtils; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.util.ArrayList; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Set; |
import javax.swing.JLabel; |
import javax.swing.JTextField; |
import javax.swing.event.DocumentEvent; |
public class ArticleTarifSQLElement extends ComptaSQLConfElement { |
46,10 → 34,6 |
protected List<String> getListFields() { |
final List<String> l = new ArrayList<String>(); |
l.add("ID_TARIF"); |
l.add("ID_ARTICLE"); |
l.add("QTE"); |
l.add("PV_HT"); |
l.add("PV_TTC"); |
return l; |
} |
56,8 → 40,6 |
protected List<String> getComboFields() { |
final List<String> l = new ArrayList<String>(); |
l.add("ID_TARIF"); |
l.add("ID_ARTICLE"); |
l.add("PV_TTC"); |
return l; |
} |
67,22 → 49,6 |
return "ID_ARTICLE"; |
} |
@Override |
public Set<String> getInsertOnlyFields() { |
Set<String> req = new HashSet<>(); |
req.add("ID_TARIF"); |
req.add("ID_ARTICLE"); |
return req; |
} |
@Override |
public Set<String> getReadOnlyFields() { |
Set<String> ro = new HashSet<>(); |
ro.add("PV_HT"); |
ro.add("PV_TTC"); |
return ro; |
} |
public SQLComponent createComponent() { |
return new BaseSQLComponent(this) { |
90,144 → 56,21 |
this.setLayout(new GridBagLayout()); |
final GridBagConstraints c = new DefaultGridBagConstraints(); |
c.gridx = 0; |
c.weightx = 0; |
// Nom |
this.add(new JLabel(getLabelFor("ID_TARIF")), c); |
c.gridx++; |
c.weightx = 1; |
final SQLRequestComboBox tarifCombo = new SQLRequestComboBox(); |
this.add(tarifCombo, c); |
this.addRequiredSQLObject(tarifCombo, "ID_TARIF"); |
JLabel labelNom = new JLabel("PV_TTC"); |
JTextField textNom = new JTextField(); |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
this.add(new JLabel(getLabelFor("ID_ARTICLE")), c); |
this.add(labelNom, c); |
c.gridx++; |
c.weightx = 1; |
final SQLRequestComboBox artCombo = new SQLRequestComboBox(); |
this.add(artCombo, c); |
this.addRequiredSQLObject(artCombo, "ID_ARTICLE"); |
this.add(textNom, c); |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
JLabel labelQTE = new JLabel(getLabelFor("QTE")); |
JTextField textQTE = new JTextField(); |
this.add(labelQTE, c); |
c.gridx++; |
c.weightx = 1; |
this.add(textQTE, c); |
this.addRequiredSQLObject(textQTE, "QTE"); |
this.addRequiredSQLObject(textNom, "PV_TTC"); |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
JLabel labelRemise = new JLabel(getLabelFor("POURCENT_REMISE")); |
JTextField textRemise = new JTextField(); |
this.add(labelRemise, c); |
c.gridx++; |
c.weightx = 1; |
this.add(textRemise, c); |
this.addSQLObject(textRemise, "POURCENT_REMISE"); |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
// Nom |
JLabel labelPVM = new JLabel(getLabelFor("PRIX_METRIQUE_VT_1")); |
JTextField textPVM = new JTextField(); |
this.add(labelPVM, c); |
c.gridx++; |
c.weightx = 1; |
this.add(textPVM, c); |
this.addSQLObject(textPVM, "PRIX_METRIQUE_VT_1"); |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
JLabel labelPV = new JLabel(getLabelFor("PV_HT")); |
final JTextField textPV = new JTextField(); |
this.add(labelPV, c); |
c.gridx++; |
c.weightx = 1; |
this.add(textPV, c); |
this.addSQLObject(textPV, "PV_HT"); |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
this.add(new JLabel(getLabelFor("ID_TAXE")), c); |
c.gridx++; |
c.weightx = 1; |
final SQLRequestComboBox taxeCombo = new SQLRequestComboBox(); |
this.add(taxeCombo, c); |
this.addSQLObject(taxeCombo, "ID_TAXE"); |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
// Nom |
JLabel labelPVTTC = new JLabel(getLabelFor("PV_TTC")); |
final JTextField textTTC = new JTextField(); |
this.add(labelPVTTC, c); |
c.gridx++; |
c.weightx = 1; |
this.add(textTTC, c); |
this.addSQLObject(textTTC, "PV_TTC"); |
textPVM.getDocument().addDocumentListener(new org.openconcerto.utils.text.SimpleDocumentListener() { |
@Override |
public void update(DocumentEvent e) { |
final BigDecimal ht = StringUtils.getBigDecimalFromUserText(textPVM.getText()); |
if (ht != null) { |
SQLRowAccessor rTaxe = taxeCombo.getSelectedRowAccessor(); |
if (rTaxe == null || rTaxe.isUndefined()) { |
SQLRowAccessor a = artCombo.getSelectedRowAccessor(); |
if (a != null && !a.isUndefined()) { |
rTaxe = a.asRow().fetchNewRow().getForeignRow("ID_TAXE"); |
} |
if (rTaxe == null || rTaxe.isUndefined()) { |
rTaxe = TaxeCache.getCache().getFirstTaxe(); |
} |
} |
Float resultTaux = TaxeCache.getCache().getTauxFromId(rTaxe.getID()); |
if (resultTaux == null) { |
final SQLRow i = TaxeCache.getCache().getFirstTaxe(); |
resultTaux = i.getFloat("TAUX"); |
} |
float taux = (resultTaux == null) ? 0.0F : resultTaux.floatValue(); |
BigDecimal r = ht.multiply(BigDecimal.valueOf(taux).divide(BigDecimal.valueOf(100)).add(BigDecimal.ONE), DecimalUtils.HIGH_PRECISION); |
textPV.setText(textPVM.getText()); |
textTTC.setText(r.setScale(2, RoundingMode.HALF_UP).toString()); |
} else { |
textPV.setText(""); |
textTTC.setText(""); |
} |
} |
}); |
} |
}; |
} |
@Override |
public SQLRowValues createDefaultRowValues(String token) { |
SQLRowValues rowVals = super.createDefaultRowValues(token); |
rowVals.put("QTE", 1); |
return rowVals; |
} |
@Override |
protected String createCode() { |
return createCodeOfPackage() + ".price"; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/action/InitializeStockPanel.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/action/ListeDesArticlesAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
14,21 → 14,339 |
package org.openconcerto.erp.core.sales.product.action; |
import org.openconcerto.erp.action.CreateFrameAbstractAction; |
import org.openconcerto.erp.core.sales.product.ui.ListeDesArticlesFrame; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.ui.IListTotalPanel; |
import org.openconcerto.erp.core.sales.product.ui.FamilleArticlePanel; |
import org.openconcerto.erp.panel.ITreeSelection; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.FieldPath; |
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.model.graph.Path; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.ListSQLRequest; |
import org.openconcerto.sql.request.UpdateBuilder; |
import org.openconcerto.sql.view.ListeAddPanel; |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn; |
import org.openconcerto.sql.view.list.IListe; |
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; |
import org.openconcerto.utils.cc.ITransformer; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.Insets; |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionListener; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.math.BigDecimal; |
import java.util.ArrayList; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Set; |
import javax.swing.Action; |
import javax.swing.JButton; |
import javax.swing.JFrame; |
import javax.swing.JLabel; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.JSplitPane; |
import javax.swing.event.TableModelEvent; |
import javax.swing.event.TableModelListener; |
public class ListeDesArticlesAction extends CreateFrameAbstractAction { |
private PanelFrame panelFrame; |
String title = "Liste des articles"; |
private final SQLTable sqlTableArticle = ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("ARTICLE"); |
private final SQLTable sqlTableFamilleArticle = ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("FAMILLE_ARTICLE"); |
public ListeDesArticlesAction() { |
super(); |
this.putValue(Action.NAME, "Liste des articles"); |
} |
public JFrame createFrame() { |
final SQLElement elt = Configuration.getInstance().getDirectory().getElement(this.sqlTableArticle); |
final FamilleArticlePanel panelFam = new FamilleArticlePanel(elt.getForeignElement("ID_FAMILLE_ARTICLE")); |
final SQLTableModelSourceOnline createTableSource = elt.createTableSource(); |
SQLPreferences prefs = SQLPreferences.getMemCached(elt.getTable().getDBRoot()); |
SQLTableModelColumn colStock = null; |
// if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false)) { |
if (elt.getTable().getDBRoot().contains("ARTICLE_PRIX_REVIENT")) { |
colStock = createTableSource.getColumn(createTableSource.getColumns().size() - 2); |
} else { |
colStock = new BaseSQLTableModelColumn("Valeur HT du stock", BigDecimal.class) { |
@Override |
public JFrame createFrame() { |
return new ListeDesArticlesFrame(Configuration.getInstance().getDirectory()); |
protected Object show_(SQLRowAccessor r) { |
SQLRowAccessor stock = r.getForeign("ID_STOCK"); |
if (stock == null || stock.isUndefined()) { |
return BigDecimal.ZERO; |
} else { |
float qte = stock.getFloat("QTE_REEL"); |
BigDecimal ha = r.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 = elt.getTable(); |
Path p = new Path(table); |
Path p2 = new Path(table).addForeignField("ID_STOCK"); |
return CollectionUtils.createSet(new FieldPath(p, "PA_HT"), new FieldPath(p2, "QTE_REEL")); |
} |
}; |
colStock.setRenderer(ComptaSQLConfElement.CURRENCY_RENDERER); |
createTableSource.getColumns().add(colStock); |
} |
// } |
final IListe liste = new IListe(createTableSource); |
final ListeAddPanel panel = new ListeAddPanel(elt, liste) { |
@Override |
protected void handleAction(final JButton source, final ActionEvent evt) { |
if (source == this.buttonEffacer && getListe().fetchSelectedRow() != null) { |
JPanel panel = new JPanel(); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
c.gridwidth = 2; |
panel.add(new JLabel("Voulez vous supprimer ou rendre obsoléte?"), c); |
JButton buttonObs = new JButton("Obsolète"); |
JButton buttonSuppr = new JButton("Supprimer"); |
c.gridy++; |
panel.add(buttonObs, c); |
c.gridx++; |
panel.add(buttonSuppr, c); |
final JFrame frame = new PanelFrame(panel, "Suppression d'article"); |
buttonObs.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
List<SQLRowValues> rowVals = liste.getSelectedRows(); |
UpdateBuilder build = new UpdateBuilder(sqlTableArticle); |
build.setObject("OBSOLETE", Boolean.TRUE); |
List<Integer> ids = new ArrayList<Integer>(); |
for (SQLRowValues sqlRowValues : rowVals) { |
ids.add(sqlRowValues.getID()); |
} |
build.setWhere(new Where(sqlTableArticle.getKey(), ids)); |
sqlTableArticle.getDBSystemRoot().getDataSource().execute(build.asString()); |
frame.dispose(); |
} |
}); |
buttonSuppr.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
frame.dispose(); |
SuperHandleAction(source, evt); |
} |
}); |
frame.pack(); |
frame.setResizable(false); |
frame.setLocationRelativeTo(null); |
frame.setVisible(true); |
} else { |
super.handleAction(source, evt); |
} |
} |
public void SuperHandleAction(final JButton source, final ActionEvent evt) { |
super.handleAction(source, evt); |
} |
}; |
panel.getListe().getRequest().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
input.setWhere(getWhere(panelFam, input)); |
return input; |
} |
}); |
// if (elt.getTable().getDBRoot().contains("TARIF_AGENCE")) { |
// if (!UserRightsManager.getCurrentUserRights().haveRight("MODIF_PRODUCT_KIT")) { |
// liste.addSelectionDataListener(new PropertyChangeListener() { |
// |
// @Override |
// public void propertyChange(PropertyChangeEvent evt) { |
// SQLRowValues rowVals = IListe.get(evt).getSelectedRow(); |
// if (rowVals != null) { |
// int nbComp = |
// rowVals.getReferentRows(rowVals.getTable().getTable("ARTICLE_ELEMENT").getField("ID_ARTICLE_PARENT")).size(); |
// |
// panel.setModifyVisible(nbComp == 0 || (rowVals != null && |
// rowVals.getForeignID("ID_USER_COMMON_CREATE") == UserManager.getUserID())); |
// panel.setDeleteVisible(nbComp == 0 || (rowVals != null && |
// rowVals.getForeignID("ID_USER_COMMON_CREATE") == UserManager.getUserID())); |
// } |
// } |
// }); |
// } |
// } |
if (colStock != null) { |
// && !prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, 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); |
} |
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(panelFam), panel); |
JPanel panelAll = new JPanel(new GridBagLayout()); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
c.insets = new Insets(0, 0, 0, 0); |
panelAll.add(pane, c); |
final ITreeSelection tree = panelFam.getFamilleTree(); |
tree.addValueListener(new PropertyChangeListener() { |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
panel.getListe().getRequest().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
input.setWhere(getWhere(panelFam, input)); |
return input; |
} |
}); |
} |
}); |
// rafraichir le titre à chaque changement de la liste |
panel.getListe().addListener(new TableModelListener() { |
public void tableChanged(TableModelEvent e) { |
setTitle(panel); |
} |
}); |
panel.getListe().addListenerOnModel(new PropertyChangeListener() { |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
if (evt.getPropertyName() == null || evt.getPropertyName().equals("loading") || evt.getPropertyName().equals("searching")) |
setTitle(panel); |
} |
}); |
panelFam.getCheckObsolete().addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
final ListSQLRequest request = panel.getListe().getRequest(); |
request.setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
input.setWhere(getWhere(panelFam, input)); |
return input; |
} |
}); |
} |
}); |
this.panelFrame = new PanelFrame(panelAll, "Liste des articles"); |
return this.panelFrame; |
} |
protected void setTitle(ListeAddPanel panel) { |
String title = this.title; |
if (panel.getListe().getModel().isLoading()) |
title += ", chargement en cours"; |
if (panel.getListe().getModel().isSearching()) |
title += ", recherche en cours"; |
if (this.panelFrame != null) |
this.panelFrame.setTitle(title); |
} |
/** |
* Filtre par rapport à la famille sélectionnée |
* |
* @param panel |
* @return le where approprié |
*/ |
public Where getWhere(FamilleArticlePanel panel, SQLSelect request) { |
int id = panel.getFamilleTree().getSelectedID(); |
Where w = null; |
if (panel.getCheckObsolete().isSelected()) { |
w = new Where(this.sqlTableArticle.getField("OBSOLETE"), "=", Boolean.FALSE); |
// FIXME Fonctionnement avec multidepot |
// w = w.or(new |
// Where(request.getAlias(this.sqlTableArticle.getForeignTable("ID_STOCK").getField("QTE_REEL")), |
// ">", 0)); |
} |
if (id > 1) { |
Set<Integer> idsMatch = new HashSet<>(); |
idsMatch.add(id); |
fillChildren(idsMatch, CollectionUtils.createSet(id)); |
Where w2 = new Where(this.sqlTableArticle.getField("ID_FAMILLE_ARTICLE"), "=", this.sqlTableFamilleArticle.getKey()); |
w2 = w2.and(new Where(this.sqlTableFamilleArticle.getKey(), idsMatch)); |
if (w != null) { |
w = w.and(w2); |
} else { |
w = w2; |
} |
} |
return w; |
} |
private void fillChildren(Set<Integer> idsMatch, Set<Integer> father) { |
SQLRowValues rowVals = new SQLRowValues(this.sqlTableFamilleArticle); |
final String keyFieldName = rowVals.getTable().getKey().getName(); |
rowVals.put(keyFieldName, null); |
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowVals); |
List<SQLRowValues> children = fetcher.fetch(new Where(this.sqlTableFamilleArticle.getField("ID_FAMILLE_ARTICLE_PERE"), father)); |
Set<Integer> childToCheck = new HashSet<>(); |
for (SQLRowValues child : children) { |
if (!idsMatch.contains(child.getID())) { |
childToCheck.add(child.getID()); |
idsMatch.add(child.getID()); |
} |
} |
if (!childToCheck.isEmpty()) { |
fillChildren(idsMatch, childToCheck); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/action/TransfertStockPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
14,14 → 14,25 |
package org.openconcerto.erp.core.sales.product.action; |
import org.openconcerto.erp.core.common.ui.NumericTextField; |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.model.ProductComponent; |
import org.openconcerto.erp.core.supplychain.stock.element.ComposedItemStockUpdater; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItem; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItem.TypeStockMouvement; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.ConnectionHandlerNoSetup; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLDataSource; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.sqlobject.SQLRequestComboBox; |
import org.openconcerto.sql.utils.SQLUtils; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.JDate; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.text.SimpleDocumentListener; |
import org.openconcerto.utils.Tuple2; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
30,7 → 41,12 |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.math.BigDecimal; |
import java.util.Arrays; |
import java.math.RoundingMode; |
import java.sql.SQLException; |
import java.text.SimpleDateFormat; |
import java.util.ArrayList; |
import java.util.Date; |
import java.util.List; |
import javax.swing.JButton; |
import javax.swing.JFrame; |
41,8 → 57,11 |
import javax.swing.SwingUtilities; |
import javax.swing.event.DocumentEvent; |
import org.apache.commons.dbutils.ResultSetHandler; |
public class TransfertStockPanel extends JPanel { |
private final String mvtStockTableQuoted; |
private static String defaultLabel = "Transfert de stock"; |
public TransfertStockPanel(Configuration instance) { |
50,8 → 69,10 |
final JButton buttonUpdate = new JButton("Mettre à jour"); |
final ReferenceArticleSQLElement articleElt = instance.getDirectory().getElement(ReferenceArticleSQLElement.class); |
final SQLTable mvtStockTable = instance.getRoot().findTable("MOUVEMENT_STOCK"); |
this.mvtStockTableQuoted = mvtStockTable.getSQLName().quote(); |
final SQLElement articleElt = instance.getDirectory().getElement("ARTICLE"); |
final SQLRequestComboBox comboArticle = new SQLRequestComboBox(); |
comboArticle.uiInit(articleElt.createComboRequest()); |
167,20 → 188,110 |
public void actionPerformed(ActionEvent e) { |
buttonUpdate.setEnabled(false); |
BigDecimal qteReel = fieldReel.getValue(); |
List<String> multipleRequestsHundred = new ArrayList<String>(100); |
boolean usePrice = mvtStockTable.contains("PRICE"); |
List<StockItem> stockItems = new ArrayList<StockItem>(); |
final Date dateValue = date.getValue(); |
final SQLRow selectedRowArticle = comboArticle.getSelectedRow(); |
final SQLRow selectedRowDepotDepart = comboStockDepart.getSelectedRow(); |
final SQLRow selectedRowDepotArrivee = comboStockArrive.getSelectedRow(); |
try { |
SQLUtils.executeAtomic(selectedRowDepotDepart.getTable().getDBSystemRoot().getDataSource(), new ConnectionHandlerNoSetup<Object, SQLException>() { |
@Override |
public Object handle(SQLDataSource ds) throws SQLException { |
{ |
// DEPART |
final SQLRowAccessor rowStockDepart = ProductComponent.findOrCreateStock(selectedRowArticle, selectedRowDepotDepart); |
StockItem item = new StockItem(selectedRowArticle, rowStockDepart); |
if (!item.isStockInit()) { |
SQLRowValues rowVals = new SQLRowValues(mvtStockTable.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(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice)); |
item.updateQty(diff, TypeStockMouvement.THEORIQUE); |
multipleRequestsHundred |
.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label.getText(), 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(mvtStockTable.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(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice)); |
item.updateQty(diff, TypeStockMouvement.THEORIQUE); |
multipleRequestsHundred |
.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(label.getText(), selectedRowDepotDepart, selectedRowDepotArrivee), false, usePrice)); |
multipleRequestsHundred.add(item.getUpdateRequest()); |
} |
articleElt.transfert(Arrays.asList(Tuple2.create(comboArticle.getSelectedRow(), qteReel)), comboStockDepart.getSelectedRow(), comboStockArrive.getSelectedRow(), label.getText(), |
date.getValue()); |
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(instance.getRoot().getDBSystemRoot(), multipleRequestsHundred, handlers); |
final DBRoot root = mvtStockTable.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); |
} |
((JFrame) SwingUtilities.getRoot(TransfertStockPanel.this)).dispose(); |
} |
}); |
} |
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) { |
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
String mvtStockQuery = "INSERT INTO " + this.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 " + this.mvtStockTableQuoted + ")"; |
if (usePrice && prc != null) { |
mvtStockQuery += "," + prc.setScale(6, RoundingMode.HALF_UP).toString(); |
} |
mvtStockQuery += ")"; |
return mvtStockQuery; |
} |
private void updateButtons(final JButton buttonUpdate, final SQLRequestComboBox comboArticle, final SQLRequestComboBox comboStockDepart, final SQLRequestComboBox comboStockArrive, |
final NumericTextField fieldReel) { |
buttonUpdate.setEnabled(fieldReel.getText().trim().length() > 0 && comboArticle.getSelectedRow() != null && comboStockArrive.getSelectedRow() != null |
&& comboStockDepart.getSelectedRow() != null && comboStockArrive.getSelectedRow().getID() != comboStockDepart.getSelectedRow().getID()); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/ArticlePromotionTable.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/ListeDesArticlesFrame.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/TaxeCategorieComptableTable.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/QteUnitairePieceRowValuesRenderer.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/TicketSheetXML.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/model/TarifQuantite.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/model/ArticleCache.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/model/Categorie.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
16,9 → 16,7 |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.Comparator; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Set; |
public class Categorie { |
private static List<Categorie> topLevelCategories = new ArrayList<>(); |
28,7 → 26,7 |
// Sous catégories |
private List<Categorie> l = new ArrayList<>(); |
// Articles dans cette categorie |
private Set<Article> articles = new HashSet<>(); |
private List<Article> articles = new ArrayList<>(); |
private Categorie parent; |
private boolean isUnknown = false; |
71,8 → 69,10 |
} |
void addArticle(Article a) { |
if (!this.articles.contains(a)) { |
this.articles.add(a); |
} |
} |
public static List<Categorie> getTopLevelCategories() { |
return topLevelCategories; |
91,11 → 91,7 |
} |
public List<Article> getArticles() { |
int size = articles.size(); |
for (Categorie c : l) { |
size += c.getArticles().size(); |
} |
final List<Article> result = new ArrayList<>(size); |
final List<Article> result = new ArrayList<>(); |
result.addAll(articles); |
for (Categorie c : l) { |
result.addAll(c.getArticles()); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/model/Client.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
68,10 → 68,6 |
return fullName; |
} |
public void setFullName(String fullName) { |
this.fullName = fullName; |
} |
public BigDecimal getSolde() { |
return solde; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/model/Article.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
15,15 → 15,10 |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.QuickOrderedMap; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.Comparator; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
public class Article { |
35,18 → 30,11 |
private BigDecimal priceHT; |
private String barCode = "empty barcode"; |
private String code = ""; |
private BigDecimal discount_pct = BigDecimal.ZERO; |
private BigDecimal ecotaxe = BigDecimal.ZERO; |
private final int id; |
// unité de vente (null si à la pièce) |
private String salesUnit; |
private static Map<String, List<Article>> codes = new HashMap<>(); |
private static Map<String, Article> codes = new HashMap<String, Article>(); |
// declinaison (ex "taille":"45", "couleur","rouge"), null si pas de declinaison |
private QuickOrderedMap<String, String> declinaisons; |
List<TarifQuantite> tarifs; |
private String declinaison; |
public Article(Categorie s1, String string, int id) { |
this.s = s1; |
this.id = id; |
56,7 → 44,6 |
public Article(Article a) { |
this.s = a.s; |
this.code = a.code; |
this.name = a.name; |
this.priceTTC = a.priceTTC; |
this.idTaxe = a.idTaxe; |
64,66 → 51,9 |
this.barCode = a.barCode; |
this.id = a.id; |
this.salesUnit = a.salesUnit; |
this.discount_pct = a.discount_pct; |
this.ecotaxe = a.ecotaxe; |
this.s.addArticle(this); |
final QuickOrderedMap<String, String> decl = a.getDeclinaisons(); |
if (decl != null) { |
final int size = decl.size(); |
this.declinaisons = new QuickOrderedMap<>(size); |
for (int i = 0; i < size; i++) { |
this.declinaisons.put(decl.getKey(i), decl.getValue(i)); |
} |
} |
} |
public void setTarifsPromotion(List<TarifQuantite> list) { |
this.tarifs = new ArrayList<>(); |
for (TarifQuantite t : list) { |
if (t.getIdArticle() == this.id) { |
this.tarifs.add(t); |
} |
} |
Collections.sort(this.tarifs, new Comparator<TarifQuantite>() { |
@Override |
public int compare(TarifQuantite o1, TarifQuantite o2) { |
return o1.getQuantite() - o2.getQuantite(); |
} |
}); |
} |
public TarifQuantite getTarifPromotionForQuantity(int qty) { |
if (this.tarifs == null || this.tarifs.isEmpty()) { |
return null; |
} |
TarifQuantite result = null; |
for (final TarifQuantite t : this.tarifs) { |
if (t.getQuantite() > qty) { |
break; |
} |
result = t; |
} |
return result; |
} |
public void addDeclinaison(String key, String value) { |
if (this.declinaisons == null) { |
this.declinaisons = new QuickOrderedMap<>(5); |
} |
this.declinaisons.put(key, value); |
} |
public QuickOrderedMap<String, String> getDeclinaisons() { |
return this.declinaisons; |
} |
public boolean isPromotion() { |
return this.tarifs != null && !this.tarifs.isEmpty(); |
} |
public boolean isAdditionalCopyRequested() { |
return this.additionalCopyRequested; |
} |
137,36 → 67,9 |
} |
public BigDecimal getPriceWithoutTax() { |
return getPriceWithoutTax(false); |
} |
public BigDecimal getPriceWithoutTax(boolean with_discount) { |
if (with_discount) |
return this.priceHT.multiply(BigDecimal.ONE.subtract(getDiscountPct())); |
return this.priceHT; |
} |
public BigDecimal getPriceWithoutTax(BigDecimal qty) { |
return getPriceWithoutTax(qty, false); |
} |
public BigDecimal getPriceWithoutTax(BigDecimal qty, boolean withDiscount) { |
BigDecimal price = this.priceHT; |
if (getSalesUnit() == null) { |
// Promotion |
final TarifQuantite tarifPromotionForQuantity = getTarifPromotionForQuantity(qty.intValue()); |
if (tarifPromotionForQuantity != null) { |
price = tarifPromotionForQuantity.getPrixHT(); |
} |
} |
if (withDiscount) { |
price = price.multiply(BigDecimal.ONE.subtract(getDiscountPct())); |
} |
return price; |
} |
public void setPriceWithoutTax(BigDecimal priceHTInCents) { |
this.priceHT = priceHTInCents; |
} |
181,38 → 84,17 |
public void setBarCode(String bar) { |
this.barCode = bar; |
List<Article> list = codes.get(bar); |
if (list == null) { |
list = new ArrayList<>(); |
codes.put(bar, list); |
codes.put(bar, this); |
} |
list.add(this); |
} |
public void setPriceWithTax(BigDecimal priceInCents) { |
this.priceTTC = priceInCents; |
} |
public BigDecimal getPriceWithTax(BigDecimal quantity) { |
return getPriceWithTax(quantity, false); |
public BigDecimal getPriceWithTax() { |
return this.priceTTC; |
} |
public BigDecimal getPriceWithTax(BigDecimal qty, boolean withDiscount) { |
BigDecimal price = this.priceTTC; |
if (getSalesUnit() == null) { |
// Promotion |
final TarifQuantite tarifPromotionForQuantity = getTarifPromotionForQuantity(qty.intValue()); |
if (tarifPromotionForQuantity != null) { |
price = tarifPromotionForQuantity.getPrixTTC(); |
} |
} |
if (withDiscount) { |
price = price.multiply(BigDecimal.ONE.subtract(getDiscountPct())); |
} |
return price; |
} |
public String getName() { |
return this.name; |
} |
235,13 → 117,10 |
@Override |
public String toString() { |
if (this.declinaisons != null) { |
return "Article:" + this.code + " | " + this.name + " " + this.priceTTC + " cents" + "(HT:" + this.priceHT + ") " + getSalesUnit() + " discount:" + getDiscountPct(); |
return "Article:" + this.name + " " + this.priceTTC + " cents" + "(HT:" + this.priceHT + ") " + getSalesUnit(); |
} |
return "Article:" + this.code + " | " + this.name + " [" + this.declinaisons + "] : " + this.priceTTC + " cents" + "(HT:" + this.priceHT + ") " + getSalesUnit() + " discount:" + getDiscountPct(); |
} |
public static List<Article> getArticleFromBarcode(String code) { |
public static Article getArticleFromBarcode(String code) { |
return codes.get(code); |
} |
279,41 → 158,4 |
public String getSalesUnit() { |
return this.salesUnit; |
} |
public void setDiscountPct(BigDecimal dsct) { |
this.discount_pct = dsct; |
} |
public BigDecimal getEcoTaxe() { |
return this.ecotaxe; |
} |
public BigDecimal getDiscountPct() { |
return this.discount_pct; |
} |
public void setEcoTaxe(BigDecimal ecotaxe) { |
this.ecotaxe = ecotaxe; |
} |
/** |
* ligne precisant la declinaison sur le ticket |
*/ |
public void setDeclinaison(String declinaison) { |
this.declinaison = declinaison; |
} |
public String getDeclinaison() { |
if (this.declinaison == null && this.declinaisons != null && !this.declinaisons.isEmpty()) { |
StringBuilder b = new StringBuilder(); |
for (int i = 0; i < this.declinaisons.size(); i++) { |
b.append(this.declinaisons.getValue(i)); |
b.append(" "); |
} |
return b.toString().trim(); |
} |
return this.declinaison; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/model/Ticket.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
24,6 → 24,7 |
import org.openconcerto.erp.core.sales.pos.io.Printable; |
import org.openconcerto.erp.core.sales.pos.io.TicketPrinter; |
import org.openconcerto.erp.core.sales.pos.model.RegisterFiles.HashMode; |
import org.openconcerto.erp.core.sales.pos.ui.CaissePanel; |
import org.openconcerto.erp.core.sales.pos.ui.TicketCellRenderer; |
import org.openconcerto.erp.generationEcritures.GenerationEcritures; |
import org.openconcerto.erp.generationEcritures.GenerationMvtVirement; |
30,6 → 31,8 |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElementDirectory; |
import org.openconcerto.sql.model.SQLBackgroundTableCache; |
import org.openconcerto.sql.model.SQLBackgroundTableCacheItem; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
52,11 → 55,9 |
import java.util.Collections; |
import java.util.Comparator; |
import java.util.Date; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Locale; |
import java.util.Map; |
import java.util.Set; |
import org.jdom2.Attribute; |
import org.jdom2.Document; |
151,12 → 152,8 |
final String codebarre = element.getAttributeValue("codebarre"); |
final String codeArt = element.getAttributeValue("code"); |
final String salesUnit = element.getAttributeValue("unit"); |
final String declinaison = element.getAttributeValue("declinaison"); |
final Categorie cat = new Categorie(categorie); |
final BigDecimal discount_pct = new BigDecimal(element.getAttributeValue("discount_pct", "0.00")); |
final BigDecimal ecotaxe = new BigDecimal(element.getAttributeValue("ecotaxe", "0.00")); |
final String valueID = element.getAttributeValue("id"); |
final int id = valueID == null || valueID.trim().length() == 0 ? tableArticle.getUndefinedID() : Integer.parseInt(valueID); |
167,11 → 164,6 |
art.setIdTaxe(idTaxe); |
art.setBarCode(codebarre); |
art.setSalesUnit(salesUnit); |
art.setDeclinaison(declinaison); |
art.setDiscountPct(discount_pct); |
art.setEcoTaxe(ecotaxe); |
final TicketItem line = new TicketItem(art, qte); |
t.items.add(line); |
207,13 → 199,10 |
} |
} |
// TODO receiptCode should be immutable and the day part should be the current |
// accounting day |
// not the day of the present time. E.g. for work day beginning at 15:00, even |
// at 3:00 the |
// TODO receiptCode should be immutable and the day part should be the current accounting day |
// not the day of the present time. E.g. for work day beginning at 15:00, even at 3:00 the |
// receipt code should contain the previous day. |
// The creationCal should only be set once the ticket is done (i.e. no further |
// modifications |
// The creationCal should only be set once the ticket is done (i.e. no further modifications |
// should be allowed) |
// create new ticket, i.e. null creationDate since it's not done |
288,23 → 277,16 |
e.setAttribute("qte", String.valueOf(item.getQty())); |
// Prix unitaire |
final Article article = item.getArticle(); |
e.setAttribute("prix", String.valueOf(article.getPriceWithTax(item.getQty(), false))); |
e.setAttribute("prixHT", String.valueOf(article.getPriceWithoutTax(item.getQty(), false))); |
e.setAttribute("prix", String.valueOf(article.getPriceWithTax())); |
e.setAttribute("prixHT", String.valueOf(article.getPriceWithoutTax())); |
e.setAttribute("idTaxe", String.valueOf(article.getIdTaxe())); |
e.setAttribute("categorie", article.getCategorie().getName()); |
e.setAttribute("codebarre", article.getBarCode()); |
e.setAttribute("code", article.getCode()); |
e.setAttribute("id", String.valueOf(article.getId())); |
e.setAttribute("ecotaxe", String.valueOf(article.getEcoTaxe())); |
e.setAttribute("discount_pct", String.valueOf(article.getDiscountPct())); |
if (article.getSalesUnit() != null) { |
e.setAttribute("unit", article.getSalesUnit()); |
} |
if (article.getDeclinaison() != null) { |
e.setAttribute("declinaison", article.getDeclinaison()); |
} |
e.setText(article.getName()); |
topLevel.addContent(e); |
} |
438,10 → 420,9 |
final BigDecimal nb = item.getQty(); |
final Float tauxFromId = TaxeCache.getCache().getTauxFromId(article.getIdTaxe()); |
final BigDecimal tauxTVA = BigDecimal.valueOf(tauxFromId).movePointLeft(2).add(BigDecimal.ONE); |
final BigDecimal unitPrice = article.getPriceWithoutTax().multiply(tauxTVA, DecimalUtils.HIGH_PRECISION); |
final BigDecimal multiply = article.getPriceWithoutTax().multiply(nb, DecimalUtils.HIGH_PRECISION).multiply(tauxTVA, DecimalUtils.HIGH_PRECISION); |
final BigDecimal unitPrice = article.getPriceWithoutTax(nb, false).multiply(tauxTVA, DecimalUtils.HIGH_PRECISION); |
final BigDecimal multiply = article.getPriceWithoutTax(nb, false).multiply(nb, DecimalUtils.HIGH_PRECISION).multiply(tauxTVA, DecimalUtils.HIGH_PRECISION); |
String qtyString = DefaultTicketPrinter.formatRight(MAX_QTE_WIDTH, String.valueOf(nb)); |
final String priceUnformated = TicketCellRenderer.centsToString(multiply.movePointRight(2).setScale(0, RoundingMode.HALF_UP).intValue()); |
final String priceString = DefaultTicketPrinter.formatRight(MAX_PRICE_WIDTH, priceUnformated); |
469,31 → 450,12 |
final String nameString = DefaultTicketPrinter.formatLeft(maxWidth - 2 - MAX_PRICE_WIDTH - MAX_QTE_WIDTH - 1 - unitPriceString.length(), article.getName()); |
prt.addToBuffer(qtyString + " " + nameString + " " + unitPriceString + " " + priceString); |
} |
if (article.getDeclinaison() != null) { |
prt.addToBuffer(" " + article.getDeclinaison()); |
} |
if (article.getSalesUnit() != null) { |
prt.addToBuffer( |
" (" + nb.abs() + " " + article.getSalesUnit() + " x " + TicketCellRenderer.centsToString(unitPrice.movePointRight(2).setScale(0, RoundingMode.HALF_UP).intValue()) + ")"); |
} |
if (article.getEcoTaxe().compareTo(BigDecimal.ZERO) != 0) { |
final String nameString = " * dont eco-part.:"; |
BigDecimal eco = article.getEcoTaxe().movePointRight(2).setScale(0, RoundingMode.HALF_UP); |
final String ecoString = DefaultTicketPrinter.formatRight(MAX_PRICE_WIDTH, TicketCellRenderer.centsToString(eco.intValue())); |
prt.addToBuffer(nameString + ecoString); |
} |
if (article.getDiscountPct().compareTo(BigDecimal.ZERO) != 0) { |
final String nameString = DefaultTicketPrinter.formatLeft(maxWidth - 2 - MAX_PRICE_WIDTH - 1, " * Remise"); |
BigDecimal discount = multiply.movePointRight(2).multiply(article.getDiscountPct()).negate().setScale(0, RoundingMode.HALF_UP); |
final String discountString = DefaultTicketPrinter.formatRight(MAX_PRICE_WIDTH, TicketCellRenderer.centsToString(discount.intValue())); |
prt.addToBuffer(" " + nameString + " " + " " + discountString); |
} |
} |
final StringBuilder spacer = new StringBuilder(); |
for (int i = 0; i <= MAX_QTE_WIDTH; i++) { |
spacer.append(' '); |
629,22 → 591,22 |
public void incrementArticle(final Article a) { |
System.err.println("Ticket.incrementArticle()" + a.getName()); |
TicketItem ticketLine; |
boolean alreadyExist = false; |
if (a.getSalesUnit() == null) { |
for (final TicketItem line : this.items) { |
if (line.getArticle().equals(a)) { |
alreadyExist = true; |
ticketLine = line; |
ticketLine.setQty(line.getQty().add(BigDecimal.ONE)); |
line.setQty(line.getQty().add(BigDecimal.ONE)); |
break; |
} |
} |
} |
if (!alreadyExist) { |
ticketLine = new TicketItem(a, BigDecimal.ONE); |
this.items.add(ticketLine); |
final TicketItem line = new TicketItem(a, BigDecimal.ONE); |
this.items.add(line); |
} |
} |
public void addItem(TicketItem item) { |
668,29 → 630,12 |
final Boolean bServiceActive = Boolean.valueOf(val); |
calc.setServiceActive(bServiceActive != null && bServiceActive); |
final int size = this.items.size(); |
Set<Integer> ids = new HashSet<>(); |
ArticleCache cache = ArticleCache.getInstance(); |
for (int i = 0; i < size; i++) { |
final TicketItem line = this.items.get(i); |
final Article art = line.getArticle(); |
int id = art.getId(); |
if (!cache.isInCache(id)) { |
ids.add(id); |
} |
} |
if (!ids.isEmpty()) { |
cache.preloadCacheArticleMap(new ArrayList<>(ids)); |
} |
for (int i = 0; i < size; i++) { |
final TicketItem line = this.items.get(i); |
final BigDecimal count = line.getQty(); |
final Article art = line.getArticle(); |
final SQLRowValues rowVals = new SQLRowValues(tableElt); |
rowVals.put("T_PV_HT", art.getPriceWithoutTax(count, true).multiply(count)); |
rowVals.put("T_PV_HT", art.getPriceWithoutTax().multiply(count)); |
if (art.getSalesUnit() != null) { |
rowVals.put("QTE_UNITAIRE", count); |
rowVals.put("QTE", BigDecimal.ONE); |
698,8 → 643,7 |
rowVals.put("QTE", count.intValue()); |
} |
rowVals.put("ID_TAXE", art.getIdTaxe()); |
System.out.println("Ticket.getTotalCalculator()" + rowVals); |
calc.addLine(rowVals, cache.getArticleRowValuesFromCache(art.getId()), i, false); |
calc.addLine(rowVals, CaissePanel.getArticleRowValuesFromCache(art.getId()), i, false); |
} |
calc.checkResult(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/io/ConcertProtocol.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
13,33 → 13,17 |
package org.openconcerto.erp.core.sales.pos.io; |
import org.openconcerto.erp.core.sales.pos.io.ConcertProtocol.ConcertStateListener.States; |
import org.openconcerto.utils.StringUtils; |
import gnu.io.CommPort; |
import gnu.io.CommPortIdentifier; |
import gnu.io.SerialPort; |
import java.io.ByteArrayOutputStream; |
import java.io.FileInputStream; |
import java.io.FileOutputStream; |
import java.io.InputStream; |
import java.io.OutputStream; |
import java.util.ArrayList; |
import java.util.List; |
import org.apache.poi.util.HexDump; |
import gnu.io.CommPort; |
import gnu.io.CommPortIdentifier; |
import gnu.io.SerialPort; |
public class ConcertProtocol { |
public interface ConcertStateListener { |
enum States { |
ERROR, CONNECTED, WAITING, OK, NOK |
} |
void stateChanged(States state); |
} |
// Message start |
private static final char STX = (char) 0x02; |
// Message end |
63,21 → 47,10 |
public static final String CURRENCY_EUR = "978"; |
private String port; |
private List<ConcertStateListener> listeners = new ArrayList<>(); |
public ConcertProtocol(String port) { |
this.port = port; |
} |
public void addStateListener(ConcertStateListener listener) { |
listeners.add(listener); |
} |
private void fireStateChanged(States connected) { |
for (ConcertStateListener l : listeners) |
l.stateChanged(connected); |
} |
public synchronized boolean sendCardPayment(int amountInCents, String currency) throws Exception { |
if (currency == null) { |
currency = CURRENCY_EUR; |
88,38 → 61,19 |
public boolean sendPrototolE(int posIndex, int amountInCents, boolean requireResponse, char mode, char type, String currency, String string) throws Exception { |
boolean result = false; |
if (posIndex > 99 || posIndex < 0) { |
fireStateChanged(ConcertStateListener.States.ERROR); |
throw new IllegalArgumentException("Pos index must be between 0 and 99"); |
} |
if (amountInCents < 0) { |
fireStateChanged(ConcertStateListener.States.ERROR); |
throw new IllegalArgumentException("Amount must be positive"); |
} |
if (currency.length() != 3) { |
fireStateChanged(ConcertStateListener.States.ERROR); |
throw new IllegalArgumentException("Bad currency code : " + currency); |
} |
final OutputStream out; |
InputStream in; |
final SerialPort serialPort; |
if (isSerialPort()) { |
serialPort = getSerialPort(); |
out = serialPort.getOutputStream(); |
in = serialPort.getInputStream(); |
} else { |
serialPort = null; |
in = new FileInputStream(this.port); |
final SerialPort serialPort = getSerialPort(); |
final OutputStream out = serialPort.getOutputStream(); |
final InputStream in = serialPort.getInputStream(); |
if (in.available() > 0) { |
byte[] buffer = new byte[512]; |
in.read(buffer); |
in.close(); |
} |
in = new FileInputStream(this.port); |
out = new FileOutputStream(this.port); |
} |
out.write(ENQ); |
byte[] buffer = new byte[512]; |
126,18 → 80,10 |
int nbRead = in.read(buffer); |
if (nbRead != 1 || buffer[0] != ACK) { |
String r = StringUtils.bytesToHexString(buffer, nbRead); |
in.close(); |
out.close(); |
if (serialPort != null) { |
String r = HexDump.toHex(buffer, nbRead); |
serialPort.close(); |
} |
fireStateChanged(ConcertStateListener.States.ERROR); |
throw new IllegalStateException("Bad response received : " + r); |
} |
fireStateChanged(ConcertStateListener.States.CONNECTED); |
// |
final ByteArrayOutputStream bOut = new ByteArrayOutputStream(); |
bOut.write(STX); |
166,13 → 112,8 |
// READ ACK |
nbRead = in.read(buffer); |
if (nbRead != 1 || buffer[0] != ACK) { |
String r = StringUtils.bytesToHexString(buffer, nbRead); |
in.close(); |
out.close(); |
if (serialPort != null) { |
String r = HexDump.toHex(buffer, nbRead); |
serialPort.close(); |
} |
fireStateChanged(ConcertStateListener.States.ERROR); |
throw new IllegalStateException("Bad response received : " + nbRead + ": " + r); |
} |
179,8 → 120,6 |
// END |
out.write(EOT); |
fireStateChanged(ConcertStateListener.States.WAITING); |
// Wait reply |
int count = 0; |
final int maxCount = 60 * 5; |
194,11 → 133,9 |
result = true; |
out.write(ACK); |
count = maxCount; |
fireStateChanged(ConcertStateListener.States.OK); |
} else if (buffer[3] == '7') { |
out.write(NACK); |
count = maxCount; |
fireStateChanged(ConcertStateListener.States.NOK); |
} |
} else if (buffer[0] == EOT) { |
count = maxCount; |
211,25 → 148,18 |
out.close(); |
in.close(); |
if (serialPort != null) { |
serialPort.close(); |
} |
return result; |
} |
private byte getLrc(byte[] bytes) { |
byte lrc = (byte) 0x0; |
byte LRC = (byte) 0x0; |
for (int i = 1; i < bytes.length; i++) { |
lrc ^= bytes[i]; |
LRC ^= bytes[i]; |
} |
return lrc; |
return LRC; |
} |
private boolean isSerialPort() { |
return (this.port.startsWith("/dev") || this.port.startsWith("COM")); |
} |
private SerialPort getSerialPort() throws Exception { |
if (port == null || port.length() == 0) { |
throw new IllegalStateException("Invalid serial port name: " + port); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/io/AbstractESCPrinter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
100,12 → 100,6 |
c = 135; |
} else if (c == 'ô') { |
c = 147; |
} else if (c == 'É') { |
c = 'E'; |
} else if (c == 'È') { |
c = 'E'; |
} else if (c == '²') { |
c = '2'; |
} |
bOut.write(c); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/io/BarcodeReader.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
14,7 → 14,6 |
package org.openconcerto.erp.core.sales.pos.io; |
import org.openconcerto.erp.core.sales.pos.ui.BarcodeListener; |
import org.openconcerto.erp.gs1.GS1Util; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.component.ITextArea; |
import org.openconcerto.utils.StringUtils; |
42,8 → 41,7 |
/** |
* Lecteur code barres, intercepte les événements clavier pour détecter un scan de code. Le code |
* barre doit terminer par un retour à la ligne. Pour les GS1 : Aim Code ID Character AIM ID doit |
* être activé, ]D2 pour databar / ]C1 pour GS1 |
* barre doit terminer par un retour à la ligne. |
*/ |
public class BarcodeReader implements KeyEventDispatcher { |
58,7 → 56,7 |
private TimerTask task; |
private boolean enable = true; |
private boolean debug = false; |
private Map<Integer, String> mapCharacterFR = new HashMap<>(); |
Map<Integer, String> mapCharacterFR = new HashMap<>(); |
public BarcodeReader(int maxInterKeyDelay) { |
this.timer = null; |
195,7 → 193,6 |
} |
} else if (keyChar == KeyEvent.CHAR_UNDEFINED) { |
System.err.println("CHAR_UNDEFINED"); |
this.value += '\u001D'; |
} else { |
// Caractere non code barre |
if (this.debug) { |
209,20 → 206,11 |
this.task = new TimerTask() { |
@Override |
public void run() { |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
redispatch(); |
redispatchLater(); |
} |
}); |
} |
}; |
try { |
this.timer.schedule(this.task, this.maxInterKeyDelay); |
} catch (Exception ex) { |
ex.printStackTrace(); |
} |
} |
// si pas d'evenement, pas de temps associé |
assert !this.eve.isEmpty() || this.firstTime == -1; |
} |
230,6 → 218,15 |
} |
private void redispatchLater() { |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
redispatch(); |
} |
}); |
} |
private void redispatch() { |
for (int i = 0; i < this.eve.size(); i++) { |
final KeyEvent ee = this.eve.get(i); |
307,15 → 304,7 |
public void barcodeRead(String code) { |
t1.append("Barcode OK : '" + code + "'\n"); |
t1.append("Hex: " + StringUtils.bytesToHexString(code.getBytes())); |
t1.append("\n"); |
GS1Util e = new GS1Util(); |
try { |
t1.append("GS1: " + e.parseFromScanner(code).formatHumanReadable()); |
} catch (Exception ex) { |
t1.append("GS1: " + ex.getMessage()); |
} |
t1.append("\n\n"); |
} |
}); |
f.setSize(new Dimension(640, 480)); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/POSConfiguration.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
60,8 → 60,6 |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.i18n.TranslationManager; |
import java.awt.GraphicsDevice; |
import java.awt.GraphicsEnvironment; |
import java.io.File; |
import java.io.FileOutputStream; |
import java.io.IOException; |
111,11 → 109,10 |
private int userID = 2; |
private int companyID = 42; |
private int posID = 2; |
private int depotStockId = 2; |
private int scanDelay = 80; |
private List<TicketLine> headerLines = new ArrayList<>(); |
private List<TicketLine> footerLines = new ArrayList<>(); |
private List<TicketLine> headerLines = new ArrayList<TicketLine>(); |
private List<TicketLine> footerLines = new ArrayList<TicketLine>(); |
// Terminal CB |
private String creditCardPort = ""; |
// LCD |
173,18 → 170,10 |
// Screen |
public int getScreenWidth() { |
if (screenWidth == 0) { |
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
screenWidth = gd.getDisplayMode().getWidth(); |
} |
return screenWidth; |
} |
public int getScreenHeight() { |
if (screenHeight == 0) { |
GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(); |
screenHeight = gd.getDisplayMode().getHeight(); |
} |
return screenHeight; |
} |
213,17 → 202,7 |
public void setPosID(int posID) { |
this.posID = posID; |
} |
// Depot stock |
public void setDepotID(int depotStockId) { |
this.depotStockId = depotStockId; |
} |
public int getDepotID() { |
return depotStockId; |
} |
public int getScanDelay() { |
return scanDelay; |
} |
394,12 → 373,8 |
idClient = defaultIDClient; |
} |
rowVals.put("ID_CLIENT", idClient); |
SQLRow rowClient = elt.getTable().getForeignTable("ID_CLIENT").getRow(idClient); |
SQLRowAccessor rowCat = rowClient.getNonEmptyForeign("ID_CATEGORIE_COMPTABLE"); |
// TODO fusionner TotalCalculator avec Ticket.GetTotalCalcutor |
TotalCalculator calc = new TotalCalculator("T_PA_HT", "T_PV_HT", null, rowCat); |
TotalCalculator calc = new TotalCalculator("T_PA_HT", "T_PV_HT", null, null); |
String val = DefaultNXProps.getInstance().getStringProperty("ArticleService"); |
Boolean bServiceActive = Boolean.valueOf(val); |
410,9 → 385,6 |
SQLRowValues rowValsElt = new SQLRowValues(eltFact.getTable()); |
final Article article = item.getArticle(); |
final BigDecimal nb = item.getQty(); |
rowValsElt.put("ID_DEPOT_STOCK", getDepotID()); |
if (article.getSalesUnit() == null) { |
rowValsElt.put("QTE", nb.intValue()); |
} else { |
419,12 → 391,11 |
rowValsElt.put("QTE", 1); |
rowValsElt.put("QTE_UNITAIRE", nb); |
} |
rowValsElt.put("PV_HT", article.getPriceWithoutTax(nb, false)); |
rowValsElt.put("PV_HT", article.getPriceWithoutTax()); |
Float tauxFromId = TaxeCache.getCache().getTauxFromId(article.getIdTaxe()); |
BigDecimal tauxTVA = BigDecimal.valueOf(tauxFromId).movePointLeft(2).add(BigDecimal.ONE); |
final BigDecimal valueHT = article.getPriceWithoutTax(nb, true).multiply(nb, DecimalUtils.HIGH_PRECISION); |
final BigDecimal valueHT = article.getPriceWithoutTax().multiply(nb, DecimalUtils.HIGH_PRECISION); |
if (article.getSalesUnit() != null) { |
rowValsElt.put("ID_UNITE_VENTE", mapUniteVenteName.get(article.getSalesUnit())); |
} |
432,9 → 403,6 |
rowValsElt.put("T_PV_TTC", valueHT.multiply(tauxTVA, DecimalUtils.HIGH_PRECISION)); |
rowValsElt.put("ID_TAXE", article.getIdTaxe()); |
rowValsElt.put("CODE", article.getCode()); |
rowValsElt.put("POURCENT_REMISE", article.getDiscountPct().movePointRight(2)); |
rowValsElt.put("ECO_CONTRIBUTION", article.getEcoTaxe()); |
rowValsElt.put("T_ECO_CONTRIBUTION", article.getEcoTaxe().multiply(nb)); |
rowValsElt.put("NOM", article.getName()); |
rowValsElt.put("ID_TICKET_CAISSE", rowVals); |
rowValsElt.put("ID_ARTICLE", article.getId()); |
534,7 → 502,7 |
sel.setWhere(new Where(elt.getTable().getField("NOM"), "=", "Caisse OpenConcerto")); |
@SuppressWarnings("unchecked") |
List<SQLRow> l = (List<SQLRow>) elt.getTable().getBase().getDataSource().execute(sel.asString(), new SQLSelectHandlerBuilder(sel).createHandler()); |
if (!l.isEmpty()) { |
if (l.size() > 0) { |
rowClient = l.get(0); |
} else { |
SQLRowValues rowValues = new SQLRowValues(elt.getTable()); |
618,7 → 586,6 |
setUserID(Integer.valueOf(rootElement.getAttributeValue("userID", "2"))); |
setCompanyID(Integer.valueOf(rootElement.getAttributeValue("societeID", "42"))); |
setPosID(Integer.valueOf(rootElement.getAttributeValue("caisseID", "2"))); |
setDepotID(Integer.valueOf(rootElement.getAttributeValue("depotID", "2"))); |
setScanDelay(Integer.valueOf(rootElement.getAttributeValue("scanDelay", "80"))); |
setAskPostalCode(rootElement.getAttributeValue("askPostalCode", "false").equals("true")); |
705,7 → 672,6 |
configElement.setAttribute("userID", String.valueOf(this.userID)); |
configElement.setAttribute("societeID", String.valueOf(this.companyID)); |
configElement.setAttribute("caisseID", String.valueOf(this.posID)); |
configElement.setAttribute("depotID", String.valueOf(this.depotStockId)); |
configElement.setAttribute("scanDelay", String.valueOf(this.scanDelay)); |
configElement.setAttribute("askPostalCode", this.askPostalCode ? "true" : "false"); |
doc.addContent(configElement); |
789,10 → 755,11 |
} |
public boolean isUsingJPos() { |
// TODO Auto-generated method stub |
return false; |
} |
public List<String> getJPosDirectories() { |
public List<String> getJPosDirectories() {// TODO Auto-generated method stub |
final ArrayList<String> result = new ArrayList<String>(); |
return result; |
} |
835,7 → 802,7 |
for (SQLRowValues sqlRowValues : result) { |
Client c = new Client(sqlRowValues.getID(), sqlRowValues.getString("NOM"), sqlRowValues.getBigDecimal("SOLDE_COMPTE")); |
final SQLRowAccessor foreign = sqlRowValues.getForeign("ID_ADRESSE"); |
c.setAdresse(foreign.getString("RUE") + "\n" + foreign.getString("VILLE")); |
c.setAdresse(foreign.getString("RUE") + " " + foreign.getString("VILLE")); |
l.add(c); |
} |
Collections.sort(l, new Comparator<Client>() { |
865,5 → 832,4 |
public void setAskPostalCode(boolean askPostalCode) { |
this.askPostalCode = askPostalCode; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/element/TicketCaisseSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
13,39 → 13,15 |
package org.openconcerto.erp.core.sales.pos.element; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.core.sales.pos.TicketSheetXML; |
import org.openconcerto.erp.core.sales.pos.model.Article; |
import org.openconcerto.erp.core.sales.pos.model.Categorie; |
import org.openconcerto.erp.core.sales.pos.model.Paiement; |
import org.openconcerto.erp.core.sales.pos.model.ReceiptCode; |
import org.openconcerto.erp.core.sales.pos.model.Ticket; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.element.SQLElementDirectory; |
import org.openconcerto.sql.element.UISQLComponent; |
import org.openconcerto.sql.model.SQLBase; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowListRSH; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.utils.PartialUniqueTrigger; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.action.SQLRowValuesAction.PredicateRowAction; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
import java.math.BigDecimal; |
import java.text.ParseException; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Collections; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
import javax.swing.JTextField; |
70,21 → 46,8 |
public TicketCaisseSQLElement() { |
super("TICKET_CAISSE", "un ticket de caisse", "tickets de caisses"); |
PredicateRowAction action = new PredicateRowAction(true, "ticket.document.generate", (le) -> { |
final TicketSheetXML bSheet = new TicketSheetXML(createTicket(le.getSelectedRow().asRow()), ComptaPropsConfiguration.getInstanceCompta()); |
try { |
bSheet.createDocument(); |
bSheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
} catch (Exception originalExn) { |
ExceptionHandler.handle("Erreur lors de la création de la facture", originalExn); |
} |
}); |
action.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowValuesActions().add(action); |
} |
protected List<String> getListFields() { |
final List<String> l = new ArrayList<String>(); |
l.add("NUMERO"); |
114,77 → 77,6 |
}; |
} |
public Ticket createTicket(SQLRow row) { |
// TODO merger ce code avec CaissepPanel.loadArticles si possible |
final Ticket t; |
try { |
t = new Ticket(new ReceiptCode(row.getString("NUMERO")), row.getDate("DATE"), row.getString("FILE_HASH_PREVIOUS")); |
} catch (ParseException e) { |
throw new IllegalStateException("Couldn't parse " + row, e); |
} |
final SQLElementDirectory directory = Configuration.getInstance().getDirectory(); |
SQLElement eltEncaisser = directory.getElement("ENCAISSER_MONTANT"); |
List<SQLRow> l = row.getReferentRows(eltEncaisser.getTable()); |
for (SQLRow row2 : l) { |
long montant = row2.getLong("MONTANT"); |
SQLRow rowMode = row2.getForeign("ID_MODE_REGLEMENT"); |
int type = Paiement.CB; |
if (rowMode.getInt("ID_TYPE_REGLEMENT") == TypeReglementSQLElement.CB) { |
type = Paiement.CB; |
} else { |
if (rowMode.getInt("ID_TYPE_REGLEMENT") == TypeReglementSQLElement.CHEQUE) { |
type = Paiement.CHEQUE; |
} else { |
if (rowMode.getInt("ID_TYPE_REGLEMENT") == TypeReglementSQLElement.ESPECE) { |
type = Paiement.ESPECES; |
} |
} |
} |
Paiement p = new Paiement(type); |
p.setMontantInCents((int) montant); |
t.addPaiement(p); |
} |
SQLElement eltArticle = directory.getElement("SAISIE_VENTE_FACTURE_ELEMENT"); |
final SQLSelect selUniteVente = new SQLSelect(); |
selUniteVente.addSelectStar(directory.getElement("UNITE_VENTE").getTable()); |
final Map<Integer, String> mapUniteVenteName = new HashMap<>(); |
for (SQLRow rowUniteVente : SQLRowListRSH.execute(selUniteVente)) { |
mapUniteVenteName.put(rowUniteVente.getID(), rowUniteVente.getString("CODE")); |
} |
List<SQLRow> l2 = row.getReferentRows(eltArticle.getTable()); |
Categorie c = new Categorie(""); |
for (SQLRow row2 : l2) { |
Article a = new Article(c, row2.getString("NOM"), row2.getInt("ID_ARTICLE")); |
if (row2.getInt("ID_UNITE_VENTE") != 2) { |
a.setSalesUnit(mapUniteVenteName.get(row2.getInt("ID_UNITE_VENTE"))); |
} |
BigDecimal ht = (BigDecimal) row2.getObject("PV_HT"); |
a.setPriceWithoutTax(ht); |
BigDecimal percentRemise = row2.getBigDecimal("POURCENT_REMISE"); |
if (percentRemise != null) { |
a.setDiscountPct(percentRemise.movePointLeft(2)); |
} |
int idTaxe = row2.getInt("ID_TAXE"); |
float tva = TaxeCache.getCache().getTauxFromId(idTaxe); |
a.setPriceWithTax(ht.multiply(BigDecimal.valueOf(1.0 + (tva / 100.0D)), DecimalUtils.HIGH_PRECISION)); |
a.setIdTaxe(idTaxe); |
t.addArticle(a); |
if (a.getSalesUnit() == null) { |
t.setArticleCount(a, new BigDecimal(row2.getInt("QTE"))); |
} else { |
t.setArticleCount(a, row2.getBigDecimal("QTE_UNITAIRE")); |
} |
} |
return t; |
} |
@Override |
protected String createCode() { |
return createCodeOfPackage() + ".ticket"; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/TicketClientNamePanel.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/CBPanel.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/ArticleSelectorDialogPanel.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/ArticleSelectionListener.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/StockErrorPanel.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/CaisseControler.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
15,6 → 15,7 |
import org.openconcerto.erp.core.sales.pos.POSConfiguration; |
import org.openconcerto.erp.core.sales.pos.io.BarcodeReader; |
import org.openconcerto.erp.core.sales.pos.io.ConcertProtocol; |
import org.openconcerto.erp.core.sales.pos.io.ESCSerialDisplay; |
import org.openconcerto.erp.core.sales.pos.io.TicketPrinter; |
import org.openconcerto.erp.core.sales.pos.model.Article; |
28,7 → 29,6 |
import org.openconcerto.erp.core.sales.pos.model.Ticket; |
import org.openconcerto.erp.core.sales.pos.model.TicketItem; |
import org.openconcerto.erp.preferences.TemplateNXProps; |
import org.openconcerto.erp.utils.SoundGenerator; |
import org.openconcerto.sql.element.SQLElementDirectory; |
import org.openconcerto.utils.FileUtils; |
import org.openconcerto.utils.StringUtils; |
45,11 → 45,12 |
import java.util.Calendar; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Map; |
import java.util.Set; |
import java.util.Timer; |
import java.util.TimerTask; |
import javax.swing.JOptionPane; |
import org.jdom2.JDOMException; |
public class CaisseControler implements BarcodeListener { |
171,8 → 172,7 |
public void addArticle(Article a) { |
this.t.addArticle(a); |
fire(); |
String price = TicketCellRenderer.centsToString(a.getPriceWithTax(this.t.getItemCount(a), false).movePointRight(2).setScale(0, RoundingMode.HALF_UP).intValue()); |
String price = TicketCellRenderer.centsToString(a.getPriceWithTax().movePointRight(2).setScale(0, RoundingMode.HALF_UP).intValue()); |
this.setLCD(a.getName(), price, 0); |
this.setLCDDefaultDisplay(2); |
} |
180,8 → 180,7 |
void incrementArticle(Article a) { |
this.t.incrementArticle(a); |
fire(); |
String price = TicketCellRenderer.centsToString(a.getPriceWithTax(this.t.getItemCount(a), false).movePointRight(2).setScale(0, RoundingMode.HALF_UP).intValue()); |
String price = TicketCellRenderer.centsToString(a.getPriceWithTax().movePointRight(2).setScale(0, RoundingMode.HALF_UP).intValue()); |
this.setLCD(a.getName(), price, 0); |
this.setLCDDefaultDisplay(2); |
} |
276,36 → 275,17 |
} else if (code.equalsIgnoreCase("ticket")) { |
} else { |
List<Article> list = Article.getArticleFromBarcode(code); |
if (list != null && !list.isEmpty()) { |
if (list.size() == 1) { |
final Article a = list.get(0); |
Article a = Article.getArticleFromBarcode(code); |
if (a != null) { |
System.err.println("CaisseControler.barcodeRead() barcode : " + code + " : product found : " + a.getName()); |
this.incrementArticle(a); |
this.setArticleSelected(a); |
} else { |
// choix de l'article |
caisseFrame.showArticleSelector(list, new ArticleSelectionListener() { |
public void articleSelected(Article a) { |
System.err.println("CaisseControler.barcodeRead() barcode : " + code + " : product selected : " + a.getName()); |
incrementArticle(a); |
setArticleSelected(a); |
caisseFrame.showCaisse(); |
} |
}); |
} |
} else { |
System.err.println("CaisseControler.barcodeRead() barcode : " + code + " : no product found"); |
Ticket t = Ticket.getTicketFromCode(code, this.caisseFrame.getFiles()); |
if (t != null) { |
System.err.println("CaisseControler.barcodeRead() barcode : " + code + " : receipt found :" + t.getNumber()); |
this.caisseFrame.showTickets(t); |
} else { |
// Joue un son si rien n'est trouvé |
new SoundGenerator().playSound(300.0, 0.15, 0.75, SoundGenerator.FADE_NONE, SoundGenerator.WAVE_SQUARE); |
} |
} |
} |
442,9 → 422,33 |
} |
public void sendCBRequest(final Paiement p) { |
caisseFrame.showCBPanel(p); |
final String creditCardPort = getPOSConf().getCreditCardPort(); |
if (creditCardPort != null && creditCardPort.trim().length() > 2) { |
final Thread thread = new Thread(new Runnable() { |
@Override |
public void run() { |
try { |
ConcertProtocol cp = new ConcertProtocol(creditCardPort); |
boolean ok = cp.sendCardPayment(p.getMontantInCents(), ConcertProtocol.CURRENCY_EUR); |
if (ok) { |
JOptionPane.showMessageDialog(null, "Paiement CB OK"); |
} else { |
JOptionPane.showMessageDialog(null, "Erreur paiement CB"); |
} |
} catch (Throwable ex) { |
JOptionPane.showMessageDialog(null, "Erreur terminal CB"); |
} |
} |
}); |
thread.setDaemon(true); |
thread.start(); |
} |
} |
public void setArticleHT(TicketItem item, BigDecimal ht) { |
final Article newArticle = new Article(item.getArticle()); |
newArticle.updatePriceWithoutTax(ht); |
468,7 → 472,41 |
return (!this.t.getItems().isEmpty()) && ((this.getTotal() >= 0 && this.getPaidTotal() >= this.getTotal()) || (this.getTotal() < 0 && this.getPaidTotal() == this.getTotal())); |
} |
public Set<Integer> loadFavoriteProductsIds() { |
final TemplateNXProps nxprops = (TemplateNXProps) TemplateNXProps.getInstance(); |
final File f = new File(nxprops.getDefaultStringValue(), "favorites.txt"); |
System.out.println("CaisseControler.saveFavoriteProductsIds() loading favorites from " + f.getAbsolutePath()); |
final Set<Integer> result = new HashSet<>(); |
if (f.exists()) { |
try { |
String s = FileUtils.read(f); |
List<String> sIds = StringUtils.fastSplit(s, ','); |
for (String string : sIds) { |
if (!string.isEmpty()) { |
result.add(Integer.parseInt(string)); |
} |
} |
} catch (IOException e) { |
e.printStackTrace(); |
} |
} |
return result; |
} |
public void saveFavoriteProductsIds(List<Article> products) { |
final TemplateNXProps nxprops = (TemplateNXProps) TemplateNXProps.getInstance(); |
final File f = new File(nxprops.getDefaultStringValue(), "favorites.txt"); |
System.out.println("CaisseControler.saveFavoriteProductsIds() saving favorites to " + f.getAbsolutePath()); |
try (FileOutputStream fOut = new FileOutputStream(f);) { |
for (Article product : products) { |
fOut.write(String.valueOf(product.getId()).getBytes()); |
fOut.write(','); |
} |
fOut.flush(); |
} catch (IOException e) { |
e.printStackTrace(); |
} |
} |
public void setTicketItemSelected(TicketItem item) { |
this.ticketItemSelected = item; |
528,16 → 566,4 |
fire(); |
} |
/** |
* Ouvre la fenetre d'alerte de stock |
* |
* @param runnable a executer en cas de transfert de stock ou de bypass |
* |
* @param map TicketItem <-> qté manquante |
*/ |
public void openStockErrorPanel(Map<TicketItem, Integer> missingQty, Runnable runnable) { |
this.caisseFrame.showStockErrorPanel(missingQty, runnable); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/TicketPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
59,7 → 59,7 |
this.controler = controler; |
this.controler.addCaisseListener(this); |
if (this.controler.getPOSConf().getScreenWidth() < 1280) { |
this.xOffset = -60; |
this.xOffset = -24; |
} |
this.setOpaque(false); |
this.bg = new ImageIcon(TicketPanel.class.getResource("ticket.png")).getImage(); |
100,11 → 100,9 |
} |
}; |
this.list.setOpaque(false); |
this.list.setSize(320, 450); |
this.list.setSize(315, 450); |
this.list.setFixedCellHeight(40); |
System.out.println("TicketPanel.TicketPanel() this.controler.getPOSConf().getScreenWidth()"+this.controler.getPOSConf().getScreenWidth()); |
this.list.setLocation(64 + this.xOffset, 18); |
// this.list.setLocation(30 , 18); |
this.list.setLocation(30 + this.xOffset, 18); |
this.add(this.list); |
this.lTotal.setSize(276 - 10, 32); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/ArticleModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
24,9 → 24,9 |
import javax.swing.event.ListDataListener; |
public class ArticleModel implements ListModel { |
private final List<Article> items = new ArrayList<>(); |
private final List<Article> items = new ArrayList<Article>(); |
private List<ListDataListener> listeners = new ArrayList<>(); |
private List<ListDataListener> listeners = new ArrayList<ListDataListener>(); |
private Categorie categorie; |
59,11 → 59,6 |
fire(); |
} |
public void setArticles(List<Article> list) { |
this.items.addAll(list); |
fire(); |
} |
private void fire() { |
for (ListDataListener l : listeners) { |
l.contentsChanged(new ListDataEvent(this, ListDataEvent.CONTENTS_CHANGED, 0, this.listeners.size())); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/ListeDesClientsPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
17,7 → 17,6 |
import org.openconcerto.ui.DefaultListModel; |
import org.openconcerto.ui.touch.ScrollableList; |
import java.awt.BorderLayout; |
import java.awt.Color; |
import java.awt.FlowLayout; |
import java.awt.Font; |
30,18 → 29,9 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionListener; |
import java.math.RoundingMode; |
import java.util.ArrayList; |
import java.util.List; |
import java.util.Vector; |
import javax.swing.BorderFactory; |
import javax.swing.ImageIcon; |
import javax.swing.JLabel; |
import javax.swing.JPanel; |
import javax.swing.JTextField; |
import javax.swing.SwingUtilities; |
import javax.swing.event.DocumentEvent; |
import javax.swing.event.DocumentListener; |
import javax.swing.event.ListSelectionEvent; |
import javax.swing.event.ListSelectionListener; |
51,7 → 41,7 |
private DefaultListModel ticketLlistModel; |
ListeDesClientsPanel(final CaisseFrame caisseFrame) { |
this.setBackground(new Color(245, 245, 245)); |
this.setBackground(Color.WHITE); |
this.setOpaque(true); |
this.setLayout(new GridBagLayout()); |
final GridBagConstraints c = new GridBagConstraints(); |
74,11 → 64,10 |
c.gridy++; |
c.gridwidth = 1; |
c.weighty = 1; |
c.gridheight = 1; |
c.gridheight = 2; |
ticketLlistModel = new DefaultListModel(); |
final List<Client> allClients = caisseFrame.getPOSConf().allClients(); |
ticketLlistModel.addAll(new Vector<Client>(allClients)); |
ticketLlistModel.addAll(new Vector<Client>(caisseFrame.getPOSConf().allClients())); |
final Font f = new Font("Arial", Font.PLAIN, 24); |
clientList = new ScrollableList(ticketLlistModel) { |
@Override |
111,7 → 100,7 |
g.drawString(label, 10, posY + 24); |
g.drawString(euro, getWidth() - 5 - wEuro, posY + 24); |
final String addr = client.getAddr().replace('\n', ' '); |
final String addr = client.getAddr(); |
if (addr != null) { |
g.drawString(addr, 10, posY + 48); |
} |
119,31 → 108,10 |
}; |
this.add(clientList, c); |
// Recherche |
c.gridy++; |
c.weighty = 0; |
c.fill = GridBagConstraints.BOTH; |
JPanel pBottom = new JPanel(); |
pBottom.setOpaque(true); |
pBottom.setBackground(CaissePanel.DARK_BLUE); |
pBottom.setLayout(new BorderLayout(3, 3)); |
// Icon and text |
final Font f1 = new Font("Arial", Font.PLAIN, 21); |
final JLabel label = new JLabel(new ImageIcon(this.getClass().getResource("search.png"))); |
pBottom.add(label, BorderLayout.WEST); |
pBottom.setBorder(BorderFactory.createLineBorder(CaissePanel.DARK_BLUE, 3)); |
final JTextField textField = new JTextField(); |
textField.setBorder(BorderFactory.createLineBorder(CaissePanel.DARK_BLUE, 1)); |
textField.setFont(f1); |
pBottom.add(textField, BorderLayout.CENTER); |
this.add(pBottom, c); |
// Detail |
c.fill = GridBagConstraints.BOTH; |
c.gridx = 1; |
c.gridy = 1; |
c.gridheight = 2; |
c.gridx++; |
c.gridheight = 1; |
c.weighty = 1; |
c.insets = new Insets(10, 10, 10, 10); |
168,47 → 136,8 |
} |
}); |
textField.getDocument().addDocumentListener(new DocumentListener() { |
@Override |
public void removeUpdate(DocumentEvent e) { |
changedUpdate(e); |
} |
@Override |
public void insertUpdate(DocumentEvent e) { |
changedUpdate(e); |
} |
@Override |
public void changedUpdate(DocumentEvent e) { |
List<Client> clients = new ArrayList<>(); |
String text = textField.getText().trim().toLowerCase(); |
if (text.isEmpty()) { |
clients.addAll(allClients); |
} else { |
for (Client c : allClients) { |
if (c.getFullName().toLowerCase().contains(text)) { |
clients.add(c); |
} |
} |
} |
ticketLlistModel.removeAllElements(); |
ticketLlistModel.addAll(clients); |
} |
}); |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
textField.grabFocus(); |
} |
}); |
} |
public void setSelectedClient(Object selectedValue) { |
clientList.setSelectedValue(selectedValue, true); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/CaisseFrame.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
16,10 → 16,8 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.config.Gestion; |
import org.openconcerto.erp.core.sales.pos.POSConfiguration; |
import org.openconcerto.erp.core.sales.pos.model.Article; |
import org.openconcerto.erp.core.sales.pos.model.Client; |
import org.openconcerto.erp.core.sales.pos.model.DBState; |
import org.openconcerto.erp.core.sales.pos.model.Paiement; |
import org.openconcerto.erp.core.sales.pos.model.ReceiptCode; |
import org.openconcerto.erp.core.sales.pos.model.RegisterDB; |
import org.openconcerto.erp.core.sales.pos.model.RegisterFiles; |
54,7 → 52,6 |
import java.text.ParseException; |
import java.util.EnumSet; |
import java.util.List; |
import java.util.Map; |
import java.util.Objects; |
import java.util.Set; |
import java.util.concurrent.Callable; |
251,12 → 248,6 |
JOptionPane.showMessageDialog(f, |
"La résolution de votre écran est trop faible.\nLa largeur doit être au minium de 1024 pixels.\nLa hauteur doit être au minium de 720 pixels."); |
} |
// if( |
// registerFiles.getLastLog().getLastFundEvent(EventType.CASHFUND_OPENING) |
// == null ) { |
// TODO f.showComptage(EventType.CASHFUND_OPENING, f.getControler()); |
// } |
} catch (Throwable e) { |
// Catch throwable to be able to see NoClassDefFound and other hard issues |
ExceptionHandler.handle("Erreur d'initialisation de la caisse (main)", e); |
466,7 → 457,7 |
return remoteState; |
} |
public static void quit(final POSConfiguration posConf) { |
static public void quit(final POSConfiguration posConf) { |
POSConfiguration.getLogger().log(Level.INFO, "User exit"); |
posConf.closeConnexion(); |
Frame[] l = Frame.getFrames(); |
600,70 → 591,6 |
this.getGlassPane().setVisible(true); |
this.validate(); |
this.repaint(); |
} |
public void showCBPanel(Paiement p) { |
getControler().disableBarcodeReader(); |
System.out.println("CaisseFrame.showCBPanel()"); |
this.invalidate(); |
final CBPanel panel = new CBPanel(this, this.getControler(), p); |
final POSGlassPane glassPane2 = new POSGlassPane(panel, (getWidth() - panel.getPreferredSize().width) / 2, 100); |
this.setGlassPane(glassPane2); |
this.getGlassPane().setVisible(true); |
this.validate(); |
this.repaint(); |
} |
public void showArticleSelector(List<Article> list, ArticleSelectionListener articleSelectionListener) { |
getControler().disableBarcodeReader(); |
this.invalidate(); |
final ArticleSelectorDialogPanel panel = new ArticleSelectorDialogPanel(this, list, articleSelectionListener); |
final int x = (getWidth() - panel.getPreferredSize().width) / 2; |
final int y = 100; |
System.out.println("CaisseFrame.showArticleSelector() at " + x + "," + y + " " + panel.getPreferredSize().width + "x" + panel.getPreferredSize().height + " : " + list.size() |
+ " products (barcode : " + list.get(0).getBarCode() + ")"); |
final POSGlassPane glassPane2 = new POSGlassPane(panel, x, y); |
this.setGlassPane(glassPane2); |
this.getGlassPane().setVisible(true); |
this.validate(); |
this.repaint(); |
} |
public void showStockErrorPanel(Map<TicketItem, Integer> missingQty, Runnable runnable) { |
getControler().disableBarcodeReader(); |
this.invalidate(); |
final StockErrorPanel panel = new StockErrorPanel(this, missingQty, runnable); |
final int x = (getWidth() - panel.getPreferredSize().width) / 2; |
final int y = 100; |
System.out.println("CaisseFrame.showStockErrorPanel() at " + x + "," + y + " " + panel.getPreferredSize().width + "x" + panel.getPreferredSize().height + " : " + missingQty.size()); |
final POSGlassPane glassPane2 = new POSGlassPane(panel, x, y); |
this.setGlassPane(glassPane2); |
this.getGlassPane().setVisible(true); |
this.validate(); |
this.repaint(); |
} |
public void showTicketClientNamePanel(Ticket ticket) { |
getControler().disableBarcodeReader(); |
this.invalidate(); |
final TicketClientNamePanel panel = new TicketClientNamePanel(this, ticket); |
final int x = (getWidth() - panel.getPreferredSize().width) / 2; |
final int y = 100; |
System.out.println("CaisseFrame.showTicketClientNamePanel() at " + x + "," + y + " " + panel.getPreferredSize().width + "x" + panel.getPreferredSize().height + " : " + ticket); |
final POSGlassPane glassPane2 = new POSGlassPane(panel, x, y); |
this.setGlassPane(glassPane2); |
this.getGlassPane().setVisible(true); |
this.validate(); |
this.repaint(); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/PaiementPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
408,11 → 408,8 |
JOptionPane.showMessageDialog(PaiementPanel.this, "Ouverture du tiroir caisse impossible"); |
} |
} else if (p.getType() == Paiement.CB) { |
final String creditCardPort = this.controller.getPOSConf().getCreditCardPort(); |
if (!creditCardPort.trim().isEmpty()) { |
this.controller.sendCBRequest(p); |
} |
} |
} |
this.controller.setPaiementSelected(p); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/ArticleSelector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
16,8 → 16,6 |
import org.openconcerto.erp.core.sales.pos.model.Article; |
import org.openconcerto.erp.core.sales.pos.model.Categorie; |
import org.openconcerto.ui.touch.ScrollableList; |
import org.openconcerto.utils.QuickOrderedMap; |
import org.openconcerto.utils.StringUtils; |
import java.awt.Color; |
import java.awt.FlowLayout; |
104,7 → 102,7 |
@Override |
public void paintCell(Graphics g, Object object, int index, boolean isSelected, int posY) { |
Article article = (Article) object; |
paintArticle(f, g, article, isSelected, posY, this.getWidth(), this.getCellHeight(), this.maxStringWidth, getLeftMargin(), false); |
paintArticle(f, g, article, isSelected, posY, this.getWidth(), this.getCellHeight(), this.maxStringWidth, getLeftMargin()); |
} |
}; |
187,7 → 185,7 |
} |
public static void paintArticle(final Font f, Graphics g, Article article, boolean isSelected, int posY, int cellWidth, int cellHeight, int maxWidth, int leftMargin, boolean showCode) { |
public static void paintArticle(final Font f, Graphics g, Article article, boolean isSelected, int posY, int cellWidth, int cellHeight, int maxWidth, int leftMargin) { |
g.setFont(f); |
210,20 → 208,6 |
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
String label = article.getName(); |
if (showCode && article.getCode() != null && !article.getCode().isEmpty()) { |
label += " [" + article.getCode() + "]"; |
} |
StringBuilder declinaisons = null; |
QuickOrderedMap<String, String> decls = article.getDeclinaisons(); |
if (decls != null && !decls.isEmpty()) { |
declinaisons = new StringBuilder(); |
for (int i = 0; i < decls.size(); i++) { |
declinaisons.append(StringUtils.firstUpThenLow(decls.getKey(i))); |
declinaisons.append(": "); |
declinaisons.append(decls.getValue(i)); |
declinaisons.append(" "); |
} |
} |
if (label.length() > maxWidth * 2) { |
label = label.substring(0, maxWidth * 2) + "..."; |
241,20 → 225,8 |
label2 = label2.substring(0, maxWidth) + "..."; |
} |
} |
if (declinaisons != null) { |
String textDeclinaisons = declinaisons.toString(); |
if (label2 == null) { |
label2 = textDeclinaisons; |
} else { |
if (label2.length() + textDeclinaisons.length() > maxWidth) { |
label2 = label2.substring(0, maxWidth - textDeclinaisons.length()) + "..."; |
} |
label2 = label2 + " " + textDeclinaisons; |
} |
} |
final BigDecimal priceInCents = article.getPriceWithTax(BigDecimal.ONE); |
final BigDecimal priceInCents = article.getPriceWithTax(); |
String euro = getPrice(priceInCents); |
int wEuro = (int) g.getFontMetrics().getStringBounds(euro, g).getWidth(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/ticket.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/CaissePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
14,18 → 14,13 |
package org.openconcerto.erp.core.sales.pos.ui; |
import org.openconcerto.erp.core.sales.pos.model.Article; |
import org.openconcerto.erp.core.sales.pos.model.ArticleCache; |
import org.openconcerto.erp.core.sales.pos.model.Categorie; |
import org.openconcerto.erp.core.sales.pos.model.RegisterFiles.DifferentDayException; |
import org.openconcerto.erp.core.sales.pos.model.TarifQuantite; |
import org.openconcerto.erp.core.sales.pos.model.Ticket; |
import org.openconcerto.erp.core.sales.pos.model.TicketItem; |
import org.openconcerto.erp.core.supplychain.stock.element.StockSQLElement; |
import org.openconcerto.erp.preferences.TemplateNXProps; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.element.SQLElementDirectory; |
import org.openconcerto.sql.model.SQLField; |
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; |
34,9 → 29,7 |
import org.openconcerto.sql.model.SQLTable.VirtualFields; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.FileUtils; |
import org.openconcerto.utils.StringUtils; |
import org.openconcerto.utils.cc.ITransformer; |
import java.awt.Color; |
import java.awt.Font; |
49,16 → 42,10 |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionListener; |
import java.awt.geom.Rectangle2D; |
import java.io.File; |
import java.io.FileOutputStream; |
import java.io.IOException; |
import java.math.BigDecimal; |
import java.text.DecimalFormat; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Calendar; |
import java.util.HashMap; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Map; |
import java.util.Set; |
78,11 → 65,10 |
private ArticleSearchPanel articleSearchPanel; |
private JPanel selector; |
final SQLElementDirectory dir; |
public CaissePanel(final CaisseFrame caisseFrame) throws Exception { |
this.dir = caisseFrame.getConf().getDirectory(); |
loadArticles(this.dir); |
final SQLElementDirectory dir = caisseFrame.getConf().getDirectory(); |
this.setLayout(new GridBagLayout()); |
this.setBackground(Color.WHITE); |
this.setOpaque(isOpaque()); |
99,7 → 85,7 |
this.add(this.st, c); |
TicketPanel t = new TicketPanel(this.controler); |
loadArticles(dir); |
c.gridy++; |
c.weighty = 1; |
c.gridwidth = 1; |
156,18 → 142,31 |
@Override |
public void actionPerformed(ActionEvent e) { |
checkStock(getControler().getPOSConf().getDepotID(), new Runnable() { |
@Override |
public void run() { |
if (caisseFrame.getPOSConf().askPostalCode()) { |
caisseFrame.showPostalCodeFrame(CaissePanel.this); |
} else { |
validateTicket(caisseFrame); |
final Ticket savedReceipt; |
try { |
savedReceipt = CaissePanel.this.controler.saveAndClearTicket(caisseFrame.getFiles(), caisseFrame.getConf().getDirectory()); |
} catch (DifferentDayException ex) { |
JOptionPane.showMessageDialog(CaissePanel.this, "Impossible de laisser la caisse ouverte plusieurs jours. Veuillez la clôturer pour pouvoir faire de nouveaux tickets.", "Erreur", |
JOptionPane.ERROR_MESSAGE); |
return; |
} catch (Throwable ex) { |
ExceptionHandler.handle(CaissePanel.this, "Erreur de sauvegarde des informations du ticket", ex); |
return; |
} |
if (savedReceipt != null) { |
// Valider |
CaissePanel.this.controler.setLCD("Impression de", "votre ticket...", 0); |
try { |
caisseFrame.getPOSConf().print(savedReceipt, (savedReceipt.isAdditionnalCopyRequested() ? 1 : 0)); |
} catch (UnsatisfiedLinkError ex) { |
JOptionPane.showMessageDialog(CaissePanel.this, "Erreur de configuration de la liaison à l'imprimante"); |
} catch (Throwable ex) { |
ex.printStackTrace(); |
JOptionPane.showMessageDialog(CaissePanel.this, "Erreur d'impression du ticket"); |
} |
CaissePanel.this.controler.setLCDDefaultDisplay(2); |
} |
}); |
} |
}); |
202,94 → 201,15 |
return s; |
} |
protected void checkStock(int idDepot, Runnable runnable) { |
final List<TicketItem> items = this.controler.getItems(); |
final List<Integer> articleIds = new ArrayList<>(); |
final Map<Integer, TicketItem> mapTicketItem = new HashMap<>(); |
for (TicketItem item : items) { |
articleIds.add(item.getArticle().getId()); |
mapTicketItem.put(item.getArticle().getId(), item); |
} |
final SQLTable stockTable = this.dir.getElement(StockSQLElement.class).getTable(); |
final SQLSelect selStock = new SQLSelect(); |
selStock.addSelect(stockTable.getField("ID")); |
selStock.addSelect(stockTable.getField("ID_DEPOT_STOCK")); |
selStock.addSelect(stockTable.getField("QTE_REEL")); |
selStock.addSelect(stockTable.getField("ID_ARTICLE")); |
selStock.setWhere(Where.inValues(stockTable.getField("ID_ARTICLE"), articleIds).and(new Where(stockTable.getField("ID_DEPOT_STOCK"), "=", idDepot))); |
Map<TicketItem, Integer> missingQty = new HashMap<>(); |
for (SQLRow row : SQLRowListRSH.execute(selStock)) { |
int idArticle = row.getInt("ID_ARTICLE"); |
int qte = (int) Math.round(row.getFloat("QTE_REEL")); |
TicketItem item = mapTicketItem.get(idArticle); |
if (item == null) { |
System.err.println("Pas d'entrée dans STOCK pour l'article " + idArticle); |
} else { |
if (qte < item.getQty().intValue()) { |
int delta = item.getQty().intValue() - qte; |
missingQty.put(item, delta); |
} |
} |
} |
if (missingQty.isEmpty()) { |
runnable.run(); |
} else { |
// Transfert de stock, Annulation ou bypass |
getControler().openStockErrorPanel(missingQty, runnable); |
} |
} |
public Set<Integer> loadFavoriteProductsIds() { |
final TemplateNXProps nxprops = (TemplateNXProps) TemplateNXProps.getInstance(); |
final File f = new File(nxprops.getDefaultStringValue(), "favorites.txt"); |
System.out.println("CaisseControler.saveFavoriteProductsIds() loading favorites from " + f.getAbsolutePath()); |
final Set<Integer> result = new HashSet<>(); |
if (f.exists()) { |
try { |
String s = FileUtils.read(f); |
List<String> sIds = StringUtils.fastSplit(s, ','); |
for (String string : sIds) { |
if (!string.isEmpty()) { |
result.add(Integer.parseInt(string)); |
} |
} |
} catch (IOException e) { |
e.printStackTrace(); |
} |
} |
return result; |
} |
public void saveFavoriteProductsIds(List<Article> products) { |
final TemplateNXProps nxprops = (TemplateNXProps) TemplateNXProps.getInstance(); |
final File f = new File(nxprops.getDefaultStringValue(), "favorites.txt"); |
System.out.println("CaisseControler.saveFavoriteProductsIds() saving favorites to " + f.getAbsolutePath()); |
try (FileOutputStream fOut = new FileOutputStream(f);) { |
for (Article product : products) { |
fOut.write(String.valueOf(product.getId()).getBytes()); |
fOut.write(','); |
} |
fOut.flush(); |
} catch (IOException e) { |
e.printStackTrace(); |
} |
} |
private List<Article> loadArticles(final SQLElementDirectory dir) { |
long t1 = System.currentTimeMillis(); |
private void loadArticles(final SQLElementDirectory dir) { |
final SQLSelect selUniteVente = new SQLSelect(); |
final SQLTable tableUniteVente = dir.getElement("UNITE_VENTE").getTable(); |
selUniteVente.addSelect(tableUniteVente.getKey()); |
selUniteVente.addSelect(tableUniteVente.getField("CODE")); |
selUniteVente.addSelectStar(dir.getElement("UNITE_VENTE").getTable()); |
final Map<Integer, String> mapUniteVenteName = new HashMap<>(); |
for (SQLRow row : SQLRowListRSH.execute(selUniteVente)) { |
mapUniteVenteName.put(row.getID(), row.getString("CODE")); |
} |
final Set<Integer> favoriteProductsIds = loadFavoriteProductsIds(); |
final Set<Integer> favoriteProductsIds = this.controler.loadFavoriteProductsIds(); |
final List<Article> favoriteProducts = new ArrayList<>(); |
final Map<Integer, Categorie> categoriesMap = new HashMap<>(); |
318,150 → 238,71 |
final SQLSelect selArticle = new SQLSelect(); |
final SQLTable tableArticle = eltArticle.getTable(); |
selArticle.addAllSelect(tableArticle.getFields(VirtualFields.PRIMARY_KEY.union(VirtualFields.ARCHIVE))); |
selArticle.addAllSelect(tableArticle, |
Arrays.asList("ID_FAMILLE_ARTICLE", "NOM", "CODE", "CODE_BARRE", "ID_TAXE", "PV_HT", "PV_TTC", "ADDITIONAL_TICKET_COPY", "ID_UNITE_VENTE", "ID_ECO_CONTRIBUTION")); |
selArticle.addAllSelect(tableArticle, Arrays.asList("ID_FAMILLE_ARTICLE", "NOM", "CODE", "CODE_BARRE", "ID_TAXE", "PV_HT", "PV_TTC", "ADDITIONAL_TICKET_COPY", "ID_UNITE_VENTE")); |
selArticle.setWhere(new Where(tableArticle.getField("OBSOLETE"), "=", Boolean.FALSE).and(new Where(tableArticle.getField("MASQUE_CAISSE"), "=", Boolean.FALSE))); |
selArticle.andWhere(new Where(tableArticle.getField("VIRTUEL"), "=", Boolean.FALSE)); |
List<String> tablesDeclinaisons = new ArrayList<>(); |
List<String> declinaisonsFieldNames = new ArrayList<>(); |
for (SQLField f : tableArticle.getFields()) { |
if (f.getName().startsWith("ID_ARTICLE_DECLINAISON_")) { |
selArticle.addSelect(f); |
declinaisonsFieldNames.add(f.getName()); |
tablesDeclinaisons.add(f.getName().substring("ID_".length())); |
} |
} |
final Categorie cUnclassified = new Categorie("Non classés", true); |
cUnclassified.setUnknown(); |
// Fetch des declinaisons : |
// "ID_ARTICLE_DECLINAISON_COULEUR" : { {3 , "noir"] } , |
// "ID_ARTICLE_DECLINAISON_TAILLE" : { {2 ,"XL"},{3,"XXL"}}; |
Map<String, Map<Integer, String>> mapDeclinaisons = new HashMap<>(); |
for (String table : tablesDeclinaisons) { |
SQLTable t = eltArticle.getTable().getTable(table); |
final SQLSelect selDecl = new SQLSelect(); |
selDecl.addSelect(t.getKey()); |
selDecl.addSelect(t.getField("NOM")); |
Map<Integer, String> m = new HashMap<>(); |
mapDeclinaisons.put("ID_" + table, m); |
for (SQLRow row : SQLRowListRSH.execute(selDecl)) { |
m.put(row.getID(), row.getString("NOM")); |
} |
} |
// Fetch des articles |
final List<SQLRow> rArticles = SQLRowListRSH.execute(selArticle); |
List<Integer> idsArticles = new ArrayList<>(rArticles.size()); |
for (SQLRow r : rArticles) { |
idsArticles.add(r.getID()); |
} |
// Recuperation des promos |
final SQLTable tableArticleTairdPromotion = tableArticle.getTable("ARTICLE_TARIF_PROMOTION"); |
final SQLTable tableTarifPromotion = tableArticle.getTable("TARIF_PROMOTION"); |
SQLRowValues rTarifPromotion = new SQLRowValues(tableArticleTairdPromotion); |
rTarifPromotion.putNulls(tableArticleTairdPromotion.getFieldsName()); |
rTarifPromotion.putRowValues("ID_TARIF_PROMOTION").putNulls("START", "END"); |
rTarifPromotion.putRowValues("ID_ARTICLE").putNulls("ID_TAXE"); |
Where where = new Where(tableArticleTairdPromotion.getField("ID_ARTICLE"), idsArticles); |
Calendar today = Calendar.getInstance(); |
final SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rTarifPromotion); |
fetcher.appendSelTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
input.andWhere(new Where(input.getAlias(tableTarifPromotion.getField("START")), "<", today)); |
input.andWhere(new Where(input.getAlias(tableTarifPromotion.getField("END")), ">", today)); |
return input; |
} |
}); |
List<SQLRowValues> rPromotions = fetcher.fetch(where); |
long t1p = System.currentTimeMillis(); |
// Tarifs : id article <-> liste des tarifs par quantité |
Map<Integer, List<TarifQuantite>> mapTarif = new HashMap<>(); |
System.err.println("CaissePanel.loadArticles()" + rPromotions.size() + " promotions"); |
for (SQLRowValues r : rPromotions) { |
final Integer foreignID = ((Integer) r.getObjectNoCheck("ID_ARTICLE")); |
List<TarifQuantite> list = mapTarif.get(foreignID); |
if (list == null) { |
list = new ArrayList<>(); |
mapTarif.put(foreignID, list); |
} |
TarifQuantite t = new TarifQuantite(foreignID, r.getInt("QTE"), r.getBigDecimal("PV_HT"), r.getBigDecimal("PV_TTC"), r.getForeign("ID_ARTICLE").getInt("ID_TAXE")); |
list.add(t); |
} |
final List<Article> res = new ArrayList<>(rArticles.size()); |
for (SQLRow row : rArticles) { |
final Integer idFamilleArticle = ((Integer) row.getObjectNoCheck("ID_FAMILLE_ARTICLE")); |
for (SQLRow row : SQLRowListRSH.execute(selArticle)) { |
final int idFamilleArticle = row.getInt("ID_FAMILLE_ARTICLE"); |
Categorie s1 = categoriesMap.get(idFamilleArticle); |
if (s1 == null) { |
s1 = cUnclassified; |
categoriesMap.put(idFamilleArticle, cUnclassified); |
} |
final String name = ((String) row.getObjectNoCheck("NOM")).trim(); |
final String name = row.getString("NOM").trim(); |
if (name.length() > 0) { |
final Article a = new Article(s1, name, row.getID()); |
final String barcode = (String) row.getObjectNoCheck("CODE_BARRE"); |
final String code = (String) row.getObjectNoCheck("CODE"); |
final String barcode = row.getString("CODE_BARRE"); |
final String code = row.getString("CODE"); |
a.setBarCode(StringUtils.isEmpty(barcode, true) ? code : barcode); |
a.setCode(code); |
a.setIdTaxe(((Integer) row.getObjectNoCheck("ID_TAXE"))); |
a.setPriceWithoutTax((BigDecimal) row.getObjectNoCheck("PV_HT")); |
a.setPriceWithTax((BigDecimal) row.getObjectNoCheck("PV_TTC")); |
a.setAdditionalCopyRequested((Boolean) row.getObjectNoCheck("ADDITIONAL_TICKET_COPY")); |
final Integer idEcoContribution = ((Integer) row.getObjectNoCheck("ID_ECO_CONTRIBUTION")); |
if (idEcoContribution > 1) |
a.setEcoTaxe((BigDecimal) row.getForeign("ID_ECO_CONTRIBUTION").getObjectNoCheck("TAUX")); |
final Integer idUniteVente = ((Integer) row.getObjectNoCheck("ID_UNITE_VENTE")); |
if (idUniteVente != 2) { |
a.setSalesUnit(mapUniteVenteName.get(idUniteVente)); |
a.setIdTaxe(row.getInt("ID_TAXE")); |
a.setPriceWithoutTax(row.getBigDecimal("PV_HT")); |
a.setPriceWithTax(row.getBigDecimal("PV_TTC")); |
a.setAdditionalCopyRequested(row.getBoolean("ADDITIONAL_TICKET_COPY")); |
if (row.getInt("ID_UNITE_VENTE") != 2) { |
a.setSalesUnit(mapUniteVenteName.get(row.getInt("ID_UNITE_VENTE"))); |
} |
final Integer idProduct = a.getId(); |
if (favoriteProductsIds.contains(idProduct)) { |
favoriteProducts.add(a); |
} |
final List<TarifQuantite> promotions = mapTarif.get(row.getID()); |
if (promotions != null) { |
a.setTarifsPromotion(promotions); |
for (TarifQuantite t : promotions) { |
if (t.getQuantite() == 1) { |
a.setIdTaxe(t.getIdTaxe()); |
a.setPriceWithoutTax(t.getPrixHT()); |
a.setPriceWithTax(t.getPrixTTC()); |
break; |
} |
} |
Categorie.setFavoriteProducts(favoriteProducts); |
initCacheArticleMap(dir); |
} |
for (String f : declinaisonsFieldNames) { |
Integer idArtDeclinaison = (Integer) row.getObjectNoCheck(f); |
if (idArtDeclinaison != null && idArtDeclinaison > 1) { |
Map<Integer, String> mm = mapDeclinaisons.get(f); |
if (mm != null) { |
String v = mm.get(idArtDeclinaison); |
a.addDeclinaison(f.substring("ID_ARTICLE_DECLINAISON_".length()), v); |
private static Map<Integer, SQLRowAccessor> cacheArticle = new HashMap<>(); |
public static SQLRowAccessor getArticleRowValuesFromCache(int id) { |
return cacheArticle.get(id); |
} |
} |
} |
res.add(a); |
private void initCacheArticleMap(final SQLElementDirectory dir) { |
final SQLTable tableArt = dir.getElement("ARTICLE").getTable(); |
SQLRowValues rowValsArt = new SQLRowValues(tableArt); |
rowValsArt.putNulls(tableArt.getFieldsName()); |
final SQLTable tableArtCatComptable = dir.getElement("ARTICLE_CATEGORIE_COMPTABLE").getTable(); |
SQLRowValues rowValsArtCatComptable = new SQLRowValues(tableArtCatComptable); |
rowValsArtCatComptable.putNulls(tableArtCatComptable.getFieldsName()); |
rowValsArtCatComptable.put("ID_ARTICLE", rowValsArt); |
final SQLRowValues rowValsCaCompt = rowValsArtCatComptable.putRowValues("ID_CATEGORIE_COMPTABLE"); |
rowValsCaCompt.putNulls(rowValsCaCompt.getTable().getFieldsName()); |
final SQLRowValues rowValsFam = rowValsArt.putRowValues("ID_FAMILLE_ARTICLE"); |
rowValsFam.putNulls(rowValsFam.getTable().getFieldsName()); |
final SQLRowValues rowValuesFamP = rowValsFam.putRowValues("ID_FAMILLE_ARTICLE_PERE"); |
rowValuesFamP.putNulls(rowValuesFamP.getTable().getFieldsName()); |
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowValsArt); |
List<SQLRowValues> res = fetcher.fetch(); |
for (SQLRowValues sqlRowValues : res) { |
cacheArticle.put(sqlRowValues.getID(), sqlRowValues); |
} |
} |
long t2p = System.currentTimeMillis(); |
Categorie.setFavoriteProducts(favoriteProducts); |
ArticleCache.initCache(dir); |
ArticleCache.getInstance().preloadCacheArticleMap(new ArrayList<>(favoriteProductsIds)); |
long t2 = System.currentTimeMillis(); |
System.err.println("CaissePanel.loadArticles() " + res.size() + " in " + (t2 - t1) + " ms : process: " + (t2p - t1p) + " ms"); |
return res; |
} |
@Override |
618,7 → 459,7 |
try { |
caisseFrame.getPOSConf().print(savedReceipt, (savedReceipt.isAdditionnalCopyRequested() ? 1 : 0)); |
} catch (UnsatisfiedLinkError ex) { |
JOptionPane.showMessageDialog(CaissePanel.this, "Erreur de configuration de la liaison à l'imprimante"); |
JOptionPane.showMessageDialog(CaissePanel.this, "Erreur de configuration de la liaison à l'imprimante"); |
} catch (Throwable ex) { |
ex.printStackTrace(); |
JOptionPane.showMessageDialog(CaissePanel.this, "Erreur d'impression du ticket"); |
626,7 → 467,7 |
CaissePanel.this.controler.setLCDDefaultDisplay(2); |
} else { |
System.err.println("CaissePanel.validateTicket() ticket non sauvé"); |
System.err.println("CaissePanel.validateTicket() ticket non sauvé"); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/ArticleSearchPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
80,7 → 80,7 |
public void paintCell(Graphics g, Object object, int index, boolean isSelected, int posY) { |
if (object instanceof Article) { |
Article article = (Article) object; |
ArticleSelector.paintArticle(f1, g, article, isSelected, posY, this.getWidth(), this.getCellHeight(), 36, 10, true); |
ArticleSelector.paintArticle(f1, g, article, isSelected, posY, this.getWidth(), this.getCellHeight(), 36, 10); |
if (Categorie.getFavoriteProducts().contains(article)) { |
g.setColor(Color.ORANGE); |
g.fillRect(0, posY, 6, this.getCellHeight()); |
99,7 → 99,7 |
if (obj instanceof Article) { |
Article product = (Article) obj; |
Categorie.toggleFavoriteState(product); |
controler.getCaisseFrame().mainPanel.saveFavoriteProductsIds(Categorie.getFavoriteProducts()); |
controler.saveFavoriteProductsIds(Categorie.getFavoriteProducts()); |
model.setFilter(ArticleSearchPanel.this.textField.getText()); |
ArticleSearchPanel.this.list.scrollToOffset(0); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/PriceEditorPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
42,7 → 42,6 |
private final NumericTextField htTextField; |
private final NumericTextField ttcTextField; |
private final NumericTextField discountPercentTextField; |
// Remise HT |
private final NumericTextField discountTextField; |
private final NumericKeypadPanel keyPad; |
72,7 → 71,7 |
this.add(this.rTTC, c); |
this.ttcTextField = new NumericTextField(); |
this.ttcTextField.setFont(title.getFont()); |
this.ttcTextField.setValue(item.getArticle().getPriceWithTax(BigDecimal.ONE, false)); |
this.ttcTextField.setValue(item.getArticle().getPriceWithTax()); |
this.ttcTextField.requestFocusInWindow(); |
c.gridx++; |
c.weightx = 1; |
84,7 → 83,7 |
c.weightx = 0; |
this.add(this.rHT, c); |
this.htTextField = new NumericTextField(); |
this.htTextField.setValue(item.getArticle().getPriceWithoutTax(BigDecimal.ONE)); |
this.htTextField.setValue(item.getArticle().getPriceWithoutTax()); |
this.htTextField.setFont(title.getFont()); |
c.gridx++; |
c.weightx = 1; |
125,8 → 124,8 |
c.gridx = 0; |
c.gridwidth = 2; |
final POSLabel labelPriceOld = new POSLabel("Ancien Prix : "); |
labelPriceOld.setText("Ancien Prix : " + TicketCellRenderer.toString(item.getArticle().getPriceWithTax(BigDecimal.ONE)) + "€ TTC, " |
+ TicketCellRenderer.toString(item.getArticle().getPriceWithoutTax(BigDecimal.ONE)) + "€ HT"); |
labelPriceOld.setText( |
"Ancien Prix : " + TicketCellRenderer.toString(item.getArticle().getPriceWithTax()) + "€ TTC, " + TicketCellRenderer.toString(item.getArticle().getPriceWithoutTax()) + "€ HT"); |
this.add(labelPriceOld, c); |
c.gridy++; |
149,16 → 148,7 |
@Override |
public void actionPerformed(ActionEvent e) { |
if (rHT.isSelected() || rTTC.isSelected()) { |
caisseFrame.getControler().setArticleHT(item, getHTFromUI()); |
} else if (rDiscountPercent.isSelected()) { |
item.getArticle().setDiscountPct(discountPercentTextField.getValue().divide(new BigDecimal(100))); |
} else if (rDiscount.isSelected()) { |
// Remise HT |
final BigDecimal priceWithoutTax = item.getArticle().getPriceWithoutTax(BigDecimal.ONE, false); |
BigDecimal pct = BigDecimal.ONE.subtract((priceWithoutTax.subtract(discountTextField.getValue())).divide(priceWithoutTax)); |
item.getArticle().setDiscountPct(pct); |
} |
caisseFrame.showCaisse(); |
} |
}); |
183,7 → 173,7 |
this.keyPad = new NumericKeypadPanel(this.ttcTextField); |
this.add(this.keyPad, c); |
updatePrice(item.getArticle().getPriceWithoutTax(BigDecimal.ONE)); |
updatePrice(item.getArticle().getPriceWithoutTax()); |
updateTextFields(); |
// |
final ActionListener listenerRadio = new ActionListener() { |
240,10 → 230,9 |
} else if (this.rTTC.isSelected()) { |
r = Article.computePriceWithoutTax(this.ttcTextField.getValue(), this.item.getArticle().getIdTaxe()); |
} else if (this.rDiscountPercent.isSelected()) { |
r = this.item.getArticle().getPriceWithoutTax(BigDecimal.ONE, false) |
.subtract(this.item.getArticle().getPriceWithoutTax(BigDecimal.ONE).multiply(this.discountPercentTextField.getValue().divide(new BigDecimal(100)))); |
r = this.item.getArticle().getPriceWithoutTax().subtract(this.item.getArticle().getPriceWithoutTax().multiply(this.discountPercentTextField.getValue().divide(new BigDecimal(100)))); |
} else if (this.rDiscount.isSelected()) { |
r = this.item.getArticle().getPriceWithoutTax(BigDecimal.ONE, false).subtract(this.discountTextField.getValue()); |
r = this.item.getArticle().getPriceWithoutTax().subtract(this.discountTextField.getValue()); |
} |
} catch (Exception e) { |
e.printStackTrace(); |
250,7 → 239,7 |
} |
if (r == null) { |
// fallback if something wrong |
r = this.item.getArticle().getPriceWithoutTax(BigDecimal.ONE); |
r = this.item.getArticle().getPriceWithoutTax(); |
} |
return r; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/TextAreaTicketPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
13,16 → 13,32 |
package org.openconcerto.erp.core.sales.pos.ui; |
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.core.sales.pos.POSConfiguration; |
import org.openconcerto.erp.core.sales.pos.element.TicketCaisseSQLElement; |
import org.openconcerto.erp.core.sales.pos.model.Article; |
import org.openconcerto.erp.core.sales.pos.model.Categorie; |
import org.openconcerto.erp.core.sales.pos.model.Paiement; |
import org.openconcerto.erp.core.sales.pos.model.ReceiptCode; |
import org.openconcerto.erp.core.sales.pos.model.Ticket; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.element.SQLElementDirectory; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowListRSH; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.utils.DecimalUtils; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionListener; |
import java.math.BigDecimal; |
import java.text.ParseException; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
import javax.swing.JButton; |
import javax.swing.JPanel; |
30,7 → 46,7 |
public class TextAreaTicketPanel extends JPanel { |
public TextAreaTicketPanel(TicketCaisseSQLElement elt, final POSConfiguration conf, SQLRow row) { |
public TextAreaTicketPanel(final POSConfiguration conf, SQLRow row) { |
super(new GridBagLayout()); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
c.fill = GridBagConstraints.BOTH; |
37,7 → 53,7 |
c.weightx = 0; |
c.weighty = 0; |
final Ticket ticket = elt.createTicket(row); |
final Ticket ticket = createTicket(row); |
JButton button = new JButton("Imprimer"); |
button.addActionListener(new ActionListener() { |
65,4 → 81,68 |
ticket.print(comp, conf.getTicketPrinterConfiguration1().getTicketWidth()); |
} |
private Ticket createTicket(SQLRow row) { |
// TODO merger ce code avec CaissepPanel.loadArticles si possible |
final Ticket t; |
try { |
t = new Ticket(new ReceiptCode(row.getString("NUMERO")), row.getDate("DATE"), row.getString("FILE_HASH_PREVIOUS")); |
} catch (ParseException e) { |
throw new IllegalStateException("Couldn't parse " + row, e); |
} |
final SQLElementDirectory directory = Configuration.getInstance().getDirectory(); |
SQLElement eltEncaisser = directory.getElement("ENCAISSER_MONTANT"); |
List<SQLRow> l = row.getReferentRows(eltEncaisser.getTable()); |
for (SQLRow row2 : l) { |
long montant = row2.getLong("MONTANT"); |
SQLRow rowMode = row2.getForeign("ID_MODE_REGLEMENT"); |
int type = Paiement.CB; |
if (rowMode.getInt("ID_TYPE_REGLEMENT") == TypeReglementSQLElement.CB) { |
type = Paiement.CB; |
} else { |
if (rowMode.getInt("ID_TYPE_REGLEMENT") == TypeReglementSQLElement.CHEQUE) { |
type = Paiement.CHEQUE; |
} else { |
if (rowMode.getInt("ID_TYPE_REGLEMENT") == TypeReglementSQLElement.ESPECE) { |
type = Paiement.ESPECES; |
} |
} |
} |
Paiement p = new Paiement(type); |
p.setMontantInCents((int) montant); |
t.addPaiement(p); |
} |
SQLElement eltArticle = directory.getElement("SAISIE_VENTE_FACTURE_ELEMENT"); |
final SQLSelect selUniteVente = new SQLSelect(); |
selUniteVente.addSelectStar(directory.getElement("UNITE_VENTE").getTable()); |
final Map<Integer, String> mapUniteVenteName = new HashMap<>(); |
for (SQLRow rowUniteVente : SQLRowListRSH.execute(selUniteVente)) { |
mapUniteVenteName.put(rowUniteVente.getID(), rowUniteVente.getString("CODE")); |
} |
List<SQLRow> l2 = row.getReferentRows(eltArticle.getTable()); |
Categorie c = new Categorie(""); |
for (SQLRow row2 : l2) { |
Article a = new Article(c, row2.getString("NOM"), row2.getInt("ID_ARTICLE")); |
if (row2.getInt("ID_UNITE_VENTE") != 2) { |
a.setSalesUnit(mapUniteVenteName.get(row2.getInt("ID_UNITE_VENTE"))); |
} |
BigDecimal ht = (BigDecimal) row2.getObject("PV_HT"); |
a.setPriceWithoutTax(ht); |
int idTaxe = row2.getInt("ID_TAXE"); |
float tva = TaxeCache.getCache().getTauxFromId(idTaxe); |
a.setPriceWithTax(ht.multiply(BigDecimal.valueOf(1.0 + (tva / 100.0D)), DecimalUtils.HIGH_PRECISION)); |
a.setIdTaxe(idTaxe); |
t.addArticle(a); |
if (a.getSalesUnit() == null) { |
t.setArticleCount(a, new BigDecimal(row2.getInt("QTE"))); |
} else { |
t.setArticleCount(a, row2.getBigDecimal("QTE_UNITAIRE")); |
} |
} |
return t; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/TicketCellRenderer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
16,7 → 16,6 |
import org.openconcerto.erp.core.sales.pos.model.Article; |
import org.openconcerto.erp.core.sales.pos.model.TicketItem; |
import org.openconcerto.ui.touch.ScrollableList; |
import org.openconcerto.utils.QuickOrderedMap; |
import java.awt.Color; |
import java.awt.Component; |
59,7 → 58,7 |
c.gridx++; |
c.weightx = 0; |
final BigDecimal priceWithTax = article.getPriceWithTax(item.getQty()); |
final BigDecimal priceWithTax = article.getPriceWithTax(); |
final JLabel l3 = new JLabel(toString(priceWithTax), SwingConstants.RIGHT); |
p.add(l3, c); |
109,44 → 108,22 |
String s2 = article.getName().toUpperCase().trim(); |
final int maxLength = 15; |
if (s2.length() > maxLength) { |
if (s2.length() > maxLength) |
s2 = s2.substring(0, maxLength + 1) + '…'; |
} |
QuickOrderedMap<String, String> decls = article.getDeclinaisons(); |
String textDeclinaisons = null; |
if (decls != null && !decls.isEmpty()) { |
StringBuilder declinaisons = new StringBuilder(); |
for (int i = 0; i < decls.size(); i++) { |
declinaisons.append(decls.getValue(i)); |
declinaisons.append(" "); |
} |
g.drawString(s2, width1 + inset, height); |
textDeclinaisons = declinaisons.toString().trim(); |
} |
g.drawString(s2, width1 + inset, height - 6); |
final String s3 = centsToString(article.getPriceWithTax(qty, true).multiply(qty).movePointRight(2).setScale(0, RoundingMode.HALF_UP).intValue()) + "€"; |
final String s3 = centsToString(article.getPriceWithTax().multiply(qty).movePointRight(2).setScale(0, RoundingMode.HALF_UP).intValue()) + "€"; |
final int width3 = (int) g.getFontMetrics().getStringBounds(s3, g).getWidth() + +inset; |
g.drawString(s3, list.getWidth() - width3, height - 4); |
g.setFont(g.getFont().deriveFont(12f)); |
final String s4 = qty.toPlainString() + " x " + centsToString(article.getPriceWithTax(qty).movePointRight(2).setScale(0, RoundingMode.HALF_UP).intValue()); |
final String s4 = qty.toPlainString() + " x " + centsToString(article.getPriceWithTax().movePointRight(2).setScale(0, RoundingMode.HALF_UP).intValue()); |
final int width4 = (int) g.getFontMetrics().getStringBounds(s4, g).getWidth() + +inset; |
g.drawString(s4, list.getWidth() - width4, height + 11); |
if (textDeclinaisons != null) { |
g.drawString(textDeclinaisons, width1 + inset, height + 11); |
} |
if (!article.getDiscountPct().equals(BigDecimal.ZERO)) { |
g.setFont(g.getFont().deriveFont(Font.ITALIC)); |
g.drawString("Remise: " + article.getDiscountPct().movePointRight(2).setScale(2, BigDecimal.ROUND_HALF_UP) + " %", inset * 2 + 140, height + 12); |
} |
} |
public static String centsToString(int cents) { |
final int c = Math.abs(cents) % 100; |
String sc = String.valueOf(c); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/FilteredListModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
79,7 → 79,7 |
int size = allArticles.size(); |
for (int i = 0; i < size; i++) { |
Article a = allArticles.get(i); |
final String name = (a.getName() + a.getCode() + a.getBarCode() + a.getDeclinaison()).toLowerCase(); |
final String name = a.getName().toLowerCase() + a.getCode().toLowerCase() + a.getBarCode().toLowerCase(); |
for (int j = 0; j < length; j++) { |
if (name.contains(parts[j])) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/ConfigCaissePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
65,7 → 65,6 |
private final JComboBox comboSociete; |
private final JComboBox comboCaisse; |
private final JComboBox comboUtilisateur; |
private final JComboBox comboDepot; |
private final TicketLineTable headerTable; |
private final TicketLineTable footerTable; |
private JTextField textTerminalCB; |
78,7 → 77,6 |
private JTextField textLCDPort; |
private JTextField textLCDLine1; |
private JTextField textLCDLine2; |
protected int depotStockId = 2; |
public ConfigCaissePanel(final ServerFinderPanel serverFinderPanel) { |
this.serverFinderPanel = serverFinderPanel; |
149,7 → 147,6 |
} |
}); |
this.add(this.comboCaisse, c); |
// Utilisateur |
c.gridx = 0; |
c.gridy++; |
c.weightx = 0; |
168,25 → 165,6 |
} |
}); |
this.add(this.comboUtilisateur, c); |
// Depots |
c.gridx = 0; |
c.gridy++; |
c.weightx = 0; |
this.add(new JLabel("Dépôt de stock", SwingConstants.RIGHT), c); |
c.gridx++; |
this.comboDepot = new JComboBox(); |
this.comboDepot.setRenderer(new DefaultListCellRenderer() { |
@Override |
public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { |
final SQLRow r = (SQLRow) value; |
String label = ""; |
if (r != null) { |
label = r.getString("CODE") + " " + r.getString("NOM") + " (" + r.getID() + ")".trim(); |
} |
return super.getListCellRendererComponent(list, label, index, isSelected, cellHasFocus); |
} |
}); |
this.add(this.comboDepot, c); |
// Ticket |
final JLabelBold titleTicket = new JLabelBold("Ticket"); |
269,15 → 247,7 |
} |
} |
}); |
this.comboDepot.addItemListener(new ItemListener() { |
@Override |
public void itemStateChanged(final ItemEvent e) { |
if (e.getStateChange() == ItemEvent.SELECTED) { |
ConfigCaissePanel.this.depotStockId = ((SQLRow) e.getItem()).getID(); |
} |
} |
}); |
} |
private Component createLCDPanel() { |
final JPanel p = new JPanel(); |
450,30 → 420,18 |
final SQLSelect sel = new SQLSelect(); |
sel.addSelectStar(conf.getRootSociete().getTable("CAISSE")); |
final List<SQLRow> caisses = SQLRowListRSH.execute(sel); |
// Depots |
final SQLSelect sel2 = new SQLSelect(); |
sel2.addSelectStar(conf.getRootSociete().getTable("DEPOT_STOCK")); |
final List<SQLRow> depots = SQLRowListRSH.execute(sel2); |
// Stock l'id de la caisse pour que la reslectionne soit correcte |
final int idCaisseToSelect = this.caisseId; |
final int idDepotToSelect = this.depotStockId; |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
ConfigCaissePanel.this.caisseId = idCaisseToSelect; |
ConfigCaissePanel.this.depotStockId = idDepotToSelect; |
if (caisses.isEmpty()) { |
JOptionPane.showMessageDialog(ConfigCaissePanel.this, "Pas de caisses définies dans la société " + name); |
} |
ConfigCaissePanel.this.comboCaisse.setModel(new DefaultComboBoxModel(new Vector<SQLRow>(caisses))); |
ConfigCaissePanel.this.comboDepot.setModel(new DefaultComboBoxModel(new Vector<SQLRow>(depots))); |
ConfigCaissePanel.this.comboUtilisateur.setEnabled(true); |
ConfigCaissePanel.this.comboCaisse.setEnabled(true); |
ConfigCaissePanel.this.comboDepot.setEnabled(true); |
{ |
// Selection caisse |
final ComboBoxModel model = ConfigCaissePanel.this.comboCaisse.getModel(); |
final int stop = model.getSize(); |
if (stop > 0) { |
489,24 → 447,6 |
} |
} |
} |
{ |
// Selection depot |
final ComboBoxModel model2 = ConfigCaissePanel.this.comboDepot.getModel(); |
final int stop2 = model2.getSize(); |
if (stop2 > 0) { |
// Force la reselection si la valeur n'existe plus, |
// nécessité de recuperer l'id |
ConfigCaissePanel.this.depotStockId = ((SQLRow) model2.getElementAt(0)).getID(); |
} |
for (int i = 0; i < stop2; i++) { |
final SQLRow r = (SQLRow) model2.getElementAt(i); |
if (r.getID() == idDepotToSelect) { |
ConfigCaissePanel.this.comboDepot.setSelectedItem(r); |
break; |
} |
} |
} |
} |
}); |
} else { |
539,7 → 479,6 |
this.userId = configuration.getUserID(); |
this.societeId = configuration.getCompanyID(); |
this.caisseId = configuration.getPosID(); |
this.depotStockId = configuration.getDepotID(); |
this.headerTable.fillFrom(configuration.getHeaderLines()); |
this.footerTable.fillFrom(configuration.getFooterLines()); |
this.ticketPanel1.setConfiguration(configuration.getTicketPrinterConfiguration1()); |
567,7 → 506,6 |
ConfigCaissePanel.this.comboSociete.setEnabled(false); |
ConfigCaissePanel.this.comboUtilisateur.setEnabled(false); |
ConfigCaissePanel.this.comboCaisse.setEnabled(false); |
ConfigCaissePanel.this.comboDepot.setEnabled(false); |
final ServerFinderConfig config = ConfigCaissePanel.this.serverFinderPanel.createServerFinderConfig(); |
if (!config.isOnline()) { |
JOptionPane.showMessageDialog(ConfigCaissePanel.this, "Impossible de se connecter au serveur"); |
661,7 → 599,6 |
System.out.println("Societe: id:" + this.societeId); |
System.out.println("Caisse: id:" + this.caisseId); |
System.out.println("Utilisateur: id:" + this.userId); |
System.out.println("Depot: id:" + this.depotStockId); |
} |
public void saveConfiguration() { |
671,7 → 608,6 |
configuration.setUserID(this.userId); |
configuration.setCompanyID(this.societeId); |
configuration.setPosID(this.caisseId); |
configuration.setDepotID(this.depotStockId); |
configuration.setHeaderLines(this.headerTable.getLines()); |
configuration.setFooterLines(this.footerTable.getLines()); |
// Terminal CB |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/ListeDesTicketsPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
13,9 → 13,7 |
package org.openconcerto.erp.core.sales.pos.ui; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.sales.pos.TicketPrinterConfiguration; |
import org.openconcerto.erp.core.sales.pos.TicketSheetXML; |
import org.openconcerto.erp.core.sales.pos.io.Printable; |
import org.openconcerto.erp.core.sales.pos.io.TicketPrinter; |
import org.openconcerto.erp.core.sales.pos.model.RegisterFiles; |
41,7 → 39,6 |
import java.io.IOException; |
import java.text.ParseException; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.Date; |
import java.util.List; |
240,8 → 237,8 |
c.gridy++; |
c.weighty = 0; |
c.fill = GridBagConstraints.NONE; |
final Font font = new Font(ARIAL_FONT, Font.PLAIN, 32); |
this.l = new JList(new String[] { "Imprimer la facture", "Imprimer le ticket", "Annuler le ticket" }); |
final Font font = new Font(ARIAL_FONT, Font.PLAIN, 46); |
this.l = new JList(new String[] { "Imprimer", "Annuler le ticket" }); |
this.l.setCellRenderer(new ListCellRenderer() { |
@Override |
289,14 → 286,8 |
Object selectedValue = this.ticketList.getSelectedValue(); |
int selectedIndex = this.l.getSelectedIndex(); |
if (selectedIndex == 0 && selectedValue != null) { |
if (selectedValue instanceof Ticket) { |
Ticket ticket = (Ticket) selectedValue; |
ListeDesTicketsPanel.this.frame.showTicketClientNamePanel(ticket); |
return; |
} |
} else if (selectedIndex == 1 && selectedValue != null) { |
this.frame.getPOSConf().printOnceOnFirstPrinter(((Printable) selectedValue)); |
} else if (selectedIndex == 2 && selectedValue != null && selectedValue instanceof Ticket) { |
} else if (selectedIndex == 1 && selectedValue != null && selectedValue instanceof Ticket) { |
Ticket t = (Ticket) selectedValue; |
this.frame.getControler().cancel(t); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/price/element/TarifPromotionSQLElement.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/component/BonDeLivraisonSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* 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 |
53,7 → 53,6 |
import org.openconcerto.sql.sqlobject.JUniqueTextField; |
import org.openconcerto.sql.sqlobject.SQLRequestComboBox; |
import org.openconcerto.sql.sqlobject.SQLTextCombo; |
import org.openconcerto.sql.sqlobject.itemview.SimpleRowItemView; |
import org.openconcerto.sql.users.UserManager; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.list.RowValuesTable; |
63,11 → 62,8 |
import org.openconcerto.ui.JDate; |
import org.openconcerto.ui.TitledSeparator; |
import org.openconcerto.ui.component.ITextArea; |
import org.openconcerto.ui.valuewrapper.ValidatedValueWrapper; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.NumberUtils; |
import org.openconcerto.utils.cc.ITransformer; |
import org.openconcerto.utils.checks.ValidState; |
import java.awt.Color; |
import java.awt.GridBagConstraints; |
259,21 → 255,9 |
c.weightx = 0; |
c.weighty = 0; |
c.fill = GridBagConstraints.NONE; |
final ValidatedValueWrapper<Integer> clientValidatedValueWrapper = ValidatedValueWrapper.add(new ElementComboBox(), new ITransformer<Integer, ValidState>() { |
@Override |
public ValidState transformChecked(Integer t) { |
ElementComboBox boxClient = (ElementComboBox) getView("ID_CLIENT").getComp(); |
if (getMode() == Mode.INSERTION && boxClient != null && !boxClient.isEmpty() |
&& (boxClient.getSelectedRow().getBoolean("BLOQUE_LIVRAISON") || boxClient.getSelectedRow().getBoolean("BLOQUE"))) { |
return ValidState.create(false, "Les intéractions avec ce client sont verrouillées."); |
} else { |
return ValidState.getTrueInstance(); |
} |
} |
}); |
this.comboClient = (ElementComboBox) clientValidatedValueWrapper.getComp(); |
addView(new SimpleRowItemView<Integer>(clientValidatedValueWrapper), "ID_CLIENT", REQ); |
this.comboClient = new ElementComboBox(); |
this.add(this.comboClient, c); |
this.addRequiredSQLObject(this.comboClient, "ID_CLIENT"); |
if (this.displayDpt) { |
c.gridx++; |
391,23 → 375,6 |
comboContact.getRequest().setWhere(Where.FALSE); |
DefaultGridBagConstraints.lockMinimumSize(comboContact); |
this.addView(comboContact, "ID_CONTACT"); |
// Commercial |
JLabel labelCommercial = new JLabel(getLabelFor("ID_COMMERCIAL")); |
labelCommercial.setHorizontalAlignment(SwingConstants.RIGHT); |
c.gridx++; |
c.weightx = 0; |
this.add(labelCommercial, c); |
this.comboCommercial = new ElementComboBox(false, 25); |
this.comboCommercial.setListIconVisible(false); |
c.gridx++; |
c.fill = GridBagConstraints.NONE; |
c.weightx = 1; |
this.add(this.comboCommercial, c); |
addRequiredSQLObject(this.comboCommercial, "ID_COMMERCIAL"); |
comboClient.addModelListener("wantedID", new PropertyChangeListener() { |
@Override |
417,11 → 384,6 |
if (wantedID != SQLRow.NONEXISTANT_ID && wantedID >= SQLRow.MIN_VALID_ID) { |
final SQLRow rowClient = getTable().getForeignTable("ID_CLIENT").getRow(wantedID); |
String alerte = rowClient.getString("ALERTE"); |
if (!isFilling() && alerte != null && alerte.trim().length() > 0) { |
JOptionPane.showMessageDialog(comboClient, alerte); |
} |
int idClient = rowClient.getID(); |
comboContact.getRequest().setWhere(new Where(contactElement.getTable().getField("ID_CLIENT"), "=", idClient)); |
if (rowClient.getObject("ID_CATEGORIE_COMPTABLE") != null && !rowClient.isForeignEmpty("ID_CATEGORIE_COMPTABLE")) { |
432,10 → 394,6 |
tableBonItem.setClient(rowClient, !isFilling()); |
if (!isFilling() && !rowClient.isForeignEmpty("ID_COMMERCIAL")) { |
comboCommercial.setValue(rowClient.getForeignID("ID_COMMERCIAL")); |
} |
} else { |
comboContact.getRequest().setWhere(Where.FALSE); |
tableBonItem.setRowCatComptable(null); |
446,10 → 404,26 |
} |
} |
}); |
// Commercial |
JLabel labelCommercial = new JLabel(getLabelFor("ID_COMMERCIAL")); |
labelCommercial.setHorizontalAlignment(SwingConstants.RIGHT); |
c.fill = GridBagConstraints.HORIZONTAL; |
c.gridx++; |
c.weightx = 0; |
this.add(labelCommercial, c); |
this.comboCommercial = new ElementComboBox(false, 25); |
this.comboCommercial.setListIconVisible(false); |
c.gridx++; |
c.fill = GridBagConstraints.NONE; |
c.weightx = 1; |
this.add(this.comboCommercial, c); |
addRequiredSQLObject(this.comboCommercial, "ID_COMMERCIAL"); |
} |
final ElementComboBox boxTarif = new ElementComboBox(); |
this.comboClient.addValueListener(new PropertyChangeListener() { |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
762,27 → 736,6 |
this.addSQLObject(this.selectCommande, "ID_COMMANDE_CLIENT"); |
this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO"); |
comboClient.addModelListener("wantedID", new PropertyChangeListener() { |
@Override |
public void propertyChange(PropertyChangeEvent arg0) { |
Integer id = comboClient.getWantedID(); |