OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 177 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 177 Rev 180
Line 16... Line 16...
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
17
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
18
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
18
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement;
19
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
19
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
20
import org.openconcerto.erp.model.ISQLCompteSelector;
20
import org.openconcerto.erp.model.ISQLCompteSelector;
21
import org.openconcerto.erp.preferences.DefaultNXProps;
-
 
22
import org.openconcerto.sql.Configuration;
21
import org.openconcerto.sql.Configuration;
23
import org.openconcerto.sql.model.SQLBase;
22
import org.openconcerto.sql.model.SQLBase;
24
import org.openconcerto.sql.model.SQLRow;
23
import org.openconcerto.sql.model.SQLRow;
25
import org.openconcerto.sql.model.SQLRowAccessor;
24
import org.openconcerto.sql.model.SQLRowAccessor;
26
import org.openconcerto.sql.model.SQLRowValues;
25
import org.openconcerto.sql.model.SQLRowValues;
Line 34... Line 33...
34
import java.awt.GridBagConstraints;
33
import java.awt.GridBagConstraints;
35
import java.awt.GridBagLayout;
34
import java.awt.GridBagLayout;
36
import java.awt.Insets;
35
import java.awt.Insets;
37
import java.sql.SQLException;
36
import java.sql.SQLException;
38
 
37
 
39
import javax.swing.JCheckBox;
-
 
40
import javax.swing.JLabel;
38
import javax.swing.JLabel;
41
import javax.swing.JOptionPane;
39
import javax.swing.JOptionPane;
42
import javax.swing.JPanel;
40
import javax.swing.JPanel;
43
import javax.swing.SwingUtilities;
41
import javax.swing.SwingUtilities;
44
 
42
 
Line 48... Line 46...
48
            selCompteVenteService, selCompteTVACol, selCompteTVADed, selCompteTVAImmo, selCompteAchatIntra, selCompteFactor, selComptePortSoumis, selComptePortNonSoumis;
46
            selCompteVenteService, selCompteTVACol, selCompteTVADed, selCompteTVAImmo, selCompteAchatIntra, selCompteFactor, selComptePortSoumis, selComptePortNonSoumis;
49
    private ElementComboBox selJrnlFactor, selJrnlValEnc, selJrnlCB;
47
    private ElementComboBox selJrnlFactor, selJrnlValEnc, selJrnlCB;
50
    private final static SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
48
    private final static SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
51
    private static final SQLTable tablePrefCompte = base.getTable("PREFS_COMPTE");
49
    private static final SQLTable tablePrefCompte = base.getTable("PREFS_COMPTE");
52
    private SQLRowValues rowPrefCompteVals = new SQLRowValues(tablePrefCompte);
50
    private SQLRowValues rowPrefCompteVals = new SQLRowValues(tablePrefCompte);
53
    private JCheckBox checkLettrageAuto = new JCheckBox("Activer le lettrage automatique.");
-
 
54
    private JCheckBox checkHideCompteFacture = new JCheckBox("Ne pas afficher les comptes dans les factures.");
-
 
55
    private JCheckBox checkHideCompteClient = new JCheckBox("Ne pas afficher les comptes dans les clients.");
-
 
56
    private JCheckBox checkHideAnalytique = new JCheckBox("Ne pas afficher l'analytique dans les saisies au kilomètre.");
-
 
57
 
51
 
58
    public CompteGestCommPreferencePanel() {
52
    public CompteGestCommPreferencePanel() {
59
        super();
53
        super();
60
 
54
 
61
        final SQLRow rowPrefCompte = tablePrefCompte.getRow(2);
55
        final SQLRow rowPrefCompte = tablePrefCompte.getRow(2);
Line 76... Line 70...
76
        c.gridheight = 1;
70
        c.gridheight = 1;
77
        c.weightx = 1;
71
        c.weightx = 1;
78
        c.weighty = 0;
72
        c.weighty = 0;
79
 
73
 
80
        c.gridwidth = GridBagConstraints.REMAINDER;
74
        c.gridwidth = GridBagConstraints.REMAINDER;
81
        this.add(this.checkLettrageAuto, c);
-
 
82
        c.gridy++;
-
 
83
        this.add(this.checkHideCompteClient, c);
-
 
84
        c.gridy++;
-
 
85
        this.add(this.checkHideCompteFacture, c);
-
 
86
        c.gridy++;
-
 
87
        this.add(this.checkHideAnalytique, c);
-
 
88
        c.gridy++;
-
 
89
 
75
 
90
        /*******************************************************************************************
76
        /*******************************************************************************************
91
         * SAISIE DES ACHATS
77
         * SAISIE DES ACHATS
92
         ******************************************************************************************/
78
         ******************************************************************************************/
93
        TitledSeparator sep = new TitledSeparator("Saisie des Achats");
79
        TitledSeparator sep = new TitledSeparator("Saisie des Achats");
Line 373... Line 359...
373
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_VENTE", this.selCompteTVACol.getValue());
359
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_VENTE", this.selCompteTVACol.getValue());
374
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_INTRA", this.selCompteTVAIntraComm.getValue());
360
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_INTRA", this.selCompteTVAIntraComm.getValue());
375
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_IMMO", this.selCompteTVAImmo.getValue());
361
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_IMMO", this.selCompteTVAImmo.getValue());
376
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_PORT_SOUMIS", this.selComptePortSoumis.getValue());
362
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_PORT_SOUMIS", this.selComptePortSoumis.getValue());
377
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_PORT_NON_SOUMIS", this.selComptePortNonSoumis.getValue());
363
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_PORT_NON_SOUMIS", this.selComptePortNonSoumis.getValue());
378
        this.rowPrefCompteVals.put("AUTO_LETTRAGE", this.checkLettrageAuto.isSelected());
-
 
379
        DefaultNXProps.getInstance().setProperty("HideCompteClient", String.valueOf(this.checkHideCompteClient.isSelected()));
-
 
380
        DefaultNXProps.getInstance().setProperty("HideCompteFacture", String.valueOf(this.checkHideCompteFacture.isSelected()));
-
 
381
        DefaultNXProps.getInstance().setProperty("HideAnalytique", String.valueOf(this.checkHideAnalytique.isSelected()));
-
 
382
        DefaultNXProps.getInstance().store();
-
 
383
        try {
364
        try {
384
            final Object[] pb = this.rowPrefCompteVals.getInvalid();
365
            final Object[] pb = this.rowPrefCompteVals.getInvalid();
385
            if (pb != null) {
366
            if (pb != null) {
386
                final SQLFieldTranslator trans = Configuration.getInstance().getTranslator();
367
                final SQLFieldTranslator trans = Configuration.getInstance().getTranslator();
387
                JOptionPane.showMessageDialog(SwingUtilities.getRoot(this), "Impossible de valider les modifications! Le champ <"
368
                JOptionPane.showMessageDialog(SwingUtilities.getRoot(this), "Impossible de valider les modifications! Le champ <"
Line 400... Line 381...
400
            // Achats
381
            // Achats
401
            String compte;
382
            String compte;
402
 
383
 
403
            compte = ComptePCESQLElement.getComptePceDefault("Achats");
384
            compte = ComptePCESQLElement.getComptePceDefault("Achats");
404
 
385
 
405
            this.checkLettrageAuto.setSelected(false);
-
 
406
 
-
 
407
            int value = ComptePCESQLElement.getId(compte);
386
            int value = ComptePCESQLElement.getId(compte);
408
            this.selCompteAchat.setValue(value);
387
            this.selCompteAchat.setValue(value);
409
 
388
 
410
            // Achats Intra
389
            // Achats Intra
411
            compte = ComptePCESQLElement.getComptePceDefault("AchatsIntra");
390
            compte = ComptePCESQLElement.getComptePceDefault("AchatsIntra");
Line 523... Line 502...
523
                if (value <= 1) {
502
                if (value <= 1) {
524
                    value = JournalSQLElement.BANQUES;
503
                    value = JournalSQLElement.BANQUES;
525
                }
504
                }
526
                this.selJrnlValEnc.setValue(value);
505
                this.selJrnlValEnc.setValue(value);
527
            }
506
            }
528
            setComboValues(selCompteFourn, "ID_COMPTE_PCE_FOURNISSEUR", "Fournisseurs");
507
            setComboValues(this.selCompteFourn, "ID_COMPTE_PCE_FOURNISSEUR", "Fournisseurs");
529
            setComboValues(selCompteClient, "ID_COMPTE_PCE_CLIENT", "Clients");
508
            setComboValues(this.selCompteClient, "ID_COMPTE_PCE_CLIENT", "Clients");
530
            setComboValues(selCompteAvanceClient, "ID_COMPTE_PCE_AVANCE_CLIENT", "AvanceClients");
509
            setComboValues(this.selCompteAvanceClient, "ID_COMPTE_PCE_AVANCE_CLIENT", "AvanceClients");
531
            setComboValues(selCompteValeurEncaissement, "ID_COMPTE_PCE_VALEUR_ENCAISSEMENT", "ValeurEncaissement");
510
            setComboValues(this.selCompteValeurEncaissement, "ID_COMPTE_PCE_VALEUR_ENCAISSEMENT", "ValeurEncaissement");
532
            setComboValues(selComptePortSoumis, "ID_COMPTE_PCE_PORT_SOUMIS", "PortVenteSoumisTVA");
511
            setComboValues(this.selComptePortSoumis, "ID_COMPTE_PCE_PORT_SOUMIS", "PortVenteSoumisTVA");
533
            setComboValues(selComptePortNonSoumis, "ID_COMPTE_PCE_PORT_NON_SOUMIS", "PortVenteNonSoumisTVA");
512
            setComboValues(this.selComptePortNonSoumis, "ID_COMPTE_PCE_PORT_NON_SOUMIS", "PortVenteNonSoumisTVA");
534
            setComboValues(selCompteTVACol, "ID_COMPTE_PCE_TVA_VENTE", "TVACollectee");
513
            setComboValues(this.selCompteTVACol, "ID_COMPTE_PCE_TVA_VENTE", "TVACollectee");
535
            setComboValues(selCompteTVADed, "ID_COMPTE_PCE_TVA_ACHAT", "TVADeductible");
514
            setComboValues(this.selCompteTVADed, "ID_COMPTE_PCE_TVA_ACHAT", "TVADeductible");
536
            setComboValues(selCompteTVAIntraComm, "ID_COMPTE_PCE_TVA_INTRA", "TVAIntraComm");
515
            setComboValues(this.selCompteTVAIntraComm, "ID_COMPTE_PCE_TVA_INTRA", "TVAIntraComm");
537
            setComboValues(selCompteTVAImmo, "ID_COMPTE_PCE_TVA_IMMO", "TVAImmo");
516
            setComboValues(this.selCompteTVAImmo, "ID_COMPTE_PCE_TVA_IMMO", "TVAImmo");
538
            this.checkLettrageAuto.setSelected(rowPrefCompteVals.getBoolean("AUTO_LETTRAGE"));
-
 
539
            this.checkHideCompteClient.setSelected(Boolean.valueOf(DefaultNXProps.getInstance().getProperty("HideCompteClient")));
-
 
540
            this.checkHideCompteFacture.setSelected(Boolean.valueOf(DefaultNXProps.getInstance().getProperty("HideCompteFacture")));
-
 
541
            this.checkHideAnalytique.setSelected(Boolean.valueOf(DefaultNXProps.getInstance().getProperty("HideAnalytique")));
-
 
542
        } catch (Exception e) {
517
        } catch (Exception e) {
543
            e.printStackTrace();
518
            e.printStackTrace();
544
        }
519
        }
545
    }
520
    }
546
 
521