OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 156 Rev 174
Line 13... Line 13...
13
 
13
 
14
 package org.openconcerto.erp.core.finance.accounting.ui;
14
 package org.openconcerto.erp.core.finance.accounting.ui;
15
 
15
 
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.generationEcritures.GenerationMvtSaisieVenteFacture;
19
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture;
19
import org.openconcerto.erp.model.ISQLCompteSelector;
20
import org.openconcerto.erp.model.ISQLCompteSelector;
20
import org.openconcerto.erp.preferences.DefaultNXProps;
21
import org.openconcerto.erp.preferences.DefaultNXProps;
21
import org.openconcerto.sql.Configuration;
22
import org.openconcerto.sql.Configuration;
22
import org.openconcerto.sql.model.SQLBase;
23
import org.openconcerto.sql.model.SQLBase;
Line 43... Line 44...
43
 
44
 
44
public class CompteGestCommPreferencePanel extends DefaultPreferencePanel {
45
public class CompteGestCommPreferencePanel extends DefaultPreferencePanel {
45
 
46
 
46
    private ISQLCompteSelector selCompteTVAIntraComm, selCompteFourn, selCompteAchat, selCompteValeurEncaissement, selCompteAvanceClient, selCompteClient, selCompteVenteProduits,
47
    private ISQLCompteSelector selCompteTVAIntraComm, selCompteFourn, selCompteAchat, selCompteValeurEncaissement, selCompteAvanceClient, selCompteClient, selCompteVenteProduits,
47
            selCompteVenteService, selCompteTVACol, selCompteTVADed, selCompteTVAImmo, selCompteAchatIntra, selCompteFactor, selComptePortSoumis, selComptePortNonSoumis;
48
            selCompteVenteService, selCompteTVACol, selCompteTVADed, selCompteTVAImmo, selCompteAchatIntra, selCompteFactor, selComptePortSoumis, selComptePortNonSoumis;
48
    private ElementComboBox selJrnlFactor;
49
    private ElementComboBox selJrnlFactor, selJrnlValEnc;
49
    private final static SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
50
    private final static SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
50
    private static final SQLTable tablePrefCompte = base.getTable("PREFS_COMPTE");
51
    private static final SQLTable tablePrefCompte = base.getTable("PREFS_COMPTE");
51
    private SQLRowValues rowPrefCompteVals = new SQLRowValues(tablePrefCompte);
52
    private SQLRowValues rowPrefCompteVals = new SQLRowValues(tablePrefCompte);
52
    private JCheckBox checkLettrageAuto = new JCheckBox("Activer le lettrage automatique.");
53
    private JCheckBox checkLettrageAuto = new JCheckBox("Activer le lettrage automatique.");
53
    private JCheckBox checkHideCompteFacture = new JCheckBox("Ne pas afficher les comptes dans les factures.");
54
    private JCheckBox checkHideCompteFacture = new JCheckBox("Ne pas afficher les comptes dans les factures.");
Line 172... Line 173...
172
 
173
 
173
        this.selCompteValeurEncaissement = new ISQLCompteSelector();
174
        this.selCompteValeurEncaissement = new ISQLCompteSelector();
174
        this.selCompteValeurEncaissement.init();
175
        this.selCompteValeurEncaissement.init();
175
        this.add(this.selCompteValeurEncaissement, c);
176
        this.add(this.selCompteValeurEncaissement, c);
176
 
177
 
-
 
178
        // Journal
-
 
179
        c.gridy++;
-
 
180
        c.weightx = 0;
-
 
181
        c.gridx = 0;
-
 
182
        this.add(new JLabel("Journal dépôt chèque"), c);
-
 
183
        c.weightx = 1;
-
 
184
        c.gridx++;
-
 
185
        this.selJrnlValEnc = new ElementComboBox();
-
 
186
        this.selJrnlValEnc.init(Configuration.getInstance().getDirectory().getElement("JOURNAL"));
-
 
187
        this.add(this.selJrnlValEnc, c);
-
 
188
 
177
        // Compte vente produits
189
        // Compte vente produits
178
        c.gridy++;
190
        c.gridy++;
179
        c.weightx = 0;
191
        c.weightx = 0;
180
        c.gridx = 0;
192
        c.gridx = 0;
181
        this.add(new JLabel("Compte Vente de produits"), c);
193
        this.add(new JLabel("Compte Vente de produits"), c);
Line 323... Line 335...
323
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_VENTE_PRODUIT", this.selCompteVenteProduits.getValue());
335
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_VENTE_PRODUIT", this.selCompteVenteProduits.getValue());
324
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_VENTE_SERVICE", this.selCompteVenteService.getValue());
336
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_VENTE_SERVICE", this.selCompteVenteService.getValue());
325
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_FACTOR", this.selCompteFactor.getValue());
337
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_FACTOR", this.selCompteFactor.getValue());
326
        final int selectedId = this.selJrnlFactor.getSelectedId();
338
        final int selectedId = this.selJrnlFactor.getSelectedId();
327
        this.rowPrefCompteVals.put("ID_JOURNAL_FACTOR", (selectedId > 1) ? selectedId : 1);
339
        this.rowPrefCompteVals.put("ID_JOURNAL_FACTOR", (selectedId > 1) ? selectedId : 1);
-
 
340
 
-
 
341
        final int selectedIdEnc = this.selJrnlValEnc.getSelectedId();
-
 
342
        this.rowPrefCompteVals.put("ID_JOURNAL_VALEUR_ENCAISSEMENT", (selectedIdEnc > 1) ? selectedIdEnc : 1);
-
 
343
 
328
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_FOURNISSEUR", this.selCompteFourn.getValue());
344
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_FOURNISSEUR", this.selCompteFourn.getValue());
329
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_CLIENT", this.selCompteClient.getValue());
345
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_CLIENT", this.selCompteClient.getValue());
330
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_AVANCE_CLIENT", this.selCompteAvanceClient.getValue());
346
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_AVANCE_CLIENT", this.selCompteAvanceClient.getValue());
331
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_VALEUR_ENCAISSEMENT", this.selCompteValeurEncaissement.getValue());
347
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_VALEUR_ENCAISSEMENT", this.selCompteValeurEncaissement.getValue());
332
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_ACHAT", this.selCompteTVADed.getValue());
348
        this.rowPrefCompteVals.put("ID_COMPTE_PCE_TVA_ACHAT", this.selCompteTVADed.getValue());
Line 386... Line 402...
386
            compte = ComptePCESQLElement.getComptePceDefault("Factor");
402
            compte = ComptePCESQLElement.getComptePceDefault("Factor");
387
            value = ComptePCESQLElement.getId(compte);
403
            value = ComptePCESQLElement.getId(compte);
388
            this.selCompteFactor.setValue(value);
404
            this.selCompteFactor.setValue(value);
389
 
405
 
390
            this.selJrnlFactor.setValue(GenerationMvtSaisieVenteFacture.journal);
406
            this.selJrnlFactor.setValue(GenerationMvtSaisieVenteFacture.journal);
-
 
407
            this.selJrnlValEnc.setValue(JournalSQLElement.BANQUES);
391
 
408
 
392
            // Fournisseurs
409
            // Fournisseurs
393
            compte = ComptePCESQLElement.getComptePceDefault("Fournisseurs");
410
            compte = ComptePCESQLElement.getComptePceDefault("Fournisseurs");
394
            value = ComptePCESQLElement.getId(compte);
411
            value = ComptePCESQLElement.getId(compte);
395
            this.selCompteFourn.setValue(value);
412
            this.selCompteFourn.setValue(value);
Line 453... Line 470...
453
            setComboValues(selCompteAchatIntra, "ID_COMPTE_PCE_ACHAT_INTRA", "AchatsIntra");
470
            setComboValues(selCompteAchatIntra, "ID_COMPTE_PCE_ACHAT_INTRA", "AchatsIntra");
454
            setComboValues(selCompteVenteProduits, "ID_COMPTE_PCE_VENTE_PRODUIT", "VentesProduits");
471
            setComboValues(selCompteVenteProduits, "ID_COMPTE_PCE_VENTE_PRODUIT", "VentesProduits");
455
            setComboValues(selCompteVenteService, "ID_COMPTE_PCE_VENTE_SERVICE", "VentesServices");
472
            setComboValues(selCompteVenteService, "ID_COMPTE_PCE_VENTE_SERVICE", "VentesServices");
456
            setComboValues(selCompteFactor, "ID_COMPTE_PCE_FACTOR", "Factor");
473
            setComboValues(selCompteFactor, "ID_COMPTE_PCE_FACTOR", "Factor");
457
 
474
 
-
 
475
            {
458
            // Journal Factor
476
                // Journal Factor
459
            int value = (this.rowPrefCompteVals.getObject("ID_JOURNAL_FACTOR") == null ? 1 : this.rowPrefCompteVals.getInt("ID_JOURNAL_FACTOR"));
477
                int value = (this.rowPrefCompteVals.getObject("ID_JOURNAL_FACTOR") == null ? 1 : this.rowPrefCompteVals.getInt("ID_JOURNAL_FACTOR"));
460
            if (value <= 1) {
478
                if (value <= 1) {
461
 
-
 
462
                value = GenerationMvtSaisieVenteFacture.journal;
479
                    value = GenerationMvtSaisieVenteFacture.journal;
463
            }
480
                }
464
            this.selJrnlFactor.setValue(value);
481
                this.selJrnlFactor.setValue(value);
-
 
482
            }
-
 
483
            {
-
 
484
                // Journal Val enc
-
 
485
                int value = (this.rowPrefCompteVals.getObject("ID_JOURNAL_VALEUR_ENCAISSEMENT") == null ? 1 : this.rowPrefCompteVals.getInt("ID_JOURNAL_VALEUR_ENCAISSEMENT"));
-
 
486
                if (value <= 1) {
-
 
487
                    value = JournalSQLElement.BANQUES;
-
 
488
                }
-
 
489
                this.selJrnlValEnc.setValue(value);
465
 
490
            }
466
            setComboValues(selCompteFourn, "ID_COMPTE_PCE_FOURNISSEUR", "Fournisseurs");
491
            setComboValues(selCompteFourn, "ID_COMPTE_PCE_FOURNISSEUR", "Fournisseurs");
467
            setComboValues(selCompteClient, "ID_COMPTE_PCE_CLIENT", "Clients");
492
            setComboValues(selCompteClient, "ID_COMPTE_PCE_CLIENT", "Clients");
468
            setComboValues(selCompteAvanceClient, "ID_COMPTE_PCE_AVANCE_CLIENT", "AvanceClients");
493
            setComboValues(selCompteAvanceClient, "ID_COMPTE_PCE_AVANCE_CLIENT", "AvanceClients");
469
            setComboValues(selCompteValeurEncaissement, "ID_COMPTE_PCE_VALEUR_ENCAISSEMENT", "ValeurEncaissement");
494
            setComboValues(selCompteValeurEncaissement, "ID_COMPTE_PCE_VALEUR_ENCAISSEMENT", "ValeurEncaissement");
470
            setComboValues(selComptePortSoumis, "ID_COMPTE_PCE_PORT_SOUMIS", "PortVenteSoumisTVA");
495
            setComboValues(selComptePortSoumis, "ID_COMPTE_PCE_PORT_SOUMIS", "PortVenteSoumisTVA");