OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 174
Line 22... Line 22...
22
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
22
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
23
import org.openconcerto.erp.core.common.ui.AbstractArticleItemTable;
23
import org.openconcerto.erp.core.common.ui.AbstractArticleItemTable;
24
import org.openconcerto.erp.core.common.ui.DeviseField;
24
import org.openconcerto.erp.core.common.ui.DeviseField;
25
import org.openconcerto.erp.core.common.ui.TotalPanel;
25
import org.openconcerto.erp.core.common.ui.TotalPanel;
26
import org.openconcerto.erp.core.customerrelationship.customer.ui.AdresseType;
26
import org.openconcerto.erp.core.customerrelationship.customer.ui.AdresseType;
-
 
27
import org.openconcerto.erp.core.customerrelationship.customer.ui.CategorieComptableChoiceUI;
27
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
28
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
28
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
29
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement;
29
import org.openconcerto.erp.core.finance.payment.component.ModeDeReglementSQLComponent;
30
import org.openconcerto.erp.core.finance.payment.component.ModeDeReglementSQLComponent;
30
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
31
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
31
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
32
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
Line 158... Line 159...
158
                } else {
159
                } else {
159
                    totalTTC.setCategorieComptable(null);
160
                    totalTTC.setCategorieComptable(null);
160
                    tableFacture.setRowCatComptable(null);
161
                    tableFacture.setRowCatComptable(null);
161
                }
162
                }
162
 
163
 
-
 
164
                if (!isFilling()) {
-
 
165
                    tableFacture.setClient(rowCli, true);
-
 
166
                }
-
 
167
 
163
                if (getMode() == SQLComponent.Mode.INSERTION || !isFilling()) {
168
                if (getMode() == SQLComponent.Mode.INSERTION || !isFilling()) {
164
                    SQLElement sqleltModeRegl = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT");
169
                    SQLElement sqleltModeRegl = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT");
165
                    int idModeRegl = rowCli.getInt("ID_MODE_REGLEMENT");
170
                    int idModeRegl = rowCli.getInt("ID_MODE_REGLEMENT");
166
                    if (idModeRegl > 1) {
171
                    if (idModeRegl > 1) {
167
                        SQLRow rowModeRegl = sqleltModeRegl.getTable().getRow(idModeRegl);
172
                        SQLRow rowModeRegl = sqleltModeRegl.getTable().getRow(idModeRegl);
Line 478... Line 483...
478
                        addressUI.getComboAdrL().getRequest().setWhere(Where.FALSE);
483
                        addressUI.getComboAdrL().getRequest().setWhere(Where.FALSE);
479
                    }
484
                    }
480
                }
485
                }
481
            });
486
            });
482
        // }
487
        // }
-
 
488
 
-
 
489
        SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
-
 
490
        if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.CATEGORIE_COMPTABLE_SPEC, false)) {
-
 
491
            // cat spe
-
 
492
            final CategorieComptableChoiceUI catUI = new CategorieComptableChoiceUI();
-
 
493
            catUI.addToUI(this, c);
-
 
494
            catUI.getCombo().addModelListener("wantedID", new PropertyChangeListener() {
-
 
495
 
-
 
496
                @Override
-
 
497
                public void propertyChange(PropertyChangeEvent evt) {
-
 
498
                    int wantedID = catUI.getCombo().getWantedID();
-
 
499
                    if (wantedID != SQLRow.NONEXISTANT_ID && wantedID >= SQLRow.MIN_VALID_ID) {
-
 
500
                        tableFacture.setRowCatComptable(catUI.getCombo().getElement().getTable().getRow(wantedID));
-
 
501
                    } else {
-
 
502
                        tableFacture.setRowCatComptable(null);
-
 
503
                    }
-
 
504
                }
-
 
505
            });
-
 
506
        }
-
 
507
 
483
        // Contact
508
        // Contact
484
        this.contact = new ElementComboBox() {
509
        this.contact = new ElementComboBox() {
485
            @Override
510
            @Override
486
            protected SQLComponent createSQLComponent(EditMode mode) {
511
            protected SQLComponent createSQLComponent(EditMode mode) {
487
                final SQLComponent c = super.createSQLComponent(mode);
512
                final SQLComponent c = super.createSQLComponent(mode);
Line 724... Line 749...
724
            });
749
            });
725
        }
750
        }
726
        final DeviseField textFraisDocHT = new DeviseField();
751
        final DeviseField textFraisDocHT = new DeviseField();
727
        final SQLRequestComboBox boxTaxeFraisDoc = new SQLRequestComboBox(false, 8);
752
        final SQLRequestComboBox boxTaxeFraisDoc = new SQLRequestComboBox(false, 8);
728
 
753
 
729
        SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
-
 
730
        final boolean showFrais = prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.FRAIS_DOCUMENT, false);
754
        final boolean showFrais = prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.FRAIS_DOCUMENT, false);
731
        if (showFrais) {
755
        if (showFrais) {
732
 
756
 
733
            JLabel labelFraisDocHT = new JLabel(getLabelFor("FRAIS_DOCUMENT_HT"));
757
            JLabel labelFraisDocHT = new JLabel(getLabelFor("FRAIS_DOCUMENT_HT"));
734
            labelFraisDocHT.setHorizontalAlignment(SwingConstants.RIGHT);
758
            labelFraisDocHT.setHorizontalAlignment(SwingConstants.RIGHT);
Line 1913... Line 1937...
1913
    @Override
1937
    @Override
1914
    protected void refreshAfterSelect(SQLRowAccessor r) {
1938
    protected void refreshAfterSelect(SQLRowAccessor r) {
1915
        this.tableFacture.setDateDevise(this.dateSaisie.getValue());
1939
        this.tableFacture.setDateDevise(this.dateSaisie.getValue());
1916
    }
1940
    }
1917
 
1941
 
-
 
1942
    @Override
-
 
1943
    protected void initDone() {
-
 
1944
 
-
 
1945
        super.initDone();
-
 
1946
 
-
 
1947
        // FIXME listener pour le module project à déplacer dans le module quand l'interface passera
-
 
1948
        // en group
-
 
1949
        if (getTable().contains("ID_AFFAIRE")) {
-
 
1950
            final SQLRequestComboBox viewClient = (SQLRequestComboBox) getView("ID_CLIENT").getComp();
-
 
1951
            final SQLRequestComboBox viewAffaire = (SQLRequestComboBox) getView("ID_AFFAIRE").getComp();
-
 
1952
            final SQLRequestComboBox viewComm = (SQLRequestComboBox) getView("ID_COMMERCIAL").getComp();
-
 
1953
            final SQLRequestComboBox viewAgence;
-
 
1954
            if (getTable().contains("ID_POLE_PRODUIT")) {
-
 
1955
                viewAgence = (SQLRequestComboBox) getView("ID_POLE_PRODUIT").getComp();
-
 
1956
            } else {
-
 
1957
                viewAgence = null;
-
 
1958
            }
-
 
1959
 
-
 
1960
            viewAffaire.addModelListener("wantedID", new PropertyChangeListener() {
-
 
1961
 
-
 
1962
                @Override
-
 
1963
                public void propertyChange(PropertyChangeEvent evt) {
-
 
1964
                    if (!isFilling()) {
-
 
1965
                        SQLRowAccessor selAffaire = viewAffaire.getSelectedRow();
-
 
1966
                        if (selAffaire != null && !selAffaire.isUndefined()) {
-
 
1967
                            viewClient.setValue(selAffaire.getForeignID("ID_CLIENT"));
-
 
1968
                            if (selAffaire.getTable().contains("ID_COMMERCIAL")) {
-
 
1969
                                viewComm.setValue(selAffaire.getForeignID("ID_COMMERCIAL"));
-
 
1970
                            }
-
 
1971
                        }
-
 
1972
                    }
-
 
1973
                }
-
 
1974
            });
-
 
1975
 
-
 
1976
            if (viewAgence != null) {
-
 
1977
 
-
 
1978
                viewComm.addModelListener("wantedID", new PropertyChangeListener() {
-
 
1979
 
-
 
1980
                    @Override
-
 
1981
                    public void propertyChange(PropertyChangeEvent evt) {
-
 
1982
                        if (!isFilling()) {
-
 
1983
                            SQLRowAccessor selComm = viewComm.getSelectedRow();
-
 
1984
                            if (selComm != null && !selComm.isUndefined() && selComm.getTable().contains("ID_POLE_PRODUIT")) {
-
 
1985
                                viewAgence.setValue(selComm.getForeignID("ID_POLE_PRODUIT"));
-
 
1986
                            }
-
 
1987
                        }
-
 
1988
                    }
-
 
1989
                });
-
 
1990
            }
-
 
1991
        }
-
 
1992
 
-
 
1993
    }
-
 
1994
 
1918
}
1995
}