Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/OpenConcerto/lib/fontbox-2.0.19.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/pdfbox-2.0.19.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/mysql-connector-java-5.1.40-bin.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/poi-3.17.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/poi-4.1.0.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/flatlaf-0.41.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/poi-5.0.0.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/poi-5.0.0.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/fontbox-2.0.22.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/fontbox-2.0.22.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.badSecurity.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.badSecurity.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/pdfbox-2.0.22.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/pdfbox-2.0.22.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/jOpenCalendar.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/flatlaf-1.2.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/flatlaf-1.2.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/pdfbox2d.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/pdfbox2d.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/lib/mysql-connector-java-5.1.45-bin.jar |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/lib/mysql-connector-java-5.1.45-bin.jar |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Labels/test.graphicspl |
---|
New file |
0,0 → 1,30 |
<?xml version="1.0" encoding="UTF-8" ?> |
<graphicspl width="600" height="400" dpi="300" |
printratio="0.5"> |
<rectangle fill="true" x="0" y="380" width="600" height="20" |
color="#FF000" /> |
<image x="420" y="20" width="160" height="160" file="icon.png" /> |
<text x="10" y="10" fontsize="20" font="Verdana">OpenConcerto</text> |
<text x="390" y="60" fontsize="40" font="Verdana" align="right" |
wrap="true" maxwidth="200">Atome Premium</text> |
<text x="390" y="140" fontsize="40" font="Verdana" align="right" |
color="#12000">56.00 € HT</text> |
<barcode x="10" y="120" modulewidth="4" type="datamatrix" |
width="200">OpenConcerto</barcode> |
<barcode x="10" y="220" type="gs1" height="100" modulewidth="6" |
fontsize="25">1234566546 |
</barcode> |
<text x="300" y="200" fontsize="10" font="Verdana" align="center" |
color="#666666">ARTICLE EN PROMOTION - NON ECHANGEABLE</text> |
<rectangle fill="false" x="0" y="0" width="599" height="399" /> |
</graphicspl> |
/trunk/OpenConcerto/Configuration/Template/Labels/icon.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Labels/icon.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.xml |
---|
47,7 → 47,7 |
<field name="AU" prefix=" au " type="date" datePattern="dd/MM/yy" /> |
</element> |
<element location="D54" type="fill"> |
<element location="D58" type="fill"> |
<field name="DU" type="datePaye" /> |
</element> |
89,7 → 89,7 |
</element> |
<element location="F12" type="fill"> |
<field name="ID_CUMULS_CONGES"> |
<field name="ACQUIS" /> |
<field name="ACQUIS" type="cumulConges" /> |
</field> |
</element> |
<element location="B6" type="replace" replacePattern="_"> |
122,79 → 122,159 |
</element> |
<element location="I54" type="fill"> |
<field name="NET_A_PAYER" /> |
<element location="H54" type="fill"> |
<field name="NET_AVANT_PAS" /> |
</element> |
<element location="I55" type="fill"> |
<field name="REDUCTION_GVT" /> |
</element> |
<element location="D58" type="fill"> |
<element location="E57" type="fill"> |
<field name="NET_IMP" /> |
</element> |
<element location="F57" type="fill"> |
<field name="ID_PAS"> |
<field name="TAUX_PAS" /> |
</field> |
</element> |
<element location="I57" type="fill"> |
<field name="TOTAL_PAS" /> |
</element> |
<element location="I58" type="fill"> |
<field name="NET_A_PAYER" /> |
</element> |
<element location="D62" type="fill"> |
<field name="SAL_BRUT" /> |
</element> |
<element location="E58" type="fill"> |
<element location="E62" type="fill"> |
<field name="COT_SAL" /> |
</element> |
<element location="F58" type="fill"> |
<element location="F62" type="fill"> |
<field name="COT_PAT" /> |
</element> |
<element location="G58" type="fill"> |
<element location="G62" type="fill"> |
<field name="AVANTAGE_NATURE" /> |
</element> |
<element location="H58" type="fill"> |
<element location="H62" type="fill"> |
<field name="NET_IMP" /> |
</element> |
<element location="I58" type="fill"> |
<element location="I62" type="fill"> |
<field name="ALLEGEMENT_COTISATION" /> |
</element> |
<element location="D59" type="fill"> |
<element location="D63" type="fill"> |
<field name="SAL_BRUT" type="cumulPaye" /> |
</element> |
<element location="E59" type="fill"> |
<element location="E63" type="fill"> |
<field name="COT_SAL" type="cumulPaye" /> |
</element> |
<element location="F59" type="fill"> |
<element location="F63" type="fill"> |
<field name="COT_PAT" type="cumulPaye" /> |
</element> |
<element location="G59" type="fill"> |
<element location="G63" type="fill"> |
<field name="AVANTAGE_NATURE" type="cumulPaye" /> |
</element> |
<element location="H59" type="fill"> |
<element location="H63" type="fill"> |
<field name="NET_IMP" type="cumulPaye" /> |
</element> |
<element location="I59" type="fill"> |
<element location="I63" type="fill"> |
<field name="ALLEGEMENT_COTISATION" type="cumulPaye" /> |
</element> |
<table endPageLine="61" firstLine="15" endLine="51" lastColumn="J" base="Societe" table="FICHE_PAYE_ELEMENT" |
<element location="J16" type="fill"> |
<field name="ID_SALARIE"> |
<field name="CODE" /> |
</field> |
</element> |
<element location="J18" type="fill"> |
<field name="ID_SALARIE"> |
<field name="ID_INFOS_SALARIE_PAYE"> |
<field name="DATE_ARRIVE"> |
</field> |
</field> |
</field> |
</element> |
<element location="J21" type="fichepaye.smic" /> |
<element location="J23" type="fichepaye.plafond" /> |
<element location="J28" type="fill"> |
<field name="ID_VARIABLE_SALARIE"> |
<field name="HEURE_TRAV" /> |
</field> |
</element> |
<element location="J30" type="fichepaye.heure.sup.total"> |
</element> |
<element location="J32" type="fichepaye.heure.total"> |
</element> |
<element location="J35" type="fill"> |
<field name="ID_VARIABLE_SALARIE"> |
<field name="HEURE_TRAV_CUMUL_VAL" /> |
</field> |
</element> |
<element location="J37" type="fichepaye.heure.sup.cumul.total"> |
</element> |
<element location="J39" type="fichepaye.heure.cumul.total"> |
</element> |
<table endPageLine="65" firstLine="15" endLine="51" lastColumn="J" base="Societe" table="FICHE_PAYE_ELEMENT" |
blankLineBeforeStyle="Titre 1,Titre 2" fieldWhere="IMPRESSION" orderBy="POSITION"> |
<element location="B" type="fill" cellSize="52"> |
<field name="NOM" /> |
</element> |
<element location="E" type="fill"> |
<element location="D" type="fill"> |
<field name="NB_BASE" /> |
</element> |
<element location="E" type="fill"> |
<field name="TAUX_SAL"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
</element> |
<element location="F" type="fill"> |
<field name="TAUX_SAL" /> |
<field name="MONTANT_SAL_AJ"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
</element> |
<element location="G" type="fill"> |
<field name="MONTANT_SAL_AJ" /> |
<field name="MONTANT_SAL_DED"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
</element> |
<element location="H" type="fill"> |
<field name="MONTANT_SAL_DED" /> |
<field name="TAUX_PAT"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
</element> |
<!-- <element location="I" type="fill"> |
<field name="TAUX_PAT" type="Devise" /> |
</element> --> |
<element location="J" type="fill"> |
<field name="MONTANT_PAT" /> |
<element location="I" type="fill"> |
<field name="MONTANT_PAT"> |
<exclude value="0.00" /> |
<exclude value="0.00%" /> |
<exclude value="0.000000" /> |
</field> |
</element> |
/trunk/OpenConcerto/Configuration/Template/Default/BonLivraison.xml |
---|
24,7 → 24,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/Avoir.xml |
---|
26,7 → 26,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureTicket.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureTicket.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/DemandePrix.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/FicheClient.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FactureFournisseur.odsp |
---|
1,6 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">57</sheet> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureTicket.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">66</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/AvoirF.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/CommandeClient.xml |
---|
24,7 → 24,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
62,7 → 62,7 |
<field name="NOM" /> |
</element> |
<element location="I10" type="fill"> |
<element location="H10" type="fill"> |
<field name="ID_CLIENT"> |
<field name="FORME_JURIDIQUE" /> |
<field name="NOM" /> |
69,7 → 69,7 |
</field> |
</element> |
<element location="I11" type="address.customer.full"> |
<element location="H11" type="address.customer.full"> |
</element> |
/trunk/OpenConcerto/Configuration/Template/Default/FactureFournisseur.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/CommandeClient.odsp |
---|
1,6 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">65</sheet> |
<sheet number="0">66</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/trunk/OpenConcerto/Configuration/Template/Default/SituationCompte.xml |
---|
New file |
0,0 → 1,57 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<element0 location="A1" type="Value" ValueName="SOCIETE_NOM"> |
</element0> |
<element0 location="A2" type="Value" ValueName="SOCIETE_ADRESSE"> |
</element0> |
<element0 location="A4" type="Value" ValueName="SOCIETE_VILLE"> |
</element0> |
<element0 location="A5" type="Value" prefix="Tél:" ValueName="SOCIETE_TEL"> |
</element0> |
<element0 location="D6" type="Value" ValueName="NOM_CLIENT"> |
</element0> |
<element0 location="F8" type="Value" ValueName="DATE"> |
</element0> |
<element0 location="G51" type="Value" ValueName="TOTAL_ECHEANCE"> |
</element0> |
<element0 location="G52" type="Value" ValueName="TOTAL_FUTUR"> |
</element0> |
<element0 location="G53" type="Value" ValueName="TOTAL_PASSE"> |
</element0> |
<table0 firstLine="17" endLine="50" endPageLine="58" lastColumn="G" base="Societe" table="ECHEANCE_CLIENT" pageRef="F1"> |
<element location="A" type="fill" useOOFormat="false"> |
<field base="Societe" name="DATE"/> |
</element> |
<element location="B" type="fill" useOOFormat="false"> |
<field base="Societe" name="PIECE"/> |
</element> |
<element location="C" type="fill" useOOFormat="false" maxChar="25"> |
<field base="Societe" name="LIBELLE"/> |
</element> |
<element location="D" type="fill" useOOFormat="false"> |
<field base="Societe" name="DATE_ECHEANCE"/> |
</element> |
<element location="E" type="fill" > |
<field base="Societe" name="DU"/> |
</element> |
<element location="F" type="fill" > |
<field base="Societe" name="REGLE"/> |
</element> |
<element location="G" type="fill" > |
<field base="Societe" name="SOLDE"/> |
</element> |
</table0> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/BonReception.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/ListeDebiteur.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/JournauxAnalytique.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ReleveCheque.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Operations Report.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingTaxeComplementaire.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/DIPE.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatVentes.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.odsp |
---|
1,6 → 1,7 |
<odsp> |
<spliteveryrow> |
<sheet number="0">61</sheet> |
<sheet number="0">65</sheet> |
</spliteveryrow> |
<offset x="20" y ="20"/> |
<resize percent="92"/> |
<offset x="23" y ="0"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/ExportArticle.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/VentilationAnalytique.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Courrier.odt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/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 SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/JournauxMois.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureSituation.xml |
---|
24,7 → 24,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingClient.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingClient.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/FicheArticle.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/DepotCheque.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">56</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/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/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/RepartitionAnalytique.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">57</sheet> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/trunk/OpenConcerto/Configuration/Template/Default/DepotCheque.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/DepotCheque.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">57</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/BalanceAgee.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureTicket.xml |
---|
New file |
0,0 → 1,90 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<element0 location="B1" type="Value" ValueName="SOCIETE_NOM"> |
</element0> |
<element0 location="B2" type="Value" ValueName="SOCIETE_RUE"> |
</element0> |
<element0 location="B3" type="Value" ValueName="SOCIETE_CODE_POSTAL_VILLE"> |
</element0> |
<element0 location="B5" type="Value" ValueName="SOCIETE_TYPE_CAPITAL"> |
</element0> |
<element0 location="B6" type="Value" ValueName="SOCIETE_SIRET" prefix="N° de SIREN "> |
</element0> |
<element0 location="B7" type="Value" ValueName="SOCIETE_TVA" prefix="N° de TVA "> |
</element0> |
<element0 location="B8" type="Value" ValueName="SOCIETE_TEL" prefix="N° de Téléphone "> |
</element0> |
<element0 location="B10" type="Value" ValueName="SOCIETE_MAIL" prefix="Email "> |
</element0> |
<element0 location="B13" type="Value" ValueName="NUMERO"> |
</element0> |
<element0 location="C13" type="Value" ValueName="DATE"> |
</element0> |
<element0 location="H10" type="Value" ValueName="CLIENT"> |
</element0> |
<element0 location="H11" type="Value" ValueName="ADRESSE"> |
</element0> |
<element0 location="L62" type="Value" ValueName="T_HT"> |
</element0> |
<element0 location="L65" type="Value" ValueName="T_TTC"> |
</element0> |
<element0 location="L63" type="Value" ValueName="T_TVA_1"> |
</element0> |
<element0 location="I63" type="Value" ValueName="TVA_1"> |
</element0> |
<element0 location="L64" type="Value" ValueName="T_TVA_2"> |
</element0> |
<element0 location="I64" type="Value" ValueName="TVA_2"> |
</element0> |
<table0 endPageLine="66" firstLine="20" endLine="60" blankLineBeforeStyle="Titre 1,Titre 2" lastColumn="K" |
base="Societe" table="SAISIE_VENTE_FACTURE_ELEMENT" pageRef="L16"> |
<element location="B" type="fill" cellSize="45"> |
<field name="CODE" /> |
</element> |
<element location="C" type="fill" cellSize="45"> |
<field name="NOM" /> |
</element> |
<element location="H" type="fill"> |
<field name="POURCENT_REMISE"> |
<exclude value="0.000000" /> |
</field> |
</element> |
<element location="I" type="fill"> |
<field name="PV_HT" type="devise"> |
<exclude value="0.000000" /> |
</field> |
</element> |
<element location="J" type="fill"> |
<field name="QTE" /> |
</element> |
<element location="K" type="fill"> |
<field name="TVA"> |
</field> |
</element> |
<element location="L" type="fill"> |
<field name="T_HT_REMISE" type="devise"> |
<exclude value="0.000000" /> |
</field> |
</element> |
</table0> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/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/EtatStockInventaire.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/ReleveChequeEmis.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/LivrePaye.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/AvoirF.xml |
---|
27,7 → 27,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/BonLivraison.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FicheRelance.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FactureFournisseur.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN " /> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET " /> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatChargesPaye.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Avoir.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatVentes.xml |
---|
124,4 → 124,28 |
</element> |
</table3> |
<element4 location="A4" type="Value" ValueName="DATE"> |
</element4> |
<table4 firstLine="7" endLine="52" endPageLine="54" lastColumn="F" base="Societe" table="SAISIE_VENTE_FACTURE_ELEMENT"> |
<element location="A" type="fill"> |
<field base="Societe" name="CODE" /> |
</element> |
<element location="B" type="fill"> |
<field base="Societe" name="NOM" /> |
</element> |
<element location="D" type="fill"> |
<field base="Societe" name="QTE" /> |
</element> |
<element location="E" type="fill"> |
<field base="Societe" name="QTE_REEL" /> |
</element> |
<element location="F" type="fill"> |
<field base="Societe" name="QTE_MIN" /> |
</element> |
</table4> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/DemandePrix.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/CommandeClient.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingClient.xml |
---|
New file |
0,0 → 1,36 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<element location="C2" type="Value" ValueName="DATE"> |
</element> |
<element location="C5" type="Value" ValueName="CLIENT" > |
</element> |
<table firstLine="8" endLine="305" endPageLine="305" lastColumn="H" > |
<element location="B" type="fill"> |
<field base="Societe" name="NUMERO_FACTURE"/> |
</element> |
<element location="C" type="fill"> |
<field base="Societe" name="DATE"/> |
</element> |
<element location="D" type="fill" cellSize="24"> |
<field base="Societe" name="NOM"/> |
</element> |
<element location="E" type="fill"> |
<field base="Societe" name="ECHEANCE"/> |
</element> |
<element location="F" type="fill"> |
<field base="Societe" name="T_TTC"/> |
</element> |
<element location="G" type="fill"> |
<field base="Societe" name="REGLE"/> |
</element> |
<element location="H" type="fill"> |
<field base="Societe" name="DU"/> |
</element> |
</table> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStocks.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Balance.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/BonReception.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/SituationCompte.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/SituationCompte.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/ListeFacture.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/ReportingEcoContribution.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFacture.xml |
---|
25,7 → 25,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
/trunk/OpenConcerto/Configuration/Template/Default/BonReception.odsp |
---|
1,6 → 1,6 |
<odsp> |
<spliteveryrow> |
<sheet number="0">57</sheet> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
/trunk/OpenConcerto/Configuration/Template/Default/SituationCompte.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="0" y ="0"/> |
<resize percent="100"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/DemandePrix.odsp |
---|
2,8 → 2,4 |
<spliteveryrow> |
<sheet number="0">58</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/DepotCheque.xml |
---|
New file |
0,0 → 1,60 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<element location="H1" type="fill"> |
<field base="Societe" name="DATE"> |
</field> |
</element> |
<element location="K56" type="fill"> |
<field base="Societe" name="MONTANT" type="devise"> |
</field> |
</element> |
<element location="A55" type="fill"> |
<field base="Societe" name="NOM"> |
</field> |
</element> |
<element location="A56" type="fill"> |
<field base="Societe" name="ID_BANQUE"> |
<field base="Societe" name="NOM" prefix ="Dépôt sur la banque "/> |
</field> |
</element> |
<table endPageLine="56" firstLine="5" endLine="53" lastColumn="L" base="Societe" table="DEPOT_CHEQUE_ELEMENT"> |
<element location="A" type="fill"> |
<field name="BANQUE" /> |
</element> |
<element location="B" type="fill"> |
<field name="DATE" /> |
</element> |
<element location="C" type="fill"> |
<field name="NUMERO" /> |
</element> |
<element location="E" type="fill"> |
<field name="ID_CLIENT" > |
<field name="NOM" /> |
</field> |
</element> |
<element location="J" type="fill"> |
<field name="PIECE" /> |
</element> |
<element location="K" type="fill"> |
<field name="MONTANT" type="devise"/> |
</element> |
<element location="L" type="LineReference"> |
<field name="MONTANT" type="LineReference"/> |
</element> |
</table> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/Commande.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Devis.xml |
---|
23,7 → 23,7 |
</element> |
<element location="B6" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIREN "/> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" prefix="N° de SIRET "/> |
</element> |
<element location="B7" type="replace" replacePattern="_"> |
62,7 → 62,7 |
<field name="OBJET" /> |
</element> |
<element location="I10" type="fill"> |
<element location="H10" type="fill"> |
<field name="ID_CLIENT"> |
<field name="FORME_JURIDIQUE" /> |
<field name="NOM" /> |
69,7 → 69,7 |
</field> |
</element> |
<element location="I11" type="address.customer.full"> |
<element location="H11" type="address.customer.full"> |
</element> |
<element location="L63" type="fill"> |
/trunk/OpenConcerto/Configuration/Template/Default/VenteFactureSituation.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/Relance2.odt |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/GrandLivre.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.xml |
---|
New file |
0,0 → 1,33 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<!-- <element location="A3" type="Value" ValueName="DATE"> |
</element> |
--> |
<table firstLine="2" endLine="17000" endPageLine="25000" lastColumn="E" table="SAISIE_VENTE_FACTURE"> |
<element location="A" type="fill"> |
<field name="FAMILLE" /> |
</element> |
<element location="B" type="fill"> |
<field name="CODE" /> |
</element> |
<element location="C" type="fill"> |
<field name="NOM" /> |
</element> |
<element location="D" type="fill"> |
<field name="TAILLE" /> |
</element> |
<element location="E" type="fill"> |
<field name="COULEUR" /> |
</element> |
<element location="F" type="fill"> |
<field name="QTE" /> |
</element> |
</table> |
</contentDocument> |
/trunk/OpenConcerto/src/org/openconcerto/laf/IComboBoxUI.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/laf/IButtonUI.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/laf/IScrollBarUI.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/laf/ILookAndFeel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/task/config/ComptaOptions.java |
---|
New file |
0,0 → 1,59 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.task.config; |
import net.jcip.annotations.Immutable; |
@Immutable |
public class ComptaOptions { |
private final Customer customer; |
public ComptaOptions(final Customer customer) { |
this.customer = customer; |
} |
public final Customer getCustomer() { |
return this.customer; |
} |
public final boolean customerUseControle() { |
return customerIsPreventec() || customerIsKD(); |
} |
public final boolean customerIsKD() { |
final boolean kd = getCustomer() == Customer.KD; |
return kd; |
} |
public final boolean customerIsODT() { |
final boolean kd = getCustomer() == Customer.ODT; |
return kd; |
} |
public final boolean customerIsTCP() { |
final boolean kd = getCustomer() == Customer.TCP; |
return kd; |
} |
public final boolean customerIsPreventec() { |
final boolean prev = getCustomer() == Customer.PREVENTEC; |
return prev; |
} |
public final boolean customerIsProfilbat() { |
return getCustomer() == Customer.PROFILBAT; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/task/config/Customer.java |
---|
New file |
0,0 → 1,34 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.task.config; |
public enum Customer { |
GESTION_DEFAULT("Gestion_Default"), IDEATION("Ideation"), TCP("TCP"), KD("KD"), PREVENTEC("Preventec"), PROFILBAT("Profilbat"), CTD("CTD"), ODT("ODT"); |
private final String name; |
private Customer(String name) { |
if (name == null) |
throw new NullPointerException(); |
this.name = name; |
} |
public String getName() { |
return this.name; |
} |
public static Customer fromName(String n) { |
return Customer.valueOf(n.toUpperCase()); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/credit/action/ListeDesAvoirsFournisseurAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
69,7 → 69,7 |
final IListFrame frame = new IListFrame(panel); |
frame.getPanel().setAddVisible(true); |
frame.getPanel().getListe().addIListeActions(new MouseSheetXmlListeListener(AvoirFournisseurXmlSheet.class).getRowActions()); |
frame.getPanel().getListe().addIListeActions(new MouseSheetXmlListeListener(element, AvoirFournisseurXmlSheet.class).getRowActions()); |
frame.getPanel().getListe().setModificationAllowed(false); |
return frame; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/purchase/importer/FacturXExporter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,7 → 13,9 |
package org.openconcerto.erp.core.supplychain.purchase.importer; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.finance.payment.element.ModeDeReglementSQLElement; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
23,6 → 25,7 |
import org.openconcerto.sql.model.Where; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.text.DecimalFormat; |
import java.text.DecimalFormatSymbols; |
import java.text.SimpleDateFormat; |
90,11 → 93,7 |
rowValsToFetch.putRowValues("ID_MODE_REGLEMENT").putNulls("COMPTANT", "AJOURS", "LENJOUR", "DATE_FACTURE", "FIN_MOIS").putRowValues("ID_TYPE_REGLEMENT").putNulls("NOM"); |
SQLRowValues putRowValuesClient = rowValsToFetch.putRowValues("ID_CLIENT"); |
putRowValuesClient.putNulls("NOM", "RESPONSABLE", "SIRET", "NUMERO_TVA", "MAIL", "TEL"); |
if (putRowValuesClient.getTable().contains("ID_CLIENT")) { |
this.useCommonClient = true; |
putRowValuesClient.putRowValues("ID_CLIENT").putNulls("NOM", "RESPONSABLE", "SIRET", "NUMERO_TVA", "MAIL", "TEL").putRowValues("ID_ADRESSE").putNulls("RUE", "VILLE", "CODE_POSTAL", |
"PAYS"); |
} |
putRowValuesClient.putRowValues("ID_ADRESSE").putNulls("RUE", "VILLE", "CODE_POSTAL", "PAYS"); |
putRowValuesClient.putRowValues("ID_ADRESSE_F").putNulls("RUE", "VILLE", "CODE_POSTAL", "PAYS"); |
rowValsToFetch.putRowValues("ID_ADRESSE").putNulls("RUE", "VILLE", "CODE_POSTAL", "PAYS"); |
186,7 → 185,7 |
final BigDecimal pHT, pTTC, totalHTLigne, totalTTCLigne; |
SQLRowAccessor taxeItem = rowItem.getForeign("ID_TAXE"); |
BigDecimal taxValue = new BigDecimal(taxeItem.getFloat("TAUX")).setScale(2); |
BigDecimal taxValue = new BigDecimal(taxeItem.getFloat("TAUX")).setScale(2, RoundingMode.HALF_UP); |
if (rowItem.getInt("NIVEAU") != 1) { |
pHT = BigDecimal.ZERO; |
pTTC = BigDecimal.ZERO; |
671,6 → 670,7 |
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,7 → 684,11 |
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/FactureFournisseurSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
805,14 → 805,14 |
// Création des articles |
this.table.createArticle(idFacture, this.getElement()); |
final SQLRow rowA = getTable().getRow(idFacture); |
new GenerationMvtFactureFournisseur(rowA); |
final SQLRow row = getTable().getRow(idFacture); |
new GenerationMvtFactureFournisseur(row); |
final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(rowA); |
final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
commitAvoir(null, rowA); |
commitAvoir(null, row); |
return idFacture; |
} |
850,7 → 850,7 |
} |
final FactureFournisseurXmlSheet sheet = new FactureFournisseurXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
commitAvoir(rowFactureOld, row); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/component/CommandeSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
23,6 → 23,7 |
import org.openconcerto.erp.core.common.ui.TotalPanel; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement; |
import org.openconcerto.erp.core.supplychain.order.element.CommandeSQLElement; |
import org.openconcerto.erp.core.supplychain.order.element.DemandeAchatItemSQLElement; |
import org.openconcerto.erp.core.supplychain.order.ui.CommandeItemTable; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater; |
700,7 → 701,7 |
final JPanel panelPoids = new JPanel(new GridBagLayout()); |
GridBagConstraints cPoids = new DefaultGridBagConstraints(); |
cPoids.weightx = 0; |
panelPoids.add(new JLabel(getLabelFor("T_POIDS")), cPoids); |
panelPoids.add(new JLabel(getLabelFor("T_POIDS"), SwingConstants.RIGHT), cPoids); |
cPoids.weightx = 1; |
textPoidsTotal.setEnabled(false); |
textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT); |
728,14 → 729,48 |
ElementComboBox comboTaxePort = new ElementComboBox(false, 10); |
if (getTable().contains("PORT_HT")) { |
addSQLObject(textPortHT, "PORT_HT"); |
final JPanel panelPoids = new JPanel(new GridBagLayout()); |
GridBagConstraints cPort = new DefaultGridBagConstraints(); |
cPort.gridx = 0; |
cPort.fill = GridBagConstraints.NONE; |
cPort.fill = GridBagConstraints.HORIZONTAL; |
cPort.weightx = 0; |
panelPoids.add(new JLabel(getLabelFor("PORT_HT")), cPort); |
// Condition frais de port |
if (getTable().getForeignTable("ID_FOURNISSEUR").contains("CONDITIONS_PORT")) { |
cPort.gridwidth = 2; |
final JLabel labelConditionPort = new JLabel(); |
labelConditionPort.setVisible(false); |
panelPoids.add(labelConditionPort, cPort); |
fourn.addModelListener("wantedID", (evt) -> { |
int wantedID = fourn.getWantedID(); |
if (wantedID != SQLRow.NONEXISTANT_ID && wantedID >= SQLRow.MIN_VALID_ID) { |
final SQLRow rowF = getTable().getForeignTable("ID_FOURNISSEUR").getRow(wantedID); |
final String conditions = rowF.getString("CONDITIONS_PORT"); |
if (conditions.trim().length() > 0) { |
labelConditionPort.setText(conditions); |
labelConditionPort.setVisible(true); |
} else { |
labelConditionPort.setText(""); |
labelConditionPort.setVisible(false); |
} |
} else { |
labelConditionPort.setText(""); |
labelConditionPort.setVisible(false); |
} |
}); |
cPort.gridwidth = 1; |
cPort.gridy++; |
} |
addSQLObject(textPortHT, "PORT_HT"); |
cPort.gridx = 0; |
cPort.fill = GridBagConstraints.HORIZONTAL; |
cPort.weightx = 0; |
panelPoids.add(new JLabel(getLabelFor("PORT_HT"), SwingConstants.RIGHT), cPort); |
textPortHT.setHorizontalAlignment(JTextField.RIGHT); |
cPort.gridx++; |
cPort.weightx = 1; |
745,7 → 780,7 |
cPort.gridx = 0; |
cPort.weightx = 0; |
addRequiredSQLObject(comboTaxePort, "ID_TAXE_PORT"); |
panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT")), cPort); |
panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT"), SwingConstants.RIGHT), cPort); |
cPort.gridx++; |
cPort.weightx = 1; |
panelPoids.add(comboTaxePort, cPort); |
753,9 → 788,9 |
addSQLObject(textRemiseHT, "REMISE_HT"); |
cPort.gridy++; |
cPort.gridx = 0; |
cPort.fill = GridBagConstraints.NONE; |
cPort.fill = GridBagConstraints.HORIZONTAL; |
cPort.weightx = 0; |
panelPoids.add(new JLabel(getLabelFor("REMISE_HT")), cPort); |
panelPoids.add(new JLabel(getLabelFor("REMISE_HT"), SwingConstants.RIGHT), cPort); |
textRemiseHT.setHorizontalAlignment(JTextField.RIGHT); |
cPort.gridx++; |
cPort.weightx = 1; |
914,9 → 949,10 |
} |
// generation du document |
final CommandeXmlSheet sheet = new CommandeXmlSheet(getTable().getRow(idCommande)); |
final SQLRow row = getTable().getRow(idCommande); |
final CommandeXmlSheet sheet = new CommandeXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
// incrémentation du numéro auto |
if (NumerotationAutoSQLElement.getNextNumero(getElement().getClass()).equalsIgnoreCase(this.numeroUniqueCommande.getText().trim())) { |
934,6 → 970,8 |
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class); |
elt.updateStatus(getTable(), getTable().getTable("COMMANDE_ELEMENT"), idCommande); |
((CommandeSQLElement) getElement()).fireInsertedCmdListener(row); |
if (attempt > 0) { |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
1000,9 → 1038,10 |
elt.updateStatus(getTable(), getTable().getTable("COMMANDE_ELEMENT"), getSelectedID()); |
// generation du document |
final CommandeXmlSheet sheet = new CommandeXmlSheet(getTable().getRow(id)); |
final SQLRow row = getTable().getRow(id); |
final CommandeXmlSheet sheet = new CommandeXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/table/ChiffrageCommandeTable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
66,7 → 66,16 |
final List<SQLTableElement> list = new Vector<SQLTableElement>(); |
final SQLTableElement tableElementNom = new SQLTableElement(e.getTable().getField("NOM")); |
final SQLTableElement tableElementNom = new SQLTableElement(e.getTable().getField("NOM")) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
if (e.getTable().contains("ID_CATEGORIE_HEURE")) { |
return false; |
} else { |
return super.isCellEditable(vals, rowIndex, columnIndex); |
} |
} |
}; |
list.add(tableElementNom); |
if (e.getTable().contains("ID_TYPE_CMD")) { |
final SQLTableElement cat = new SQLTableElement(e.getTable().getField("ID_TYPE_CMD")); |
82,13 → 91,19 |
final SQLField fieldHA = e.getTable().getField("PA_HT"); |
final DeviseNumericCellEditor editorPAHT = new DeviseNumericCellEditor(fieldHA); |
final SQLTableElement pa = new SQLTableElement(fieldHA, BigDecimal.class, editorPAHT); |
final SQLTableElement pa = new SQLTableElement(fieldHA, BigDecimal.class, editorPAHT) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
if (e.getTable().contains("ID_CATEGORIE_HEURE")) { |
return false; |
} else { |
return super.isCellEditable(vals, rowIndex, columnIndex); |
} |
} |
}; |
DeviseTableCellRenderer renderer = new DeviseTableCellRenderer(); |
renderer.setHideZeroValue(true); |
pa.setRenderer(renderer); |
if (e.getTable().contains("ID_CATEGORIE_HEURE")) { |
pa.setEditable(false); |
} |
list.add(pa); |
final SQLField fieldPV = e.getTable().getField("PV_HT"); |
102,6 → 117,15 |
protected Object getDefaultNullValue() { |
return BigDecimal.ZERO; |
} |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
if (e.getTable().contains("ID_CATEGORIE_HEURE")) { |
return vals.getObject("ID_CATEGORIE_HEURE") == null || vals.isForeignEmpty("ID_CATEGORIE_HEURE"); |
} else { |
return super.isCellEditable(vals, rowIndex, columnIndex); |
} |
} |
}; |
qteU.setRenderer(renderer); |
list.add(qteU); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/FactureFournisseurSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
22,6 → 22,7 |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.model.FieldPath; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.graph.Path; |
import org.openconcerto.sql.view.EditFrame; |
32,6 → 33,7 |
import org.openconcerto.sql.view.list.SQLTableModelSource; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.sql.view.list.action.ListEvent; |
import org.openconcerto.ui.table.PercentTableCellRenderer; |
import org.openconcerto.utils.CollectionUtils; |
import org.openconcerto.utils.DecimalUtils; |
52,7 → 54,7 |
public FactureFournisseurSQLElement() { |
super("FACTURE_FOURNISSEUR", "une facture fournisseur", "factures fournisseur"); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(FactureFournisseurXmlSheet.class); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, FactureFournisseurXmlSheet.class); |
mouseSheetXmlListeListener.setGenerateHeader(true); |
mouseSheetXmlListeListener.setShowHeader(true); |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions()); |
70,8 → 72,7 |
editFrame.setVisible(true); |
} |
}, true, "supplychain.invoice.clone") { |
public boolean enabledFor(IListeEvent evt) { |
List<? extends SQLRowAccessor> l = evt.getSelectedRows(); |
public boolean enabledFor(List<SQLRowValues> l) { |
return (l != null && l.size() == 1); |
} |
}; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/DemandePrixSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
57,35 → 57,6 |
@Override |
protected void _initTableSource(SQLTableModelSource source) { |
super._initTableSource(source); |
// { |
// BaseSQLTableModelColumn cmd = new BaseSQLTableModelColumn("Commande associée", |
// String.class) { |
// |
// @Override |
// protected Object show_(SQLRowAccessor r) { |
// Collection<? extends SQLRowAccessor> l = |
// r.getReferentRows(r.getTable().getTable("COMMANDE")); |
// String s = ""; |
// if (l != null && l.size() > 0) { |
// for (SQLRowAccessor sqlRowAccessor : l) { |
// s += sqlRowAccessor.getString("NUMERO") + " "; |
// } |
// } |
// |
// return s; |
// } |
// |
// @Override |
// public Set<FieldPath> getPaths() { |
// // TODO Raccord de méthode auto-généré |
// Path p = new Path(getTable()); |
// p = p.add(getTable().getTable("COMMANDE").getField("ID_DEMANDE_PRIX")); |
// |
// return CollectionUtils.createSet(new FieldPath(p, "NUMERO")); |
// } |
// }; |
// source.getColumns().add(cmd); |
// } |
} |
92,11 → 63,10 |
public DemandePrixSQLElement() { |
super("DEMANDE_PRIX"); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(DemandePrixSheetXML.class) { |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(this, DemandePrixSheetXML.class) { |
@Override |
protected String getMailObject(SQLRow row) { |
// TODO Raccord de méthode auto-généré |
return "Veuillez trouver en pièce jointe notre demande de prix."; |
} |
121,16 → 91,6 |
final CommandeSQLComponent sqlComponent = (CommandeSQLComponent) f.getPanel().getSQLComponent(); |
sqlComponent.select(inj.createRowValuesFrom(row.getID())); |
// SQLRowAccessor foreignRow = row.getForeign("ID_ADRESSE"); |
// if (foreignRow != null && !foreignRow.isUndefined()) { |
// ElementSQLObject obj = (ElementSQLObject) |
// sqlComponent.getView("ID_ADRESSE").getComp(); |
// obj.setCreated(true); |
// |
// SQLRowValues asRowValues = getLivraisonAdr(row.getForeign("ID_AFFAIRE")); |
// asRowValues.clearPrimaryKeys(); |
// obj.getSQLChild().select(asRowValues); |
// } |
sqlComponent.loadItem(sqlComponent.getRowValuesTablePanel(), Configuration.getInstance().getDirectory().getElement("DEMANDE_PRIX"), row.getID(), |
Configuration.getInstance().getDirectory().getElement("DEMANDE_PRIX_ELEMENT")); |
f.setVisible(true); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/DemandePrixSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
23,6 → 23,7 |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.ElementSQLObject; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLBackgroundTableCache; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
30,6 → 31,7 |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.sqlobject.JUniqueTextField; |
import org.openconcerto.sql.ui.RadioButtons; |
import org.openconcerto.sql.users.UserManager; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.list.RowValuesTable; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
183,7 → 185,17 |
// this.add(boxEtat, c); |
// this.addView(boxEtat, "ID_ETAT_DEMANDE_PRIX"); |
c.gridx = 0; |
c.gridy++; |
c.weightx = 0; |
this.add(new JLabel(getLabelFor("ID_COMMERCIAL"), SwingConstants.RIGHT), c); |
c.gridx++; |
c.weightx = 1; |
final ElementComboBox boxCom = new ElementComboBox(); |
this.add(boxCom, c); |
this.addView(boxCom, "ID_COMMERCIAL", REQ); |
c.weightx = 0; |
c.gridheight = 1; |
c.gridx = 0; |
c.gridy++; |
470,9 → 482,10 |
// this.table.createArticle(idCommande, this.getElement()); |
// generation du document |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(getTable().getRow(idCommande)); |
final SQLRow row = getTable().getRow(idCommande); |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
sheet.showPrintAndExportAsynchronous(true, false, true, getElement(), row); |
// incrémentation du numéro auto |
if (NumerotationAutoSQLElement.getNextNumero(DemandePrixSQLElement.class).equalsIgnoreCase(this.field.getText().trim())) { |
522,9 → 535,10 |
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class); |
elt.updateStatus(getTable(), getTable().getTable("DEMANDE_PRIX_ELEMENT"), getSelectedID()); |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(getTable().getRow(getSelectedID())); |
final SQLRow row = getTable().getRow(getSelectedID()); |
DemandePrixSheetXML sheet = new DemandePrixSheetXML(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
sheet.showPrintAndExportAsynchronous(true, false, true, getElement(), row); |
} |
532,6 → 546,15 |
protected SQLRowValues createDefaults() { |
SQLRowValues rowVals = new SQLRowValues(getTable()); |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(DemandePrixSQLElement.class)); |
SQLElement eltComm = getElement().getForeignElement("ID_COMMERCIAL"); |
int idUser = UserManager.getInstance().getCurrentUserID(); |
SQLRow rowsComm = SQLBackgroundTableCache.getInstance().getCacheForTable(eltComm.getTable()).getFirstRowContains(idUser, eltComm.getTable().getField("ID_USER_COMMON")); |
if (rowsComm != null) { |
rowVals.put("ID_COMMERCIAL", rowsComm.getID()); |
} |
if (getTable().getUndefinedID() == SQLRow.NONEXISTANT_ID) { |
rowVals.put("ID_ETAT_DEMANDE_PRIX", EtatDemandePrixSQLElement.EN_ATTENTE); |
} else { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/CommandeSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,6 → 17,7 |
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.edm.AttachmentAction; |
import org.openconcerto.erp.core.sales.order.ui.ReliquatCommandeTableModel; |
import org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent; |
import org.openconcerto.erp.core.supplychain.order.component.SaisieAchatSQLComponent; |
import org.openconcerto.erp.core.supplychain.receipt.component.BonReceptionSQLComponent; |
34,6 → 35,9 |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLSelectJoin; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.SQLTableEvent; |
import org.openconcerto.sql.model.SQLTableEvent.Mode; |
import org.openconcerto.sql.model.SQLTableModifiedListener; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.view.EditFrame; |
42,9 → 46,12 |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.RowAction; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.ui.PanelFrame; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.cc.ITransformer; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.sql.SQLException; |
import java.util.ArrayList; |
54,6 → 61,9 |
import javax.swing.ImageIcon; |
import javax.swing.JFrame; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.JTable; |
import javax.swing.SwingWorker; |
import org.apache.commons.dbutils.handlers.ArrayListHandler; |
69,7 → 79,7 |
getRowActions().add(actionAttachment); |
} |
getRowActions().addAll(new MouseSheetXmlListeListener(CommandeXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, CommandeXmlSheet.class).getRowActions()); |
// Transfert vers BR |
PredicateRowAction bonAction = new PredicateRowAction(new AbstractAction() { |
155,8 → 165,34 |
}, 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); |
193,6 → 229,22 |
return new CommandeSQLComponent(); |
} |
private final List<SQLTableModifiedListener> listenerCmdInserted = new ArrayList<>(); |
public void addInsertedCmdListener(SQLTableModifiedListener l) { |
this.listenerCmdInserted.add(l); |
} |
public void removeInsertedCmdListener(SQLTableModifiedListener l) { |
this.listenerCmdInserted.remove(l); |
} |
public void fireInsertedCmdListener(SQLRow row) { |
for (SQLTableModifiedListener sqlTableModifiedListener : this.listenerCmdInserted) { |
sqlTableModifiedListener.tableModified(new SQLTableEvent(row, Mode.ROW_ADDED, null)); |
} |
} |
public void transfertBR(final List<SQLRowValues> selectedRows) { |
EditFrame f = TransfertBaseSQLComponent.openTransfertFrame(selectedRows, "BON_RECEPTION"); |
219,6 → 271,7 |
} |
}); |
comp.loadQuantity(fetcher.fetch()); |
comp.removeZeroQtyLines(); |
} |
/** |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/order/element/CommandeElementSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,10 → 15,12 |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.ui.DeviseField; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.UISQLComponent; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.UpdateBuilder; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.users.UserManager; |
104,6 → 106,15 |
l.add("ID_STYLE"); |
l.add("CODE"); |
l.add("NOM"); |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVER_DECLINAISON, false)) { |
for (String fieldName : getTable().getFieldsName()) { |
if (fieldName.startsWith("ID_ARTICLE_DECLINAISON_")) { |
l.add(fieldName); |
} |
} |
} |
l.add("ID_COMMANDE"); |
l.add("ID_ARTICLE"); |
l.add("PA_HT"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/receipt/element/CodeFournisseurSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
14,10 → 14,8 |
package org.openconcerto.erp.core.supplychain.receipt.element; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.ui.DeviseField; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.UISQLComponent; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import java.util.ArrayList; |
import java.util.List; |
42,6 → 40,11 |
return l; |
} |
@Override |
protected String getParentFFName() { |
return "ID_ARTICLE"; |
} |
/* |
* (non-Javadoc) |
* |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/receipt/element/BonReceptionSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
51,6 → 51,10 |
import javax.swing.SwingWorker; |
import org.apache.commons.dbutils.handlers.ArrayListHandler; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater; |
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate; |
import org.openconcerto.sql.model.SQLRowAccessor; |
public class BonReceptionSQLElement extends ComptaSQLConfElement { |
112,7 → 116,7 |
getRowActions().add(actionsTRFA); |
getRowActions().add(actionTRSimple); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(BonReceptionXmlSheet.class); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, BonReceptionXmlSheet.class); |
mouseSheetXmlListeListener.setGenerateHeader(true); |
mouseSheetXmlListeListener.setShowHeader(true); |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions()); |
226,4 → 230,37 |
protected String createCodeSuffix() { |
return ".note"; |
} |
/** |
* Mise à jour des stocks pour chaque article composant du bon |
* |
* @throws SQLException |
*/ |
public void updateStock(int id) throws SQLException { |
SQLRow row = getTable().getRow(id); |
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() { |
@Override |
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) { |
return getLibelleStock(rowOrigin, rowElt); |
} |
}, row, row.getReferentRows(getTable().getTable("BON_RECEPTION_ELEMENT")), |
getTable().contains("CREATE_VIRTUAL_STOCK") && row.getBoolean("CREATE_VIRTUAL_STOCK") ? TypeStockUpdate.REAL_VIRTUAL_RECEPT : TypeStockUpdate.REAL_RECEPT); |
if (getTable().getDBRoot().contains("RELIQUAT_BR")) { |
List<SQLRow> l = row.getReferentRows(getTable().getTable("RELIQUAT_BR").getField("ID_BON_RECEPTION_ORIGINE")); |
for (SQLRow sqlRow : l) { |
stockUpdater.addReliquat(sqlRow.getForeign("ID_ARTICLE"), sqlRow.getInt("QTE"), sqlRow.getBigDecimal("QTE_UNITAIRE")); |
} |
} |
stockUpdater.update(); |
} |
public String getLibelleStock(SQLRowAccessor row, SQLRowAccessor rowElt) { |
return "Bon de réception N°" + row.getString("NUMERO"); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/receipt/component/BonReceptionSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
586,7 → 586,7 |
@Override |
public void run() { |
try { |
updateStock(idBonFinal); |
((BonReceptionSQLElement) getElement()).updateStock(idBonFinal); |
((BonReceptionSQLElement) getElement()).updateCmdElement(((BonReceptionSQLElement) getElement()).getCmdFrom(idBonFinal), idBonFinal); |
} catch (Exception e) { |
ExceptionHandler.handle("Update error", e); |
598,9 → 598,10 |
elt.updateStatus(getTable(), getTable().getTable("BON_RECEPTION_ELEMENT"), idBon); |
// generation du document |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(getTable().getRow(idBonFinal)); |
final SQLRow row = getTable().getRow(idBonFinal); |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
} catch (Exception e) { |
throw new IllegalStateException(e); |
671,6 → 672,16 |
} |
} |
public void removeZeroQtyLines() { |
int count = this.tableBonItem.getModel().getRowCount() - 1; |
for (int i = count; i >= 0; i--) { |
final SQLRowValues rowValuesAt = this.tableBonItem.getModel().getRowValuesAt(i); |
if (rowValuesAt.getInt("QTE") == 0) { |
this.tableBonItem.getModel().removeRowAt(i); |
} |
} |
} |
@Override |
public void update() { |
700,7 → 711,7 |
try { |
// Mise à jour du stock |
updateStock(id); |
((BonReceptionSQLElement) getElement()).updateStock(id); |
((BonReceptionSQLElement) getElement()).updateCmdElement(cmdFrom, id); |
DemandeAchatItemSQLElement elt = getElement().getDirectory().getElement(DemandeAchatItemSQLElement.class); |
716,9 → 727,10 |
elt.updateStatus(getTable(), getTable().getTable("BON_RECEPTION_ELEMENT"), id); |
// generation du document |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(getTable().getRow(id)); |
final SQLRow row = getTable().getRow(id); |
final BonReceptionXmlSheet sheet = new BonReceptionXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
} |
} |
775,40 → 787,7 |
} |
} |
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/supplychain/product/element/ArticleFournisseurSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
33,7 → 33,7 |
public ArticleFournisseurSQLElement() { |
super("ARTICLE_FOURNISSEUR", "un article fournisseur", "articles fournisseurs"); |
getRowActions().addAll(new MouseSheetXmlListeListener(FicheArticleXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, FicheArticleXmlSheet.class).getRowActions()); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/EtatStockFromInventoryFileCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
16,11 → 16,19 |
import org.openconcerto.erp.core.sales.product.model.PriceByQty; |
import org.openconcerto.erp.importer.ArrayTableModel; |
import org.openconcerto.erp.importer.DataImporter; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowListRSH; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.utils.Tuple3; |
import java.io.File; |
import java.io.IOException; |
27,6 → 35,7 |
import java.math.BigDecimal; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Calendar; |
import java.util.Collection; |
import java.util.Date; |
33,8 → 42,11 |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
import java.util.Map.Entry; |
import java.util.Set; |
import javax.swing.JOptionPane; |
public class EtatStockFromInventoryFileCreator { |
// Map<String, SQLRowValues> kits = new HashMap<String, SQLRowValues>(); |
41,11 → 53,102 |
// List<String> codeKits = new ArrayList<String>(); |
// List<SQLRowValues> rowValsArtNonSync = new ArrayList<SQLRowValues>(); |
private static String FAMILLE = "Famille"; |
private static String CODE = "Code"; |
private static String NOM = "Nom"; |
private static String TAILLE = "Taille"; |
private static String COULEUR = "Couleur"; |
private static String QTE = "Qté réelle relevée"; |
private final Map<String, Integer> mapCouleur = new HashMap<String, Integer>(); |
private final Map<String, Integer> mapTaille = new HashMap<String, Integer>(); |
private final DBRoot root; |
private final SQLElement artElt; |
public EtatStockFromInventoryFileCreator(SQLElement artElt) { |
this.artElt = artElt; |
this.root = artElt.getTable().getDBRoot(); |
} |
public void importArticles(File file, Date d) throws IOException, SQLException { |
final SQLTable table = Configuration.getInstance().getRoot().findTable("ARTICLE"); |
Map<String, SQLRowValues> articles = getArticles(); |
final SQLTable table = this.root.findTable("ARTICLE"); |
{ |
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) { |
63,14 → 166,25 |
BigDecimal total = BigDecimal.ZERO; |
for (int i = 0; i < m.getRowCount(); i++) { |
List<Object> o = m.getLineValuesAt(i); |
String code = o.get(0).toString(); |
String code = o.get(columnMapping.get(CODE)).toString(); |
if (code.trim().length() == 0) { |
break; |
} |
final String stringQty = o.get(3).toString(); |
final String stringQty = o.get(columnMapping.get(QTE)).toString(); |
Integer qty = stringQty.trim().length() == 0 ? 0 : Integer.valueOf(stringQty); |
SQLRowValues match = articles.get(code); |
String couleur = ""; |
if (columnMapping.get(COULEUR) != null) { |
couleur = o.get(columnMapping.get(COULEUR)).toString(); |
} |
String taille = ""; |
if (columnMapping.get(TAILLE) != null) { |
taille = o.get(columnMapping.get(TAILLE)).toString(); |
} |
SQLRowAccessor match = findArticle(code, couleur, taille); |
if (match != null) { |
SQLRowValues stockValues = new SQLRowValues(table.getTable("ETAT_STOCK_ELEMENT")); |
95,8 → 209,9 |
} |
etatStock.createEmptyUpdateRow().put("MONTANT_HA", total).commit(); |
} |
} |
public BigDecimal getPRC(SQLRowValues rowVals, int qty, Date d) { |
public BigDecimal getPRC(SQLRowAccessor rowVals, int qty, Date d) { |
if (rowVals.getTable().getDBRoot().contains("ARTICLE_PRIX_REVIENT")) { |
SQLTable table = rowVals.getTable().getDBRoot().getTable("ARTICLE_PRIX_REVIENT"); |
Collection<SQLRow> prcs = rowVals.asRow().getReferentRows(table); |
126,7 → 241,10 |
} |
} |
private Map<String, SQLRowValues> getArticles() throws SQLException { |
private final Map<String, SQLRowAccessor> mapArticle = new HashMap<String, SQLRowAccessor>(); |
private final Map<Tuple3<String, String, String>, SQLRowAccessor> mapDeclArticle = new HashMap<Tuple3<String, String, String>, SQLRowAccessor>(); |
private void fillArticles() throws SQLException { |
final SQLTable table = Configuration.getInstance().getRoot().findTable("ARTICLE"); |
SQLRowValues graph = new SQLRowValues(table); |
graph.put("ID", null); |
135,6 → 253,8 |
graph.put("NOM", null); |
graph.put("PA_HT", null); |
graph.putRowValues("ID_STOCK").putNulls("ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
graph.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("ID", "NOM"); |
graph.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("ID", "NOM"); |
final SQLTable tableArtElt = table.getTable("ARTICLE_ELEMENT"); |
SQLRowValues artElt = new SQLRowValues(tableArtElt); |
142,24 → 262,110 |
artElt.put("QTE", null); |
artElt.put("QTE_UNITAIRE", null); |
artElt.put("ID_ARTICLE_PARENT", graph); |
artElt.putRowValues("ID_ARTICLE").putNulls("ID", "CODE", "NOM").putRowValues("ID_STOCK").putNulls("QTE_TH", "QTE_REEL", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
final SQLRowValues putRowValues = artElt.putRowValues("ID_ARTICLE"); |
putRowValues.putNulls("ID", "CODE", "NOM").putRowValues("ID_STOCK").putNulls("QTE_TH", "QTE_REEL", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
putRowValues.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("ID", "NOM"); |
putRowValues.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("ID", "NOM"); |
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(graph); |
List<SQLRowValues> results = fetcher.fetch(); |
Map<String, SQLRowValues> vals = new HashMap<String, SQLRowValues>(); |
for (SQLRowValues sqlRowValues : results) { |
final Set<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT")); |
// On ne prend que les articles simples |
if (referentRows.size() == 0) { |
final String code = sqlRowValues.getString("CODE"); |
vals.put(code, sqlRowValues); |
final SQLRowAccessor couleur = sqlRowValues.getObject("ID_ARTICLE_DECLINAISON_COULEUR") == null ? null : sqlRowValues.getNonEmptyForeign("ID_ARTICLE_DECLINAISON_COULEUR"); |
final SQLRowAccessor taille = sqlRowValues.getObject("ID_ARTICLE_DECLINAISON_TAILLE") == null ? null : sqlRowValues.getNonEmptyForeign("ID_ARTICLE_DECLINAISON_TAILLE"); |
if (couleur == null && taille == null) { |
mapArticle.put(sqlRowValues.getString("CODE"), sqlRowValues); |
} else if (couleur == null) { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), null, taille.getString("NOM")), sqlRowValues); |
} else if (taille == null) { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), couleur.getString("NOM"), null), sqlRowValues); |
} else { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), couleur.getString("NOM"), taille.getString("NOM")), sqlRowValues); |
} |
} else { |
} |
} |
return vals; |
} |
private SQLRowAccessor findArticle(String code, String couleur, String taille) throws SQLException { |
if (!mapCouleur.containsKey(couleur)) { |
SQLRowValues rowVals = new SQLRowValues(root.getTable("ARTICLE_DECLINAISON_COULEUR")); |
rowVals.put("NOM", couleur); |
mapCouleur.put(couleur, rowVals.commit().getID()); |
} |
if (!mapTaille.containsKey(taille)) { |
SQLRowValues rowVals = new SQLRowValues(root.getTable("ARTICLE_DECLINAISON_TAILLE")); |
rowVals.put("NOM", taille); |
mapTaille.put(taille, rowVals.commit().getID()); |
} |
SQLRowAccessor sqlRowAccessor; |
if ((couleur == null || couleur.trim().length() == 0) && (taille == null || taille.trim().length() == 0)) { |
sqlRowAccessor = mapArticle.get(code); |
} else if (couleur == null || couleur.trim().length() == 0) { |
sqlRowAccessor = mapDeclArticle.get(Tuple3.create(code, null, taille.trim())); |
if (sqlRowAccessor == null) { |
sqlRowAccessor = cloneFromArticle(mapArticle.get(code), null, mapTaille.get(taille.trim())); |
mapDeclArticle.put(Tuple3.create(code, null, taille.trim()), sqlRowAccessor); |
} |
} else if (taille == null || taille.trim().length() == 0) { |
sqlRowAccessor = mapDeclArticle.get(Tuple3.create(code, couleur.trim(), null)); |
if (sqlRowAccessor == null) { |
sqlRowAccessor = cloneFromArticle(mapArticle.get(code), mapCouleur.get(couleur.trim()), null); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), null), sqlRowAccessor); |
} |
} else { |
sqlRowAccessor = mapDeclArticle.get(Tuple3.create(code, couleur.trim(), taille.trim())); |
if (sqlRowAccessor == null) { |
if (mapArticle.get(code) != null) { |
sqlRowAccessor = cloneFromArticle(mapArticle.get(code), |
mapCouleur.get(couleur.trim()), mapTaille.get(taille.trim())); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), taille.trim()), sqlRowAccessor); |
} |
} |
} |
return sqlRowAccessor; |
} |
public SQLRow cloneFromArticle(SQLRowAccessor rArt, Integer idCouleur, Integer idTaille) throws SQLException { |
if (rArt == null) { |
return null; |
} |
SQLRowValues copy = artElt.createCopy(rArt.getID()); |
if (idCouleur != null) { |
copy.put("ID_ARTICLE_DECLINAISON_COULEUR", idCouleur); |
} |
if (idTaille != null) { |
copy.put("ID_ARTICLE_DECLINAISON_TAILLE", idTaille); |
} |
return copy.commit(); |
} |
private String getColumnName(int columnNumber) { |
int dividend = columnNumber; |
String columnName = ""; |
int modulo; |
while (dividend >= 0) { |
modulo = dividend % 26; |
columnName = String.valueOf((char) (65 + modulo)) + columnName; |
dividend = (int) ((dividend - modulo) / 26); |
if (dividend <= 0) { |
break; |
} else { |
dividend--; |
} |
} |
return columnName; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/EtatStockSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
32,6 → 32,7 |
import java.awt.event.ActionEvent; |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.Date; |
import java.util.List; |
49,8 → 50,8 |
@Override |
public void actionPerformed(ActionEvent e) { |
EtatStockSnapshotCreator creator = new EtatStockSnapshotCreator(getTable().getTable("DEPOT_STOCK").getRow(DepotStockSQLElement.DEFAULT_ID), new Date(), getTable().getDBRoot()); |
creator.create(); |
PanelFrame frame = new PanelFrame(new EtatStockCreationPanel(getDirectory().getElement(DepotStockSQLElement.class)), "Création état de stock"); |
FrameUtil.showPacked(frame); |
} |
}, true); |
action.setPredicate(IListeEvent.createSelectionCountPredicate(0, Integer.MAX_VALUE)); |
79,7 → 80,7 |
EtatStockInventaireXmlSheet sheet = new EtatStockInventaireXmlSheet(IListe.get(e).getSelectedRow().asRow()); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, false, false, false); |
sheet.showPrintAndExport(true, false, false, false, false, Collections.emptyList()); |
} catch (Exception e1) { |
ExceptionHandler.handle("Erreur lors de la création de l'inventaire", e1); |
} |
97,7 → 98,7 |
FrameUtil.showPacked(frame); |
} |
}, true); |
action.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
action.setPredicate(IListeEvent.createSelectionCountPredicate(0, Integer.MAX_VALUE)); |
getRowActions().add(action); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/InventaireFromEtatStockImporter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,16 → 18,22 |
import org.openconcerto.erp.core.sales.product.model.ProductHelper.SupplierPriceField; |
import org.openconcerto.erp.importer.ArrayTableModel; |
import org.openconcerto.erp.importer.DataImporter; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowListRSH; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesCluster.StoreMode; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.utils.SQLUtils; |
import org.openconcerto.utils.Tuple2; |
import org.openconcerto.utils.Tuple3; |
import java.io.File; |
import java.io.IOException; |
34,6 → 40,7 |
import java.math.BigDecimal; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Calendar; |
import java.util.Collection; |
import java.util.Date; |
40,8 → 47,11 |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
import java.util.Map.Entry; |
import java.util.Set; |
import javax.swing.JOptionPane; |
import org.apache.commons.dbutils.ResultSetHandler; |
public class InventaireFromEtatStockImporter { |
49,18 → 59,107 |
private Map<String, SQLRowValues> kits = new HashMap<String, SQLRowValues>(); |
private List<String> codeKits = new ArrayList<String>(); |
private SQLRowAccessor depot; |
private static String FAMILLE = "Famille"; |
private static String CODE = "Code"; |
private static String NOM = "Nom"; |
private static String TAILLE = "Taille"; |
private static String COULEUR = "Couleur"; |
private static String QTE = "Qté réelle relevée"; |
private static String QTE_OPENCONCERTO = "QTE OpenConcerto"; |
private final Map<String, Integer> mapCouleur = new HashMap<String, Integer>(); |
private final Map<String, Integer> mapTaille = new HashMap<String, Integer>(); |
private final DBRoot root; |
private final SQLElement artElt; |
public InventaireFromEtatStockImporter(SQLRowAccessor depot) { |
public InventaireFromEtatStockImporter(SQLElement articleElt, SQLRowAccessor depot) { |
this.depot = depot; |
this.root = articleElt.getTable().getDBRoot(); |
this.artElt = articleElt; |
{ |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(articleElt.getTable().getTable("ARTICLE_DECLINAISON_COULEUR").getKey()); |
sel.addSelect(articleElt.getTable().getTable("ARTICLE_DECLINAISON_COULEUR").getField("NOM")); |
List<SQLRow> l = SQLRowListRSH.execute(sel); |
for (SQLRow sqlRow : l) { |
mapCouleur.put(sqlRow.getString("NOM").trim(), sqlRow.getID()); |
} |
} |
{ |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(articleElt.getTable().getTable("ARTICLE_DECLINAISON_TAILLE").getKey()); |
sel.addSelect(articleElt.getTable().getTable("ARTICLE_DECLINAISON_TAILLE").getField("NOM")); |
List<SQLRow> l = SQLRowListRSH.execute(sel); |
for (SQLRow sqlRow : l) { |
mapTaille.put(sqlRow.getString("NOM").trim(), sqlRow.getID()); |
} |
} |
} |
public void importArticles(File file, DBRoot root) throws IOException, SQLException { |
final SQLTable table = root.findTable("ARTICLE"); |
final SQLTable tableArtElt = root.findTable("ARTICLE_ELEMENT"); |
Map<String, Tuple2<SQLRowValues, SQLRowValues>> articles = getArticles(); |
// Récupération des couples articles/stocks existant |
fillArticles(); |
// 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) { |
90,15 → 189,27 |
List<Object> o = m.getLineValuesAt(i); |
if (o.size() >= 5) { |
System.err.println(o); |
String code = o.get(1).toString(); |
String code = o.get(columnMapping.get(CODE)).toString(); |
if (code.trim().length() > 0) { |
final String stringQty = o.get(4).toString(); |
final String stringQty = o.get(columnMapping.get(QTE)).toString(); |
Double qty = stringQty.trim().length() == 0 ? 0 : Double.valueOf(stringQty); |
final String stringQtyOld = o.get(3).toString(); |
final String stringQtyOld = o.get(columnMapping.get(QTE_OPENCONCERTO)).toString(); |
float qtyOld = stringQtyOld.trim().length() == 0 ? 0 : Float.valueOf(stringQtyOld); |
Tuple2<SQLRowValues, SQLRowValues> match = articles.get(code); |
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); |
if (match != null) { |
SQLRowAccessor stockValues = match.get1(); |
174,11 → 285,12 |
for (String code : codeKits) { |
System.err.println(code); |
SQLRowValues rowValsKit = kits.get(code); |
StockItem item = new StockItem(rowValsKit, rowValsKit.getForeign("ID_STOCK")); |
StockItem item = new StockItem(rowValsKit, ProductComponent.findOrCreateStock(rowValsKit, depot)); |
Collection<SQLRowValues> elts = rowValsKit.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT")); |
for (SQLRowValues sqlRowValues : elts) { |
if (sqlRowValues.getForeign("ID_ARTICLE") != null) { |
item.addItemComponent(new StockItemComponent(new StockItem(sqlRowValues.getForeign("ID_ARTICLE"), sqlRowValues.getForeign("ID_ARTICLE").getForeign("ID_STOCK")), |
item.addItemComponent( |
new StockItemComponent(new StockItem(sqlRowValues.getForeign("ID_ARTICLE"), ProductComponent.findOrCreateStock(sqlRowValues.getForeign("ID_ARTICLE"), depot)), |
sqlRowValues.getBigDecimal("QTE_UNITAIRE"), sqlRowValues.getInt("QTE"))); |
} |
} |
231,8 → 343,8 |
// checkMinPrice(rowVals, mapLastValidRows.get(qte)); |
// } |
// } |
} |
} |
private void checkMinPrice(SQLRow rowValsSuplierLastValid, SQLRow lastValidRow) { |
boolean update = false; |
309,18 → 421,29 |
// return result; |
} |
private Map<String, Tuple2<SQLRowValues, SQLRowValues>> getArticles() throws SQLException { |
private final Map<String, Tuple2<SQLRowValues, SQLRowValues>> mapArticle = new HashMap<String, Tuple2<SQLRowValues, SQLRowValues>>(); |
private final Map<String, Tuple2<SQLRowValues, SQLRowValues>> mapArticleVirtuel = new HashMap<String, Tuple2<SQLRowValues, SQLRowValues>>(); |
private final Map<Tuple3<String, String, String>, Tuple2<SQLRowValues, SQLRowValues>> mapDeclArticle = new HashMap<Tuple3<String, String, String>, Tuple2<SQLRowValues, SQLRowValues>>(); |
private void fillArticles() throws SQLException { |
final SQLTable table = Configuration.getInstance().getRoot().findTable("ARTICLE"); |
SQLRowValues graph = new SQLRowValues(table); |
graph.put("ID", null); |
graph.put("CODE", null); |
graph.put("NOM", null); |
graph.put("NOM", null); |
graph.put("VIRTUEL", null); |
graph.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("ID", "NOM"); |
graph.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("ID", "NOM"); |
final SQLTable foreignTableStock = table.getForeignTable("ID_STOCK"); |
SQLRowValues graphStock = new SQLRowValues(foreignTableStock); |
graphStock.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
graphStock.put("ID_ARTICLE", graph); |
SQLRowValues graphStockArt = new SQLRowValues(foreignTableStock); |
graphStockArt.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
graph.put("ID_STOCK", graphStockArt); |
final SQLTable tableArtElt = table.getTable("ARTICLE_ELEMENT"); |
SQLRowValues artElt = new SQLRowValues(tableArtElt); |
artElt.put("ID", null); |
328,11 → 451,17 |
artElt.put("QTE_UNITAIRE", null); |
artElt.put("ID_ARTICLE_PARENT", graph); |
final SQLRowValues articleParent = artElt.putRowValues("ID_ARTICLE"); |
articleParent.putNulls("ID", "CODE", "NOM"); |
articleParent.putNulls("ID", "CODE", "NOM", "VIRTUEL"); |
articleParent.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("ID", "NOM"); |
articleParent.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("ID", "NOM"); |
SQLRowValues graphStockItem = new SQLRowValues(foreignTableStock); |
graphStockItem.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
graphStockItem.put("ID_ARTICLE", articleParent); |
SQLRowValues graphStockArtItem = new SQLRowValues(foreignTableStock); |
graphStockArtItem.putNulls("ID_DEPOT_STOCK", "ID", "QTE_REEL", "QTE_TH", "QTE_LIV_ATTENTE", "QTE_RECEPT_ATTENTE"); |
articleParent.put("ID_STOCK", graphStockArtItem); |
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(graph); |
List<SQLRowValues> results = fetcher.fetch(); |
342,7 → 471,6 |
c.set(Calendar.DAY_OF_MONTH, 31); |
Date dEndYear = c.getTime(); |
Map<String, Tuple2<SQLRowValues, SQLRowValues>> vals = new HashMap<String, Tuple2<SQLRowValues, SQLRowValues>>(); |
for (SQLRowValues sqlRowValues : results) { |
final String code = sqlRowValues.getString("CODE"); |
354,11 → 482,25 |
rowValsStock = sqlRowValues2; |
} |
} |
if (rowValsStock == null) { |
rowValsStock = ProductComponent.findOrCreateStock(sqlRowValues, depot).asRowValues(); |
// if (rowValsStock == null) { |
// rowValsStock = ProductComponent.findOrCreateStock(sqlRowValues, depot).asRowValues(); |
// } |
if (sqlRowValues.getBoolean("VIRTUEL")) { |
mapArticleVirtuel.put(sqlRowValues.getString("CODE"), Tuple2.create(sqlRowValues, rowValsStock)); |
} |
vals.put(code, Tuple2.create(sqlRowValues, rowValsStock)); |
final SQLRowAccessor couleur = sqlRowValues.getObject("ID_ARTICLE_DECLINAISON_COULEUR") == null ? null : sqlRowValues.getNonEmptyForeign("ID_ARTICLE_DECLINAISON_COULEUR"); |
final SQLRowAccessor taille = sqlRowValues.getObject("ID_ARTICLE_DECLINAISON_TAILLE") == null ? null : sqlRowValues.getNonEmptyForeign("ID_ARTICLE_DECLINAISON_TAILLE"); |
if (couleur == null && taille == null) { |
mapArticle.put(sqlRowValues.getString("CODE"), Tuple2.create(sqlRowValues, rowValsStock)); |
} else if (couleur == null) { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), null, taille.getString("NOM")), Tuple2.create(sqlRowValues, rowValsStock)); |
} else if (taille == null) { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), couleur.getString("NOM"), null), Tuple2.create(sqlRowValues, rowValsStock)); |
} else { |
mapDeclArticle.put(Tuple3.create(sqlRowValues.getString("CODE"), couleur.getString("NOM"), taille.getString("NOM")), Tuple2.create(sqlRowValues, rowValsStock)); |
} |
final Set<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableArtElt.getField("ID_ARTICLE_PARENT")); |
if (referentRows.size() == 0) { |
403,6 → 545,99 |
// } |
} |
} |
return vals; |
} |
private Tuple2<SQLRowValues, SQLRowValues> findArticle(String code, String couleur, String taille) throws SQLException { |
if (!mapCouleur.containsKey(couleur)) { |
SQLRowValues rowVals = new SQLRowValues(root.getTable("ARTICLE_DECLINAISON_COULEUR")); |
rowVals.put("NOM", couleur); |
mapCouleur.put(couleur, rowVals.commit().getID()); |
} |
if (!mapTaille.containsKey(taille)) { |
SQLRowValues rowVals = new SQLRowValues(root.getTable("ARTICLE_DECLINAISON_TAILLE")); |
rowVals.put("NOM", taille); |
mapTaille.put(taille, rowVals.commit().getID()); |
} |
Tuple2<SQLRowValues, SQLRowValues> t; |
if ((couleur == null || couleur.trim().length() == 0) && (taille == null || taille.trim().length() == 0)) { |
t = mapArticle.get(code); |
if (t.get1() == null) { |
t = Tuple2.create(t.get0(), ProductComponent.findOrCreateStock(t.get0(), depot).asRowValues()); |
mapArticle.put(code, t); |
} |
} else if (couleur == null || couleur.trim().length() == 0) { |
t = mapDeclArticle.get(Tuple3.create(code, null, taille.trim())); |
if (t == null) { |
SQLRowValues artRow = cloneFromArticle(mapArticleVirtuel.get(code).get0(), null, mapTaille.get(taille.trim())).asRowValues(); |
final SQLRowValues stockRow = ProductComponent.findOrCreateStock(artRow, depot).asRowValues(); |
t = Tuple2.create(artRow, stockRow); |
mapDeclArticle.put(Tuple3.create(code, null, taille.trim()), t); |
} else if (t.get1() == null) { |
t = Tuple2.create(t.get0(), ProductComponent.findOrCreateStock(t.get0(), depot).asRowValues()); |
mapDeclArticle.put(Tuple3.create(code, null, taille.trim()), t); |
} |
} else if (taille == null || taille.trim().length() == 0) { |
t = mapDeclArticle.get(Tuple3.create(code, couleur.trim(), null)); |
if (t == null) { |
SQLRowValues artRow = cloneFromArticle(mapArticleVirtuel.get(code).get0(), mapCouleur.get(couleur.trim()), null).asRowValues(); |
final SQLRowValues stockRow = ProductComponent.findOrCreateStock(artRow, depot).asRowValues(); |
t = Tuple2.create(artRow, stockRow); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), null), t); |
} else if (t.get1() == null) { |
t = Tuple2.create(t.get0(), ProductComponent.findOrCreateStock(t.get0(), depot).asRowValues()); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), null), t); |
} |
} else { |
t = mapDeclArticle.get(Tuple3.create(code, couleur.trim(), taille.trim())); |
if (t == null) { |
if (mapArticle.get(code) != null) { |
SQLRowValues artRow = cloneFromArticle(mapArticleVirtuel.get(code).get0(), mapCouleur.get(couleur.trim()), mapTaille.get(taille.trim())).asRowValues(); |
final SQLRowValues stockRow = ProductComponent.findOrCreateStock(artRow, depot).asRowValues(); |
t = Tuple2.create(artRow, stockRow); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), taille.trim()), t); |
} |
} else if (t.get1() == null) { |
t = Tuple2.create(t.get0(), ProductComponent.findOrCreateStock(t.get0(), depot).asRowValues()); |
mapDeclArticle.put(Tuple3.create(code, couleur.trim(), taille.trim()), t); |
} |
} |
return t; |
} |
public SQLRow cloneFromArticle(SQLRowAccessor rArt, Integer idCouleur, Integer idTaille) throws SQLException { |
if (rArt == null) { |
return null; |
} |
SQLRowValues copy = artElt.createCopy(rArt.getID()); |
copy.put("VIRTUEL", Boolean.FALSE); |
copy.put("ID_ARTICLE_VIRTUEL_PERE", rArt.getID()); |
if (idCouleur != null) { |
copy.put("ID_ARTICLE_DECLINAISON_COULEUR", idCouleur); |
} |
if (idTaille != null) { |
copy.put("ID_ARTICLE_DECLINAISON_TAILLE", idTaille); |
} |
return copy.commit(); |
} |
private String getColumnName(int columnNumber) { |
int dividend = columnNumber; |
String columnName = ""; |
int modulo; |
while (dividend >= 0) { |
modulo = dividend % 26; |
columnName = String.valueOf((char) (65 + modulo)) + columnName; |
dividend = (int) ((dividend - modulo) / 26); |
if (dividend <= 0) { |
break; |
} else { |
dividend--; |
} |
} |
return columnName; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/EtatStockSnapshotCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
38,11 → 38,13 |
private final Date d; |
private final DBRoot root; |
private final SQLRowAccessor depot; |
private final boolean withAllProducts; |
public EtatStockSnapshotCreator(SQLRowAccessor depot, Date d, DBRoot root) { |
public EtatStockSnapshotCreator(SQLRowAccessor depot, Date d, DBRoot root, boolean withAllProducts) { |
this.d = d; |
this.depot = depot; |
this.root = root; |
this.withAllProducts = withAllProducts; |
} |
public void create() { |
73,12 → 75,12 |
Map<Integer, EtatStock> mapStockSnap = new HashMap<Integer, EtatStock>(); |
{ |
final SQLTable tableStock = this.root.getTable("MOUVEMENT_STOCK"); |
final SQLTable tableMvtStock = this.root.getTable("MOUVEMENT_STOCK"); |
final SQLRowValues vals = new SQLRowValues(tableStock); |
final SQLRowValues vals = new SQLRowValues(tableMvtStock); |
vals.put("QTE", null); |
if (tableStock.contains("PRICE")) { |
if (tableMvtStock.contains("PRICE")) { |
vals.put("PRICE", null); |
} |
vals.put("ID_ARTICLE", null); |
121,15 → 123,15 |
@Override |
public SQLSelect transformChecked(SQLSelect sel) { |
Where w = (new Where(tableStock.getField("DATE"), "<=", d)); |
Where w = (new Where(tableMvtStock.getField("DATE"), "<=", d)); |
if (dateDeb != null) { |
w = w.and(new Where(tableStock.getField("DATE"), ">=", dateDeb)); |
w = w.and(new Where(tableStock.getKey(), ">=", idMvtStockDeb)); |
w = w.and(new Where(tableStock.getField("CLOTURE"), "!=", Boolean.TRUE)); |
w = w.and(new Where(tableMvtStock.getField("DATE"), ">=", dateDeb)); |
w = w.and(new Where(tableMvtStock.getKey(), ">=", idMvtStockDeb)); |
w = w.and(new Where(tableMvtStock.getField("CLOTURE"), "!=", Boolean.TRUE)); |
} |
w = w.and(new Where(tableStock.getField("REEL"), "=", Boolean.TRUE)); |
w = w.and(new Where(sel.getJoin(tableStock.getField("ID_STOCK")).getJoinedTable().getField("ID_DEPOT_STOCK"), "=", depot.getID())); |
w = w.and(new Where(tableMvtStock.getField("REEL"), "=", Boolean.TRUE)); |
w = w.and(new Where(sel.getJoin(tableMvtStock.getField("ID_STOCK")).getJoinedTable().getField("ID_DEPOT_STOCK"), "=", depot.getID())); |
sel.setWhere(w); |
return sel; |
149,7 → 151,7 |
EtatStock et = mapStockSnap.get(foreignIDArt); |
et.setQte(et.getQte().add(new BigDecimal(rowVF.getFloat("QTE")))); |
BigDecimal bigDecimal = BigDecimal.ZERO; |
if (tableStock.contains("PRICE")) { |
if (tableMvtStock.contains("PRICE")) { |
bigDecimal = rowVF.getBigDecimal("PRICE"); |
} |
et.setPa(bigDecimal); |
157,6 → 159,58 |
} |
} |
// Ajout des articles sans mouvement de stock sur la période |
final SQLTable tableStock = tableMvtStock.getTable("STOCK"); |
final SQLRowValues valsStock = new SQLRowValues(tableStock); |
valsStock.putRowValues("ID_ARTICLE").putNulls("CODE", "NOM", "OBSOLETE"); |
valsStock.putNulls("QTE_REEL").putRowValues("ID_DEPOT_STOCK").putNulls("ID", "NOM", "CODE"); |
SQLRowValuesListFetcher fetcherStock = SQLRowValuesListFetcher.create(valsStock); |
SQLTable tableArt = tableStock.getForeignTable("ID_ARTICLE"); |
fetcherStock.addSelTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
Where w = new Where(tableStock.getField("ID_DEPOT_STOCK"), "=", depot.getID()); |
w = w.and(new Where(input.getAlias(tableArt).getField("OBSOLETE"), "=", Boolean.FALSE)); |
input.setWhere(w); |
System.err.println(input.asString()); |
return input; |
} |
}, 0); |
List<SQLRowValues> resultAllStock = fetcherStock.fetch(); |
for (SQLRowValues sqlRowValues : resultAllStock) { |
final int foreignIDArt = sqlRowValues.getForeignID("ID_ARTICLE"); |
if (!mapStockSnap.containsKey(foreignIDArt)) { |
mapStockSnap.put(foreignIDArt, new EtatStock(sqlRowValues.getForeign("ID_ARTICLE"))); |
} |
} |
if (this.withAllProducts) { |
// Ajout de tous les articles non obsoletes |
final SQLRowValues valsArt = new SQLRowValues(tableArt); |
valsArt.putNulls("CODE", "NOM", "OBSOLETE"); |
SQLRowValuesListFetcher fetcherArt = SQLRowValuesListFetcher.create(valsArt); |
fetcherArt.addSelTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
Where w = new Where(tableArt.getField("VIRTUEL"), "=", Boolean.FALSE); |
w = w.and(new Where(tableArt.getField("OBSOLETE"), "=", Boolean.FALSE)); |
input.setWhere(w); |
System.err.println(input.asString()); |
return input; |
} |
}, 0); |
List<SQLRowValues> resultArt = fetcherArt.fetch(); |
for (SQLRowValues sqlRowValues : resultArt) { |
final int idArt = sqlRowValues.getID(); |
if (!mapStockSnap.containsKey(idArt)) { |
mapStockSnap.put(idArt, new EtatStock(sqlRowValues)); |
} |
} |
} |
SQLRowValues rowVals = new SQLRowValues(tableEtatStock); |
rowVals.put("DATE", d); |
rowVals.put("MONTANT_HA", totalHT); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/EtatStockCreationPanel.java |
---|
New file |
0,0 → 1,87 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
/* |
* Créé le 23 avr. 2012 |
*/ |
package org.openconcerto.erp.core.supplychain.stock.element; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.sqlobject.SQLRequestComboBox; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.JDate; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.util.Date; |
import javax.swing.AbstractAction; |
import javax.swing.JButton; |
import javax.swing.JCheckBox; |
import javax.swing.JLabel; |
import javax.swing.JPanel; |
public class EtatStockCreationPanel extends JPanel { |
public EtatStockCreationPanel(final SQLElement depotElt) { |
super(new GridBagLayout()); |
final SQLRequestComboBox boxDepot = new SQLRequestComboBox(false); |
boxDepot.uiInit(depotElt.createComboRequest()); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
JLabel labelCom = new JLabel("Dépôt "); |
this.add(labelCom, c); |
c.gridx++; |
this.add(boxDepot, c); |
c.gridx++; |
JLabel labelD = new JLabel("au"); |
this.add(labelD, c); |
final JDate dateDebut = new JDate(true); |
c.gridx++; |
this.add(dateDebut, c); |
final JCheckBox box = new JCheckBox("intégrer uniquement les articles du dépôt"); |
box.setSelected(true); |
c.gridx++; |
this.add(box, c); |
final JButton buttonValid = new JButton(new AbstractAction("Valider") { |
@Override |
public void actionPerformed(ActionEvent e) { |
SQLRowAccessor row = boxDepot.getSelectedRow(); |
final SQLRowAccessor rowDepot; |
if (row != null && !row.isUndefined()) { |
rowDepot = boxDepot.getSelectedRow(); |
} else { |
rowDepot = depotElt.getTable().getRow(DepotStockSQLElement.DEFAULT_ID); |
} |
Date d = dateDebut.getDate() == null ? new Date() : dateDebut.getDate(); |
EtatStockSnapshotCreator creator = new EtatStockSnapshotCreator(rowDepot, d, depotElt.getTable().getDBRoot(), !box.isSelected()); |
creator.create(); |
} |
}); |
c.gridx++; |
// buttonValid.setEnabled(false); |
this.add(buttonValid, c); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/StockSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,6 → 13,7 |
package org.openconcerto.erp.core.supplychain.stock.element; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.ui.PanelFrame; |
import org.openconcerto.erp.core.sales.product.action.InventairePanel; |
20,24 → 21,30 |
import org.openconcerto.erp.model.MouseSheetXmlListeListener; |
import org.openconcerto.sql.element.BaseSQLComponent; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLInjector; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.users.rights.UserRightsManager; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.FrameUtil; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ListMap; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.math.BigDecimal; |
import java.sql.SQLException; |
import java.util.Arrays; |
import java.util.Collection; |
47,6 → 54,7 |
import javax.swing.AbstractAction; |
import javax.swing.JLabel; |
import javax.swing.JOptionPane; |
import javax.swing.JTextField; |
public class StockSQLElement extends ComptaSQLConfElement { |
53,20 → 61,34 |
public StockSQLElement() { |
super("STOCK", "un stock", "stocks"); |
getRowActions().addAll(new MouseSheetXmlListeListener(FicheArticleXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, FicheArticleXmlSheet.class).getRowActions()); |
PredicateRowAction stock = new PredicateRowAction(new AbstractAction("Mettre à jour les stocks") { |
@Override |
public void actionPerformed(ActionEvent e) { |
PanelFrame p = new PanelFrame(new InventairePanel(IListe.get(e), IListe.get(e).getSelectedRows()), "Mise à jour des stocks"); |
if (UserRightsManager.getCurrentUserRights().canAdd(getTable().getDBRoot().getTable("STOCK"))) { |
final PanelFrame p = new PanelFrame(new InventairePanel(IListe.get(e), IListe.get(e).getSelectedRows()), "Mise à jour des stocks"); |
FrameUtil.show(p); |
} else { |
JOptionPane.showMessageDialog(null, "Vous n'avez les droits suffisants pour modifier manuellement les stocks!"); |
} |
} |
}, true, false); |
stock.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(stock); |
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"); |
128,7 → 150,7 |
return rowStock; |
} |
public static SQLRowAccessor getStock(SQLRowAccessor rowValsSource) { |
public static SQLRowAccessor getStock(SQLRowAccessor rowValsSource) throws SQLException { |
SQLRowAccessor rowStock = null; |
final int idDepot; |
144,30 → 166,32 |
} |
idDepot = rowValsArt.getForeignID("ID_DEPOT_STOCK"); |
} |
SQLTable stockTable = rowValsSource.getTable().getTable("STOCK"); |
final int idArticle = rowValsSource.getForeignID("ID_ARTICLE"); |
DBRoot root = rowValsSource.getTable().getDBRoot(); |
SQLTable stockTable = root.getTable("STOCK"); |
SQLRowValues putRowValuesStock = new SQLRowValues(stockTable); |
putRowValuesStock.putNulls(stockTable.getTable().getFieldsName()); |
SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(putRowValuesStock); |
Where w = new Where(putRowValuesStock.getTable().getField("ID_DEPOT_STOCK"), "=", idDepot); |
Where w2 = new Where(putRowValuesStock.getTable().getField("ID_ARTICLE"), "=", rowValsSource.getForeignID("ID_ARTICLE")); |
Where w = new Where(stockTable.getField("ID_DEPOT_STOCK"), "=", idDepot); |
Where w2 = new Where(stockTable.getField("ID_ARTICLE"), "=", idArticle); |
Collection<SQLRowValues> rowValsResult = fetch.fetch(w.and(w2)); |
if (rowValsResult.isEmpty()) { |
SQLRowValues rowValsStock = new SQLRowValues(stockTable); |
rowValsStock.put("ID_ARTICLE", rowValsSource.getForeignID("ID_ARTICLE")); |
rowValsStock.put("ID_ARTICLE", idArticle); |
rowValsStock.put("ID_DEPOT_STOCK", idDepot); |
rowValsStock.put("QTE_TH", 0F); |
rowValsStock.put("QTE_REEL", 0F); |
rowValsStock.put("QTE_RECEPT_ATTENTE", 0F); |
rowValsStock.put("QTE_LIV_ATTENTE", 0F); |
try { |
rowStock = rowValsStock.insert(); |
if (idDepot == DepotStockSQLElement.DEFAULT_ID) { |
rowValsSource.getForeign("ID_ARTICLE").createEmptyUpdateRow().put("ID_STOCK", rowStock.getID()).commit(); |
} |
} catch (SQLException e) { |
ExceptionHandler.handle("Erreur lors la création du stock!", e); |
} |
} else if (rowValsResult.size() == 1) { |
rowStock = rowValsResult.iterator().next(); |
} else if (rowValsResult.size() > 1) { |
176,6 → 200,44 |
return rowStock; |
} |
/** |
* Stock d'un article dans un dépôt donné |
* |
* @param idDepot dépôt |
* @param idArticle article |
* @param createIfMissing initialisation du stock à 0 si n'existe pas |
* @return le stock (null si createIfMissing à false et que que le stock n'existe pas) |
*/ |
public SQLRow getStock(int idDepot, int idArticle, boolean createIfMissing) throws SQLException { |
final SQLTable stockTable = getTable(); |
final SQLRowValues putRowValuesStock = new SQLRowValues(stockTable); |
putRowValuesStock.putNulls(stockTable.getFieldsName()); |
final SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(putRowValuesStock); |
final Where w = new Where(stockTable.getField("ID_DEPOT_STOCK"), "=", idDepot); |
final Where w2 = new Where(stockTable.getField("ID_ARTICLE"), "=", idArticle); |
final Collection<SQLRowValues> rowValsResult = fetch.fetch(w.and(w2)); |
SQLRow result; |
if (rowValsResult.isEmpty()) { |
if (!createIfMissing) { |
return null; |
} |
final SQLRowValues rowValsStock = new SQLRowValues(stockTable); |
rowValsStock.put("ID_ARTICLE", idArticle); |
rowValsStock.put("ID_DEPOT_STOCK", idDepot); |
rowValsStock.put("QTE_TH", 0F); |
rowValsStock.put("QTE_REEL", 0F); |
rowValsStock.put("QTE_RECEPT_ATTENTE", 0F); |
rowValsStock.put("QTE_LIV_ATTENTE", 0F); |
result = rowValsStock.insert(); |
} else if (rowValsResult.size() == 1) { |
result = rowValsResult.iterator().next().asRow(); |
} else { |
throw new IllegalStateException("2 lignes de stocks pour le même dépôt! Article " + idArticle + " Depot " + idDepot); |
} |
return result; |
} |
/* |
* (non-Javadoc) |
* |
271,7 → 333,63 |
}; |
} |
/** |
* Transfert d'une commande en commande fournisseur |
* |
* @param commandeID |
*/ |
public void transfertCommande(List<SQLRowAccessor> rows) { |
ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() { |
@Override |
public void run() { |
SQLTable tableCmdElt = getDirectory().getElement("COMMANDE_ELEMENT").getTable(); |
SQLElement eltArticle = getDirectory().getElement("ARTICLE"); |
final ListMap<SQLRow, SQLRowValues> map = new ListMap<SQLRow, SQLRowValues>(); |
for (SQLRowAccessor sqlRow : rows) { |
SQLRowAccessor rowArticleFind = sqlRow.getForeign("ID_ARTICLE"); |
int qte = 1; |
BigDecimal qteUV = BigDecimal.ONE; |
qte = -Math.round(sqlRow.getFloat("QTE_TH") - sqlRow.getFloat("QTE_MIN")); |
SQLInjector inj = SQLInjector.getInjector(eltArticle.getTable(), tableCmdElt); |
SQLRowValues rowValsElt = new SQLRowValues(inj.createRowValuesFrom(rowArticleFind.asRow())); |
rowValsElt.put("ID_DEPOT_STOCK", sqlRow.getForeignID("ID_DEPOT_STOCK")); |
rowValsElt.put("QTE", qte); |
rowValsElt.put("QTE_UNITAIRE", qteUV); |
rowValsElt.put("T_POIDS", rowValsElt.getLong("POIDS") * rowValsElt.getInt("QTE")); |
// TODO récupérer le prix depuis les tarifs d'achat |
rowValsElt.put("T_PA_HT", ((BigDecimal) rowValsElt.getObject("PA_HT")).multiply(new BigDecimal(rowValsElt.getInt("QTE")), DecimalUtils.HIGH_PRECISION)); |
rowValsElt.put("T_PA_TTC", |
((BigDecimal) rowValsElt.getObject("T_PA_HT")).multiply(new BigDecimal((rowValsElt.getForeign("ID_TAXE").getFloat("TAUX") / 100.0 + 1.0)), DecimalUtils.HIGH_PRECISION)); |
final SQLRow fournisseur = rowArticleFind.asRow().getForeignRow("ID_FOURNISSEUR"); |
if (fournisseur != null && !fournisseur.isUndefined() && !rowArticleFind.isUndefined()) { |
SQLRowValues rowValsCode = new SQLRowValues(tableCmdElt.getForeignTable("ID_CODE_FOURNISSEUR")); |
rowValsCode.putNulls("ID"); |
final Where w = new Where(rowValsCode.getTable().getField("ID_ARTICLE"), "=", rowArticleFind.getID()) |
.and(new Where(rowValsCode.getTable().getField("ID_FOURNISSEUR"), "=", fournisseur.getID())); |
final List<SQLRowValues> fetch = SQLRowValuesListFetcher.create(rowValsCode).fetch(w); |
for (SQLRowValues sqlRowAccessor : fetch) { |
rowValsElt.put("ID_CODE_FOURNISSEUR", sqlRowAccessor.getID()); |
} |
} |
map.add(fournisseur, rowValsElt); |
} |
MouvementStockSQLElement.createCommandeF(map, null, ""); |
} |
}); |
} |
@Override |
protected String createCode() { |
return "supplychain.stock"; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/MouvementStockSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,8 → 17,10 |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.model.ProductComponent; |
import org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent; |
import org.openconcerto.erp.core.supplychain.order.ui.CommandeItemTable; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItem.TypeStockMouvement; |
import org.openconcerto.erp.core.supplychain.supplier.component.MouvementStockSQLComponent; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
26,10 → 28,14 |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.element.TreesOfSQLRows; |
import org.openconcerto.sql.model.ConnectionHandlerNoSetup; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLBackgroundTableCache; |
import org.openconcerto.sql.model.SQLBase; |
import org.openconcerto.sql.model.SQLDataSource; |
import org.openconcerto.sql.model.SQLInjector; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowListRSH; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLSelect; |
38,17 → 44,22 |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.ListSQLRequest; |
import org.openconcerto.sql.users.UserManager; |
import org.openconcerto.sql.utils.SQLUtils; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.EditPanel; |
import org.openconcerto.sql.view.EditPanel.EditMode; |
import org.openconcerto.sql.view.list.RowValuesTableModel; |
import org.openconcerto.ui.FrameUtil; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.ListMap; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.sql.SQLException; |
import java.text.SimpleDateFormat; |
import java.util.ArrayList; |
import java.util.Collection; |
import java.util.Date; |
import java.util.List; |
import java.util.Map.Entry; |
55,6 → 66,8 |
import javax.swing.JOptionPane; |
import javax.swing.SwingUtilities; |
import org.apache.commons.dbutils.ResultSetHandler; |
public class MouvementStockSQLElement extends ComptaSQLConfElement { |
public MouvementStockSQLElement() { |
119,9 → 132,16 |
// QTE_RECEPT_ATTENTE |
final ListMap<SQLRow, SQLRowValues> map = new ListMap<>(); |
final SQLTable tableCommandeElement = Configuration.getInstance().getBase().getTable("COMMANDE_ELEMENT"); |
final SQLElement elementStock = Configuration.getInstance().getDirectory().getElement("STOCK"); |
if (rowsMvt == null || rowsMvt.isEmpty()) { |
return map; |
} |
final DBRoot root = rowsMvt.iterator().next().getTable().getDBRoot(); |
final SQLTable tableCommandeElement = root.getTable("COMMANDE_ELEMENT"); |
final SQLTable tableStock = root.getTable("STOCK"); |
for (SQLRow rowMvtStock : rowsMvt) { |
boolean retour = rowMvtStock.getString("SOURCE") == null || rowMvtStock.getString("SOURCE").startsWith("AVOIR_CLIENT"); |
138,7 → 158,7 |
float qte = rowStock.getFloat("QTE_REEL"); |
float qteMvt = rowMvtStock.getFloat("QTE"); |
SQLRowValues rowVals = new SQLRowValues(elementStock.getTable()); |
SQLRowValues rowVals = new SQLRowValues(tableStock); |
float qteNvlle; |
float qteNvlleEnAttenteRecept = rowStock.getFloat("QTE_RECEPT_ATTENTE"); |
173,7 → 193,7 |
try { |
rowVals.update(rowStock.getID()); |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
SQLPreferences prefs = new SQLPreferences(root); |
boolean gestionStockMin = prefs.getBoolean(GestionArticleGlobalPreferencePanel.WARNING_STOCK_MIN, true); |
if (!archive && gestionStockMin && rowStock.getObject("QTE_MIN") != null && qteNvlle < rowStock.getFloat("QTE_MIN")) { |
203,7 → 223,7 |
float qte = rowStock.getFloat("QTE_TH"); |
float qteMvt = rowMvtStock.getFloat("QTE"); |
SQLRowValues rowVals = new SQLRowValues(elementStock.getTable()); |
SQLRowValues rowVals = new SQLRowValues(tableStock); |
float qteNvlle; |
float qteNvlleEnAttenteRecept = rowStock.getFloat("QTE_RECEPT_ATTENTE"); |
321,6 → 341,9 |
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; |
327,6 → 350,7 |
break; |
} |
} |
} |
if (rowValsMatch != null) { |
int qte = rowValsMatch.getInt("QTE"); |
411,7 → 435,100 |
} |
} |
public void transfertStock(BigDecimal qteReel, final Date dateValue, final SQLRow selectedRowArticle, final SQLRow selectedRowDepotDepart, final SQLRow selectedRowDepotArrivee, |
final String labelTrStock) { |
final boolean usePrice = getTable().contains("PRICE"); |
try { |
SQLUtils.executeAtomic(selectedRowDepotDepart.getTable().getDBSystemRoot().getDataSource(), new ConnectionHandlerNoSetup<Object, SQLException>() { |
@Override |
public Object handle(SQLDataSource ds) throws SQLException { |
List<StockItem> stockItems = new ArrayList<StockItem>(); |
List<String> multipleRequestsHundred = new ArrayList<String>(100); |
{ |
// DEPART |
final SQLRowAccessor rowStockDepart = ProductComponent.findOrCreateStock(selectedRowArticle, selectedRowDepotDepart); |
StockItem item = new StockItem(selectedRowArticle, rowStockDepart); |
if (!item.isStockInit()) { |
SQLRowValues rowVals = new SQLRowValues(getTable().getTable("STOCK")); |
rowVals.put("ID_ARTICLE", selectedRowArticle.getID()); |
rowVals.put("ID_DEPOT_STOCK", selectedRowDepotDepart.getID()); |
rowVals.commit(); |
selectedRowArticle.fetchValues(); |
item = new StockItem(selectedRowArticle, rowStockDepart); |
} |
stockItems.add(item); |
double diff = -qteReel.doubleValue(); |
item.updateQty(diff, TypeStockMouvement.REEL); |
multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(labelTrStock, selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice)); |
item.updateQty(diff, TypeStockMouvement.THEORIQUE); |
multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(labelTrStock, selectedRowDepotDepart, selectedRowDepotArrivee), false, usePrice)); |
multipleRequestsHundred.add(item.getUpdateRequest()); |
} |
// ARRIVEE |
{ |
final SQLRowAccessor rowStockArrivee = ProductComponent.findOrCreateStock(selectedRowArticle, selectedRowDepotArrivee); |
StockItem item = new StockItem(selectedRowArticle, rowStockArrivee); |
if (!item.isStockInit()) { |
SQLRowValues rowVals = new SQLRowValues(getTable().getTable("STOCK")); |
rowVals.put("ID_ARTICLE", selectedRowArticle.getID()); |
rowVals.put("ID_DEPOT_STOCK", selectedRowDepotArrivee.getID()); |
rowVals.commit(); |
selectedRowArticle.fetchValues(); |
item = new StockItem(selectedRowArticle, rowStockArrivee); |
} |
stockItems.add(item); |
double diff = qteReel.doubleValue(); |
item.updateQty(diff, TypeStockMouvement.REEL); |
multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(labelTrStock, selectedRowDepotDepart, selectedRowDepotArrivee), true, usePrice)); |
item.updateQty(diff, TypeStockMouvement.THEORIQUE); |
multipleRequestsHundred.add(getMvtRequest(dateValue, BigDecimal.ZERO, diff, item, getLabel(labelTrStock, selectedRowDepotDepart, selectedRowDepotArrivee), false, usePrice)); |
multipleRequestsHundred.add(item.getUpdateRequest()); |
} |
final int size = multipleRequestsHundred.size(); |
List<? extends ResultSetHandler> handlers = new ArrayList<ResultSetHandler>(size); |
for (int i = 0; i < size; i++) { |
handlers.add(null); |
} |
SQLUtils.executeMultiple(selectedRowArticle.getTable().getDBSystemRoot(), multipleRequestsHundred, handlers); |
final DBRoot root = getTable().getDBRoot(); |
if (root.contains("ARTICLE_ELEMENT")) { |
// Mise à jour des stocks des nomenclatures |
ComposedItemStockUpdater comp = new ComposedItemStockUpdater(root, stockItems); |
comp.update(); |
} |
return null; |
} |
}); |
} catch (SQLException e1) { |
ExceptionHandler.handle("Stock update error", e1); |
} |
} |
private String getLabel(String label, SQLRowAccessor fromDepot, SQLRowAccessor toDepot) { |
return label + " de " + fromDepot.getString("NOM") + " vers " + toDepot.getString("NOM"); |
} |
private String getMvtRequest(Date time, BigDecimal prc, double qteFinal, StockItem item, String label, boolean reel, boolean usePrice) { |
String mvtStockTableQuoted = getTable().getSQLName().quote(); |
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
String mvtStockQuery = "INSERT INTO " + mvtStockTableQuoted + " (\"QTE\",\"DATE\",\"ID_ARTICLE\",\"ID_STOCK\",\"NOM\",\"REEL\",\"ORDRE\""; |
if (usePrice && prc != null) { |
mvtStockQuery += ",\"PRICE\""; |
} |
mvtStockQuery += ") VALUES(" + qteFinal + ",'" + dateFormat.format(time) + "'," + item.getArticle().getID() + "," + item.stock.getID() + ",'" + label + "'," + reel |
+ ", (SELECT (MAX(\"ORDRE\")+1) FROM " + mvtStockTableQuoted + ")"; |
if (usePrice && prc != null) { |
mvtStockQuery += "," + prc.setScale(6, RoundingMode.HALF_UP).toString(); |
} |
mvtStockQuery += ")"; |
return mvtStockQuery; |
} |
@Override |
protected String createCode() { |
return createCodeOfPackage() + ".transaction"; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/element/ImportInventairePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
92,7 → 92,8 |
@Override |
public void run() { |
final InventaireFromEtatStockImporter impoter = new InventaireFromEtatStockImporter(rowDepot); |
// FIXME ajouter une barre de progression |
final InventaireFromEtatStockImporter impoter = new InventaireFromEtatStockImporter(depotElt.getDirectory().getElement("ARTICLE"), rowDepot); |
try { |
SQLUtils.executeAtomic(depotElt.getTable().getDBSystemRoot().getDataSource(), new ConnectionHandlerNoSetup<Object, IOException>() { |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/action/ListeDesMouvementsStockAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,8 → 18,13 |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel; |
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.view.IListFrame; |
import org.openconcerto.sql.view.list.SQLTableModelSource; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.utils.cc.ITransformer; |
import java.awt.GridBagConstraints; |
import java.awt.event.ActionEvent; |
32,14 → 37,40 |
public class ListeDesMouvementsStockAction extends CreateIListFrameAbstractAction<MouvementStockSQLElement> { |
private final SQLRowAccessor rowArtFilter; |
public ListeDesMouvementsStockAction(final ComptaPropsConfiguration conf) { |
this(conf, null); |
} |
public ListeDesMouvementsStockAction(final ComptaPropsConfiguration conf, SQLRowAccessor rowArticleFilter) { |
super(conf, MouvementStockSQLElement.class); |
this.rowArtFilter = rowArticleFilter; |
} |
protected SQLTableModelSource createTableSource() { |
SQLTableModelSource source = this.getElem().createTableSource(); |
if (this.rowArtFilter != null && !this.rowArtFilter.isUndefined()) { |
source.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
input.setWhere(new Where(input.getTable("MOUVEMENT_STOCK").getField("ID_ARTICLE"), "=", ListeDesMouvementsStockAction.this.rowArtFilter.getID())); |
return input; |
} |
}); |
} |
return source; |
} |
@Override |
protected void initFrame(IListFrame frame) { |
super.initFrame(frame); |
if (this.rowArtFilter != null && !this.rowArtFilter.isUndefined()) { |
frame.setTextTitle("Mouvements de stocks, article " + this.rowArtFilter.getString("CODE") + " " + this.rowArtFilter.getString("NOM")); |
} |
final SQLElement element = getElem(); |
JTable table = frame.getPanel().getListe().getJTable(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/supplychain/stock/action/ListeDesStocksAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
16,8 → 16,7 |
import org.openconcerto.erp.action.CreateFrameAbstractAction; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.ui.IListTotalPanel; |
import org.openconcerto.erp.core.common.ui.ListeViewPanel; |
import org.openconcerto.erp.core.common.ui.PanelFrame; |
import org.openconcerto.erp.rights.DepotStockViewRightEditor; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.FieldPath; |
28,6 → 27,7 |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.model.graph.Path; |
import org.openconcerto.sql.users.rights.UserRightsManager; |
import org.openconcerto.sql.view.ListeAddPanel; |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn; |
import org.openconcerto.sql.view.list.IListe; |
34,6 → 34,7 |
import org.openconcerto.sql.view.list.SQLTableModelColumn; |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.PanelFrame; |
import org.openconcerto.utils.CollectionUtils; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.Tuple2; |
53,8 → 54,15 |
public class ListeDesStocksAction extends CreateFrameAbstractAction { |
private final boolean besoin; |
public ListeDesStocksAction() { |
this(false); |
} |
public ListeDesStocksAction(boolean b) { |
super(); |
this.besoin = b; |
this.putValue(Action.NAME, "Liste des stocks"); |
} |
67,9 → 75,32 |
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; |
100,7 → 131,6 |
@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")); |
} |
113,7 → 143,11 |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
input.setWhere(new Where(input.getTable("STOCK").getField("ID_DEPOT_STOCK"), "=", sqlRow.getID())); |
Where w = sqlRow == null ? null : new Where(input.getTable("STOCK").getField("ID_DEPOT_STOCK"), "=", sqlRow.getID()); |
if (besoin) { |
w = Where.and(w, new Where(input.getTable("STOCK").getField("QTE_TH"), "<", input.getTable("STOCK").getField("QTE_MIN"))); |
} |
input.setWhere(w); |
return input; |
} |
}); |
132,14 → 166,6 |
c2.weightx = 0; |
c2.fill = GridBagConstraints.NONE; |
panel.add(total, c2); |
tabs.add(sqlRow.getString("NOM"), panel); |
return 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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
217,6 → 217,20 |
this.addView(devise, "ID_DEVISE"); |
} |
if (getTable().contains("CONDITIONS_PORT")) { |
// Conditions frais port |
c.gridy++; |
c.gridx = 0; |
c.weightx = 0; |
this.add(new JLabel(getLabelFor("CONDITIONS_PORT"), SwingConstants.RIGHT), c); |
c.gridx++; |
c.weightx = 0.5; |
JTextField textCondPort = new JTextField(); |
this.add(textCondPort, c); |
this.addView(textCondPort, "CONDITIONS_PORT"); |
} |
if (getTable().contains("ALG_REGISTRE")) { |
c.gridy++; |
c.gridx = 0; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/AgenceSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/CustomerGroup.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
110,6 → 110,7 |
gInfo.addItem("CODE_FOURNISSEUR"); |
gInfo.addItem("REMIND_DATE"); |
gInfo.addItem("CONDITIONS_LIVRAISON", new LayoutHints(true, true, true, true, true, true, true, true)); |
gInfo.addItem("ALERTE", new LayoutHints(true, true, true, true, true, true, true, true)); |
gInfo.addItem("INFOS", new LayoutHints(true, true, true, true, true, true, true, true)); |
gInfo.addItem("COMMENTAIRES", new LayoutHints(true, true, true, true, true, true, true, true)); |
gInfo.addItem("OBSOLETE"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ClientNormalSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
25,8 → 25,10 |
import org.openconcerto.sql.model.FieldPath; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.model.graph.Path; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.ComboSQLRequest; |
import org.openconcerto.sql.request.ListSQLRequest; |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn; |
import org.openconcerto.sql.view.list.IListe; |
41,6 → 43,7 |
import java.awt.event.ActionEvent; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Collections; |
import java.util.List; |
import java.util.Set; |
71,7 → 74,7 |
final SQLRowAccessor row = IListe.get(e).fetchSelectedRow(); |
FicheClientXmlSheet sheet = new FicheClientXmlSheet(row.asRow()); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
sheet.showPrintAndExportAsynchronous(true, false, true, Collections.emptyList()); |
} |
}, false, "customerrelationship.customer.info.create"); |
actionFicheClient.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
208,6 → 211,12 |
} |
@Override |
protected void _initComboRequest(ComboSQLRequest req) { |
super._initComboRequest(req); |
req.setWhere(new Where(getTable().getField("OBSOLETE"), "=", Boolean.FALSE)); |
} |
/* |
* (non-Javadoc) |
* |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactItemTable.java.r30880 |
---|
New file |
0,0 → 1,149 |
package ilm.erp.core.customerrelationship.customer.element; |
import ilm.sql.Configuration; |
import ilm.sql.element.SQLElement; |
import ilm.sql.model.SQLRowValues; |
import ilm.sql.view.list.RowValuesTable; |
import ilm.sql.view.list.RowValuesTableControlPanel; |
import ilm.sql.view.list.RowValuesTableModel; |
import ilm.sql.view.list.RowValuesTableRenderer; |
import ilm.sql.view.list.SQLTableElement; |
import ilm.ui.FormatEditor; |
import ilm.utils.FormatGroup; |
import ilm.utils.convertor.DateToSQLConvertor; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.io.File; |
import java.text.DateFormat; |
import java.util.Date; |
import java.util.List; |
import java.util.Vector; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.ToolTipManager; |
public class ContactItemTable extends JPanel { |
private RowValuesTable table; |
final RowValuesTableControlPanel comp; |
public ContactItemTable(SQLRowValues defaultRow) { |
this(defaultRow, Configuration.getInstance().getDirectory().getElement(defaultRow.getTable())); |
} |
private ContactItemTable(SQLRowValues defaultRow, SQLElement elt) { |
this.setOpaque(false); |
this.setLayout(new GridBagLayout()); |
GridBagConstraints c = new GridBagConstraints(); |
c.gridwidth = 1; |
c.gridheight = 1; |
c.gridx = 0; |
c.gridy = 0; |
c.fill = GridBagConstraints.HORIZONTAL; |
c.weightx = 1; |
c.weighty = 0; |
List<SQLTableElement> list = new Vector<SQLTableElement>(); |
SQLTableElement tableElementTitre = new SQLTableElement(elt.getTable().getField("ID_TITRE_PERSONNEL")); |
list.add(tableElementTitre); |
SQLTableElement tableElementNom = new SQLTableElement(elt.getTable().getField("NOM")); |
list.add(tableElementNom); |
SQLTableElement tableElementPrenom = new SQLTableElement(elt.getTable().getField("PRENOM")); |
list.add(tableElementPrenom); |
SQLTableElement tableElementFonction = new SQLTableElement(elt.getTable().getField("FONCTION")); |
list.add(tableElementFonction); |
if (elt.getTable().contains("SERVICE")) { |
SQLTableElement tableElementService = new SQLTableElement(elt.getTable().getField("SERVICE")); |
list.add(tableElementService); |
} |
SQLTableElement tableElementTel = new SQLTableElement(elt.getTable().getField("TEL_DIRECT")); |
list.add(tableElementTel); |
SQLTableElement tableElementFax = new SQLTableElement(elt.getTable().getField("FAX")); |
list.add(tableElementFax); |
SQLTableElement tableElementTelP = new SQLTableElement(elt.getTable().getField("TEL_MOBILE")); |
list.add(tableElementTelP); |
SQLTableElement tableElementMail = new SQLTableElement(elt.getTable().getField("EMAIL")); |
list.add(tableElementMail); |
if (elt.getTable().contains("TYPE")) { |
SQLTableElement tableElementType = new SQLTableElement(elt.getTable().getField("TYPE")); |
list.add(tableElementType); |
} |
if (elt.getTable().contains("PAYS")) { |
SQLTableElement tableElementPays = new SQLTableElement(elt.getTable().getField("PAYS")); |
list.add(tableElementPays); |
} |
if (elt.getTable().contains("ENVOI_RAPPORT_MAIL")) { |
SQLTableElement tableElementEnvoiMail = new SQLTableElement(elt.getTable().getField("ENVOI_RAPPORT_MAIL")); |
list.add(tableElementEnvoiMail); |
} |
if (elt.getTable().contains("NO_MAILING")) { |
SQLTableElement tableElementNoMailing = new SQLTableElement(elt.getTable().getField("NO_MAILING")); |
list.add(tableElementNoMailing); |
} |
if (elt.getTable().contains("DATE_NAISSANCE")) { |
list.add(new SQLTableElement(elt.getTable().getField("DATE_NAISSANCE")) { |
private final DateToSQLConvertor conv = new DateToSQLConvertor(); |
{ |
this.setEditor(new FormatEditor( |
new FormatGroup(DateFormat.getDateInstance(DateFormat.SHORT), DateFormat.getDateInstance(DateFormat.MEDIUM), DateFormat.getDateInstance(DateFormat.LONG)))); |
} |
@Override |
public Object convertEditorValueToModel(Object value, SQLRowValues row) { |
return this.conv.convert((Date) value); |
} |
}); |
} |
final RowValuesTableModel model = new RowValuesTableModel(elt, list, elt.getTable().getField("NOM"), false, defaultRow); |
this.table = new RowValuesTable(model, new File(Configuration.getInstance().getConfDir(), "Table" + File.separator + "Table_Contact.xml")); |
ToolTipManager.sharedInstance().unregisterComponent(this.table); |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader()); |
this.comp = new RowValuesTableControlPanel(this.table); |
this.add(this.comp, c); |
c.gridy++; |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
this.add(new JScrollPane(this.table), c); |
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer()); |
} |
public void updateField(String field, int id) { |
this.table.updateField(field, id); |
} |
public void insertFrom(String field, SQLRowValues row) { |
this.table.insertFrom(field, row); |
} |
public void insertFrom(String field, int id) { |
this.table.insertFrom(field, id); |
} |
public RowValuesTableModel getModel() { |
return this.table.getRowValuesTableModel(); |
} |
public void setEditable(boolean b) { |
this.comp.setEditable(b); |
this.table.setEditable(b); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ClientNormalSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
24,6 → 24,7 |
import org.openconcerto.erp.core.finance.payment.component.ModeDeReglementSQLComponent; |
import org.openconcerto.erp.model.ISQLCompteSelector; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.erp.preferences.ModeReglementDefautPrefPanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.BaseSQLComponent; |
39,6 → 40,7 |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.UndefinedRowValuesCache; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.SQLRowItemView; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.sqlobject.JUniqueTextField; |
742,6 → 744,13 |
} |
} |
private void createCompteClientFromCodeAuto(int idClient) { |
final SQLRow rowClient = getTable().getRow(idClient); |
if (rowClient.isForeignEmpty("ID_COMPTE_PCE")) { |
createCompteClientAuto(idClient); |
} |
} |
private void createCompteClientAuto(int idClient) { |
SQLRowValues rowVals = getTable().getRow(idClient).createEmptyUpdateRow(); |
String initialClient = ""; |
803,6 → 812,10 |
if (this.boxGestionAutoCompte.isSelected()) { |
createCompteClientAuto(id); |
} |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.COMPTE_CLIENT_AUTO, Boolean.FALSE)) { |
createCompteClientFromCodeAuto(id); |
} |
return id; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/CustomerSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,17 → 13,23 |
package org.openconcerto.erp.core.customerrelationship.customer.element; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.edm.AttachmentAction; |
import org.openconcerto.erp.core.reports.history.ui.HistoriqueClientFrame; |
import org.openconcerto.erp.core.sales.product.element.ListeTarifClient; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.GlobalMapper; |
import org.openconcerto.sql.element.GroupSQLComponent; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.ListSQLRequest; |
import org.openconcerto.sql.request.SQLFieldTranslator; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.RowAction; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.ui.light.LightUIElement; |
import org.openconcerto.ui.light.LightUILine; |
31,7 → 37,9 |
import org.openconcerto.ui.light.SimpleTextLine; |
import java.awt.event.ActionEvent; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Set; |
import javax.swing.AbstractAction; |
60,9 → 68,36 |
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"); |
70,11 → 105,19 |
} |
@Override |
public Set<String> getReadOnlyFields() { |
Set<String> s = new HashSet<>(); |
return s; |
} |
@Override |
protected List<String> getListFields() { |
final List<String> fields = super.getListFields(); |
if (getTable().contains("GROUPE")) { |
fields.add("GROUPE"); |
} |
fields.add("ENCOURS_MAX"); |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.CATEGORIE_COMPTABLE_SPEC, false)) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactItemTable.java.r25937 |
---|
New file |
0,0 → 1,149 |
package ilm.erp.core.customerrelationship.customer.element; |
import ilm.sql.Configuration; |
import ilm.sql.element.SQLElement; |
import ilm.sql.model.SQLRowValues; |
import ilm.sql.view.list.RowValuesTable; |
import ilm.sql.view.list.RowValuesTableControlPanel; |
import ilm.sql.view.list.RowValuesTableModel; |
import ilm.sql.view.list.RowValuesTableRenderer; |
import ilm.sql.view.list.SQLTableElement; |
import ilm.ui.FormatEditor; |
import ilm.utils.FormatGroup; |
import ilm.utils.convertor.DateToSQLConvertor; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.io.File; |
import java.text.DateFormat; |
import java.util.Date; |
import java.util.List; |
import java.util.Vector; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.ToolTipManager; |
public class ContactItemTable extends JPanel { |
private RowValuesTable table; |
final RowValuesTableControlPanel comp; |
public ContactItemTable(SQLRowValues defaultRow) { |
this(defaultRow, Configuration.getInstance().getDirectory().getElement(defaultRow.getTable())); |
} |
private ContactItemTable(SQLRowValues defaultRow, SQLElement elt) { |
this.setOpaque(false); |
this.setLayout(new GridBagLayout()); |
GridBagConstraints c = new GridBagConstraints(); |
c.gridwidth = 1; |
c.gridheight = 1; |
c.gridx = 0; |
c.gridy = 0; |
c.fill = GridBagConstraints.HORIZONTAL; |
c.weightx = 1; |
c.weighty = 0; |
List<SQLTableElement> list = new Vector<SQLTableElement>(); |
SQLTableElement tableElementTitre = new SQLTableElement(elt.getTable().getField("ID_TITRE_PERSONNEL")); |
list.add(tableElementTitre); |
SQLTableElement tableElementNom = new SQLTableElement(elt.getTable().getField("NOM")); |
list.add(tableElementNom); |
SQLTableElement tableElementPrenom = new SQLTableElement(elt.getTable().getField("PRENOM")); |
list.add(tableElementPrenom); |
SQLTableElement tableElementFonction = new SQLTableElement(elt.getTable().getField("FONCTION")); |
list.add(tableElementFonction); |
if (elt.getTable().contains("SERVICE")) { |
SQLTableElement tableElementService = new SQLTableElement(elt.getTable().getField("SERVICE")); |
list.add(tableElementService); |
} |
SQLTableElement tableElementTel = new SQLTableElement(elt.getTable().getField("TEL_DIRECT")); |
list.add(tableElementTel); |
SQLTableElement tableElementFax = new SQLTableElement(elt.getTable().getField("FAX")); |
list.add(tableElementFax); |
SQLTableElement tableElementTelP = new SQLTableElement(elt.getTable().getField("TEL_MOBILE")); |
list.add(tableElementTelP); |
SQLTableElement tableElementMail = new SQLTableElement(elt.getTable().getField("EMAIL")); |
list.add(tableElementMail); |
if (elt.getTable().contains("TYPE")) { |
SQLTableElement tableElementType = new SQLTableElement(elt.getTable().getField("TYPE")); |
list.add(tableElementType); |
} |
if (elt.getTable().contains("PAYS")) { |
SQLTableElement tableElementPays = new SQLTableElement(elt.getTable().getField("PAYS")); |
list.add(tableElementPays); |
} |
if (elt.getTable().contains("ENVOI_RAPPORT_MAIL")) { |
SQLTableElement tableElementEnvoiMail = new SQLTableElement(elt.getTable().getField("ENVOI_RAPPORT_MAIL")); |
list.add(tableElementEnvoiMail); |
} |
if (elt.getTable().contains("NO_MAILING")) { |
SQLTableElement tableElementNoMailing = new SQLTableElement(elt.getTable().getField("NO_MAILING")); |
list.add(tableElementNoMailing); |
} |
list.add(new SQLTableElement(elt.getTable().getField("DATE_NAISSANCE")) { |
private final DateToSQLConvertor conv = new DateToSQLConvertor(); |
{ |
this.setEditor( |
new FormatEditor(new FormatGroup(DateFormat.getDateInstance(DateFormat.SHORT), DateFormat.getDateInstance(DateFormat.MEDIUM), DateFormat.getDateInstance(DateFormat.LONG)))); |
} |
@Override |
public Object convertEditorValueToModel(Object value, SQLRowValues row) { |
return this.conv.convert((Date) value); |
} |
}); |
final RowValuesTableModel model = new RowValuesTableModel(elt, list, elt.getTable().getField("NOM"), false, defaultRow); |
this.table = new RowValuesTable(model, new File(Configuration.getInstance().getConfDir(), "Table" + File.separator + "Table_Contact.xml")); |
ToolTipManager.sharedInstance().unregisterComponent(this.table); |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader()); |
this.comp = new RowValuesTableControlPanel(this.table); |
this.add(this.comp, c); |
c.gridy++; |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
this.add(new JScrollPane(this.table), c); |
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer()); |
} |
public void updateField(String field, int id) { |
this.table.updateField(field, id); |
} |
public void insertFrom(String field, SQLRowValues row) { |
this.table.insertFrom(field, row); |
} |
public void insertFrom(String field, int id) { |
this.table.insertFrom(field, id); |
} |
public RowValuesTableModel getModel() { |
return this.table.getRowValuesTableModel(); |
} |
public void setEditable(boolean b) { |
this.comp.setEditable(b); |
this.table.setEditable(b); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/RelanceSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
54,6 → 54,7 |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.List; |
import java.util.logging.Level; |
183,7 → 184,7 |
try { |
FicheRelanceSheet sheet = new FicheRelanceSheet(IListe.get(e).getSelectedRow().asRow().fetchNew(false)); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
sheet.showPrintAndExportAsynchronous(true, false, true, Collections.emptyList()); |
} catch (Exception ex) { |
ExceptionHandler.handle("Impression impossible", ex); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/customerrelationship/customer/element/ContactItemTable.java.mine |
---|
New file |
0,0 → 1,150 |
package ilm.erp.core.customerrelationship.customer.element; |
import ilm.sql.Configuration; |
import ilm.sql.element.SQLElement; |
import ilm.sql.model.SQLRowValues; |
import ilm.sql.view.list.RowValuesTable; |
import ilm.sql.view.list.RowValuesTableControlPanel; |
import ilm.sql.view.list.RowValuesTableModel; |
import ilm.sql.view.list.RowValuesTableRenderer; |
import ilm.sql.view.list.SQLTableElement; |
import ilm.ui.FormatEditor; |
import ilm.utils.FormatGroup; |
import ilm.utils.convertor.DateToSQLConvertor; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.io.File; |
import java.text.DateFormat; |
import java.util.Date; |
import java.util.List; |
import java.util.Vector; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.ToolTipManager; |
public class ContactItemTable extends JPanel { |
private RowValuesTable table; |
final RowValuesTableControlPanel comp; |
public ContactItemTable(SQLRowValues defaultRow) { |
this(defaultRow, Configuration.getInstance().getDirectory().getElement(defaultRow.getTable())); |
} |
private ContactItemTable(SQLRowValues defaultRow, SQLElement elt) { |
this.setOpaque(false); |
this.setLayout(new GridBagLayout()); |
GridBagConstraints c = new GridBagConstraints(); |
c.gridwidth = 1; |
c.gridheight = 1; |
c.gridx = 0; |
c.gridy = 0; |
c.fill = GridBagConstraints.HORIZONTAL; |
c.weightx = 1; |
c.weighty = 0; |
List<SQLTableElement> list = new Vector<SQLTableElement>(); |
SQLTableElement tableElementTitre = new SQLTableElement(elt.getTable().getField("ID_TITRE_PERSONNEL")); |
list.add(tableElementTitre); |
SQLTableElement tableElementNom = new SQLTableElement(elt.getTable().getField("NOM")); |
list.add(tableElementNom); |
SQLTableElement tableElementPrenom = new SQLTableElement(elt.getTable().getField("PRENOM")); |
list.add(tableElementPrenom); |
SQLTableElement tableElementFonction = new SQLTableElement(elt.getTable().getField("FONCTION")); |
list.add(tableElementFonction); |
if (elt.getTable().contains("SERVICE")) { |
SQLTableElement tableElementService = new SQLTableElement(elt.getTable().getField("SERVICE")); |
list.add(tableElementService); |
} |
SQLTableElement tableElementTel = new SQLTableElement(elt.getTable().getField("TEL_DIRECT")); |
list.add(tableElementTel); |
SQLTableElement tableElementFax = new SQLTableElement(elt.getTable().getField("FAX")); |
list.add(tableElementFax); |
SQLTableElement tableElementTelP = new SQLTableElement(elt.getTable().getField("TEL_MOBILE")); |
list.add(tableElementTelP); |
SQLTableElement tableElementMail = new SQLTableElement(elt.getTable().getField("EMAIL")); |
list.add(tableElementMail); |
if (elt.getTable().contains("TYPE")) { |
SQLTableElement tableElementType = new SQLTableElement(elt.getTable().getField("TYPE")); |
list.add(tableElementType); |
} |
if (elt.getTable().contains("PAYS")) { |
SQLTableElement tableElementPays = new SQLTableElement(elt.getTable().getField("PAYS")); |
list.add(tableElementPays); |
} |
if (elt.getTable().contains("ENVOI_RAPPORT_MAIL")) { |
SQLTableElement tableElementEnvoiMail = new SQLTableElement(elt.getTable().getField("ENVOI_RAPPORT_MAIL")); |
list.add(tableElementEnvoiMail); |
} |
if (elt.getTable().contains("NO_MAILING")) { |
SQLTableElement tableElementNoMailing = new SQLTableElement(elt.getTable().getField("NO_MAILING")); |
list.add(tableElementNoMailing); |
} |
if (elt.getTable().contains("DATE_NAISSANCE")) { |
list.add(new SQLTableElement(elt.getTable().getField("DATE_NAISSANCE")) { |
private final DateToSQLConvertor conv = new DateToSQLConvertor(); |
{ |
this.setEditor(new FormatEditor( |
new FormatGroup(DateFormat.getDateInstance(DateFormat.SHORT), DateFormat.getDateInstance(DateFormat.MEDIUM), DateFormat.getDateInstance(DateFormat.LONG)))); |
} |
@Override |
public Object convertEditorValueToModel(Object value, SQLRowValues row) { |
return this.conv.convert((Date) value); |
} |
}); |
} |
final RowValuesTableModel model = new RowValuesTableModel(elt, list, elt.getTable().getField("NOM"), false, defaultRow); |
this.table = new RowValuesTable(model, new File(Configuration.getInstance().getConfDir(), "Table" + File.separator + "Table_Contact.xml")); |
ToolTipManager.sharedInstance().unregisterComponent(this.table); |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader()); |
this.comp = new RowValuesTableControlPanel(this.table); |
this.add(this.comp, c); |
c.gridy++; |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
this.add(new JScrollPane(this.table), c); |
this.table.setDefaultRenderer(Long.class, new RowValuesTableRenderer()); |
} |
public void updateField(String field, int id) { |
this.table.updateField(field, id); |
} |
public void insertFrom(String field, SQLRowValues row) { |
this.table.insertFrom(field, row); |
} |
public void insertFrom(String field, int id) { |
this.table.insertFrom(field, id); |
} |
public RowValuesTableModel getModel() { |
return this.table.getRowValuesTableModel(); |
} |
public void setEditable(boolean b) { |
this.comp.setEditable(b); |
this.table.setEditable(b); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/model/PointageModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
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/finance/accounting/model/CurrencyConverter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
122,10 → 122,16 |
// Clean date |
final Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC")); |
c.setTimeInMillis(date.getTime()); |
c.set(Calendar.HOUR_OF_DAY, 0); |
c.set(Calendar.MINUTE, 0); |
c.set(Calendar.SECOND, 0); |
c.set(Calendar.MILLISECOND, 0); |
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); |
} |
final Date d = c.getTime(); |
// Get conversion info |
203,6 → 209,9 |
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; |
} |
216,8 → 225,8 |
w = w.and(new Where(t.getField("DATE"), "<=", d)); |
select.setWhere(w); |
select.addFieldOrder(t.getField("DATE"), Order.desc()); |
// Limit pour récupérer le taux de la veille |
select.setLimit(2); |
// On ne veut que le plus récent |
select.setLimit(1); |
final List<SQLRow> rows = SQLRowListRSH.execute(select); |
return rows; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/element/SaisieKmSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
636,11 → 636,12 |
final TableRef aliasEcrTable = sel.getAlias(ecritureTable); |
final String quoteDebit = new SQLName(aliasEcrTable.getAlias(), "DEBIT").quote(); |
final String quoteCredit = new SQLName(aliasEcrTable.getAlias(), "CREDIT").quote(); |
sel.setWhere(Where.isNotNull(ecritureTable.getField("LETTRAGE")).and(new Where(ecritureTable.getField("LETTRAGE"), "!=", ""))); |
sel.setHaving(Where.createRaw("SUM (" + quoteCredit + ") != SUM(" + quoteDebit + ")", aliasEcrTable.getField("DEBIT"))); |
List<String> resultBadLettrage = getElement().getTable().getDBSystemRoot().getDataSource().executeCol(sel.asString()); |
if (resultBadLettrage != null && !resultBadLettrage.isEmpty()) { |
UpdateBuilder update = new UpdateBuilder(ecritureTable); |
update.setObject(ecritureTable.getField("LETTRAGE"), ""); |
update.setObject(ecritureTable.getField("DATE_LETTRAGE"), null); |
647,29 → 648,9 |
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/RepartitionAnalytiquePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
27,6 → 27,7 |
import java.awt.event.ActionEvent; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.util.Collections; |
import java.util.Date; |
import java.util.concurrent.ExecutionException; |
74,7 → 75,7 |
RepartitionAnalytiqueSheetXML sheet = new RepartitionAnalytiqueSheetXML(dateDeb.getDate(), dateEnd.getDate()); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, false); |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
} catch (InterruptedException e) { |
e.printStackTrace(); |
} catch (ExecutionException e) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/BalanceSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
433,9 → 433,8 |
} |
} |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
if (this.nbPage < 1) { |
this.nbPage = 1; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/PdfGenerator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,19 → 13,22 |
package org.openconcerto.erp.core.finance.accounting.report; |
import static org.openconcerto.task.config.ComptaBasePropsConfiguration.getStreamStatic; |
import org.openconcerto.erp.generationDoc.TemplateManager; |
import org.openconcerto.ui.preferences.TemplateProps; |
import org.openconcerto.utils.ExceptionHandler; |
import java.awt.Color; |
import java.io.File; |
import java.io.FileInputStream; |
import java.io.FileNotFoundException; |
import java.io.FileOutputStream; |
import java.io.IOException; |
import java.io.InputStream; |
import java.util.Calendar; |
import java.util.Date; |
import java.util.Map; |
import javax.swing.JOptionPane; |
import com.ibm.icu.text.SimpleDateFormat; |
import com.lowagie.text.Document; |
import com.lowagie.text.DocumentException; |
58,7 → 61,7 |
} |
PdfGenerator(String fileNameIn, String fileNameOut, String directoryOut) { |
this.fileNameIn = "/Configuration/Template/PDF/" + fileNameIn; |
this.fileNameIn = fileNameIn; |
this.fileNameOut = fileNameOut; |
this.directoryOut = new File(directoryOut, String.valueOf(Calendar.getInstance().get(Calendar.YEAR))); |
} |
75,7 → 78,7 |
this.cb.endText(); |
this.document.close(); |
} catch (FileNotFoundException e) { |
ExceptionHandler.handle("Impossible de générer le fichier. \n" + e, e); |
JOptionPane.showMessageDialog(null, "Impossible de générer le fichier.\nModèle PDF non trouvé : " + e.getMessage()); |
} |
} |
85,8 → 88,31 |
PdfReader reader = null; |
PdfWriter writer = null; |
try { |
reader = new PdfReader(getStreamStatic(this.fileNameIn)); |
InputStream in = TemplateManager.getInstance().getTemplate(fileNameIn); |
if (in == null) { |
File defaultFile = new File("Configuration/Template/PDF/" + fileNameIn); |
System.err.println("PdfGenerator.init() template " + fileNameIn + " not retrieved from TemplateManager"); |
if (defaultFile.exists()) { |
in = new FileInputStream(defaultFile); |
} else { |
System.err.println("PdfGenerator.init() template " + defaultFile.getAbsolutePath() + " not found in program directory"); |
} |
final String property = TemplateProps.getInstance().getProperty("LocationTemplate"); |
defaultFile = new File(property, fileNameIn); |
if (defaultFile.exists()) { |
in = new FileInputStream(defaultFile); |
} else { |
System.err.println("PdfGenerator.init() template " + defaultFile.getAbsolutePath() + " not found in template prefs directory"); |
} |
if (in == null) { |
throw new FileNotFoundException(fileNameIn); |
} |
} |
reader = new PdfReader(in); |
final Rectangle psize = reader.getPageSize(1); |
psize.setRight(psize.getRight() - this.templateOffsetX); |
psize.setTop(psize.getTop() - this.templateOffsetY); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/Map3310.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
24,6 → 24,7 |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.utils.GestionDevise; |
import java.io.File; |
import java.util.Date; |
import java.util.HashMap; |
import java.util.Map; |
186,9 → 187,13 |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
Gestion.openPDF(p.getGeneratedFile()); |
final File generatedFile = p.getGeneratedFile(); |
if (generatedFile != null) { |
Gestion.openPDF(generatedFile); |
} else { |
Map3310.this.bar.setValue(100); |
} |
} |
}); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/JournauxSheetXML.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
112,6 → 112,9 |
vals.put("DEBIT", null); |
vals.put("DATE", null); |
vals.put("NOM", null); |
if (tableEcriture.contains("NOM_PIECE")) { |
vals.put("NOM_PIECE", null); |
} |
final SQLRowValuesListFetcher fetcher = new SQLRowValuesListFetcher(vals); |
fetcher.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/GrandLivreSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
462,9 → 462,9 |
} |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
if (this.nbPage < 1) { |
this.nbPage = 1; |
} |
Date end = new Date(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/Map2033A.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
22,6 → 22,7 |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.utils.GestionDevise; |
import java.io.File; |
import java.text.DateFormat; |
import java.text.SimpleDateFormat; |
import java.util.Date; |
186,7 → 187,7 |
// 27688, 277" |
// S040=261+266...268+271+272+27682+274+27684+275+2761+27685+27688 |
long v040 = this.sommeCompte.sommeCompteFils("261", this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(266, 268, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompte(271, 275, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(2761, 2761, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompte(270, 275, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(2761, 2761, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.sommeCompteFils("27682", this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompte(27684, 27685, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.sommeCompteFils("27688", this.dateDebut, this.dateFin); |
685,10 → 686,11 |
long v156 = -this.sommeCompte.sommeCompteFils("160", this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("161", this.dateDebut, this.dateFin) |
- this.sommeCompte.soldeCompte(163, 166, true, this.dateDebut, this.dateFin) - this.sommeCompte.soldeCompte(1680, 1681, true, this.dateDebut, this.dateFin) |
- this.sommeCompte.soldeCompte(1682, 1682, true, this.dateDebut, this.dateFin) - this.sommeCompte.soldeCompte(1684, 1689, true, this.dateDebut, this.dateFin) |
- this.sommeCompte.sommeCompteFils("17", this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("426", this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompteCrediteur(450, 454, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompteCrediteur(456, 456, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompteCrediteur(458, 459, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompteCrediteur(512, 517, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompteCrediteur(518, 518, true, this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("519", this.dateDebut, this.dateFin); |
- this.sommeCompte.sommeCompteFils("19", this.dateDebut, this.dateFin) - this.sommeCompte.sommeCompteFils("17", this.dateDebut, this.dateFin) |
- this.sommeCompte.sommeCompteFils("426", this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompteCrediteur(450, 454, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompteCrediteur(456, 456, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompteCrediteur(458, 459, true, this.dateDebut, this.dateFin) |
+ this.sommeCompte.soldeCompteCrediteur(512, 517, true, this.dateDebut, this.dateFin) + this.sommeCompte.soldeCompteCrediteur(518, 518, true, this.dateDebut, this.dateFin) |
- this.sommeCompte.sommeCompteFils("519", this.dateDebut, this.dateFin); |
this.m.put("PASSIF3.25", GestionDevise.currencyToString(v156, false)); |
// 151 |
874,9 → 876,13 |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
Gestion.openPDF(p.getGeneratedFile()); |
final File generatedFile = p.getGeneratedFile(); |
if (generatedFile != null) { |
Gestion.openPDF(generatedFile); |
} else { |
Map2033A.this.bar.setValue(100); |
} |
} |
}); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/GrandLivrePDF.java |
---|
New file |
0,0 → 1,754 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.core.finance.accounting.report; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement; |
import org.openconcerto.erp.rights.ComptaUserRight; |
import org.openconcerto.sql.element.SQLElementDirectory; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.users.rights.UserRightsManager; |
import org.openconcerto.utils.GestionDevise; |
import org.openconcerto.utils.cc.ITransformer; |
import java.awt.Color; |
import java.io.ByteArrayOutputStream; |
import java.io.File; |
import java.io.IOException; |
import java.io.InputStream; |
import java.text.DateFormat; |
import java.text.DecimalFormat; |
import java.text.DecimalFormatSymbols; |
import java.util.ArrayList; |
import java.util.Calendar; |
import java.util.Date; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Locale; |
import java.util.Map; |
import org.apache.commons.dbutils.handlers.ArrayListHandler; |
import org.apache.pdfbox.pdmodel.PDDocument; |
import org.apache.pdfbox.pdmodel.PDPage; |
import org.apache.pdfbox.pdmodel.PDPageContentStream; |
import org.apache.pdfbox.pdmodel.common.PDRectangle; |
import org.apache.pdfbox.pdmodel.font.PDType1Font; |
import org.apache.pdfbox.pdmodel.graphics.image.PDImageXObject; |
public class GrandLivrePDF { |
public static final int MODEALL = 1; |
public static final int MODELETTREE = 2; |
public static final int MODENONLETTREE_PERIODE = 3; |
public static final int MODENONLETTREE_ALL = 4; |
private final SQLTable tableEcriture; |
private final SQLTable tableMvt; |
private final SQLTable tableCompte; |
private final DateFormat dateFormatEcr = DateFormat.getDateInstance(DateFormat.SHORT); |
private final SQLRow rowSociete; |
private final Date dateDu; |
private final Date dateAu; |
private final String compteDeb; |
private final String compteEnd; |
private final int lettrage; |
private boolean cumul = false; |
private boolean excludeCompteSolde = true; |
private boolean centralClient = false; |
private boolean centralFourn = false; |
private int idJrnlExclude = -1; |
private final List<Map<String, Object>> recapSousTotaux = new ArrayList<>(); |
private final SQLElementDirectory directory; |
public static final String TEMPLATE_ID = "GrandLivre"; |
public static final String TEMPLATE_PROPERTY_NAME = "LocationGrandLivre"; |
private static final int LINE_HEIGHT = 10; |
private static final float COL_1_SIZE = 34; |
private static final float COL_2_SIZE = 35; |
private static final float COL_3_SIZE = 35; |
private static final float COL_4_SIZE = 246; |
private static final float COL_5_SIZE = 50; |
private static final float COL_6_SIZE = COL_5_SIZE; |
private static final float COL_7_SIZE = 60; |
private static final float COL_1_X = 40; |
private static final float COL_2_X = COL_1_X + COL_1_SIZE; |
private static final float COL_3_X = COL_2_X + COL_2_SIZE; |
private static final float COL_4_X = COL_3_X + COL_3_SIZE; |
private static final float COL_5_X = COL_4_X + COL_4_SIZE; |
private static final float COL_6_X = COL_5_X + COL_5_SIZE; |
private static final float COL_7_X = COL_6_X + COL_6_SIZE; |
private final DecimalFormat decimalFormat = new DecimalFormat("#,##0.00", DecimalFormatSymbols.getInstance(Locale.FRANCE)); |
public GrandLivrePDF(ComptaPropsConfiguration conf, Date du, Date au, String compteDep, String compteEnd, int lettrage, boolean cumul, boolean excludeCptSolde, boolean centralClient, |
boolean centralFourn, int idJrnlExclude) { |
this.directory = conf.getDirectory(); |
this.rowSociete = conf.getRowSociete(); |
final DBRoot b = conf.getRootSociete(); |
this.tableEcriture = b.getTable("ECRITURE"); |
this.tableMvt = b.getTable("MOUVEMENT"); |
this.tableCompte = b.getTable("COMPTE_PCE"); |
final Calendar cal = Calendar.getInstance(); |
cal.setTime(au); |
this.idJrnlExclude = idJrnlExclude; |
this.dateAu = au; |
this.dateDu = du; |
this.compteDeb = compteDep.trim(); |
this.compteEnd = compteEnd.trim(); |
this.lettrage = lettrage; |
this.cumul = cumul; |
this.excludeCompteSolde = excludeCptSolde; |
this.centralClient = centralClient; |
this.centralFourn = centralFourn; |
} |
public void getGeneratedPDFFile(File f) throws IOException { |
final List<Integer> lCompteSolde; |
if (GrandLivrePDF.this.excludeCompteSolde) { |
lCompteSolde = getListeCompteSolde(); |
} else { |
lCompteSolde = null; |
} |
final Map<Integer, Long> mapCumul = getCumulsAnterieur(GrandLivrePDF.this.dateDu, lCompteSolde); |
final List<SQLRowValues> list = fetchEcritures(lCompteSolde); |
long totalDebit = 0; |
long totalCredit = 0; |
long sousTotalCredit = 0; |
long sousTotalDebit = 0; |
String nomCpt = ""; |
String numCpt = ""; |
int y = 0; |
final String companyName = this.rowSociete.getString("TYPE") + " " + this.rowSociete.getString("NOM"); |
final String title = "Compte : " + this.compteDeb + " à " + this.compteEnd + ". Période du " + this.dateFormatEcr.format(this.dateDu) + " au " + this.dateFormatEcr.format(this.dateAu); |
final Double doubleZero = Double.valueOf("0"); |
try (PDDocument doc = new PDDocument()) { |
PDPageContentStream contents = null; |
final int size = list.size(); |
for (int i = 0; i < size; i++) { |
if (y < 70) { |
final PDPage page = new PDPage(PDRectangle.A4); |
doc.addPage(page); |
if (contents != null) { |
contents.close(); |
} |
contents = new PDPageContentStream(doc, page); |
y = drawHeader(contents, companyName, title, true); |
} |
final SQLRowValues rowEcr = list.get(i); |
final int idCpt = rowEcr.getInt("ID_COMPTE_PCE"); |
nomCpt = rowEcr.getString("COMPTE_NOM"); |
numCpt = rowEcr.getString("COMPTE_NUMERO"); |
// Cumuls antérieurs |
// Titre |
String prevNum = (i == 0 ? null : list.get(i - 1).getString("COMPTE_NUMERO")); |
if (prevNum == null || (!prevNum.equals(numCpt) && (!this.centralFourn || !(prevNum.startsWith("401") && numCpt.startsWith("401"))) |
&& (!this.centralClient || !(prevNum.startsWith("411") && numCpt.startsWith("411"))))) { |
// Si on centralise les comptes clients ou fournisseurs on affiche |
// le compte 401 ou 411 |
if (this.centralClient && nomCpt.startsWith("411")) { |
nomCpt = "411"; |
numCpt = "Centralisation clients"; |
} |
if (this.centralFourn && nomCpt.startsWith("401")) { |
nomCpt = "401"; |
numCpt = "Centralisation fournisseurs"; |
} |
y = drawNomCompte(contents, y, numCpt, nomCpt); |
if (this.cumul) { |
Long longSolde = mapCumul.get(idCpt); |
if (longSolde == null) { |
longSolde = Long.valueOf(0); |
} |
long debitCumulAnt = 0; |
long creditCumulAnt = 0; |
if (longSolde > 0) { |
debitCumulAnt = longSolde; |
} else { |
creditCumulAnt = -longSolde; |
} |
final Double debit = debitCumulAnt == 0 ? doubleZero : Double.valueOf(GestionDevise.currencyToString(debitCumulAnt, false)); |
final Double credit = creditCumulAnt == 0 ? doubleZero : Double.valueOf(GestionDevise.currencyToString(creditCumulAnt, false)); |
final Double solde = longSolde == 0 ? doubleZero : Double.valueOf(GestionDevise.currencyToString(longSolde, false)); |
totalCredit += creditCumulAnt; |
totalDebit += debitCumulAnt; |
sousTotalCredit += creditCumulAnt; |
sousTotalDebit += debitCumulAnt; |
y = drawCumul(contents, y, debit, credit, solde); |
} |
} |
final long cred = rowEcr.getLong("CREDIT"); |
final long deb = rowEcr.getLong("DEBIT"); |
final Date dateEcriture = rowEcr.getDate("DATE").getTime(); |
final String journal = rowEcr.getString("JOURNAL_CODE"); |
final String mouvement = rowEcr.getForeign("ID_MOUVEMENT").getString("NUMERO"); |
final String piece = rowEcr.getForeign("ID_MOUVEMENT").getForeign("ID_PIECE").getString("NOM"); |
final String libelle = rowEcr.getString("NOM"); |
final String codeLettrage = rowEcr.getString("LETTRAGE"); |
final String codePointage = rowEcr.getString("POINTEE"); |
final Calendar dateLettrage = rowEcr.getDate("DATE_LETTRAGE"); |
final Calendar datePointage = rowEcr.getDate("DATE_POINTEE"); |
totalCredit += cred; |
totalDebit += deb; |
sousTotalCredit += cred; |
sousTotalDebit += deb; |
final long ssolde = sousTotalDebit - sousTotalCredit; |
final Double debit = deb == 0 ? doubleZero : deb / 100D; |
final Double credit = cred == 0 ? doubleZero : cred / 100D; |
final Double solde = ssolde == 0 ? doubleZero : ssolde / 100D; |
y = drawLine(contents, y, dateEcriture, journal, mouvement, piece, libelle, codeLettrage, codePointage, dateLettrage, datePointage, debit, credit, solde); |
// si on change de compte alors on applique le style Titre 1 |
String nextNum = (i >= size - 1 ? null : list.get(i + 1).getString("COMPTE_NUMERO")); |
if (nextNum == null || (!nextNum.equals(numCpt) && (!this.centralFourn || !(nextNum.startsWith("401") && numCpt.startsWith("401")))) |
&& (!this.centralClient || !(nextNum.startsWith("411") && numCpt.startsWith("411")))) { |
if (this.centralClient && nomCpt.startsWith("411")) { |
nomCpt = "411"; |
numCpt = "Centralisation clients"; |
} |
if (this.centralFourn && nomCpt.startsWith("401")) { |
nomCpt = "401"; |
numCpt = "Centralisation fournisseurs"; |
} |
y = drawSousTotal(contents, y, numCpt, nomCpt, sousTotalDebit, sousTotalCredit); |
sousTotalCredit = 0; |
sousTotalDebit = 0; |
} |
} |
contents.close(); |
// Recapitulatif |
PDPage page = new PDPage(PDRectangle.A4); |
doc.addPage(page); |
contents = new PDPageContentStream(doc, page); |
y = drawHeader(contents, companyName, title, false); |
for (final Map<String, Object> recap : this.recapSousTotaux) { |
if (y < 70) { |
page = new PDPage(PDRectangle.A4); |
doc.addPage(page); |
if (contents != null) { |
contents.close(); |
} |
contents = new PDPageContentStream(doc, page); |
y = drawHeader(contents, companyName, title, false); |
} |
final String numero = (String) recap.get("NUMERO"); |
final String libelle = (String) recap.get("LIBELLE"); |
final double debit = (long) recap.get("DEBIT") / 100D; |
final double credit = (long) recap.get("CREDIT") / 100D; |
final double solde = debit - credit; |
y = drawRecapLine(contents, y, numero, libelle, debit, credit, solde, false); |
} |
final Double debit = totalDebit == 0 ? 0 : totalDebit / 100D; |
final Double credit = totalCredit == 0 ? 0 : totalCredit / 100D; |
final Double solde = totalDebit - totalCredit == 0 ? 0 : (totalDebit - totalCredit) / 100D; |
y = drawRecapLine(contents, y, "", "GLOBAL", debit, credit, solde, true); |
contents.close(); |
// Header avec numéro de page |
final InputStream sImage = this.getClass().getResourceAsStream("OpenConcerto_2000px.png"); |
final ByteArrayOutputStream bOut = new ByteArrayOutputStream(); |
final byte[] buf = new byte[8192]; |
int length; |
while ((length = sImage.read(buf)) > 0) { |
bOut.write(buf, 0, length); |
} |
sImage.close(); |
bOut.close(); |
final float ratio = 20; |
final int pageCount = doc.getNumberOfPages(); |
for (int index = 0; index < pageCount; index++) { |
final PDPage currentPage = doc.getPage(index); |
contents = new PDPageContentStream(doc, currentPage, PDPageContentStream.AppendMode.APPEND, true, true); |
if (index == 0 || index == pageCount - 1) { |
final PDImageXObject pdImage = PDImageXObject.createFromByteArray(doc, bOut.toByteArray(), "openconcerto.png"); |
final float h = pdImage.getHeight() / ratio; |
contents.drawImage(pdImage, 40, 10, pdImage.getWidth() / ratio, h); |
} |
contents.beginText(); |
contents.setFont(PDType1Font.HELVETICA, 10); |
contents.newLineAtOffset(250, 20); |
contents.showText("Edition du " + this.dateFormatEcr.format(new Date())); |
contents.endText(); |
contents.beginText(); |
contents.setFont(PDType1Font.HELVETICA, 10); |
contents.newLineAtOffset(500, 20); |
contents.showText("Page " + (index + 1) + " / " + pageCount); |
contents.endText(); |
contents.close(); |
} |
doc.save(f); |
} |
} |
private int drawLine(PDPageContentStream contents, int y, Date dateEcriture, String journal, String mouvement, String piece, String libelle, String codeLettrage, String codePointage, |
Calendar dateLettrage, Calendar datePointage, Double debit, Double credit, Double solde) throws IOException { |
y -= LINE_HEIGHT; |
contents.setFont(PDType1Font.HELVETICA, 7); |
if (dateEcriture != null) { |
drawRightAlign(contents, COL_1_X, y, COL_1_SIZE - 5, this.dateFormatEcr.format(dateEcriture)); |
} |
if (journal != null) { |
contents.beginText(); |
contents.newLineAtOffset(COL_2_X, y); |
contents.showText(cleanString(journal)); |
contents.endText(); |
} |
if (mouvement != null) { |
contents.beginText(); |
contents.newLineAtOffset(COL_3_X, y); |
contents.showText(cleanString(mouvement)); |
contents.endText(); |
} |
contents.beginText(); |
contents.newLineAtOffset(COL_4_X, y); |
contents.showText(cleanString(libelle)); |
contents.endText(); |
drawRightAlign(contents, COL_5_X, y, COL_5_SIZE, this.decimalFormat.format(debit)); |
drawRightAlign(contents, COL_6_X, y, COL_6_SIZE, this.decimalFormat.format(credit)); |
drawRightAlign(contents, COL_7_X, y, COL_7_SIZE, this.decimalFormat.format(solde)); |
contents.setLineWidth(0.5f); |
contents.setStrokingColor(Color.LIGHT_GRAY); |
contents.moveTo(COL_1_X - 4, y - 2f); |
contents.lineTo(COL_7_X + 4 + COL_7_SIZE, y - 2f); |
contents.stroke(); |
return y; |
} |
private int drawRecapLine(PDPageContentStream contents, int y, String num, String libelle, Double debit, Double credit, Double solde, boolean total) throws IOException { |
y -= LINE_HEIGHT; |
contents.setFont(PDType1Font.HELVETICA_BOLD, 7); |
if (!total) { |
contents.beginText(); |
contents.newLineAtOffset(COL_1_X, y); |
contents.showText(num); |
contents.endText(); |
contents.setFont(PDType1Font.HELVETICA, 7); |
contents.beginText(); |
contents.newLineAtOffset(COL_3_X, y); |
contents.showText(cleanString(libelle)); |
contents.endText(); |
} |
drawRightAlign(contents, COL_5_X, y, COL_5_SIZE, this.decimalFormat.format(debit)); |
drawRightAlign(contents, COL_6_X, y, COL_6_SIZE, this.decimalFormat.format(credit)); |
drawRightAlign(contents, COL_7_X, y, COL_7_SIZE, this.decimalFormat.format(solde)); |
if (!total) { |
contents.setLineWidth(0.5f); |
contents.setStrokingColor(Color.LIGHT_GRAY); |
contents.moveTo(COL_1_X - 4, y - 2f); |
contents.lineTo(COL_7_X + 4 + COL_7_SIZE, y - 2f); |
contents.stroke(); |
} |
return y; |
} |
private String cleanString(String s) { |
StringBuilder b = new StringBuilder(s.length()); |
for (char c : s.toCharArray()) { |
if (Character.isLetterOrDigit(c)) { |
b.append(c); |
} else if (c == 'é' || c == 'è' || c == 'ê' || c == 'â' || c == 'à' || c == 'î' || c == 'ù' || c == 'û' || c == 'ô' || c == 'ç') { |
b.append(c); |
} else if (c >= 32 && c < 127) { |
b.append(c); |
} else { |
b.append(' '); |
} |
} |
return b.toString(); |
} |
private void drawRightAlign(PDPageContentStream contents, float x, float y, float width, String text) throws IOException { |
contents.beginText(); |
final float w = PDType1Font.HELVETICA.getStringWidth(text) / 1000.0f * 7f; |
contents.newLineAtOffset(x + width - w, y); |
contents.showText(text); |
contents.endText(); |
} |
private int drawNomCompte(PDPageContentStream contents, int y, String numCpt, String nomCpt) throws IOException { |
y -= LINE_HEIGHT; |
contents.beginText(); |
contents.setFont(PDType1Font.HELVETICA_BOLD, 7); |
contents.newLineAtOffset(COL_1_X, y); |
String string = numCpt + " " + nomCpt.toUpperCase(); |
contents.showText(cleanString(string)); |
contents.endText(); |
return y; |
} |
private int drawCumul(PDPageContentStream contents, int y, Double debit, Double credit, Double solde) throws IOException { |
y -= LINE_HEIGHT; |
contents.setFont(PDType1Font.HELVETICA_BOLD, 7); |
contents.beginText(); |
contents.newLineAtOffset(COL_4_X, y); |
contents.showText("Cumuls antérieurs"); |
contents.endText(); |
drawRightAlign(contents, COL_5_X, y, COL_5_SIZE, this.decimalFormat.format(debit)); |
drawRightAlign(contents, COL_6_X, y, COL_6_SIZE, this.decimalFormat.format(credit)); |
drawRightAlign(contents, COL_7_X, y, COL_7_SIZE, this.decimalFormat.format(solde)); |
return y; |
} |
private int drawHeader(PDPageContentStream contents, String companyName, String title, boolean full) throws IOException { |
int y = 795; |
contents.beginText(); |
contents.setFont(PDType1Font.HELVETICA_BOLD, 14); |
contents.newLineAtOffset(40, y); |
contents.showText("GRAND LIVRE " + companyName.toUpperCase()); |
contents.endText(); |
y -= 17; |
contents.beginText(); |
contents.setFont(PDType1Font.HELVETICA, 12); |
contents.newLineAtOffset(40, y); |
contents.showText(title); |
contents.endText(); |
y -= 20; |
contents.setFont(PDType1Font.HELVETICA_BOLD, 7); |
if (full) { |
contents.beginText(); |
contents.newLineAtOffset(COL_1_X + 5, y); |
contents.showText("DATE"); |
contents.endText(); |
contents.beginText(); |
contents.newLineAtOffset(COL_2_X, y); |
contents.showText("JOURNAL"); |
contents.endText(); |
contents.beginText(); |
contents.newLineAtOffset(COL_3_X, y); |
contents.showText(" MVT"); |
contents.endText(); |
contents.beginText(); |
contents.newLineAtOffset(COL_4_X, y); |
contents.showText("LIBELLE"); |
contents.endText(); |
} else { |
contents.beginText(); |
contents.newLineAtOffset(COL_1_X, y); |
contents.showText("COMPTE"); |
contents.endText(); |
} |
drawRightAlign(contents, COL_5_X, y, COL_5_SIZE, "DEBIT"); |
drawRightAlign(contents, COL_6_X, y, COL_6_SIZE, "CREDIT"); |
drawRightAlign(contents, COL_7_X, y, COL_7_SIZE, "SOLDE CUMULE"); |
y -= 4; |
contents.setStrokingColor(Color.BLACK); |
contents.setLineWidth(1f); |
contents.moveTo(COL_1_X - 4, y); |
contents.lineTo(COL_7_X + COL_7_SIZE + 4, y); |
contents.stroke(); |
return y; |
} |
private int drawSousTotal(PDPageContentStream contents, int y, String numCpt, String nomCpt, long debit, long credit) throws IOException { |
final Map<String, Object> lineRecap = new HashMap<>(); |
lineRecap.put("NUMERO", numCpt); |
lineRecap.put("LIBELLE", nomCpt); |
lineRecap.put("DEBIT", debit); |
lineRecap.put("CREDIT", credit); |
this.recapSousTotaux.add(lineRecap); |
y -= LINE_HEIGHT; |
contents.beginText(); |
contents.setFont(PDType1Font.HELVETICA_BOLD, 7); |
contents.newLineAtOffset(COL_4_X, y); |
contents.showText("Sous-total"); |
contents.endText(); |
drawRightAlign(contents, COL_5_X, y, COL_5_SIZE, this.decimalFormat.format(debit / 100D)); |
drawRightAlign(contents, COL_6_X, y, COL_6_SIZE, this.decimalFormat.format(credit / 100D)); |
drawRightAlign(contents, COL_7_X, y, COL_7_SIZE, this.decimalFormat.format((debit - credit) / 100D)); |
y -= LINE_HEIGHT; |
return y; |
} |
private List<SQLRowValues> fetchEcritures(List<Integer> lCompteSolde) { |
final SQLRowValues vals = new SQLRowValues(this.tableEcriture); |
vals.put("ID_COMPTE_PCE", null); |
vals.put("COMPTE_NUMERO", null); |
vals.put("COMPTE_NOM", null); |
if (this.tableEcriture.contains("NOM_PIECE")) { |
vals.put("NOM_PIECE", null); |
} |
vals.put("ID_JOURNAL", null); |
vals.put("JOURNAL_CODE", null); |
vals.putRowValues("ID_MOUVEMENT").put("NUMERO", null).putRowValues("ID_PIECE").put("NOM", null); |
vals.put("CREDIT", null); |
vals.put("DEBIT", null); |
vals.put("DATE", null); |
vals.put("NOM", null); |
vals.put("LETTRAGE", null); |
vals.put("POINTEE", null); |
vals.put("DATE_LETTRAGE", null); |
vals.put("DATE_POINTEE", null); |
final SQLRowValuesListFetcher fetcher = new SQLRowValuesListFetcher(vals); |
fetcher.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() { |
@Override |
public SQLSelect transformChecked(SQLSelect sel) { |
final Where w = getWhere(lCompteSolde); |
sel.setWhere(w); |
sel.addFieldOrder(GrandLivrePDF.this.tableEcriture.getField("COMPTE_NUMERO")); |
sel.addFieldOrder(GrandLivrePDF.this.tableEcriture.getField("DATE")); |
sel.addFieldOrder(GrandLivrePDF.this.tableMvt.getField("NUMERO")); |
return sel; |
} |
}); |
return fetcher.fetch(); |
} |
private List<Integer> getListeCompteSolde() { |
final SQLSelect sel = new SQLSelect(); |
sel.addSelect(this.tableEcriture.getField("ID_COMPTE_PCE")); |
sel.addSelect(this.tableEcriture.getField("DEBIT"), "SUM"); |
sel.addSelect(this.tableEcriture.getField("CREDIT"), "SUM"); |
final Where w = getWhere(null); |
sel.setWhere(w); |
sel.addGroupBy(this.tableEcriture.getField("ID_COMPTE_PCE")); |
final String req = sel.asString(); |
@SuppressWarnings("unchecked") |
final List<Object[]> l = (List<Object[]>) this.tableCompte.getBase().getDataSource().execute(req, new ArrayListHandler()); |
final List<Integer> list = new ArrayList<>(); |
for (final Object[] o : l) { |
long credit = 0; |
if (o[2] != null) { |
credit = Long.parseLong(o[2].toString()); |
} |
long debit = 0; |
if (o[1] != null) { |
debit = Long.parseLong(o[1].toString()); |
} |
final int id = Integer.parseInt(o[0].toString()); |
final long solde = debit - credit; |
if (solde == 0) { |
list.add(id); |
} |
} |
return list; |
} |
private Where getWhere(final List<Integer> lCompteSolde) { |
Where w = new Where(this.tableEcriture.getField("DATE"), this.dateDu, this.dateAu); |
if (this.compteDeb.equals(this.compteEnd)) { |
w = w.and(new Where(this.tableEcriture.getField("COMPTE_NUMERO"), "=", this.compteDeb)); |
} else { |
w = w.and(new Where(this.tableEcriture.getField("COMPTE_NUMERO"), (Object) this.compteDeb, (Object) this.compteEnd)); |
} |
w = w.and(new Where(this.tableEcriture.getField("ID_JOURNAL"), "!=", this.idJrnlExclude)); |
w = w.and(new Where(this.tableEcriture.getField("ID_MOUVEMENT"), "=", this.tableMvt.getField("ID"))); |
if (this.lettrage == MODELETTREE) { |
w = w.and(new Where(this.tableEcriture.getField("LETTRAGE"), "<>", (Object) null)); |
w = w.and(new Where(this.tableEcriture.getField("LETTRAGE"), "!=", "")); |
w = w.and(new Where(this.tableEcriture.getField("DATE_LETTRAGE"), "<=", this.dateAu)); |
} else if (this.lettrage == MODENONLETTREE_PERIODE) { |
Where w2 = new Where(this.tableEcriture.getField("LETTRAGE"), "=", (Object) null); |
Where wSTTC = new Where(this.tableEcriture.getField("DATE_LETTRAGE"), "<>", (Object) null); |
wSTTC = wSTTC.and(new Where(this.tableEcriture.getField("DATE_LETTRAGE"), ">", this.dateAu)); |
w2 = w2.or(wSTTC); |
w = w.and(w2.or(new Where(this.tableEcriture.getField("LETTRAGE"), "=", ""))); |
} else if (this.lettrage == MODENONLETTREE_ALL) { |
final Where w2 = new Where(this.tableEcriture.getField("LETTRAGE"), "=", (Object) null); |
w = w.and(w2.or(new Where(this.tableEcriture.getField("LETTRAGE"), "=", ""))); |
} |
if (this.excludeCompteSolde && lCompteSolde != null) { |
w = w.and(new Where(this.tableEcriture.getField("ID_COMPTE_PCE"), lCompteSolde).not()); |
} |
w = w.and(new Where(this.tableEcriture.getField("NOM"), "NOT LIKE", "Fermeture du compte%")); |
if (!UserRightsManager.getCurrentUserRights().haveRight(ComptaUserRight.ACCES_NOT_RESCTRICTED_TO_411)) { |
// TODO Show Restricted acces in UI |
w = w.and(new Where(this.tableEcriture.getField("COMPTE_NUMERO"), "LIKE", "411%")); |
} |
return w; |
} |
/** |
* @param d date limite des cumuls |
* @return Map<Integer id compte, Long solde(debit-credit)> |
*/ |
private Map<Integer, Long> getCumulsAnterieur(Date d, List<Integer> listCompteSolde) { |
final SQLSelect sel = new SQLSelect(); |
sel.addSelect(this.tableEcriture.getField("ID_COMPTE_PCE")); |
sel.addSelect(this.tableEcriture.getField("DEBIT"), "SUM"); |
sel.addSelect(this.tableEcriture.getField("CREDIT"), "SUM"); |
sel.addSelect(this.tableEcriture.getField("COMPTE_NUMERO")); |
Where w = new Where(this.tableEcriture.getField("DATE"), "<", d); |
w = w.and(new Where(this.tableEcriture.getField("ID_MOUVEMENT"), "=", this.tableMvt.getKey())); |
if (this.compteDeb.equals(this.compteEnd)) { |
w = w.and(new Where(this.tableEcriture.getField("COMPTE_NUMERO"), "=", this.compteDeb)); |
} else { |
w = w.and(new Where(this.tableEcriture.getField("COMPTE_NUMERO"), (Object) this.compteDeb, (Object) this.compteEnd)); |
} |
if (this.lettrage == MODELETTREE) { |
final Object o = null; |
w = w.and(new Where(this.tableEcriture.getField("LETTRAGE"), "<>", o)); |
w = w.and(new Where(this.tableEcriture.getField("LETTRAGE"), "!=", "")); |
} else { |
if (this.lettrage == MODENONLETTREE_ALL || this.lettrage == MODENONLETTREE_PERIODE) { |
final Object o = null; |
final Where w2 = new Where(this.tableEcriture.getField("LETTRAGE"), "=", o); |
w = w.and(w2.or(new Where(this.tableEcriture.getField("LETTRAGE"), "=", ""))); |
} |
} |
w = w.and(new Where(this.tableEcriture.getField("ID_COMPTE_PCE"), "=", this.tableCompte.getField("ID"))); |
w = w.and(new Where(this.tableEcriture.getField("ID_JOURNAL"), "!=", this.idJrnlExclude)); |
if (listCompteSolde != null) { |
w = w.and(new Where(this.tableEcriture.getField("ID_COMPTE_PCE"), listCompteSolde).not()); |
} |
sel.setWhere(w); |
final String req = sel.asString() + " GROUP BY \"ECRITURE\".\"ID_COMPTE_PCE\", \"ECRITURE\".\"COMPTE_NUMERO\""; |
@SuppressWarnings("unchecked") |
final List<Object[]> l = (List<Object[]>) this.tableEcriture.getBase().getDataSource().execute(req, new ArrayListHandler()); |
final Map<Integer, Long> map = new HashMap<>(); |
final int idCptFourn = ComptePCESQLElement.getId("401", "Fournisseurs"); |
final int idCptClient = ComptePCESQLElement.getId("411", "Clients"); |
for (final Object[] o : l) { |
long credit = 0; |
if (o[2] != null) { |
credit = Long.parseLong(o[2].toString()); |
} |
long debit = 0; |
if (o[1] != null) { |
debit = Long.parseLong(o[1].toString()); |
} |
final int id = Integer.parseInt(o[0].toString()); |
final long solde = debit - credit; |
map.put(id, solde); |
if (o[3] != null) { |
final String numero = o[3].toString(); |
if (this.centralFourn && numero.startsWith("401")) { |
Long lS = map.get(idCptFourn); |
if (lS != null) { |
lS += solde; |
} else { |
lS = solde; |
} |
map.put(idCptFourn, lS); |
} |
if (this.centralClient && numero.startsWith("411")) { |
Long lS = map.get(idCptClient); |
if (lS != null) { |
lS += solde; |
} else { |
lS = solde; |
} |
map.put(idCptClient, lS); |
} |
} |
} |
return map; |
} |
} |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
22,6 → 22,7 |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.utils.GestionDevise; |
import java.io.File; |
import java.text.DateFormat; |
import java.text.SimpleDateFormat; |
import java.util.Date; |
387,8 → 388,7 |
* CHARGES FINANCIERES |
******************************************************************************************/ |
// 294 SommeSolde( 66, 66* )+SommeSolde( 686, 686* ) |
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); |
long v294 = this.sommeCompte.soldeCompte(660, 669, true, this.dateDeb, this.dateFin) + this.sommeCompte.soldeCompte(686, 686, 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(44566, 44566, true, this.dateDeb, this.dateFin); |
long v378 = this.sommeCompte.soldeCompteDebiteur(4456, 4456, true, this.dateDeb, this.dateFin); |
this.m.put("T1.42", GestionDevise.currencyToString(v378, false)); |
SwingUtilities.invokeLater(new Runnable() { |
508,9 → 508,13 |
SwingUtilities.invokeLater(new Runnable() { |
public void run() { |
Gestion.openPDF(p.getGeneratedFile()); |
final File generatedFile = p.getGeneratedFile(); |
if (generatedFile != null) { |
Gestion.openPDF(generatedFile); |
} else { |
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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
279,9 → 279,9 |
this.nbPage++; |
} |
// on conserve la page d'origine du model |
if (this.nbPage > 0) { |
this.nbPage--; |
if (this.nbPage < 1) { |
this.nbPage = 1; |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/VentilationAnalytiquePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
34,6 → 34,7 |
import java.beans.PropertyChangeListener; |
import java.io.File; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.Date; |
import java.util.concurrent.ExecutionException; |
113,7 → 114,7 |
VentilationAnalytiqueSheetXML sheet = new VentilationAnalytiqueSheetXML(dateDeb.getDate(), dateEnd.getDate(), poste); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, false); |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
} catch (InterruptedException e) { |
// TODO Auto-generated catch block |
e.printStackTrace(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/OpenConcerto_2000px.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/report/OpenConcerto_2000px.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/action/ImpressionGrandLivreAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
29,7 → 29,7 |
@Override |
public JFrame createFrame() { |
final PanelFrame panelFrame = new PanelFrame(new ImpressionGrandLivrePanel(), "Impression du grand livre"); |
final PanelFrame panelFrame = new PanelFrame(new ImpressionGrandLivrePanel(), "Grand livre"); |
return panelFrame; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/action/ImportEcritureRImportAction.java |
---|
New file |
0,0 → 1,41 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.core.finance.accounting.action; |
import org.openconcerto.erp.core.finance.accounting.ui.ImportEcritureRImportPanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.ui.FrameUtil; |
import org.openconcerto.ui.PanelFrame; |
import java.awt.event.ActionEvent; |
import javax.swing.AbstractAction; |
public class ImportEcritureRImportAction extends AbstractAction { |
public ImportEcritureRImportAction() { |
super("Import d'écritures RImport (Ciel/Sage)"); |
} |
@Override |
public void actionPerformed(ActionEvent e) { |
final PanelFrame frame = new PanelFrame(new ImportEcritureRImportPanel(Configuration.getInstance().getDirectory()), "Import d'écritures RImport (Ciel/Sage)"); |
frame.pack(); |
frame.setResizable(false); |
frame.setLocationRelativeTo(null); |
FrameUtil.show(frame); |
} |
} |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,6 → 17,7 |
import org.openconcerto.utils.ExceptionHandler; |
import java.awt.event.ActionEvent; |
import java.util.Collections; |
public class ImpressionJournalPayePanel extends ImpressionPayePanel { |
28,7 → 29,7 |
final JournalPaieXmlSheet bSheet = new JournalPaieXmlSheet(selMoisDeb.getSelectedId(), selMoisEnd.getSelectedId(), Integer.valueOf(textAnnee.getText())); |
try { |
bSheet.createDocument(); |
bSheet.showPrintAndExport(true, false, false); |
bSheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
} 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/ImpressionJournauxPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
16,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.GrandLivreSheet; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivrePDF; |
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,6 → 42,7 |
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; |
70,8 → 71,9 |
private JButton annul; |
private JCheckBox checkCentralMois; |
private JCheckBox checkAncienModele; |
private JTextField compteDeb, compteEnd; |
private int mode = GrandLivreSheet.MODEALL; |
private JTextField compteDeb; |
private JTextField compteEnd; |
private int mode = GrandLivrePDF.MODEALL; |
private JProgressBar bar = new JProgressBar(0, 3); |
public ImpressionJournauxPanel() { |
80,8 → 82,6 |
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) { |
// TODO Auto-generated method stub |
mode = GrandLivreSheet.MODEALL; |
ImpressionJournauxPanel.this.mode = GrandLivrePDF.MODEALL; |
} |
}); |
JRadioButton radioLettree = new JRadioButton(new AbstractAction("Lettrées") { |
public void actionPerformed(ActionEvent e) { |
// TODO Auto-generated method stub |
mode = GrandLivreSheet.MODELETTREE; |
ImpressionJournauxPanel.this.mode = GrandLivrePDF.MODELETTREE; |
} |
}); |
JRadioButton radioNonLettree = new JRadioButton(new AbstractAction("Non lettrées") { |
public void actionPerformed(ActionEvent e) { |
// TODO Auto-generated method stub |
mode = GrandLivreSheet.MODENONLETTREE_PERIODE; |
ImpressionJournauxPanel.this.mode = GrandLivrePDF.MODENONLETTREE_PERIODE; |
} |
}); |
JPanel panelMode = new JPanel(); |
207,10 → 207,6 |
// 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; |
255,6 → 251,7 |
} 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() { |
264,7 → 261,9 |
}); |
} 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); |
273,7 → 272,9 |
try { |
xmlSheet.createDocument(); |
xmlSheet.getOrCreatePDFDocumentFile(false, true); |
Gestion.openPDF(xmlSheet.getGeneratedPDFFile()); |
final File generatedPDFFile = xmlSheet.getGeneratedPDFFile(); |
if (generatedPDFFile != null) |
Gestion.openPDF(generatedPDFFile); |
} catch (Exception exn) { |
ExceptionHandler.handle("Erreur lors de la création du journal !", exn); |
} |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
47,7 → 47,7 |
super(new GridBagLayout()); |
JLabel label = new JLabel("Import depuis un fichier au format FEC."); |
final JButton button = new JButton("Sélectionner le ficher"); |
final JButton button = new JButton("Sélectionnez le ficher"); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
c.gridwidth = 2; |
this.add(label, c); |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
139,11 → 139,8 |
this.selCompte = new ISQLCompteSelector(); |
SQLElement eltCpt = directory.getElement("COMPTE_PCE"); |
final ComboSQLRequest createComboRequest = eltCpt.createComboRequest(); |
String function = "REGEXP"; |
if (Configuration.getInstance().getBase().getServer().getSQLSystem() == SQLSystem.POSTGRESQL) { |
function = "~"; |
} |
createComboRequest.setWhere(new Where(eltCpt.getTable().getField("NUMERO"), function, "^4.*$")); |
Where w = createTierWhere(eltCpt); |
createComboRequest.setWhere(w); |
this.selCompte.init(eltCpt, createComboRequest); |
this.selCompte.setValue(idCompte); |
152,6 → 149,22 |
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 |
661,7 → 674,7 |
}); |
// Changement de compte |
this.selCompte.addValueListener(new PropertyChangeListener() { |
this.selCompte.addModelListener("wantedID", new PropertyChangeListener() { |
public void propertyChange(PropertyChangeEvent evt) { |
changeListRequest(); |
727,6 → 740,16 |
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(); |
} |
994,7 → 1017,7 |
* sélection |
*/ |
private void changeListRequest() { |
Object idCpt = this.selCompte.getSelectedId(); |
Object idCpt = this.selCompte.getWantedID(); |
SQLRow row = this.tableComptePCE.getRow(Integer.valueOf(idCpt.toString())); |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
37,11 → 37,12 |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.FontUtils; |
import org.openconcerto.ui.JDate; |
import org.openconcerto.ui.TitledSeparator; |
import org.openconcerto.ui.JLabelBold; |
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; |
92,7 → 93,6 |
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,31 → 147,22 |
} |
}.execute(); |
// c.fill = GridBagConstraints.NONE; |
c.weightx = 1; |
c.gridx++; |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.gridwidth = 2; |
c.fill = GridBagConstraints.NONE; |
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 |
// Numero de releve |
// c.anchor = GridBagConstraints.EAST; |
JLabel labelReleve = new JLabel("N° de relevé"); |
final JLabel labelReleve = new JLabel("N° de relevé"); |
labelReleve.setHorizontalAlignment(SwingConstants.RIGHT); |
this.add(labelReleve, c); |
179,15 → 170,14 |
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.HORIZONTAL; |
c.fill = GridBagConstraints.NONE; |
c.gridwidth = 1; |
c.weightx = 0; |
createPanelWarning(); |
c.gridwidth = 1; |
c.weightx = 1; |
this.add(this.warningPanel, c); |
// Date de pointage |
194,6 → 184,7 |
// 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; |
246,11 → 237,13 |
cCheck.gridx++; |
cCheck.gridwidth = 1; |
this.fieldEcart.setEditable(false); |
panelCheckValue.add(this.fieldEcart, cCheck); |
c.gridx++; |
c.gridwidth = 3; |
c.gridwidth = 1; |
c.weightx = 1; |
c.fill = GridBagConstraints.HORIZONTAL; |
this.add(panelCheckValue, c); |
this.fieldSoldeA.getDocument().addDocumentListener(new SimpleDocumentListener() { |
268,11 → 261,11 |
} |
}); |
TitledSeparator sepPeriode = new TitledSeparator("Filtre "); |
JLabelBold sepPeriode = new JLabelBold("Liste des écritures"); |
c.gridy++; |
c.gridx = 0; |
c.anchor = GridBagConstraints.WEST; |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.gridwidth = 3; |
c.fill = GridBagConstraints.HORIZONTAL; |
this.add(sepPeriode, c); |
281,12 → 274,12 |
c.weightx = 0; |
c.gridwidth = 1; |
c.gridx = 0; |
final JLabel labelEcr = new JLabel("Ecritures"); |
final JLabel labelEcr = new JLabel("Etats"); |
labelEcr.setHorizontalAlignment(SwingConstants.RIGHT); |
this.add(labelEcr, c); |
c.gridx++; |
c.fill = GridBagConstraints.NONE; |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.gridwidth = 2; |
c.weightx = 1; |
this.add(panelSelectEcritures, c); |
c.fill = GridBagConstraints.HORIZONTAL; |
326,16 → 319,9 |
c.weightx = 1; |
c.fill = GridBagConstraints.NONE; |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.gridwidth = 2; |
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())); |
345,114 → 331,16 |
c.weighty = 1; |
c.weightx = 1; |
c.fill = GridBagConstraints.BOTH; |
c.gridwidth = GridBagConstraints.REMAINDER; |
c.gridwidth = 3; |
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; |
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) { |
this.add(createBottomPanel(), c); |
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.addValueListener(new PropertyChangeListener() { |
this.selCompte.addModelListener("wantedID", new PropertyChangeListener() { |
public void propertyChange(PropertyChangeEvent evt) { |
changeListRequest(); |
530,6 → 418,96 |
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(); |
536,7 → 514,6 |
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); |
550,7 → 527,6 |
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); |
} |
559,7 → 535,6 |
menu.add(new AbstractAction("Dépointer") { |
public void actionPerformed(ActionEvent e) { |
int rowIndex = PointagePanel.this.ecriturePanel.getListe().getJTable().rowAtPoint(mE.getPoint()); |
actionDepointage(rowIndex); |
} |
637,7 → 612,7 |
} |
public ListPanelEcritures getEcriturePanel() { |
return ecriturePanel; |
return this.ecriturePanel; |
} |
// Pointe la ligne passée en parametre |
668,7 → 643,7 |
* sélection |
*/ |
private void changeListRequest() { |
Object idCpt = this.selCompte.getSelectedId(); |
Object idCpt = this.selCompte.getWantedID(); |
// filtre de selection |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,7 → 15,7 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.config.Gestion; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivreSheet; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivrePDF; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivreSheetXML; |
import org.openconcerto.erp.generationDoc.SpreadSheetGeneratorListener; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
25,6 → 25,8 |
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; |
33,16 → 35,18 |
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; |
54,13 → 58,15 |
public class ImpressionGrandLivrePanel extends JPanel implements SpreadSheetGeneratorListener { |
private final JDate dateDeb, dateEnd; |
private JButton valid; |
private final JDate dateDeb; |
private final JDate dateEnd; |
private JButton validPDF; |
private JButton validODS; |
private JButton annul; |
private JCheckBox checkImpr; |
private JCheckBox checkVisu; |
private JTextField compteDeb, compteEnd; |
private int mode = GrandLivreSheet.MODEALL; |
private int mode = GrandLivrePDF.MODEALL; |
private JProgressBar bar = new JProgressBar(0, 3); |
public ImpressionGrandLivrePanel() { |
67,8 → 73,9 |
this.setLayout(new GridBagLayout()); |
final GridBagConstraints c = new DefaultGridBagConstraints(); |
SQLRow rowSociete = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete(); |
SQLRow rowExercice = Configuration.getInstance().getBase().getTable("EXERCICE_COMMON").getRow(rowSociete.getInt("ID_EXERCICE_COMMON")); |
final ComptaPropsConfiguration comptaPropsConfiguration = (ComptaPropsConfiguration) Configuration.getInstance(); |
SQLRow rowSociete = comptaPropsConfiguration.getRowSociete(); |
SQLRow rowExercice = comptaPropsConfiguration.getBase().getTable("EXERCICE_COMMON").getRow(rowSociete.getInt("ID_EXERCICE_COMMON")); |
this.dateDeb = new JDate(); |
this.dateEnd = new JDate(); |
77,7 → 84,7 |
c.weightx = 0; |
this.add(new JLabel("Période du", SwingConstants.RIGHT), c); |
c.gridx++; |
c.weightx = 1; |
c.weightx = 0; |
this.add(this.dateDeb, c); |
// Chargement des valeurs par défaut |
String valueDateDeb = DefaultNXProps.getInstance().getStringProperty("GrandLivreDateDeb"); |
164,25 → 171,25 |
// Radio mode |
JRadioButton radioAll = new JRadioButton(new AbstractAction("Toutes") { |
public void actionPerformed(ActionEvent e) { |
mode = GrandLivreSheet.MODEALL; |
mode = GrandLivrePDF.MODEALL; |
} |
}); |
JRadioButton radioLettree = new JRadioButton(new AbstractAction("Lettrées") { |
public void actionPerformed(ActionEvent e) { |
mode = GrandLivreSheet.MODELETTREE; |
mode = GrandLivrePDF.MODELETTREE; |
} |
}); |
JRadioButton radioNonLettree = new JRadioButton(new AbstractAction("Non lettrées") { |
public void actionPerformed(ActionEvent e) { |
mode = GrandLivreSheet.MODENONLETTREE_ALL; |
mode = GrandLivrePDF.MODENONLETTREE_ALL; |
} |
}); |
JRadioButton radioNonLettreePeridod = new JRadioButton(new AbstractAction("Non lettrées sur la période") { |
public void actionPerformed(ActionEvent e) { |
mode = GrandLivreSheet.MODENONLETTREE_PERIODE; |
mode = GrandLivrePDF.MODENONLETTREE_PERIODE; |
} |
}); |
225,17 → 232,13 |
this.bar.setStringPainted(true); |
this.add(this.bar, c); |
this.valid = new JButton("Valider"); |
this.validPDF = new JButton("PDF"); |
this.validODS = new JButton("Tableur"); |
this.annul = new JButton("Fermer"); |
this.checkImpr = new JCheckBox("Impression"); |
this.checkVisu = new JCheckBox("Visualisation"); |
// Print & View |
final JPanel panelPrintView = new JPanel(new FlowLayout(FlowLayout.LEADING, 2, 0)); |
// OK, Cancel |
panelPrintView.add(this.checkImpr); |
panelPrintView.add(this.checkVisu); |
this.checkImpr.setSelected(true); |
c.gridx = 0; |
c.gridy++; |
c.gridwidth = 4; |
243,68 → 246,98 |
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.valid); |
panelOkCancel.add(this.validODS); |
panelOkCancel.add(this.validPDF); |
panelOkCancel.add(this.annul); |
this.add(panelOkCancel, c); |
this.checkValidity(); |
this.valid.addActionListener(new ActionListener() { |
this.validPDF.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
valid.setEnabled(false); |
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); |
bar.setString(null); |
bar.setValue(1); |
bar.setValue(0); |
// un fichier a été choisi (sortie par OK) |
// nom du fichier choisi |
final File file = chooser.getSelectedFile(); |
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 { |
bSheet.createDocument(); |
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() { |
if (bSheet.getSize() == 0) { |
JOptionPane.showMessageDialog(ImpressionGrandLivrePanel.this, "Aucune écriture trouvée"); |
@Override |
public void run() { |
Gestion.openPDF(file); |
} |
}); |
} else { |
} catch (Exception exn) { |
ExceptionHandler.handle("Erreur de génération du grand livre", exn); |
exn.printStackTrace(); |
} finally { |
taskEnd(); |
} |
} |
}).start(); |
} |
SwingUtilities.invokeLater(new Runnable() { |
} |
}); |
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() { |
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); |
// bSheet.showPrintAndExport(false, false, true, true); |
SwingUtilities.invokeLater(new Runnable() { |
@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) { |
// TODO Bloc catch auto-généré |
ExceptionHandler.handle("Erreur de génération du grand livre", exn); |
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(); |
} |
362,19 → 395,23 |
Date beginDate = this.dateDeb.getDate(); |
Date endDate = this.dateEnd.getDate(); |
// System.err.println("Check validity between "); |
this.valid.setEnabled(true); |
this.validODS.setEnabled(true); |
this.validPDF.setEnabled(true); |
if (beginDate == null || endDate == null) { |
this.valid.setEnabled(false); |
this.validODS.setEnabled(false); |
this.validPDF.setEnabled(false); |
} else { |
if (this.compteDeb.getText().trim().length() == 0 || this.compteEnd.getText().trim().length() == 0) { |
this.valid.setEnabled(false); |
this.validODS.setEnabled(false); |
this.validPDF.setEnabled(false); |
} else { |
if (this.compteDeb.getText().trim().compareToIgnoreCase(this.compteEnd.getText().trim()) > 0) { |
this.valid.setEnabled(false); |
this.validODS.setEnabled(false); |
this.validPDF.setEnabled(false); |
} else { |
if (beginDate.after(endDate)) { |
this.valid.setEnabled(false); |
this.validODS.setEnabled(false); |
this.validPDF.setEnabled(false); |
} |
} |
} |
404,6 → 441,7 |
public void taskEnd() { |
bar.setValue(3); |
bar.setString("Terminée"); |
valid.setEnabled(true); |
validPDF.setEnabled(true); |
validODS.setEnabled(true); |
} |
} |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
27,6 → 27,7 |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.util.Calendar; |
import java.util.Collections; |
import javax.swing.JButton; |
import javax.swing.JFrame; |
99,7 → 100,7 |
int year = Integer.valueOf(this.spinYear.getValue().toString()); |
PointageXmlSheet sheet = new PointageXmlSheet(mois, year); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(true, false, true); |
sheet.showPrintAndExportAsynchronous(true, false, true, Collections.emptyList()); |
} else { |
if (e.getSource() == this.close) { |
((JFrame) SwingUtilities.getRoot(this)).dispose(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/accounting/ui/ImportEcritureRImportPanel.java |
---|
New file |
0,0 → 1,106 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.core.finance.accounting.ui; |
import org.openconcerto.erp.panel.compta.ImportFEC; |
import org.openconcerto.erp.panel.compta.ImportRImport; |
import org.openconcerto.sql.element.SQLElementDirectory; |
import org.openconcerto.sql.users.UserManager; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.ReloadPanel; |
import org.openconcerto.ui.SwingThreadUtils; |
import java.awt.FileDialog; |
import java.awt.Frame; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionListener; |
import java.io.File; |
import java.io.IOException; |
import java.sql.SQLException; |
import javax.swing.JButton; |
import javax.swing.JLabel; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
import javax.swing.SwingUtilities; |
public class ImportEcritureRImportPanel extends JPanel { |
public ImportEcritureRImportPanel(final SQLElementDirectory dir) { |
super(new GridBagLayout()); |
JLabel label = new JLabel("Import depuis un fichier au format RImport (Ciel/Sage)."); |
final JButton button = new JButton("Sélectionnez le ficher"); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
c.gridwidth = 2; |
this.add(label, c); |
c.gridy++; |
c.gridwidth = 1; |
c.weightx = 1; |
final ReloadPanel rlPanel = new ReloadPanel(); |
c.anchor = GridBagConstraints.EAST; |
c.fill = GridBagConstraints.NONE; |
this.add(rlPanel, c); |
c.gridx++; |
c.weightx = 0; |
this.add(button, c); |
button.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
button.setEnabled(false); |
final Frame frame = SwingThreadUtils.getAncestorOrSelf(Frame.class, ImportEcritureRImportPanel.this); |
final FileDialog fd = new FileDialog(frame, "Import d'écritures", FileDialog.LOAD); |
fd.setVisible(true); |
rlPanel.setMode(ReloadPanel.MODE_ROTATE); |
if (fd.getFile() != null) { |
new Thread() { |
@Override |
public void run() { |
final File fileToImport = new File(fd.getDirectory(), fd.getFile()); |
ImportRImport fec = new ImportRImport(); |
try { |
fec.loadFrom(fileToImport); |
fec.importTo(dir, dir.getElement("ECRITURE").getTable().getDBRoot(), UserManager.getUser()); |
} catch (IOException e) { |
// TODO Auto-generated catch block |
e.printStackTrace(); |
} catch (SQLException e) { |
// TODO Auto-generated catch block |
e.printStackTrace(); |
} finally { |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
public void run() { |
if (fd != null) { |
rlPanel.setMode(ReloadPanel.MODE_EMPTY); |
} |
JOptionPane.showMessageDialog(null, "Import terminé!"); |
} |
}); |
} |
} |
}.start(); |
} |
} |
}); |
} |
} |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
203,10 → 203,8 |
String req = sel.asString() + " GROUP BY \"COMPTE_PCE\".\"ID\",\"COMPTE_PCE\".\"NUMERO\",\"COMPTE_PCE\".\"NOM\" ORDER BY \"COMPTE_PCE\".\"NUMERO\""; |
System.out.println(req); |
Object ob = base.getDataSource().execute(req, new ArrayListHandler()); |
List myList = (List) 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/tax/action/ReportingEcoContributionPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
26,6 → 26,7 |
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; |
76,7 → 77,7 |
} catch (ExecutionException exn) { |
exn.printStackTrace(); |
} |
sheet.showPrintAndExport(true, false, false); |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
}; |
}.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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
26,6 → 26,7 |
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; |
76,7 → 77,7 |
} catch (ExecutionException exn) { |
exn.printStackTrace(); |
} |
sheet.showPrintAndExport(true, false, false); |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
}; |
}.start(); |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
14,13 → 14,19 |
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; |
31,11 → 37,13 |
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; |
105,6 → 113,8 |
public SQLComponent createComponent() { |
return new BaseSQLComponent(this) { |
TaxeCategorieComptableTable tableCatComptable = new TaxeCategorieComptableTable(getElement().getDirectory().getElement(TaxeCatComptableSQLElement.class)); |
@Override |
protected void addViews() { |
209,12 → 219,15 |
ISQLCompteSelector compteDedIntra = new ISQLCompteSelector(); |
this.add(compteDedIntra, c); |
// Spacer |
c.gridy++; |
c.gridx = 0; |
c.weighty = 1; |
c.anchor = GridBagConstraints.NORTHWEST; |
this.add(new JPanel(), c); |
c.weightx = 1; |
c.fill = GridBagConstraints.BOTH; |
c.gridwidth = GridBagConstraints.REMAINDER; |
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"); |
225,6 → 238,104 |
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/payment/component/EncaisserMontantSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,6 → 17,7 |
import org.openconcerto.erp.core.common.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; |
94,6 → 95,7 |
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(); |
110,8 → 112,10 |
if (rowModeRegl != null) { |
System.err.println("Set mode de règlement"); |
int idTypeRegl = rowModeRegl.getInt("ID_TYPE_REGLEMENT"); |
SQLTable tableModeRegl = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT").getTable(); |
SQLRowValues rowVals = new SQLRowValues(tableModeRegl); |
SQLRowValues rowVals = new SQLRowValues(rowModeRegl.getTable()); |
if (idTypeRegl == TypeReglementSQLElement.VIREMENT || rowModeRegl.getForeign("ID_TYPE_REGLEMENT").getBoolean("ECHEANCE")) { |
idTypeRegl = TypeReglementSQLElement.VIREMENT; |
} |
rowVals.put("ID_TYPE_REGLEMENT", idTypeRegl); |
rowVals.put("COMPTANT", Boolean.TRUE); |
rowVals.put("AJOURS", 0); |
196,6 → 200,9 |
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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
322,9 → 322,9 |
this.panelEcheance.add(new JLabel("A"), c); |
c.gridx++; |
c.gridwidth = 1; |
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.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.addValueListener(new PropertyChangeListener() { |
@Override |
367,9 → 367,9 |
this.panelEcheance.add(this.buttonLe, c); |
c.gridx++; |
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.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.addValueListener(new PropertyChangeListener() { |
@Override |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
72,6 → 72,7 |
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()); |
82,8 → 83,20 |
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); |
118,7 → 131,10 |
@Override |
public Set<String> getReadOnlyFields() { |
return Collections.singleton("ID_CLIENT"); |
Set<String> s = new HashSet<>(); |
s.add("ACOMPTE"); |
s.add("ID_CLIENT"); |
return s; |
} |
@Override |
159,22 → 175,47 |
// On rétablit les échéances |
for (SQLRow row : trees.getRows()) { |
for (SQLRow rowEncaisse : row.getReferentRows()) { |
for (SQLRow rowEncaisseItems : row.getReferentRows(row.getTable().getTable("ENCAISSER_MONTANT_ELEMENT").getField("ID_ENCAISSER_MONTANT"))) { |
SQLRow rowEch = rowEncaisse.getForeignRow("ID_ECHEANCE_CLIENT"); |
SQLRow rowEch = rowEncaisseItems.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", rowEncaisse.getLong("MONTANT_REGLE")); |
rowVals.put("MONTANT", rowEncaisseItems.getLong("MONTANT_REGLE")); |
} else { |
rowVals.put("MONTANT", rowEch.getLong("MONTANT") + rowEncaisse.getLong("MONTANT_REGLE")); |
rowVals.put("MONTANT", rowEch.getLong("MONTANT") + rowEncaisseItems.getLong("MONTANT_REGLE")); |
} |
rowVals.update(); |
} |
Configuration.getInstance().getDirectory().getElement(rowEncaisse.getTable()).archive(rowEncaisse); |
Configuration.getInstance().getDirectory().getElement(rowEncaisseItems.getTable()).archive(rowEncaisseItems); |
} |
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/element/DepotChequeSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
34,7 → 34,7 |
public DepotChequeSQLElement() { |
super("DEPOT_CHEQUE", "un dépot de chèque", "dépots de chèque"); |
MouseSheetXmlListeListener listener = new MouseSheetXmlListeListener(DepotChequeXmlSheet.class); |
MouseSheetXmlListeListener listener = new MouseSheetXmlListeListener(this, 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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
33,6 → 33,7 |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.Date; |
import java.util.List; |
81,7 → 82,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); |
sheet.showPrintAndExportAsynchronous(true, false, true, Collections.emptyList()); |
} |
@Override |
107,7 → 108,6 |
} |
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/action/ListeDesEncaissementsAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
56,7 → 56,7 |
if (source == this.buttonEffacer) { |
List<SQLRowValues> rowValsSel = this.getListe().getSelectedRows(); |
if (isEncaissementEditable(rowValsSel, "effacer")) { |
if ((rowValsSel.size() == 1 && rowValsSel.get(0).getBoolean("ACOMPTE")) || isEncaissementEditable(rowValsSel, "effacer")) { |
super.handleAction(source, evt); |
} |
} else if (source == this.buttonModifier) { |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
117,8 → 117,24 |
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"); |
217,7 → 233,7 |
c.gridy++; |
this.add(labelUser, c); |
c.gridx++; |
c.weightx = 0; |
c.weightx = 1; |
c.fill = GridBagConstraints.NONE; |
this.add(comboUser, c); |
this.addView(comboUser, "ID_USER_COMMON"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/ArretChomageIntemperieSQLElement.java |
---|
New file |
0,0 → 1,162 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.core.humanresources.payroll.element; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.sql.element.BaseSQLComponent; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.sqlobject.SQLRequestComboBox; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.JDate; |
import org.openconcerto.utils.ListMap; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.util.ArrayList; |
import java.util.List; |
import javax.swing.BorderFactory; |
import javax.swing.JLabel; |
import javax.swing.JPanel; |
public class ArretChomageIntemperieSQLElement extends ComptaSQLConfElement { |
public ArretChomageIntemperieSQLElement() { |
super("ARRET_CHOMAGE_INTEMPERIE", "un arrêt chômage ou intempéries", "arrêts chômages ou intempéries"); |
} |
protected List<String> getListFields() { |
final List<String> l = new ArrayList<String>(); |
l.add("ID_INFOS_SALARIE_PAYE"); |
l.add("ID_CODE_AMENAGEMENT_PARTIEL"); |
l.add("DATE_DEBUT_SUSPENSION"); |
l.add("DATE_FIN_SUSPENSION"); |
return l; |
} |
protected List<String> getComboFields() { |
final List<String> l = new ArrayList<String>(); |
l.add("ID_INFOS_SALARIE_PAYE"); |
l.add("ID_CODE_AMENAGEMENT_PARTIEL"); |
l.add("DATE_DEBUT_SUSPENSION"); |
l.add("DATE_FIN_SUSPENSION"); |
return l; |
} |
@Override |
public ListMap<String, String> getShowAs() { |
ListMap<String, String> map = new ListMap<String, String>(); |
map.addAll(null, "ID_INFOS_SALARIE_PAYE", "ID_CODE_AMENAGEMENT_PARTIEL", "DATE_DEBUT_SUSPENSION", "DATE_FIN_SUSPENSION"); |
map.addAll("ID_INFOS_SALARIE_PAYE", "ID_CONTRAT_SALARIE"); |
map.addAll("ID_CODE_AMENAGEMENT_PARTIEL", "CODE"); |
return map; |
} |
/* |
* (non-Javadoc) |
* |
* @see org.openconcerto.devis.SQLElement#getComponent() |
*/ |
public SQLComponent createComponent() { |
return new BaseSQLComponent(this) { |
public void addViews() { |
this.setLayout(new GridBagLayout()); |
final GridBagConstraints c = new DefaultGridBagConstraints(); |
/*********************************************************************************** |
* Renseignements |
**********************************************************************************/ |
JPanel panelInfos = new JPanel(); |
panelInfos.setBorder(BorderFactory.createTitledBorder("Renseignements (S21.G00.65)")); |
panelInfos.setLayout(new GridBagLayout()); |
// Nom |
JLabel labelContratSalarie = new JLabel(getLabelFor("ID_INFOS_SALARIE_PAYE")); |
SQLRequestComboBox textContratSalarie = new SQLRequestComboBox(); |
// c.gridx++; |
c.weightx = 0; |
panelInfos.add(labelContratSalarie, c); |
c.gridx++; |
c.weightx = 1; |
panelInfos.add(textContratSalarie, c); |
this.addView(textContratSalarie, "ID_INFOS_SALARIE_PAYE", REQ); |
c.weightx = 0; |
// Ref |
JLabel labelMotif = new JLabel(getLabelFor("ID_CODE_AMENAGEMENT_PARTIEL")); |
SQLRequestComboBox comboMotif = new SQLRequestComboBox(); |
c.gridx = 0; |
c.gridy++; |
panelInfos.add(labelMotif, c); |
c.gridx++; |
c.weightx = 1; |
panelInfos.add(comboMotif, c); |
this.addView(comboMotif, "ID_CODE_AMENAGEMENT_PARTIEL", REQ); |
c.weightx = 0; |
// Nom |
JLabel labelCodeSuspension = new JLabel(getLabelFor("ID_CODE_SUSPENSION")); |
SQLRequestComboBox textCodeSupension = new SQLRequestComboBox(); |
c.gridx++; |
c.weightx = 0; |
panelInfos.add(labelCodeSuspension, c); |
c.gridx++; |
c.weightx = 1; |
panelInfos.add(textCodeSupension, c); |
this.addView(textCodeSupension, "ID_CODE_SUSPENSION", REQ); |
// Deb |
JLabel labelDateDeb = new JLabel(getLabelFor("DATE_DEBUT_SUSPENSION")); |
JDate dateDeb = new JDate(); |
c.gridx = 0; |
c.gridy++; |
c.weightx = 0; |
panelInfos.add(labelDateDeb, c); |
c.gridx++; |
c.weightx = 1; |
panelInfos.add(dateDeb, c); |
this.addSQLObject(dateDeb, "DATE_DEBUT_SUSPENSION", REQ); |
c.weightx = 0; |
// Fin |
JLabel labelDateFin = new JLabel(getLabelFor("DATE_FIN_SUSPENSION")); |
JDate dateFin = new JDate(); |
c.gridx++; |
panelInfos.add(labelDateFin, c); |
c.gridx++; |
c.weightx = 1; |
panelInfos.add(dateFin, c); |
this.addSQLObject(dateFin, "DATE_FIN_SUSPENSION", REQ); |
c.gridx = 0; |
c.gridy++; |
c.fill = GridBagConstraints.BOTH; |
c.weightx = 1; |
c.weighty = 1; |
this.add(panelInfos, c); |
} |
}; |
} |
@Override |
protected String createCodeSuffix() { |
return ".suspension.contract"; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/MotifNonAssujettisTASQLElement.java |
---|
New file |
0,0 → 1,27 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.core.humanresources.payroll.element; |
import org.openconcerto.sql.model.DBRoot; |
public class MotifNonAssujettisTASQLElement extends AbstractCodeCommonSQLElement { |
public MotifNonAssujettisTASQLElement(final DBRoot root) { |
super(root.getTable("MOTIF_NON_ASSUJETIS_TA"), "un motif de non assujettissements TA", "motif de non assujettissements TA"); |
} |
@Override |
protected String createCode() { |
return "humanresources.motifta.code"; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/humanresources/payroll/element/CodeCaisseCongesPayesSQLElement.java |
---|
New file |
0,0 → 1,27 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.core.humanresources.payroll.element; |
import org.openconcerto.sql.model.DBRoot; |
public class CodeCaisseCongesPayesSQLElement extends AbstractCodeCommonSQLElement { |
public CodeCaisseCongesPayesSQLElement(final DBRoot root) { |
super(root.getTable("CODE_CAISSE_CONGES_PAYES"), "un code de caisse de congés payés", "codes de caisse de congés payés"); |
} |
@Override |
protected String createCode() { |
return "humanresources.congespayes.code"; |
} |
} |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
273,6 → 273,32 |
} |
} |
// 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 |
425,54 → 451,55 |
this.add(textDateFin, c); |
addSQLObject(textDateFin, "DATE_PREV_FIN"); |
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"); |
// 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 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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
64,6 → 64,7 |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.Date; |
import java.util.List; |
86,7 → 87,7 |
public FichePayeSQLElement() { |
super("FICHE_PAYE", "une fiche de paye", "fiches de paye"); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(FichePayeSheetXML.class); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(this, FichePayeSheetXML.class); |
getRowActions().addAll(l.getRowActions()); |
PredicateRowAction actionCumuls = new PredicateRowAction(new AbstractAction("Détails cumuls et variables") { |
110,7 → 111,7 |
FichePayeSheetXML sheet = new FichePayeSheetXML(row, false); |
try { |
sheet.createDocument(); |
sheet.showPrintAndExport(true, false, true); |
sheet.showPrintAndExport(true, false, true, Collections.emptyList()); |
} catch (Exception e1) { |
ExceptionHandler.handle("Erreur lors de la création du document.", e1); |
} |
438,6 → 439,18 |
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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,10 → 13,12 |
package org.openconcerto.erp.core.humanresources.payroll.element; |
public class CodeIdccSQLElement extends AbstractCodeSQLElement { |
import org.openconcerto.sql.model.DBRoot; |
public CodeIdccSQLElement() { |
super("IDCC", "un code de convention", "codes de conventions"); |
public class CodeIdccSQLElement extends AbstractCodeCommonSQLElement { |
public CodeIdccSQLElement(final DBRoot root) { |
super(root.getTable("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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
31,6 → 31,7 |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.List; |
288,6 → 289,7 |
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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
356,15 → 356,12 |
} |
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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
267,12 → 267,10 |
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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
197,6 → 197,11 |
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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
87,7 → 87,7 |
final SQLRow rowFiche = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getTable("FICHE_PAYE").getRow(frame.getPanel().getListe().getSelectedId()); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(FichePayeSheetXML.class); |
MouseSheetXmlListeListener l = new MouseSheetXmlListeListener(elt, 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/url-icon.png |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/FilePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
89,6 → 89,8 |
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")); |
} |
368,12 → 370,17 |
// 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); |
380,7 → 387,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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
26,6 → 26,7 |
import java.awt.Color; |
import java.awt.Component; |
import java.awt.Desktop; |
import java.awt.Dimension; |
import java.awt.FileDialog; |
import java.awt.FlowLayout; |
43,6 → 44,8 |
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; |
212,6 → 215,8 |
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); |
260,6 → 265,24 |
} |
}); |
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() { |
310,6 → 333,12 |
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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
50,6 → 50,7 |
import javax.crypto.spec.GCMParameterSpec; |
import javax.crypto.spec.SecretKeySpec; |
import javax.swing.JOptionPane; |
import javax.swing.SwingUtilities; |
public class AttachmentUtils { |
241,6 → 242,22 |
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(); |
292,7 → 309,17 |
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/edm/AttachmentAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
30,7 → 30,7 |
@Override |
public void actionPerformed(ActionEvent e) { |
SQLRowAccessor row = IListe.get(e).getSelectedRow(); |
SQLRowAccessor row = IListe.get(e).getSelectedRowAccessor(); |
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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
30,6 → 30,7 |
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/sales/shipment/element/BonDeLivraisonSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
16,7 → 16,6 |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
29,13 → 28,18 |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLSelect; |
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.request.ListSQLRequest; |
import org.openconcerto.sql.request.UpdateBuilder; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.EditPanel; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.RowAction; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.sql.view.list.action.ListEvent; |
import org.openconcerto.ui.preferences.DefaultProps; |
import org.openconcerto.utils.ListMap; |
42,6 → 46,7 |
import java.awt.event.ActionEvent; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.List; |
import javax.swing.AbstractAction; |
55,8 → 60,44 |
public BonDeLivraisonSQLElement(String single, String plural) { |
super("BON_DE_LIVRAISON", single, plural); |
// Verrou facture |
if (getTable().contains("VERROU_FACTURATION")) { |
PredicateRowAction lock = new PredicateRowAction(new AbstractAction("Verrouiller") { |
@Override |
public void actionPerformed(ActionEvent e) { |
updateVerrouFacture(IListe.get(e).getSelectedRowAccessors(), true); |
} |
}, false); |
lock.setPredicate(ListEvent.getNonEmptySelectionPredicate()); |
lock.setPath(Arrays.asList("Verrou facturaction", "Verrou facturaction", "Verrou facturaction")); |
PredicateRowAction unlock = new PredicateRowAction(new AbstractAction("Déverrouiller") { |
@Override |
public void actionPerformed(ActionEvent e) { |
updateVerrouFacture(IListe.get(e).getSelectedRowAccessors(), false); |
} |
}, false); |
unlock.setPath(Arrays.asList("Verrou facturaction", "Verrou facturaction", "Verrou facturaction")); |
unlock.setPredicate(ListEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(lock); |
getRowActions().add(unlock); |
} |
} |
@Override |
protected void _initListRequest(ListSQLRequest req) { |
super._initListRequest(req); |
req.addToGraphToFetch("VERROU_FACTURATION"); |
} |
private void updateVerrouFacture(List<SQLRowAccessor> rows, boolean state) { |
UpdateBuilder builder = new UpdateBuilder(getTable()); |
builder.setObject("VERROU_FACTURATION", state); |
builder.setWhere(Where.inValues(getTable().getKey(), SQLRow.getIDs(rows))); |
getTable().getDBSystemRoot().getDataSource().execute(builder.asString()); |
getTable().fireTableModified(); |
} |
public BonDeLivraisonSQLElement() { |
this("un bon de livraison", "bons de livraison"); |
} |
148,12 → 189,9 |
List<Integer> ids = new ArrayList<>(); |
for (SQLRow row : trees.getRows()) { |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
cmds.addAll(getSourceTrRowsFrom(row.getID(), "COMMANDE_CLIENT_ELEMENT", "COMMANDE_CLIENT")); |
devis.addAll(getSourceTrRowsFrom(row.getID(), "DEVIS_ELEMENT", "DEVIS")); |
ids.add(row.getID()); |
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) { |
// Mise à jour des stocks |
SQLElement eltMvtStock = Configuration.getInstance().getDirectory().getElement("MOUVEMENT_STOCK"); |
171,8 → 209,8 |
eltMvtStock.archive(((Number) tmp[0]).intValue()); |
} |
} |
} |
} |
super.archive(trees, cutLinks); |
updateQteLivree(devis, "DEVIS_ELEMENT", "DEVIS"); |
199,6 → 237,22 |
}; |
} |
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)); |
} |
} |
@Override |
protected String createCodeSuffix() { |
return ".delivery.note"; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/report/BonLivraisonXmlSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
14,6 → 14,7 |
package org.openconcerto.erp.core.sales.shipment.report; |
import org.openconcerto.erp.generationDoc.AbstractSheetXMLWithDate; |
import org.openconcerto.erp.generationDoc.gestcomm.OptionDocProcessor; |
import org.openconcerto.erp.preferences.PrinterNXProps; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.model.SQLRow; |
42,7 → 43,7 |
super(row); |
this.printer = PrinterNXProps.getInstance().getStringProperty("BonPrinter"); |
this.elt = Configuration.getInstance().getDirectory().getElement("BON_DE_LIVRAISON"); |
this.setPostProcess(new OptionDocProcessor()); |
} |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/action/ListeDesBonsDeLivraisonAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
64,13 → 64,26 |
@Override |
protected JFrame instantiateFrame() { |
final JFrame frame = new JFrame(String.valueOf(getValue(NAME))); |
PredicateRowAction toInvoiceAction = new PredicateRowAction(new AbstractAction() { |
RowAction toInvoiceAction = new RowAction(new AbstractAction() { |
public void actionPerformed(ActionEvent e) { |
transfertFactureClient(IListe.get(e).getSelectedRows()); |
} |
}, false, "sales.shipment.create.invoice"); |
toInvoiceAction.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
}, false, "sales.shipment.create.invoice") { |
@Override |
public boolean enabledFor(List<SQLRowValues> selection) { |
if (!selection.isEmpty()) { |
for (SQLRowValues sqlRowValues : selection) { |
if (sqlRowValues.getBoolean("VERROU_FACTURATION")) { |
return false; |
} |
} |
return true; |
} |
return false; |
} |
}; |
// Tabs |
final JTabbedPane tabs = new JTabbedPane(); |
tabs.addTab(getConf().getERP_TM().translate("sales.shipment.allShipments"), createAllDeliveryPanel(toInvoiceAction)); |
98,7 → 111,7 |
// Date panel |
final IListFilterDatePanel datePanel = new IListFilterDatePanel(panel.getListe(), eltCmd.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap()); |
panel.getListe().addIListeActions(new MouseSheetXmlListeListener(BonLivraisonXmlSheet.class) { |
panel.getListe().addIListeActions(new MouseSheetXmlListeListener(eltCmd, BonLivraisonXmlSheet.class) { |
@Override |
public List<RowAction> addToMenu() { |
return allowedActions; |
126,7 → 139,7 |
return panel; |
} |
JPanel createAllDeliveryPanel(final PredicateRowAction toInvoiceAction) { |
JPanel createAllDeliveryPanel(final RowAction toInvoiceAction) { |
final BonDeLivraisonSQLElement eltCmd = getElem(); |
final SQLTableModelSourceOnline tableSource = eltCmd.getTableSource(true); |
final List<RowAction> allowedActions = new ArrayList<RowAction>(); |
182,7 → 195,7 |
return panel; |
} |
JPanel createDeliveryWithoutInvoicePanel(PredicateRowAction toInvoiceAction) { |
JPanel createDeliveryWithoutInvoicePanel(RowAction toInvoiceAction) { |
final BonDeLivraisonSQLElement eltCmd = getElem(); |
final SQLTableModelSourceOnline tableSource = eltCmd.getTableSource(true); |
final List<RowAction> allowedActions = new ArrayList<RowAction>(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/ui/BonDeLivraisonItemTable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
20,6 → 20,9 |
import org.openconcerto.erp.core.common.ui.DeviseNumericCellEditor; |
import org.openconcerto.erp.core.common.ui.DeviseNumericHTConvertorCellEditor; |
import org.openconcerto.erp.core.common.ui.DeviseTableCellRenderer; |
import org.openconcerto.erp.core.common.ui.ItemAutoCompletionManager; |
import org.openconcerto.erp.core.common.ui.NiveauTableCellEditor; |
import org.openconcerto.erp.core.common.ui.NiveauTableCellRender; |
import org.openconcerto.erp.core.common.ui.QteCellEditor; |
import org.openconcerto.erp.core.common.ui.Remise; |
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter; |
64,6 → 67,7 |
import org.openconcerto.sql.view.list.ValidStateChecker; |
import org.openconcerto.ui.table.XTableColumnModel; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.Tuple3; |
import org.openconcerto.utils.cc.ITransformer; |
import org.openconcerto.utils.i18n.TranslationManager; |
78,11 → 82,13 |
import java.awt.event.MouseEvent; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Date; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
import java.util.Set; |
import java.util.Vector; |
import javax.swing.AbstractAction; |
130,6 → 136,7 |
final boolean filterFamilleArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.FILTER_BY_FAMILY, false); |
final boolean showEco = prefs.getBoolean(AbstractVenteArticleItemTable.SHOW_ECO_CONTRIBUTION_COLUMNS, false); |
final boolean showDevise = prefs.getBoolean(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false); |
final boolean withDeclinaison = prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVER_DECLINAISON, false); |
final UserRights rights = UserRightsManager.getCurrentUserRights(); |
final boolean editVTPrice = rights.haveRight(EDIT_PRIX_VENTE_CODE); |
137,6 → 144,16 |
final boolean lockVTMinPrice = rights.haveRight(LOCK_PRIX_MIN_VENTE_CODE); |
final List<SQLTableElement> list = new Vector<SQLTableElement>(); |
final SQLTableElement eNiveau = new SQLTableElement(e.getTable().getField("NIVEAU")) { |
@Override |
public void setValueFrom(SQLRowValues row, Object value) { |
super.setValueFrom(row, value); |
} |
}; |
eNiveau.setRenderer(new NiveauTableCellRender()); |
eNiveau.setEditor(new NiveauTableCellEditor()); |
list.add(eNiveau); |
list.add(new SQLTableElement(e.getTable().getField("ID_STYLE"))); |
final SQLTableElement tableFamille = new SQLTableElement(e.getTable().getField("ID_FAMILLE_ARTICLE")); |
168,7 → 185,7 |
// Code article |
final SQLTableElement tableElementCode = new SQLTableElement(e.getTable().getField("CODE"), String.class, |
new ITextArticleWithCompletionCellEditor(e.getTable().getTable("ARTICLE"), e.getTable().getTable("ARTICLE_FOURNISSEUR"))) { |
new ITextArticleWithCompletionCellEditor(e.getTable().getTable("ARTICLE"), e.getTable().getTable("ARTICLE_FOURNISSEUR"), withDeclinaison)) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
boolean b = super.isCellEditable(vals, rowIndex, columnIndex); |
199,6 → 216,21 |
}; |
list.add(tableElementNom); |
Set<String> fieldsName = e.getTable().getFieldsName(); |
List<String> fieldDecl = new ArrayList<>(); |
if (withDeclinaison) { |
for (String string : fieldsName) { |
if (string.startsWith("ID_ARTICLE_DECLINAISON")) { |
final SQLTableElement tableElementDeclinaison = new SQLTableElement(e.getTable().getField(string)); |
tableElementDeclinaison.setEditable(false); |
fieldDecl.add(string); |
list.add(tableElementDeclinaison); |
} |
} |
} |
// Désignation de l'article |
final SQLTableElement tableElementDesc = new SQLTableElement(e.getTable().getField("DESCRIPTIF")); |
list.add(tableElementDesc); |
208,6 → 240,86 |
list.add(tableElementDelai); |
} |
SQLTableElement eltLongueur = new SQLTableElement(e.getTable().getField("LONGUEUR")) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
int idUv = vals.getForeignID("ID_UNITE_VENTE"); |
return idUv == UniteVenteArticleSQLElement.M2; |
} |
}; |
list.add(eltLongueur); |
SQLTableElement eltLargeur = new SQLTableElement(e.getTable().getField("LARGEUR")) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
int idUv = vals.getForeignID("ID_UNITE_VENTE"); |
return idUv == UniteVenteArticleSQLElement.M2; |
} |
}; |
list.add(eltLargeur); |
SQLTableElement eltHauteur = new SQLTableElement(e.getTable().getField("HAUTEUR")); |
list.add(eltHauteur); |
SQLTableElement qteU = new SQLTableElement(e.getTable().getField("QTE_UNITAIRE"), BigDecimal.class) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
SQLRowAccessor row = vals.getForeign("ID_UNITE_VENTE"); |
if (row != null && !row.isUndefined() && row.getBoolean("A_LA_PIECE")) { |
return false; |
} else if (activeCalculM2 && row != null && !row.isUndefined() && row.getID() == UniteVenteArticleSQLElement.M2) { |
return false; |
} else { |
return super.isCellEditable(vals, rowIndex, columnIndex); |
} |
} |
protected Object getDefaultNullValue() { |
return BigDecimal.ZERO; |
} |
@Override |
public TableCellRenderer getTableCellRenderer() { |
return new QteUnitRowValuesRenderer(); |
} |
}; |
list.add(qteU); |
SQLTableElement uniteVente = new SQLTableElement(e.getTable().getField("ID_UNITE_VENTE")); |
list.add(uniteVente); |
// Quantité |
this.qte = new SQLTableElement(e.getTable().getField("QTE"), Integer.class, new QteCellEditor()) { |
protected Object getDefaultNullValue() { |
return Integer.valueOf(0); |
} |
@Override |
public TableCellRenderer getTableCellRenderer() { |
return new QtyToDeliverRowValuesRenderer(); |
} |
}; |
list.add(this.qte); |
// Quantité Livrée |
final SQLTableElement tableElement_QuantiteLivree = new SQLTableElement(e.getTable().getField("QTE_LIVREE"), Integer.class) { |
@Override |
public TableCellRenderer getTableCellRenderer() { |
return new DeliveredQtyRowValuesRenderer(); |
} |
protected Object getDefaultNullValue() { |
return Integer.valueOf(0); |
} |
}; |
list.add(tableElement_QuantiteLivree); |
// Valeur des métriques |
final SQLTableElement tableElement_ValeurMetrique2 = new SQLTableElement(e.getTable().getField("VALEUR_METRIQUE_2"), Float.class) { |
@Override |
340,72 → 452,6 |
list.add(eltUnitDevise); |
} |
SQLTableElement eltLongueur = new SQLTableElement(e.getTable().getField("LONGUEUR")) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
int idUv = vals.getForeignID("ID_UNITE_VENTE"); |
return idUv == UniteVenteArticleSQLElement.M2; |
} |
}; |
list.add(eltLongueur); |
SQLTableElement eltLargeur = new SQLTableElement(e.getTable().getField("LARGEUR")) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
int idUv = vals.getForeignID("ID_UNITE_VENTE"); |
return idUv == UniteVenteArticleSQLElement.M2; |
} |
}; |
list.add(eltLargeur); |
SQLTableElement eltHauteur = new SQLTableElement(e.getTable().getField("HAUTEUR")); |
list.add(eltHauteur); |
SQLTableElement qteU = new SQLTableElement(e.getTable().getField("QTE_UNITAIRE"), BigDecimal.class) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
SQLRowAccessor row = vals.getForeign("ID_UNITE_VENTE"); |
if (row != null && !row.isUndefined() && row.getBoolean("A_LA_PIECE")) { |
return false; |
} else if (activeCalculM2 && row != null && !row.isUndefined() && row.getID() == UniteVenteArticleSQLElement.M2) { |
return false; |
} else { |
return super.isCellEditable(vals, rowIndex, columnIndex); |
} |
} |
protected Object getDefaultNullValue() { |
return BigDecimal.ZERO; |
} |
@Override |
public TableCellRenderer getTableCellRenderer() { |
return new QteUnitRowValuesRenderer(); |
} |
}; |
list.add(qteU); |
SQLTableElement uniteVente = new SQLTableElement(e.getTable().getField("ID_UNITE_VENTE")); |
list.add(uniteVente); |
// Quantité |
this.qte = new SQLTableElement(e.getTable().getField("QTE"), Integer.class, new QteCellEditor()) { |
protected Object getDefaultNullValue() { |
return Integer.valueOf(0); |
} |
@Override |
public TableCellRenderer getTableCellRenderer() { |
return new QtyToDeliverRowValuesRenderer(); |
} |
}; |
list.add(this.qte); |
// Mode de vente |
final SQLTableElement tableElement_ModeVente = new SQLTableElement(e.getTable().getField("ID_MODE_VENTE_ARTICLE")); |
list.add(tableElement_ModeVente); |
447,20 → 493,6 |
this.tableElementTVA = new SQLTableElement(e.getTable().getField("ID_TAXE")); |
list.add(this.tableElementTVA); |
// Quantité Livrée |
final SQLTableElement tableElement_QuantiteLivree = new SQLTableElement(e.getTable().getField("QTE_LIVREE"), Integer.class) { |
@Override |
public TableCellRenderer getTableCellRenderer() { |
return new DeliveredQtyRowValuesRenderer(); |
} |
protected Object getDefaultNullValue() { |
return Integer.valueOf(0); |
} |
}; |
list.add(tableElement_QuantiteLivree); |
// Poids piece |
SQLTableElement tableElementPoids = new SQLTableElement(e.getTable().getField("POIDS"), Float.class); |
list.add(tableElementPoids); |
624,11 → 656,11 |
list.add(tableCmdElt); |
} |
SQLRowValues defautRow = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(e.getTable())); |
defautRow.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID()); |
defautRow.put("CODE", ""); |
defautRow.put("NOM", ""); |
final RowValuesTableModel model = new RowValuesTableModel(e, list, e.getTable().getField("NOM"), false, defautRow) { |
this.defaultRowVals = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(e.getTable())); |
this.defaultRowVals.put("ID_TAXE", TaxeCache.getCache().getFirstTaxe().getID()); |
this.defaultRowVals.put("CODE", ""); |
this.defaultRowVals.put("NOM", ""); |
final RowValuesTableModel model = new RowValuesTableModel(e, list, e.getTable().getField("NOM"), false, this.defaultRowVals) { |
@Override |
public void commitData() { |
int size = getRowCount(); |
684,6 → 716,7 |
completionField.add("LONGUEUR"); |
completionField.add("LARGEUR"); |
completionField.add("HAUTEUR"); |
completionField.addAll(fieldDecl); |
if (getSQLElement().getTable().getFieldsName().contains("DESCRIPTIF")) { |
completionField.add("DESCRIPTIF"); |
} |
696,24 → 729,12 |
} |
// Autocompletion |
final AutoCompletionManager m = new AutoCompletionManager(tableElementCode, ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getField("ARTICLE.CODE"), this.table, |
this.table.getRowValuesTableModel()) { |
@Override |
protected Object getValueFrom(SQLRow row, String field, SQLRowAccessor rowDest) { |
Object res = tarifCompletion(row, field, rowDest, true); |
if (res == null) { |
res = super.getValueFrom(row, field, rowDest); |
} |
if (field.equals("POURCENT_REMISE")) { |
return getRemiseClient(row); |
} |
return res; |
} |
}; |
m.fill("NOM", "NOM"); |
m.fill("ID", "ID_ARTICLE"); |
this.codeCompletionManager = new ItemAutoCompletionManager(this, tableElementCode, ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getField("ARTICLE.CODE"), |
this.table, this.table.getRowValuesTableModel()); |
this.codeCompletionManager.fill("NOM", "NOM"); |
this.codeCompletionManager.fill("ID", "ID_ARTICLE"); |
for (String string : completionField) { |
m.fill(string, string); |
this.codeCompletionManager.fill(string, string); |
} |
// final Where w = new Where(sqlTableArticle.getField("OBSOLETE"), "=", Boolean.FALSE); |
// m.setWhere(w); |
739,7 → 760,7 |
} |
}; |
m.setSelectTransformer(selTrans); |
this.codeCompletionManager.setSelectTransformer(selTrans); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.CAN_EXPAND_NOMENCLATURE_VT, true)) { |
767,7 → 788,7 |
@Override |
public void actionPerformed(ActionEvent arg0) { |
expandNomenclature(rowindex, m, EXPAND_TYPE.EXPAND); |
expandNomenclature(rowindex, codeCompletionManager, EXPAND_TYPE.EXPAND); |
} |
}); |
popup.add(new AbstractAction(TranslationManager.getInstance().getTranslationForItem("product.bom.expose")) { |
774,7 → 795,7 |
@Override |
public void actionPerformed(ActionEvent arg0) { |
expandNomenclature(rowindex, m, EXPAND_TYPE.VIEW_ONLY); |
expandNomenclature(rowindex, codeCompletionManager, EXPAND_TYPE.VIEW_ONLY); |
} |
}); |
788,20 → 809,8 |
}); |
} |
final AutoCompletionManager m2 = new AutoCompletionManager(tableElementNom, ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getField("ARTICLE.NOM"), this.table, |
this.table.getRowValuesTableModel()) { |
@Override |
protected Object getValueFrom(SQLRow row, String field, SQLRowAccessor rowDest) { |
Object res = tarifCompletion(row, field, rowDest, true); |
if (res == null) { |
res = super.getValueFrom(row, field, rowDest); |
} |
if (field.equals("POURCENT_REMISE")) { |
return getRemiseClient(row); |
} |
return res; |
} |
}; |
final AutoCompletionManager m2 = new ItemAutoCompletionManager(this, tableElementNom, ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getField("ARTICLE.NOM"), |
this.table, this.table.getRowValuesTableModel()); |
m2.fill("CODE", "CODE"); |
m2.fill("ID", "ID_ARTICLE"); |
for (String string : completionField) { |
811,20 → 820,8 |
// m2.setWhere(w); |
m2.setSelectTransformer(selTrans); |
final AutoCompletionManager m3 = new AutoCompletionManager(tableElementArticle, sqlTableArticle.getField("NOM"), this.table, this.table.getRowValuesTableModel(), |
ITextWithCompletion.MODE_CONTAINS, true, true, new ValidStateChecker()) { |
@Override |
protected Object getValueFrom(SQLRow row, String field, SQLRowAccessor rowDest) { |
Object res = tarifCompletion(row, field, rowDest, true); |
if (res == null) { |
res = super.getValueFrom(row, field, rowDest); |
} |
if (field.equals("POURCENT_REMISE")) { |
return getRemiseClient(row); |
} |
return res; |
} |
}; |
final AutoCompletionManager m3 = new ItemAutoCompletionManager(this, tableElementArticle, sqlTableArticle.getField("NOM"), this.table, this.table.getRowValuesTableModel(), |
ITextWithCompletion.MODE_CONTAINS, true, true, new ValidStateChecker()); |
m3.fill("CODE", "CODE"); |
m3.fill("NOM", "NOM"); |
for (String string : completionField) { |
861,7 → 858,7 |
} |
// Calcul automatique du total HT |
tableElement_QuantiteLivree.addModificationListener(tableElement_PrixMetrique1_VenteHT); |
this.qte.addModificationListener(tableElement_PrixMetrique1_VenteHT); |
tableElement_QuantiteLivree.addModificationListener(totalHT); |
tableElement_QuantiteLivree.addModificationListener(totalHA); |
qteU.addModificationListener(totalHT); |
1102,11 → 1099,11 |
if (filterFamilleArticle) { |
if (row.isForeignEmpty("ID_FAMILLE_ARTICLE")) { |
m.setWhere(null); |
codeCompletionManager.setWhere(null); |
m2.setWhere(null); |
} else { |
m.setWhere(new Where(sqlTableArticle.getField("ID_FAMILLE_ARTICLE"), "=", row.getForeignID("ID_FAMILLE_ARTICLE"))); |
codeCompletionManager.setWhere(new Where(sqlTableArticle.getField("ID_FAMILLE_ARTICLE"), "=", row.getForeignID("ID_FAMILLE_ARTICLE"))); |
m2.setWhere(new Where(sqlTableArticle.getField("ID_FAMILLE_ARTICLE"), "=", row.getForeignID("ID_FAMILLE_ARTICLE"))); |
} |
} |
1226,7 → 1223,7 |
Tuple3<Double, String, String> art = Tuple3.create(1.0D, l2.get(0).getString("CODE"), l2.get(0).getString("NOM")); |
List<Tuple3<Double, String, String>> l = new ArrayList<Tuple3<Double, String, String>>(); |
l.add(art); |
insertFromDrop(l, m); |
insertFromDrop(l, codeCompletionManager); |
} else { |
System.err.println("ARTICLE NOT FOUND !"); |
} |
1255,6 → 1252,7 |
JButton buttonStock = new JButton("Consulter le stock"); |
buttonStock.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent event) { |
try { |
SQLRowValues rowValsSel = table.getSelectedRowValues(); |
if (rowValsSel != null) { |
SQLRowAccessor foreignArt = rowValsSel.getForeign("ID_ARTICLE"); |
1267,8 → 1265,10 |
} |
} |
} |
} catch (Exception e) { |
ExceptionHandler.handle("Erreur d'accès au stock", e); |
} |
} |
}); |
this.buttons.add(buttonStock); |
/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 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
53,6 → 53,7 |
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; |
62,8 → 63,11 |
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; |
255,9 → 259,21 |
c.weightx = 0; |
c.weighty = 0; |
c.fill = GridBagConstraints.NONE; |
this.comboClient = new ElementComboBox(); |
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.add(this.comboClient, c); |
this.addRequiredSQLObject(this.comboClient, "ID_CLIENT"); |
if (this.displayDpt) { |
c.gridx++; |
375,6 → 391,23 |
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 |
384,6 → 417,11 |
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")) { |
394,6 → 432,10 |
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); |
404,26 → 446,10 |
} |
} |
}); |
// 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) { |
736,6 → 762,27 |
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(); |
if (id > 1) { |
SQLRow rowClient = comboClient.getElement().getTable().getRow(id); |
if (rowClient.getObject("ID_CATEGORIE_COMPTABLE") != null && !rowClient.isForeignEmpty("ID_CATEGORIE_COMPTABLE")) { |
panelTotal.setCategorieComptable(rowClient.getForeign("ID_CATEGORIE_COMPTABLE")); |
tableBonItem.setRowCatComptable(rowClient.getForeign("ID_CATEGORIE_COMPTABLE")); |
} else { |
panelTotal.setCategorieComptable(null); |
tableBonItem.setRowCatComptable(null); |
} |
} |
} |
}); |
// Doit etre locké a la fin |
DefaultGridBagConstraints.lockMinimumSize(comboClient); |
838,9 → 885,10 |
final List<Object> devisSourceTrRowsFrom = ((BonDeLivraisonSQLElement) getElement()).getSourceTrRowsFrom(idBon, "DEVIS_ELEMENT", "DEVIS"); |
((BonDeLivraisonSQLElement) getElement()).updateQteLivree(devisSourceTrRowsFrom, "DEVIS_ELEMENT", "DEVIS"); |
// generation du document |
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(getTable().getRow(idBon)); |
final SQLRow row = getTable().getRow(idBon); |
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(row); |
bSheet.createDocumentAsynchronous(); |
bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
// incrémentation du numéro auto |
if (NumerotationAutoSQLElement.getNextNumero(getElement().getClass()).equalsIgnoreCase(this.textNumeroUnique.getText().trim())) { |
856,16 → 904,12 |
} |
} |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) { |
try { |
updateStock(idBon); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} |
} |
// updateQte(idBon); |
if (attempt > 0) { |
SwingUtilities.invokeLater(new Runnable() { |
874,6 → 918,7 |
} |
}); |
} |
((BonDeLivraisonSQLElement) getElement()).fireInsertedCmdListener(row); |
} |
return idBon; |
944,19 → 989,16 |
((BonDeLivraisonSQLElement) getElement()).updateQteLivree(cmdClientFrom, "COMMANDE_CLIENT_ELEMENT", "COMMANDE_CLIENT"); |
// generation du document |
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(getTable().getRow(getSelectedID())); |
final SQLRow row = getTable().getRow(getSelectedID()); |
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(row); |
bSheet.createDocumentAsynchronous(); |
bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) { |
try { |
updateStock(getSelectedID()); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} |
} |
} |
1011,6 → 1053,16 |
} |
} |
public void removeZeroQtyLines() { |
int count = this.tableBonItem.getModel().getRowCount() - 1; |
for (int i = count; i >= 0; i--) { |
final SQLRowValues rowValuesAt = this.tableBonItem.getModel().getRowValuesAt(i); |
if (rowValuesAt.getInt("QTE_LIVREE") == 0) { |
this.tableBonItem.getModel().removeRowAt(i); |
} |
} |
} |
/*********************************************************************************************** |
* Mise à jour des quantités livrées dans les élements de facture |
* |
1089,12 → 1141,17 |
boolean stockWithBL = !prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true); |
if (getTable().getForeignTable("ID_CLIENT").contains("NOTE_2018")) { |
SQLRow row = getTable().getRow(id); |
List<SQLRow> trCmd = row.getReferentRows(getTable().getTable("TR_COMMANDE_CLIENT")); |
if (!trCmd.isEmpty()) { |
List<SQLRow> items = row.getReferentRows(getTable().getTable("BON_DE_LIVRAISON_ELEMENT")); |
for (SQLRow sqlRow : items) { |
if (sqlRow.contains("ID_COMMANDE_CLIENT_ELEMENT") && !sqlRow.isForeignEmpty("ID_COMMANDE_CLIENT_ELEMENT")) { |
stockWithBL = true; |
break; |
} |
} |
} |
if (stockWithBL) { |
SQLRow row = getTable().getRow(id); |
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() { |
@Override |
1139,7 → 1196,7 |
final SQLRowValues rowVals = rowElt.createUpdateRow(); |
rowVals.clearPrimaryKeys(); |
rowVals.putEmptyLink("ID_COMMANDE_CLIENT_ELEMENT"); |
getRowValuesTable().getRowValuesTableModel().addRow(rowVals); |
getRowValuesTable().getRowValuesTableModel().addRow(rowVals, false); |
final int rowIndex = getRowValuesTable().getRowValuesTableModel().getRowCount() - 1; |
getRowValuesTable().getRowValuesTableModel().fireTableModelModified(rowIndex); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/credit/component/AvoirClientSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
170,7 → 170,10 |
} else { |
table.setRowCatComptable(null); |
} |
String alerte = row.getString("ALERTE"); |
if (!isFilling() && alerte != null && alerte.trim().length() > 0) { |
JOptionPane.showMessageDialog(comboClient, alerte); |
} |
if (!isFilling() && comboClient.getElement().getTable().getFieldsName().contains("ID_TARIF")) { |
// SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF"); |
879,7 → 882,7 |
final AvoirClientXmlSheet bSheet = new AvoirClientXmlSheet(row); |
try { |
bSheet.createDocumentAsynchronous(); |
bSheet.showPrintAndExportAsynchronous(panelGestDoc.isVisualisationSelected(), panelGestDoc.isImpressionSelected(), true); |
bSheet.showPrintAndExportAsynchronous(panelGestDoc.isVisualisationSelected(), panelGestDoc.isImpressionSelected(), true, getElement(), row); |
} catch (Exception e) { |
ExceptionHandler.handle("Impossible de créer l'avoir", e); |
} |
977,7 → 980,9 |
if (!sqlRow.getBoolean("REG_COMPTA") && !sqlRow.getBoolean("REGLE")) { |
// update echeance |
SQLRowValues createEmptyUpdateRow2 = sqlRow.createEmptyUpdateRow(); |
createEmptyUpdateRow2.put("MONTANT", Math.max(0, sqlRow.getLong("MONTANT") - totalAvoir)); |
final long max = Math.max(0, sqlRow.getLong("MONTANT") - totalAvoir); |
createEmptyUpdateRow2.put("MONTANT", max); |
createEmptyUpdateRow2.put("REGLE", max == 0); |
createEmptyUpdateRow2.commit(); |
break; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/credit/element/AvoirClientSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
47,7 → 47,7 |
public AvoirClientSQLElement() { |
super("AVOIR_CLIENT", "une facture d'avoir", "factures d'avoir"); |
getRowActions().addAll(new MouseSheetXmlListeListener(AvoirClientXmlSheet.class).getRowActions()); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, AvoirClientXmlSheet.class).getRowActions()); |
} |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/element/CommandeClientElementSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
21,6 → 21,7 |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate; |
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.element.UISQLComponent; |
32,6 → 33,7 |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.ListSQLRequest; |
import org.openconcerto.sql.request.UpdateBuilder; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
213,7 → 215,9 |
}, res.get(0), res, TypeStockUpdate.VIRTUAL_DELIVER, false); |
try { |
updater.update(); |
} catch (SQLException e1) { |
} catch ( |
SQLException e1) { |
e1.printStackTrace(); |
} |
} |
229,6 → 233,15 |
final List<String> l = new ArrayList<String>(); |
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_CLIENT"); |
l.add("ID_ARTICLE"); |
l.add("ID_DEPOT_STOCK"); |
250,7 → 263,7 |
* |
* @param commandeID |
*/ |
public void transfertCommande(List<SQLRowValues> commandeClientEltsRows) { |
public void transfertCommande(List<SQLRowAccessor> commandeClientEltsRows) { |
ComptaPropsConfiguration.getInstanceCompta().getNonInteractiveSQLExecutor().execute(new Runnable() { |
264,34 → 277,31 |
List<String> fields2copy = Arrays.asList("CODE", "NOM", "VALEUR_METRIQUE_1", "VALEUR_METRIQUE_2", "VALEUR_METRIQUE_3"); |
Set<Integer> artAdded = new HashSet<Integer>(); |
for (SQLRowValues sqlRow : commandeClientEltsRows) { |
for (SQLRowAccessor sqlRow : commandeClientEltsRows) { |
boolean article = false; |
if (sqlRow.getTable().getName().equalsIgnoreCase("ARTICLE")) { |
article = true; |
} |
// renderer sur liste des ar |
// if() |
/// rowValsElt.put("QTE", sqlRow.getObject("QTE")); |
SQLRowAccessor rowArticleFind; |
SQLRowValues rowArticle; |
int qte = 1; |
BigDecimal qteUV = BigDecimal.ONE; |
boolean gestionStock = true; |
if (!article) { |
SQLRowValues rowArticle; |
if (sqlRow.contains("ID_ARTICLE") && sqlRow.getNonEmptyForeign("ID_ARTICLE") != null) { |
// on récupére l'article qui lui correspond |
rowArticleFind = sqlRow.asRow().getForeign("ID_ARTICLE"); |
rowArticle = rowArticleFind.asRowValues(); |
} else { |
// on récupére l'article qui lui correspond |
rowArticle = new SQLRowValues(eltArticle.getTable()); |
for (String field : fields2copy) { |
// if (sqlRow.getTable().getFieldsName().contains(field.getName())) { |
rowArticle.put(field, sqlRow.asRow().getObject(field)); |
// } |
} |
int idArticle = ReferenceArticleSQLElement.getIdForCNM(rowArticle, true); |
rowArticleFind = eltArticle.getTable().getRow(idArticle); |
} |
gestionStock = rowArticleFind.getBoolean("GESTION_STOCK"); |
if (!gestionStock) { |
qte = sqlRow.getInt("QTE"); |
309,9 → 319,8 |
} |
} else { |
rowArticleFind = sqlRow; |
rowArticle = sqlRow; |
if (rowArticle.getForeign("ID_STOCK") != null && !rowArticle.isForeignEmpty("ID_STOCK")) { |
SQLRowAccessor rowStock = rowArticle.getForeign("ID_STOCK"); |
if (sqlRow.getForeign("ID_STOCK") != null && !sqlRow.isForeignEmpty("ID_STOCK")) { |
SQLRowAccessor rowStock = sqlRow.getForeign("ID_STOCK"); |
qte = -Math.round(rowStock.getFloat("QTE_TH") - rowStock.getFloat("QTE_MIN")); |
} |
} |
319,11 → 328,9 |
artAdded.add(rowArticleFind.getID()); |
SQLInjector inj = SQLInjector.getInjector(rowArticle.getTable(), tableCmdElt); |
SQLInjector inj = SQLInjector.getInjector(eltArticle.getTable(), tableCmdElt); |
SQLRowValues rowValsElt = new SQLRowValues(inj.createRowValuesFrom(rowArticleFind.asRow())); |
rowValsElt.put("ID_STYLE", sqlRow.getObject("ID_STYLE")); |
rowValsElt.put("QTE", qte); |
rowValsElt.put("QTE_UNITAIRE", qteUV); |
331,8 → 338,6 |
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)); |
// rowValsElt.put("ID_DEVISE", |
// rowCmd.getForeignRow("ID_TARIF").getForeignID("ID_DEVISE")); |
map.add(rowArticleFind.asRow().getForeignRow("ID_FOURNISSEUR"), rowValsElt); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/element/CommandeClientSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
22,6 → 22,7 |
import org.openconcerto.erp.core.sales.order.component.CommandeClientSQLComponent; |
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet; |
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient; |
import org.openconcerto.erp.core.sales.order.ui.ReliquatCommandeTableModel; |
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.model.ProductComponent; |
import org.openconcerto.erp.core.sales.product.model.ProductHelper; |
47,6 → 48,9 |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLSelectJoin; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.SQLTableEvent; |
import org.openconcerto.sql.model.SQLTableEvent.Mode; |
import org.openconcerto.sql.model.SQLTableModifiedListener; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.sql.request.UpdateBuilder; |
53,6 → 57,8 |
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.EditPanelListener; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.RowAction; |
59,6 → 65,8 |
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.ui.PanelFrame; |
import org.openconcerto.utils.CollectionUtils; |
import org.openconcerto.utils.CompareUtils; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
67,6 → 75,8 |
import org.openconcerto.utils.cc.ITransformer; |
import java.awt.Component; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.io.IOException; |
import java.math.BigDecimal; |
82,6 → 92,9 |
import javax.swing.AbstractAction; |
import javax.swing.JLabel; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
import javax.swing.JScrollPane; |
import javax.swing.JTable; |
import javax.swing.SwingUtilities; |
import javax.swing.table.DefaultTableCellRenderer; |
116,8 → 129,17 |
@Override |
public void actionPerformed(ActionEvent e) { |
TransfertCommandeAutoUtils transfert = new TransfertCommandeAutoUtils(getTable()); |
List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows(); |
Set<String> clientBloque = checkClient(selectedRows); |
if (clientBloque.isEmpty()) { |
transfert.transfertMultiBL(IListe.get(e).getSelectedRows()); |
} else if (clientBloque.size() == 1) { |
JOptionPane.showMessageDialog(null, "Impossible de faire le transfert car le client " + clientBloque.iterator().next() + " est bloqué!"); |
} else { |
JOptionPane.showMessageDialog(null, "Impossible de faire le transfert car les clients " + CollectionUtils.join(clientBloque, ",") + " sont bloqués!"); |
} |
} |
}, false); |
actionTransfertBL.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(actionTransfertBL); |
146,8 → 168,17 |
@Override |
public void actionPerformed(ActionEvent e) { |
TransfertCommandeAutoUtils transfert = new TransfertCommandeAutoUtils(getTable()); |
List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows(); |
Set<String> clientBloque = checkClient(selectedRows); |
if (clientBloque.isEmpty()) { |
transfert.transfertFacture(IListe.get(e).getSelectedRows()); |
} else if (clientBloque.size() == 1) { |
JOptionPane.showMessageDialog(null, "Impossible de faire le transfert car le client " + clientBloque.iterator().next() + " est bloqué!"); |
} else { |
JOptionPane.showMessageDialog(null, "Impossible de faire le transfert car les clients " + CollectionUtils.join(clientBloque, ",") + " sont bloqués!"); |
} |
} |
}, false); |
actionFacture.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(actionFacture); |
154,6 → 185,58 |
} |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ACOMPTE_DEVIS, false)) { |
PredicateRowAction actionClient = new PredicateRowAction(new AbstractAction("Saisir un acompte") { |
EditFrame edit; |
public void actionPerformed(ActionEvent e) { |
final SQLElement eltEncaisser = Configuration.getInstance().getDirectory() |
.getElement(((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("ENCAISSER_MONTANT")); |
if (this.edit == null) { |
this.edit = new EditFrame(eltEncaisser, EditMode.CREATION); |
} |
final SQLRowAccessor selRow = IListe.get(e).getSelectedRow(); |
SQLRowValues rowVals = new SQLRowValues(eltEncaisser.getTable()); |
rowVals.put("ACOMPTE", true); |
rowVals.put("NOM", "Acompte commande " + selRow.getString("NUMERO")); |
rowVals.put("ID_CLIENT", selRow.getForeignID("ID_CLIENT")); |
rowVals.put("ID_COMMANDE_CLIENT", selRow.getID()); |
SQLRowValues rowValsElt = new SQLRowValues(eltEncaisser.getTable().getTable("ENCAISSER_MONTANT_ELEMENT")); |
rowValsElt.put("MONTANT_A_REGLER", selRow.getLong("T_TTC")); |
rowValsElt.put("DATE", selRow.getObject("DATE")); |
rowValsElt.put("ID_ENCAISSER_MONTANT", rowVals); |
this.edit.getSQLComponent().select(rowVals); |
this.edit.setVisible(true); |
this.edit.addEditPanelListener(new EditPanelListener() { |
@Override |
public void modified() { |
} |
@Override |
public void inserted(int id) { |
// Put id devis and refresh devis.t_acompte |
SQLRow rowE = eltEncaisser.getTable().getRow(id); |
String up = "UPDATE " + selRow.getTable().getSQLName().quote() + " set \"T_ACOMPTE\"=(SELECT COALESCE(SUM(\"MONTANT\"),0) from " + rowE.getTable().getSQLName().quote() |
+ " where \"ARCHIVE\"=0 and \"ID_COMMANDE_CLIENT\"=" + selRow.getID() + ") where \"ID\"=" + selRow.getID(); |
eltEncaisser.getTable().getDBSystemRoot().getDataSource().execute(up); |
} |
@Override |
public void deleted() { |
} |
@Override |
public void cancelled() { |
} |
}); |
} |
}, false); |
actionClient.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(actionClient); |
} |
final List<RowAction> allowedActions = new ArrayList<RowAction>(); |
// Transfert vers facture |
PredicateRowAction bonAction = new PredicateRowAction(new AbstractAction() { |
242,7 → 325,32 |
bonAction.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(CommandeClientXmlSheet.class); |
// 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()); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, CommandeClientXmlSheet.class); |
mouseSheetXmlListeListener.setGenerateHeader(true); |
mouseSheetXmlListeListener.setShowHeader(true); |
255,6 → 363,7 |
allowedActions.add(acompteAction); |
allowedActions.add(soldeAction); |
allowedActions.add(cmdAction); |
allowedActions.add(reliquatAction); |
allowedActions.addAll(mouseSheetXmlListeListener.getRowActions()); |
getRowActions().addAll(allowedActions); |
} |
464,7 → 573,31 |
getTable().getDBSystemRoot().getDataSource().execute(builder.asString()); |
getTable().fireTableModified(-1); |
if (etat == EtatCommandeClient.ANNULEE) { |
// Suppression des stocks si commande annulée |
SQLElement eltMvtStock = getDirectory().getElement("MOUVEMENT_STOCK"); |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(eltMvtStock.getTable().getField("ID")); |
Where w = new Where(eltMvtStock.getTable().getField("IDSOURCE"), ids); |
Where w2 = new Where(eltMvtStock.getTable().getField("SOURCE"), "=", getTable().getName()); |
sel.setWhere(w.and(w2)); |
try { |
@SuppressWarnings("rawtypes") |
List res = (List) eltMvtStock.getTable().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler()); |
if (res != null) { |
for (int i = 0; i < res.size(); i++) { |
Object[] tmp = (Object[]) res.get(i); |
eltMvtStock.archive(((Number) tmp[0]).intValue()); |
} |
} |
} catch (SQLException e) { |
ExceptionHandler.handle("Erreur lors de la suppression des mouvements de stocks", e); |
} |
} |
} |
/* |
* (non-Javadoc) |
493,12 → 626,15 |
l.add("ID_COMMERCIAL"); |
l.add("T_HT"); |
l.add("T_TTC"); |
SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ACOMPTE_DEVIS, false)) { |
l.add("T_ACOMPTE"); |
} |
if (getTable().getFieldsName().contains("ACOMPTE_COMMANDE")) { |
l.add("ACOMPTE_COMMANDE"); |
} |
l.add("NOM"); |
l.add("INFOS"); |
SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ORDER_PACKAGING_MANAGEMENT, true)) { |
l.add("NUMERO_EXPEDITION"); |
l.add("ETAT_COMMANDE"); |
510,6 → 646,9 |
public Set<String> getReadOnlyFields() { |
final Set<String> s = new HashSet<String>(); |
s.add("ID_DEVIS"); |
if (getTable().contains("T_ACOMPTE")) { |
s.add("T_ACOMPTE"); |
} |
return s; |
} |
647,8 → 786,11 |
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)); |
// rowValsElt.put("ID_DEVISE", |
// rowCmd.getForeignRow("ID_TARIF").getForeignID("ID_DEVISE")); |
final SQLRow asRow = rowArticleFind.getForeign("ID_FOURNISSEUR").asRow(); |
final SQLRowAccessor rowDeviseF = asRow.getNonEmptyForeign("ID_DEVISE"); |
if (rowDeviseF != null) { |
rowValsElt.put("ID_DEVISE", rowDeviseF.getID()); |
} |
map.add(rowArticleFind.getForeign("ID_FOURNISSEUR").asRow(), rowValsElt); |
} |
691,7 → 833,7 |
} |
}); |
comp.loadQuantity(fetcher.fetch(), "COMMANDE_CLIENT_ELEMENT"); |
comp.removeZeroQtyLines(); |
} |
/** |
762,6 → 904,39 |
@Override |
protected String createCode() { |
return "sales.order"; |
// r32617 | ludo | 2021-12-20 11:42:44 CET |
// |
// blocage des intéractions |
// ---------------------------------------------------------------------------- |
} |
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)); |
} |
} |
private Set<String> checkClient(List<? extends SQLRowAccessor> rows) { |
Set<String> clientBloque = new HashSet<>(); |
for (SQLRowAccessor sqlRowAccessor : rows) { |
SQLRowAccessor client = sqlRowAccessor.getForeign("ID_CLIENT").fetchNewRow(); |
if (client.getBoolean("BLOQUE_LIVRAISON") || client.getBoolean("BLOQUE")) { |
clientBloque.add(client.getString("CODE") + " " + client.getString("NOM")); |
} |
} |
return clientBloque; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/report/CommandeClientXmlSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
14,6 → 14,7 |
package org.openconcerto.erp.core.sales.order.report; |
import org.openconcerto.erp.generationDoc.AbstractSheetXMLWithDate; |
import org.openconcerto.erp.generationDoc.gestcomm.OptionDocProcessor; |
import org.openconcerto.erp.preferences.PrinterNXProps; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.model.SQLRow; |
28,7 → 29,7 |
super(row); |
this.printer = PrinterNXProps.getInstance().getStringProperty("cmdCliPrinter"); |
this.elt = Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT"); |
this.setPostProcess(new OptionDocProcessor()); |
} |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/action/ListeDesElementsACommanderClientAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,8 → 17,10 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel; |
import org.openconcerto.erp.core.common.ui.ListeViewPanel; |
import org.openconcerto.erp.core.common.ui.NumberCellRenderer; |
import org.openconcerto.erp.core.sales.order.element.CommandeClientElementSQLElement; |
import org.openconcerto.erp.core.sales.product.ui.QteAcommanderRenderer; |
import org.openconcerto.erp.core.supplychain.stock.action.ListeDesStocksAction; |
import org.openconcerto.erp.core.supplychain.stock.element.StockSQLElement; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.sql.element.SQLElement; |
306,6 → 308,14 |
@Override |
public void actionPerformed(ActionEvent e) { |
final SQLPreferences prefs = SQLPreferences.getMemCached(eltCmd.getTable().getDBRoot()); |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false)) { |
ListeDesStocksAction action = new ListeDesStocksAction(true); |
FrameUtil.show(action.createFrame()); |
} else { |
final SQLElement artElt = eltCmd.getForeignElement("ID_ARTICLE"); |
final SQLTableModelSourceOnline createTableSource = artElt.createTableSource(); |
createTableSource.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() { |
312,12 → 322,18 |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
FieldRef refStock = input.getAlias(artElt.getTable().getForeignTable("ID_STOCK").getField("QTE_TH")); |
FieldRef refStockMin = input.getAlias(artElt.getTable().getForeignTable("ID_STOCK").getField("QTE_MIN")); |
SQLSelectJoin j = input.getJoinFromField(artElt.getTable().getTable("ARTICLE_ELEMENT").getField("ID_ARTICLE_PARENT")); |
Where w = new Where(refStock, "<", artElt.getTable().getField("QTE_MIN")); |
if (j == null) { |
j = input.addBackwardJoin("LEFT", artElt.getTable().getTable("ARTICLE_ELEMENT").getField("ID_ARTICLE_PARENT"), null); |
} |
Where w = new Where(refStock, "<", refStockMin); |
w = w.and(new Where(j.getJoinedTable().getKey(), "=", (Object) null)); |
input.setWhere(w); |
// input.setHaving(Where.createRaw("COUNT(\"" + j.getJoinedTable().getKey() |
// input.setHaving(Where.createRaw("COUNT(\"" + |
// j.getJoinedTable().getKey() |
// + "\")" + " = 0", Arrays.asList(j.getJoinedTable().getKey()))); |
return input; |
} |
328,7 → 344,7 |
@Override |
public void actionPerformed(ActionEvent e) { |
List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows(); |
List<SQLRowAccessor> selectedRows = IListe.get(e).getSelectedRowAccessors(); |
eltCmd.transfertCommande(selectedRows); |
} |
}, true); |
338,6 → 354,7 |
IListFrame f = new IListFrame(p); |
FrameUtil.show(f); |
} |
} |
}, true); |
action.setPredicate(IListeEvent.createTotalRowCountPredicate(0, Integer.MAX_VALUE)); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/ui/ReliquatCommandeTableModel.java |
---|
New file |
0,0 → 1,111 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.core.sales.order.ui; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.util.Arrays; |
import java.util.List; |
import javax.swing.table.AbstractTableModel; |
public class ReliquatCommandeTableModel extends AbstractTableModel { |
private List<String> columns = Arrays.asList("Code", "Nom", "Qté cmd", "Reliquat"); |
private final List<? extends SQLRowAccessor> values; |
public ReliquatCommandeTableModel(SQLRowAccessor rowCmd) { |
super(); |
this.values = getValues(rowCmd); |
} |
@Override |
public Class<?> getColumnClass(int columnIndex) { |
if (columnIndex == 0) { |
return String.class; |
} else if (columnIndex == 1) { |
return String.class; |
} else if (columnIndex == 2) { |
return BigDecimal.class; |
} else { |
return BigDecimal.class; |
} |
} |
@Override |
public int getColumnCount() { |
return this.columns.size(); |
} |
@Override |
public int getRowCount() { |
return this.values.size(); |
} |
@Override |
public Object getValueAt(int rowIndex, int columnIndex) { |
if (columnIndex == 0) { |
return this.values.get(rowIndex).getString("CODE"); |
} else if (columnIndex == 1) { |
return this.values.get(rowIndex).getString("NOM"); |
} else if (columnIndex == 2) { |
return this.values.get(rowIndex).getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(this.values.get(rowIndex).getString("QTE"))).setScale(2, RoundingMode.HALF_UP); |
} else { |
BigDecimal qteCmd = this.values.get(rowIndex).getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(this.values.get(rowIndex).getString("QTE"))).setScale(2, RoundingMode.HALF_UP); |
SQLRowAccessor rowAccessor = this.values.get(rowIndex); |
String field = rowAccessor.getTable().getName().equals("COMMANDE_ELEMENT") ? "QTE_RECUE" : "QTE_LIVREE"; |
BigDecimal qteLivre = rowAccessor.getBigDecimal(field) == null ? BigDecimal.ZERO : this.values.get(rowIndex).getBigDecimal(field).setScale(2, RoundingMode.HALF_UP); |
return qteCmd.subtract(qteLivre); |
} |
} |
@Override |
public String getColumnName(int column) { |
return this.columns.get(column); |
} |
private List<? extends SQLRowAccessor> getValues(SQLRowAccessor rowCmd) { |
final SQLTable tableCmd = rowCmd.getTable(); |
final SQLTable table = tableCmd.getTable(tableCmd.getName() + "_ELEMENT"); |
SQLRowValues rowVals = new SQLRowValues(table); |
final String fieldQteRecueLivree = tableCmd.getName().equals("COMMANDE") ? "QTE_RECUE" : "QTE_LIVREE"; |
rowVals.putNulls("CODE", "NOM", "QTE", "QTE_UNITAIRE", fieldQteRecueLivree); |
final Where w = new Where(table.getField("ID_" + tableCmd.getName()), "=", rowCmd.getID()); |
final Where w2 = Where |
.createRaw(table.getField(fieldQteRecueLivree).getQuotedName() + " < (" + table.getField("QTE").getQuotedName() + "*" + table.getField("QTE_UNITAIRE").getQuotedName() + ")", |
table.getField("QTE_UNITAIRE"), table.getField("QTE"), table.getField(fieldQteRecueLivree)) |
.or(Where.isNull(table.getField(fieldQteRecueLivree))); |
final String fieldRecueLivree = tableCmd.getName().equals("COMMANDE") ? "RECU" : "LIVRE"; |
final String fieldRecueLivreeForced = tableCmd.getName().equals("COMMANDE") ? "RECU_FORCED" : "LIVRE_FORCED"; |
return SQLRowValuesListFetcher.create(rowVals) |
.fetch(w.and(w2).and(new Where(table.getField(fieldRecueLivree), "=", Boolean.FALSE)).and(new Where(table.getField(fieldRecueLivreeForced), "=", Boolean.FALSE))); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/component/CommandeClientSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
47,6 → 47,7 |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.preferences.SQLPreferences; |
54,6 → 55,7 |
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; |
62,7 → 64,10 |
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.cc.ITransformer; |
import org.openconcerto.utils.checks.ValidState; |
import java.awt.Color; |
import java.awt.GridBagConstraints; |
69,6 → 74,7 |
import java.awt.GridBagLayout; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.math.BigDecimal; |
import java.sql.SQLException; |
import java.util.Date; |
import java.util.HashSet; |
88,6 → 94,8 |
import javax.swing.event.TableModelEvent; |
import javax.swing.event.TableModelListener; |
import org.apache.commons.dbutils.handlers.ArrayListHandler; |
public class CommandeClientSQLComponent extends TransfertBaseSQLComponent { |
private CommandeClientItemTable table; |
218,7 → 226,20 |
c.fill = GridBagConstraints.HORIZONTAL; |
this.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), c); |
this.comboClient = new ElementComboBox(); |
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")) { |
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); |
c.gridx++; |
c.gridwidth = 1; |
c.weightx = 1; |
236,6 → 257,10 |
if (id > 1) { |
SQLRow row = comboClient.getElement().getTable().getRow(id); |
String alerte = row.getString("ALERTE"); |
if (alerte != null && alerte.trim().length() > 0) { |
JOptionPane.showMessageDialog(comboClient, alerte); |
} |
if (comboClient.getElement().getTable().getFieldsName().contains("ID_TARIF")) { |
SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF"); |
268,7 → 293,6 |
} |
}); |
addRequiredSQLObject(this.comboClient, "ID_CLIENT"); |
if (this.displayDpt) { |
c.gridx++; |
684,6 → 708,23 |
panel.add(labelRemiseHT, cFrais); |
cFrais.gridx++; |
panel.add(textRemiseHT, cFrais); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ACOMPTE_DEVIS, false) && getTable().contains("T_ACOMPTE")) { |
// Acompte |
cFrais.gridy++; |
cFrais.gridx = 0; |
cFrais.weightx = 0; |
cFrais.weighty = 0; |
cFrais.gridwidth = 1; |
JLabel compAcompte = new JLabel(getLabelFor("T_ACOMPTE"), SwingConstants.RIGHT); |
panel.add(compAcompte, cFrais); |
cFrais.gridx++; |
cFrais.gridwidth = GridBagConstraints.REMAINDER; |
DeviseField fieldAcompte = new DeviseField(); |
fieldAcompte.setEnabled(false); |
cFrais.weightx = 1; |
panel.add(fieldAcompte, cFrais); |
this.addView(fieldAcompte, "T_ACOMPTE"); |
} |
c.gridx = 2; |
c.weightx = 0; |
760,6 → 801,28 |
}); |
this.addView(this.table.getRowValuesTable(), ""); |
comboClient.addModelListener("wantedID", new PropertyChangeListener() { |
@Override |
public void propertyChange(PropertyChangeEvent arg0) { |
Integer id = comboClient.getWantedID(); |
if (id > 1) { |
SQLRow rowClient = comboClient.getElement().getTable().getRow(id); |
if (rowClient.getObject("ID_CATEGORIE_COMPTABLE") != null && !rowClient.isForeignEmpty("ID_CATEGORIE_COMPTABLE")) { |
totalTTC.setCategorieComptable(rowClient.getForeign("ID_CATEGORIE_COMPTABLE")); |
table.setRowCatComptable(rowClient.getForeign("ID_CATEGORIE_COMPTABLE")); |
} else { |
totalTTC.setCategorieComptable(null); |
table.setRowCatComptable(null); |
} |
} |
} |
}); |
DefaultGridBagConstraints.lockMinimumSize(comboClient); |
DefaultGridBagConstraints.lockMinimumSize(comboCommercial); |
DefaultGridBagConstraints.lockMinimumSize(comboDevis); |
815,10 → 878,12 |
this.table.createArticle(idCommande, this.getElement()); |
// generation du document |
SQLRow row = this.getElement().getTable().getRow(idCommande); |
try { |
CommandeClientXmlSheet sheet = new CommandeClientXmlSheet(getTable().getRow(idCommande)); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(CommandeClientSQLComponent.this.panelOO.isVisualisationSelected(), CommandeClientSQLComponent.this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(CommandeClientSQLComponent.this.panelOO.isVisualisationSelected(), CommandeClientSQLComponent.this.panelOO.isImpressionSelected(), true, |
this.getElement(), row); |
} catch (Exception e) { |
ExceptionHandler.handle("Impossible de créer la commande", e); |
} |
843,6 → 908,8 |
} |
}); |
} |
((CommandeClientSQLElement) getElement()).fireInsertedCmdListener(row); |
} |
return idCommande; |
918,7 → 985,8 |
try { |
CommandeClientXmlSheet sheet = new CommandeClientXmlSheet(row); |
sheet.createDocumentAsynchronous(); |
sheet.showPrintAndExportAsynchronous(CommandeClientSQLComponent.this.panelOO.isVisualisationSelected(), CommandeClientSQLComponent.this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(CommandeClientSQLComponent.this.panelOO.isVisualisationSelected(), CommandeClientSQLComponent.this.panelOO.isImpressionSelected(), true, getElement(), |
row); |
} catch (Exception e) { |
ExceptionHandler.handle("Impossible de créer la commande", e); |
} |
937,6 → 1005,8 |
private void updateStock(int id) throws SQLException { |
SQLRow row = getTable().getRow(id); |
if (row.getInt("ETAT_COMMANDE") != EtatCommandeClient.ANNULEE.getId()) { |
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() { |
@Override |
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) { |
945,7 → 1015,25 |
}, row, row.getReferentRows(getTable().getTable("COMMANDE_CLIENT_ELEMENT")), TypeStockUpdate.VIRTUAL_DELIVER); |
stockUpdater.update(); |
} else { |
// Suppression des stocks si commande annulée |
SQLElement eltMvtStock = getDirectory().getElement("MOUVEMENT_STOCK"); |
SQLSelect sel = new SQLSelect(); |
sel.addSelect(eltMvtStock.getTable().getField("ID")); |
Where w = new Where(eltMvtStock.getTable().getField("IDSOURCE"), "=", row.getID()); |
Where w2 = new Where(eltMvtStock.getTable().getField("SOURCE"), "=", getTable().getName()); |
sel.setWhere(w.and(w2)); |
@SuppressWarnings("rawtypes") |
List l = (List) eltMvtStock.getTable().getBase().getDataSource().execute(sel.asString(), new ArrayListHandler()); |
if (l != null) { |
for (int i = 0; i < l.size(); i++) { |
Object[] tmp = (Object[]) l.get(i); |
eltMvtStock.archive(((Number) tmp[0]).intValue()); |
} |
} |
} |
} |
public void setDefaults() { |
this.resetValue(); |
1054,7 → 1142,14 |
final SQLRowValues rowVals = rowElt.createUpdateRow(); |
rowVals.clearPrimaryKeys(); |
this.table.getModel().addRow(rowVals); |
if (rowVals.getTable().contains("ID_DEVIS_ELEMENT")) { |
rowVals.putEmptyLink("ID_DEVIS_ELEMENT"); |
} |
rowVals.put("QTE_LIVREE", BigDecimal.ZERO); |
rowVals.put("LIVRE", Boolean.FALSE); |
rowVals.put("LIVRE_FORCED", Boolean.FALSE); |
this.table.getModel().addRow(rowVals, false); |
final int rowIndex = this.table.getModel().getRowCount() - 1; |
this.table.getModel().fireTableModelModified(rowIndex); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/account/VenteFactureSituationSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
128,10 → 128,12 |
final DeviseField totalTVA = (DeviseField) getEditor("T_TVA"); |
final DeviseField totalEco = (DeviseField) getEditor("T_ECO_CONTRIBUTION"); |
final DeviseField totalRemise = (DeviseField) getEditor("REMISE_HT"); |
final SQLRequestComboBox taxePort = (SQLRequestComboBox) getEditor("ID_TAXE_PORT"); |
totalRemise.setEditable(false); |
totalRemise.setEnabled(false); |
final DeviseField totalPORT = (DeviseField) getEditor("PORT_HT"); |
this.addView(totalPORT, "PORT_HT"); |
this.addView(taxePort, "ID_TAXE_PORT"); |
this.addView(totalTVA, "T_TVA"); |
this.addView(totalTTC, "T_TTC"); |
this.addView(totalEco, "T_ECO_CONTRIBUTION"); |
396,7 → 398,7 |
try { |
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture); |
sheet.createDocument(); |
sheet.showPrintAndExport(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), rowFacture); |
} catch (Exception e) { |
ExceptionHandler.handle("Une erreur est survenue lors de la création du document.", e); |
} |
428,7 → 430,7 |
try { |
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture); |
sheet.createDocument(); |
sheet.showPrintAndExport(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true); |
sheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), rowFacture); |
} catch (Exception e) { |
ExceptionHandler.handle("Une erreur est survenue lors de la création du document.", e); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/element/SaisieVenteFactureSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
66,6 → 66,7 |
import org.openconcerto.sql.view.EditPanel; |
import org.openconcerto.sql.view.EditPanel.EditMode; |
import org.openconcerto.sql.view.EditPanelListener; |
import org.openconcerto.sql.view.IListeFilter; |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
72,6 → 73,7 |
import org.openconcerto.sql.view.list.RowAction; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.sql.view.list.SQLTableModelSource; |
import org.openconcerto.sql.view.list.action.ListEvent; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.FrameUtil; |
import org.openconcerto.ui.table.PercentTableCellRenderer; |
201,9 → 203,8 |
editFrame.setVisible(true); |
} |
}, true, "sales.invoice.clone") { |
public boolean enabledFor(IListeEvent evt) { |
List<? extends SQLRowAccessor> l = evt.getSelectedRows(); |
if (l != null && l.size() == 1) { |
public boolean enabledFor(List<SQLRowValues> l) { |
if (l.size() == 1) { |
SQLRowAccessor r = l.get(0); |
return !r.getBoolean("PARTIAL") && !r.getBoolean("SOLDE"); |
} |
239,21 → 240,24 |
actionCommande.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(actionCommande); |
RowAction actionCancelAvoir = new PredicateRowAction(new AbstractAction() { |
PredicateRowAction actionCancelAvoir = new PredicateRowAction(new AbstractAction() { |
public void actionPerformed(ActionEvent e) { |
cancelAvoir(IListe.get(e).getSelectedRow()); |
} |
}, false, "sales.invoice.cancel.credit") { |
@Override |
public boolean enabledFor(IListeEvent evt) { |
final SQLRowAccessor selectedRow = evt.getSelectedRow().asRow(); |
final List<SQLRowValues> rows = evt.getSelectedRows(); |
return rows != null && rows.size() == 1 && selectedRow != null && !selectedRow.isForeignEmpty("ID_AVOIR_CLIENT"); |
public boolean enabledFor(List<SQLRowValues> rows) { |
if (rows.size() != 1) { |
return false; |
} |
final SQLRow selectedRow = rows.get(0).asRow(); |
return !selectedRow.isForeignEmpty("ID_AVOIR_CLIENT"); |
} |
}; |
actionCancelAvoir.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(actionCancelAvoir); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(VenteFactureXmlSheet.class); |
MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(this, VenteFactureXmlSheet.class); |
getRowActions().addAll(mouseSheetXmlListeListener.getRowActions()); |
// this.frame.getPanel().getListe().addRowActions(mouseListener.getRowActions()); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/element/EcheanceClientSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
27,6 → 27,7 |
import org.openconcerto.erp.core.sales.invoice.report.MailRelanceCreator; |
import org.openconcerto.erp.core.sales.invoice.report.SituationCompteClientPanel; |
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet; |
import org.openconcerto.erp.core.sales.invoice.ui.DecaleEcheancePanel; |
import org.openconcerto.erp.rights.ComptaUserRight; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.BaseSQLComponent; |
62,6 → 63,7 |
import org.openconcerto.sql.view.list.SQLTableModelSource; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.EmailComposer; |
import org.openconcerto.ui.FrameUtil; |
import org.openconcerto.ui.JDate; |
import org.openconcerto.ui.PanelFrame; |
import org.openconcerto.ui.SwingThreadUtils; |
226,7 → 228,19 |
}, true); |
actionSituation.setPredicate(IListeEvent.createSelectionCountPredicate(0, Integer.MAX_VALUE)); |
getRowActions().add(actionSituation); |
PredicateRowAction actionEchDecalage = new PredicateRowAction(new AbstractAction("Décaler la date d'échéance") { |
@Override |
public void actionPerformed(ActionEvent e) { |
SQLRowValues rowVals = IListe.get(e).getSelectedRow(); |
PanelFrame frame = new PanelFrame(new DecaleEcheancePanel(rowVals), "Décaler une échéance"); |
FrameUtil.showPacked(frame); |
} |
}, true); |
actionEchDecalage.setPredicate(IListeEvent.getSingleSelectionPredicate()); |
getRowActions().add(actionEchDecalage); |
} |
if (UserRightsManager.getCurrentUserRights().haveRight(ComptaUserRight.MENU)) { |
RowAction actionCancel = new RowAction(new AbstractAction("Annuler la régularisation en comptabilité") { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/EtatStockInventaireXmlSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
84,6 → 84,8 |
rowValsArt.put("NOM", null); |
rowValsArt.put("PA_HT", null); |
rowValsArt.put("PV_HT", null); |
rowValsArt.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("NOM"); |
rowValsArt.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("NOM"); |
SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(rowVals); |
List<SQLRowValues> values = fetch.fetch(new Where(rowVals.getTable().getField("ID_ETAT_STOCK"), "=", this.row.getID())); |
115,6 → 117,7 |
Map<Line, Map<Line, List<Line>>> myValues = new TreeMap<Line, Map<Line, List<Line>>>(new Comparator<Line>() { |
@Override |
public int compare(Line o1, Line o2) { |
// TODO ajouter tri sur taille et couleur |
return o1.getNomArt().compareTo(o2.getNomArt()); |
} |
}); |
128,7 → 131,16 |
int idFamille = rowValsArticle.getForeignID("ID_FAMILLE_ARTICLE"); |
SQLRow rowF = mapF.get(idFamille); |
Line lineArt = new Line(rowF == null || rowF.isUndefined() ? "Sans famille" : rowF.getString("NOM"), rowValsArticle.getString("NOM"), rowValsArticle.getString("CODE"), ha, qte); |
String nomArticle = rowValsArticle.getString("NOM"); |
String couleur = ""; |
String taille = ""; |
if (rowValsArticle.getObject("ID_ARTICLE_DECLINAISON_COULEUR") != null && !rowValsArticle.isForeignEmpty("ID_ARTICLE_DECLINAISON_COULEUR")) { |
couleur = rowValsArticle.getForeign("ID_ARTICLE_DECLINAISON_COULEUR").getString("NOM"); |
} |
if (rowValsArticle.getObject("ID_ARTICLE_DECLINAISON_TAILLE") != null && !rowValsArticle.isForeignEmpty("ID_ARTICLE_DECLINAISON_TAILLE")) { |
taille = rowValsArticle.getForeign("ID_ARTICLE_DECLINAISON_TAILLE").getString("NOM"); |
} |
Line lineArt = new Line(rowF == null || rowF.isUndefined() ? "Sans famille" : rowF.getString("NOM"), taille, couleur, nomArticle, rowValsArticle.getString("CODE"), ha, qte); |
// Init des lines familles |
226,16 → 238,20 |
private final String nomArt; |
private final String codeArt; |
private final String famille; |
private final String taille; |
private final String couleur; |
private BigDecimal totalHA; |
private BigDecimal qte; |
public Line(String nomArt, String codeArt, BigDecimal totalHA, BigDecimal qte) { |
this("", nomArt, codeArt, totalHA, qte); |
this("", "", "", nomArt, codeArt, totalHA, qte); |
} |
public Line(String famille, String nomArt, String codeArt, BigDecimal totalHA, BigDecimal qte) { |
public Line(String famille, String taille, String couleur, String nomArt, String codeArt, BigDecimal totalHA, BigDecimal qte) { |
this.famille = famille; |
this.nomArt = nomArt; |
this.taille = taille; |
this.couleur = couleur; |
this.codeArt = codeArt; |
this.totalHA = totalHA; |
this.qte = qte; |
267,6 → 283,8 |
m.put("FAMILLE", this.famille); |
m.put("CODE", getCodeArt()); |
m.put("NOM", getNomArt()); |
m.put("TAILLE", this.taille); |
m.put("COULEUR", this.couleur); |
m.put("QTE", getQte()); |
m.put("TOTAL_HA", getTotalHA()); |
return m; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/SituationCompteXmlSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
31,6 → 31,8 |
import java.text.SimpleDateFormat; |
import java.util.ArrayList; |
import java.util.Calendar; |
import java.util.Collections; |
import java.util.Comparator; |
import java.util.Date; |
import java.util.HashMap; |
import java.util.List; |
59,7 → 61,7 |
return "SituationCompte"; |
} |
private Date d = null; |
private Date d; |
@Override |
public String getName() { |
81,16 → 83,15 |
w = w.and(new Where(echTable.getField("ID_CLIENT"), "=", row.getID())); |
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowVals); |
fetcher.addSelTransf(new ITransformer<SQLSelect, SQLSelect>() { |
List<SQLRowValues> result = fetcher.fetch(w); |
Collections.sort(result, new Comparator<SQLRowValues>() { |
@Override |
public SQLSelect transformChecked(SQLSelect input) { |
input.addFieldOrder(echTable.getField("DATE")); |
public int compare(SQLRowValues o1, SQLRowValues o2) { |
return input; |
return o1.getDate("DATE").compareTo(o2.getDate("DATE")); |
} |
}, 0); |
List<SQLRowValues> result = fetcher.fetch(w); |
}); |
List<Map<String, Object>> listValues = new ArrayList<Map<String, Object>>(); |
Map<Integer, String> styleValues = new HashMap<Integer, String>(); |
103,7 → 104,7 |
final Calendar dateEch = sqlRow.getDate("DATE"); |
mValues.put("DATE_ECHEANCE", dateFormat.format(dateEch.getTime())); |
final BigDecimal montantDu = new BigDecimal(sqlRow.getLong("MONTANT")); |
mValues.put("DU", montantDu); |
mValues.put("DU", montantDu.movePointLeft(2)); |
totalEch = totalEch.add(montantDu); |
115,13 → 116,13 |
mValues.put("DATE", dateFormat.format(rowFact.getDate("DATE").getTime())); |
final BigDecimal montantFact = new BigDecimal(rowFact.getLong("NET_A_PAYER")); |
regle = montantFact.subtract(montantDu); |
mValues.put("DU", montantFact); |
mValues.put("REGLE", montantFact.subtract(montantDu)); |
mValues.put("SOLDE", montantDu); |
mValues.put("DU", montantFact.movePointLeft(2)); |
mValues.put("REGLE", montantFact.subtract(montantDu).movePointLeft(2)); |
mValues.put("SOLDE", montantDu.movePointLeft(2)); |
} else { |
regle = BigDecimal.ZERO; |
mValues.put("SOLDE", montantDu); |
mValues.put("SOLDE", montantDu.movePointLeft(2)); |
} |
if (dateEch.before(today)) { |
totalEchPasse = totalEchPasse.add(montantDu); |
166,18 → 167,58 |
} |
SQLRow rowSoc = conf.getRowSociete(); |
// Avoir |
final SQLTable avoirTable = echTable.getTable("AVOIR_CLIENT"); |
SQLRowValues rowValsAvoir = new SQLRowValues(avoirTable); |
rowValsAvoir.putNulls("NUMERO", "MONTANT_TTC", "MONTANT_SOLDE", "MONTANT_RESTANT", "DATE", "NOM"); |
Where wA = new Where(avoirTable.getField("SOLDE"), "=", Boolean.FALSE); |
wA = wA.and(new Where(avoirTable.getField("ID_CLIENT"), "=", row.getID())); |
wA = wA.and(new Where(avoirTable.getField("MONTANT_RESTANT"), ">", 0)); |
SQLRowValuesListFetcher fetcherA = SQLRowValuesListFetcher.create(rowValsAvoir); |
List<SQLRowValues> resultA = fetcherA.fetch(wA); |
Collections.sort(resultA, new Comparator<SQLRowValues>() { |
@Override |
public int compare(SQLRowValues o1, SQLRowValues o2) { |
return o1.getDate("DATE").compareTo(o2.getDate("DATE")); |
} |
}); |
if (!resultA.isEmpty()) { |
listValues.add(new HashMap<String, Object>()); |
} |
for (SQLRowValues sqlRow : resultA) { |
Map<String, Object> mValues = new HashMap<String, Object>(); |
final Calendar dateEch = sqlRow.getDate("DATE"); |
mValues.put("DATE_ECHEANCE", dateFormat.format(dateEch.getTime())); |
final BigDecimal montantDu = new BigDecimal(sqlRow.getLong("MONTANT_RESTANT")).movePointLeft(2).negate(); |
mValues.put("DU", montantDu); |
totalEch = totalEch.add(montantDu.movePointRight(2)); |
totalEchPasse = totalEchPasse.add(montantDu.movePointRight(2)); |
mValues.put("PIECE", sqlRow.getString("NUMERO")); |
mValues.put("LIBELLE", sqlRow.getString("NOM")); |
mValues.put("DATE", dateFormat.format(sqlRow.getDate("DATE").getTime())); |
styleValues.put(listValues.size(), "Normal"); |
listValues.add(mValues); |
} |
SQLRow rowSoc = this.conf.getRowSociete(); |
SQLRow adrSoc = rowSoc.getForeign("ID_ADRESSE_COMMON"); |
Map<String, Object> sheetVals = new HashMap<String, Object>(); |
sheetVals.put("TOTAL_REGLE", totalRegle); |
sheetVals.put("TOTAL_ECHEANCE", totalEch); |
sheetVals.put("TOTAL_FUTUR", totalEch.subtract(totalEchPasse)); |
sheetVals.put("TOTAL_PASSE", totalEchPasse); |
sheetVals.put("TOTAL_REGLE", totalRegle.movePointLeft(2)); |
sheetVals.put("TOTAL_ECHEANCE", totalEch.movePointLeft(2)); |
sheetVals.put("TOTAL_FUTUR", totalEch.subtract(totalEchPasse).movePointLeft(2)); |
sheetVals.put("TOTAL_PASSE", totalEchPasse.movePointLeft(2)); |
sheetVals.put("NOM_CLIENT", row.getString("NOM")); |
sheetVals.put("DATE", new Date()); |
sheetVals.put("DATE", dateFormat.format(new Date())); |
sheetVals.put("CODE_CLIENT", row.getString("CODE")); |
sheetVals.put("TELEPHONE", row.getString("TEL")); |
SQLRow rowAdrClient = row.getForeign("ID_ADRESSE"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/VenteFactureXmlSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,11 → 15,36 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.element.BanqueSQLElement; |
import org.openconcerto.erp.core.sales.quote.report.PaypalStamper; |
import org.openconcerto.erp.core.supplychain.purchase.importer.FacturXExporter; |
import org.openconcerto.erp.generationDoc.AbstractSheetXMLWithDate; |
import org.openconcerto.erp.generationDoc.PDFAttachment; |
import org.openconcerto.erp.generationDoc.SheetUtils; |
import org.openconcerto.erp.generationDoc.gestcomm.OptionDocProcessor; |
import org.openconcerto.erp.preferences.PayPalPreferencePanel; |
import org.openconcerto.erp.preferences.PrinterNXProps; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.utils.ExceptionHandler; |
import java.io.File; |
import java.io.InputStream; |
import java.io.InputStreamReader; |
import java.io.OutputStream; |
import java.net.HttpURLConnection; |
import java.net.URL; |
import java.net.URLConnection; |
import java.net.URLEncoder; |
import java.nio.charset.StandardCharsets; |
import java.util.ArrayList; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
import java.util.StringJoiner; |
import org.jopendocument.model.OpenDocument; |
public class VenteFactureXmlSheet extends AbstractSheetXMLWithDate { |
public static final String TEMPLATE_ID = "VenteFacture"; |
28,25 → 53,26 |
@Override |
public String getReference() { |
return this.row.getString("NOM"); |
return this.getSQLRow().getString("NOM"); |
} |
@Override |
public String getName() { |
final String startName; |
if (row.getBoolean("COMPLEMENT")) { |
if (this.getSQLRow().getBoolean("COMPLEMENT")) { |
startName = "FactureComplement_"; |
} else if (row.getBoolean("ACOMPTE")) { |
} else if (this.getSQLRow().getBoolean("ACOMPTE")) { |
startName = "FactureAcompte_"; |
} else { |
startName = "Facture_"; |
} |
return startName + this.row.getString("NUMERO"); |
return startName + this.getSQLRow().getString("NUMERO"); |
} |
@Override |
public SQLRow getRowLanguage() { |
SQLRow rowClient = this.row.getForeignRow("ID_CLIENT"); |
SQLRow rowClient = this.getSQLRow().getForeignRow("ID_CLIENT"); |
if (rowClient.getTable().contains("ID_LANGUE")) { |
if (!rowClient.isForeignEmpty("ID_LANGUE")) { |
61,14 → 87,16 |
public VenteFactureXmlSheet(SQLRow row) { |
super(row); |
this.elt = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE"); |
this.printer = PrinterNXProps.getInstance().getStringProperty("FacturePrinter"); |
this.elt = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE"); |
getDefaultTemplateId(); |
this.setPostProcess(new OptionDocProcessor()); |
} |
@Override |
public String getType() { |
String type; |
SQLRow row = this.getSQLRow(); |
if (row.getBoolean("COMPLEMENT")) { |
type = "Complement"; |
} else if (row.getBoolean("ACOMPTE")) { |
88,4 → 116,96 |
return TEMPLATE_ID; |
} |
@Override |
public void createPDF(final File generatedFile, final File pdfFile, final OpenDocument doc, String storagePath) { |
if (pdfFile == null) { |
throw new IllegalArgumentException("null PDF file"); |
} |
try { |
final List<PDFAttachment> attachments = new ArrayList<>(1); |
final FacturXExporter ex = new FacturXExporter(); |
final SQLRow rowSociete = ComptaPropsConfiguration.getInstanceCompta().getRowSociete(); |
final String xml = ex.createXMLFrom(getSQLRow().getTable().getDBRoot(), getSQLRow().getID(), rowSociete); |
attachments.add(new PDFAttachment("factur-x.xml", "factur-x.xml", xml.getBytes(StandardCharsets.UTF_8), "text/xml")); |
final SQLPreferences prefs = SQLPreferences.getMemCached(getElement().getTable().getDBRoot()); |
if (prefs.getBoolean(PayPalPreferencePanel.PAYPAL_INVOICE, false)) { |
try { |
final File inFile = File.createTempFile("oc_", pdfFile.getName()); |
SheetUtils.convert2PDF(doc, inFile, attachments); |
PaypalStamper s = new PaypalStamper(); |
int x = prefs.getInt(PayPalPreferencePanel.PAYPAL_INVOICE_X, 0); |
int y = prefs.getInt(PayPalPreferencePanel.PAYPAL_INVOICE_Y, 0); |
// Reference |
String ref = getSQLRow().getString("NUMERO"); |
// Montant : ex : 10.55 |
long cents = getSQLRow().getLong("NET_A_PAYER"); |
String amount = cents / 100 + "." + cents % 100; |
// Devise |
// TODO : autres devises |
String currency = "EUR"; |
// POST |
final URL url = new URL("https://cloud.openconcerto.org/payment"); |
final URLConnection con = url.openConnection(); |
final HttpURLConnection http = (HttpURLConnection) con; |
http.setRequestMethod("POST"); |
http.setDoOutput(true); |
http.setDefaultUseCaches(false); |
String hyperlink = null; |
// x-www-form-urlencoded |
final Map<String, String> arguments = new HashMap<>(); |
arguments.put("pI", prefs.get(PayPalPreferencePanel.PAYPAL_CLIENTID, "")); |
arguments.put("pS", prefs.get(PayPalPreferencePanel.PAYPAL_SECRET, "")); |
arguments.put("ref", ref); |
arguments.put("amount", amount); |
arguments.put("currency", currency); |
arguments.put("type", "paypal"); |
final StringJoiner sj = new StringJoiner("&"); |
for (Map.Entry<String, String> entry : arguments.entrySet()) { |
sj.add(URLEncoder.encode(entry.getKey(), "UTF-8") + "=" + URLEncoder.encode(entry.getValue(), "UTF-8")); |
} |
final String postData = sj.toString(); |
byte[] out = postData.getBytes(StandardCharsets.UTF_8); |
int length = out.length; |
http.setFixedLengthStreamingMode(length); |
http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); |
http.connect(); |
try (OutputStream os = http.getOutputStream()) { |
os.write(out); |
} |
if (http.getResponseCode() != 401) { |
InputStream is = http.getInputStream(); |
InputStreamReader isr = new InputStreamReader(is); |
int numCharsRead; |
char[] charArray = new char[1024]; |
StringBuilder sb = new StringBuilder(); |
while ((numCharsRead = isr.read(charArray)) > 0) { |
sb.append(charArray, 0, numCharsRead); |
} |
// |
hyperlink = sb.toString(); |
} |
s.addLink(inFile, pdfFile, x, y, hyperlink); |
} catch (Exception e) { |
e.printStackTrace(); |
SheetUtils.convert2PDF(doc, pdfFile, attachments); |
} |
} else { |
SheetUtils.convert2PDF(doc, pdfFile, attachments); |
} |
} catch (Throwable e) { |
ExceptionHandler.handle("Impossible de créer le PDF " + pdfFile.getAbsolutePath(), e); |
} |
if (!pdfFile.canRead()) { |
ExceptionHandler.handle("Le fichier PDF " + pdfFile.getAbsolutePath() + " ne peut être lu."); |
} |
storeWithStorageEngines(generatedFile, pdfFile, storagePath); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/SituationCompteClientPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/VenteComptoirSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
101,4 → 101,8 |
this.mCell.put("A35", this.row.getObject("INFOS")); |
} |
@Override |
public int getNbPage() { |
return 1; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/action/ListeDebiteursAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
17,6 → 17,7 |
import org.openconcerto.utils.ExceptionHandler; |
import java.awt.event.ActionEvent; |
import java.util.Collections; |
import javax.swing.AbstractAction; |
import javax.swing.Action; |
34,7 → 35,7 |
final ListeDebiteursXmlSheet sheet = new ListeDebiteursXmlSheet(); |
try { |
sheet.createDocumentAsynchronous().get(); |
sheet.showPrintAndExport(true, false, false, false, false); |
sheet.showPrintAndExport(true, false, false, false, false, Collections.emptyList()); |
} catch (Exception e) { |
ExceptionHandler.handle("Impossible d'afficher la liste des débiteurs"); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/DecaleEcheancePanel.java |
---|
New file |
0,0 → 1,67 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.core.sales.invoice.ui; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.JDate; |
import org.openconcerto.utils.ExceptionHandler; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import javax.swing.AbstractAction; |
import javax.swing.JButton; |
import javax.swing.JFrame; |
import javax.swing.JLabel; |
import javax.swing.JPanel; |
import javax.swing.SwingUtilities; |
public class DecaleEcheancePanel extends JPanel { |
public DecaleEcheancePanel(final SQLRowAccessor row) { |
super(new GridBagLayout()); |
JLabel labelCom = new JLabel("Décaler l'écheance au"); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
this.add(labelCom, c); |
c.gridx++; |
final JDate dateDeb = new JDate(); |
this.add(dateDeb, c); |
dateDeb.setValue(row.getDate("DATE").getTime()); |
final JButton buttonValid = new JButton(new AbstractAction("Valider") { |
@Override |
public void actionPerformed(ActionEvent e) { |
try { |
if (dateDeb.getDate() != null) { |
row.createEmptyUpdateRow().put("DATE", dateDeb.getDate()).commit(); |
} |
((JFrame) SwingUtilities.getRoot(DecaleEcheancePanel.this)).dispose(); |
} catch (Exception e1) { |
ExceptionHandler.handle("Erreur", e1); |
} |
} |
}); |
c.gridx++; |
this.add(buttonValid, c); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/ListPanelEcheancesClients.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
93,7 → 93,6 |
// FIXME : remove queries from AWT |
final SQLTable elementEchT = getListe().getSource().getPrimaryTable(); |
Where wNotRegle = new Where(elementEchT.getField("REGLE"), "=", Boolean.FALSE); |
wNotRegle = wNotRegle.and(new Where(elementEchT.getTable().getField("ID_SEPA_MANDATE"), "=", (Object) null)); |
if (!showRegCompta) { |
wNotRegle = wNotRegle.and(new Where(elementEchT.getField("REG_COMPTA"), "=", Boolean.FALSE)); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/ListeDesVentesPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,13 → 18,11 |
import org.openconcerto.erp.core.common.ui.IListTotalPanel; |
import org.openconcerto.erp.core.common.ui.ListeViewPanel; |
import org.openconcerto.erp.core.finance.accounting.ui.ListeGestCommEltPanel; |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement; |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement.GenerationResult; |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement.IgnoreReason; |
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement; |
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.ArticleCache; |
import org.openconcerto.erp.core.sales.pos.ui.TextAreaTicketPanel; |
import org.openconcerto.erp.utils.TM; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.element.SQLElementDirectory; |
import org.openconcerto.sql.model.FieldPath; |
33,11 → 31,9 |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.model.graph.Path; |
import org.openconcerto.sql.request.UpdateBuilder; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.ITableModel; |
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.SQLTableModelColumnPath; |
48,7 → 44,6 |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.TableSorter; |
import org.openconcerto.utils.cc.IClosure; |
import org.openconcerto.utils.i18n.Grammar_fr; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
57,19 → 52,14 |
import java.math.BigInteger; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.Date; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
import javax.swing.AbstractAction; |
import javax.swing.JButton; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
import javax.swing.JTabbedPane; |
import javax.swing.JTable; |
import javax.swing.SwingWorker; |
import javax.swing.table.TableColumn; |
public class ListeDesVentesPanel extends JPanel { |
233,19 → 223,22 |
{ |
// Tab Vente caisse |
ListeViewPanel panelTicket = new ListeViewPanel(dir.getElement("TICKET_CAISSE")) { |
final TicketCaisseSQLElement ticketElement = dir.getElement(TicketCaisseSQLElement.class); |
ListeViewPanel panelTicket = new ListeViewPanel(ticketElement) { |
@Override |
protected void handleAction(JButton source, ActionEvent evt) { |
if (source == this.buttonModifier) { |
POSConfiguration posConf = POSConfiguration.getInstance(); |
try { |
if (posConf == null) |
if (posConf == null) { |
posConf = POSConfiguration.setInstance(); |
ArticleCache.initCache(dir); |
} |
} catch (Exception e) { |
ExceptionHandler.handle(source, "Impossible d'initialiser la configuration de la caisse", e); |
return; |
} |
new PanelFrame(new TextAreaTicketPanel(posConf, this.getListe().fetchSelectedRow()), "Ticket").setVisible(true); |
new PanelFrame(new TextAreaTicketPanel(ticketElement, posConf, this.getListe().fetchSelectedRow()), "Ticket").setVisible(true); |
} else { |
super.handleAction(source, evt); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/GenReportingVentePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
24,6 → 24,7 |
import java.awt.GridBagLayout; |
import java.awt.event.ActionEvent; |
import java.awt.event.ActionListener; |
import java.util.Collections; |
import java.util.List; |
import javax.swing.JButton; |
119,7 → 120,7 |
GenReportingVentePanel.this.bar, commande); |
sheet.createDocumentAsynchronous().get(); |
sheet.showPrintAndExport(true, false, false, false, false); |
sheet.showPrintAndExport(true, false, false, false, false, Collections.emptyList()); |
} catch (Exception e) { |
ExceptionHandler.handle("Erreur de traitement", e); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/GenListeVentePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
148,7 → 148,7 |
ListeVenteXmlSheet sheet = new ListeVenteXmlSheet(lTotal, GenListeVentePanel.this.du.getDate(), GenListeVentePanel.this.au.getDate(), GenListeVentePanel.this.bar); |
sheet.createDocumentAsynchronous().get(); |
sheet.showPrintAndExport(true, false, false); |
sheet.showPrintAndExport(true, false, false, Collections.emptyList()); |
} catch (Exception e) { |
ExceptionHandler.handle("Erreur de traitement", e); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/component/SaisieVenteFactureSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
49,6 → 49,7 |
import org.openconcerto.sql.element.ElementSQLObject; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.element.SQLComponent.Mode; |
import org.openconcerto.sql.model.SQLBackgroundTableCache; |
import org.openconcerto.sql.model.SQLBase; |
import org.openconcerto.sql.model.SQLInjector; |
64,6 → 65,7 |
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.users.rights.UserRightsManager; |
import org.openconcerto.sql.view.EditFrame; |
76,9 → 78,12 |
import org.openconcerto.ui.TitledSeparator; |
import org.openconcerto.ui.component.ITextArea; |
import org.openconcerto.ui.component.InteractionMode; |
import org.openconcerto.ui.valuewrapper.ValidatedValueWrapper; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.GestionDevise; |
import org.openconcerto.utils.cc.IFactory; |
import org.openconcerto.utils.cc.ITransformer; |
import org.openconcerto.utils.checks.ValidState; |
import org.openconcerto.utils.text.SimpleDocumentListener; |
import java.awt.GridBagConstraints; |
360,10 → 365,21 |
c.gridx++; |
c.weightx = 1; |
c.fill = GridBagConstraints.NONE; |
this.comboClient = new ElementComboBox(); |
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")) { |
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.add(this.comboClient, c); |
this.addRequiredSQLObject(this.comboClient, "ID_CLIENT"); |
if (this.displayDpt) { |
c.gridx++; |
1024,6 → 1040,10 |
} |
} |
if (row != null) { |
String alerte = row.getString("ALERTE"); |
if (!isFilling() && alerte != null && alerte.trim().length() > 0) { |
JOptionPane.showMessageDialog(comboClient, alerte); |
} |
if (SaisieVenteFactureSQLComponent.this.contact != null) { |
Where w = new Where(SaisieVenteFactureSQLComponent.this.eltContact.getTable().getField("ID_CLIENT"), "=", SQLRow.NONEXISTANT_ID); |
w = w.or(new Where(SaisieVenteFactureSQLComponent.this.eltContact.getTable().getField("ID_CLIENT"), "=", id)); |
1450,6 → 1470,7 |
int idMvt = -1; |
if (!this.checkPrevisionnelle.isSelected()) { |
if (getMode() == Mode.MODIFICATION) { |
if (!rowFacture.isForeignEmpty("ID_MOUVEMENT")) { |
idMvt = rowFacture.getInt("ID_MOUVEMENT"); |
// on supprime tout ce qui est lié à la facture |
System.err.println("Archivage des fils"); |
1456,6 → 1477,7 |
EcritureSQLElement eltEcr = (EcritureSQLElement) Configuration.getInstance().getDirectory().getElement("ECRITURE"); |
eltEcr.archiveMouvementProfondeur(idMvt, false); |
} |
} |
Sys |