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 19... Line 19...
19
import org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent;
19
import org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent;
20
import org.openconcerto.erp.core.supplychain.order.component.SaisieAchatSQLComponent;
20
import org.openconcerto.erp.core.supplychain.order.component.SaisieAchatSQLComponent;
21
import org.openconcerto.erp.core.supplychain.receipt.component.BonReceptionSQLComponent;
21
import org.openconcerto.erp.core.supplychain.receipt.component.BonReceptionSQLComponent;
22
import org.openconcerto.erp.generationDoc.gestcomm.CommandeXmlSheet;
22
import org.openconcerto.erp.generationDoc.gestcomm.CommandeXmlSheet;
23
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
23
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
-
 
24
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
24
import org.openconcerto.sql.Configuration;
25
import org.openconcerto.sql.Configuration;
25
import org.openconcerto.sql.element.SQLComponent;
26
import org.openconcerto.sql.element.SQLComponent;
26
import org.openconcerto.sql.element.SQLElement;
27
import org.openconcerto.sql.element.SQLElement;
27
import org.openconcerto.sql.element.TreesOfSQLRows;
28
import org.openconcerto.sql.element.TreesOfSQLRows;
28
import org.openconcerto.sql.model.SQLRow;
29
import org.openconcerto.sql.model.SQLRow;
Line 31... Line 32...
31
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
32
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
32
import org.openconcerto.sql.model.SQLSelect;
33
import org.openconcerto.sql.model.SQLSelect;
33
import org.openconcerto.sql.model.SQLSelectJoin;
34
import org.openconcerto.sql.model.SQLSelectJoin;
34
import org.openconcerto.sql.model.SQLTable;
35
import org.openconcerto.sql.model.SQLTable;
35
import org.openconcerto.sql.model.Where;
36
import org.openconcerto.sql.model.Where;
-
 
37
import org.openconcerto.sql.preferences.SQLPreferences;
36
import org.openconcerto.sql.view.EditFrame;
38
import org.openconcerto.sql.view.EditFrame;
37
import org.openconcerto.sql.view.EditPanel;
39
import org.openconcerto.sql.view.EditPanel;
38
import org.openconcerto.sql.view.list.IListe;
40
import org.openconcerto.sql.view.list.IListe;
39
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
41
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
40
import org.openconcerto.sql.view.list.RowAction;
42
import org.openconcerto.sql.view.list.RowAction;
Line 48... Line 50...
48
import java.util.List;
50
import java.util.List;
49
 
51
 
50
import javax.swing.AbstractAction;
52
import javax.swing.AbstractAction;
51
import javax.swing.ImageIcon;
53
import javax.swing.ImageIcon;
52
import javax.swing.JFrame;
54
import javax.swing.JFrame;
-
 
55
import javax.swing.JOptionPane;
-
 
56
import javax.swing.SwingWorker;
53
 
57
 
54
import org.apache.commons.dbutils.handlers.ArrayListHandler;
58
import org.apache.commons.dbutils.handlers.ArrayListHandler;
55
 
59
 
56
public class CommandeSQLElement extends ComptaSQLConfElement {
60
public class CommandeSQLElement extends ComptaSQLConfElement {
57
 
61
 
Line 65... Line 69...
65
            public void actionPerformed(ActionEvent e) {
69
            public void actionPerformed(ActionEvent e) {
66
                final List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows();
70
                final List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows();
67
                transfertBR(selectedRows);
71
                transfertBR(selectedRows);
68
            }
72
            }
69
 
73
 
70
        }, false, "supplychain.order.create.receipt");
74
        }, true, "supplychain.order.create.receipt");
71
 
75
 
72
        bonAction.setPredicate(IListeEvent.getSingleSelectionPredicate());
76
        bonAction.setPredicate(IListeEvent.getSingleSelectionPredicate());
73
        getRowActions().add(bonAction);
77
        getRowActions().add(bonAction);
74
 
78
 
-
 
79
        PredicateRowAction actionsTRFA = new PredicateRowAction(new AbstractAction("Transfert vers facture fournisseur") {
-
 
80
            public void actionPerformed(ActionEvent e) {
-
 
81
                final List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows();
-
 
82
                SwingWorker<Boolean, Object> worker = new SwingWorker<Boolean, Object>() {
-
 
83
                    @Override
-
 
84
                    protected Boolean doInBackground() throws Exception {
-
 
85
 
-
 
86
                        boolean b = TransfertBaseSQLComponent.isAlreadyAllTransfert(selectedRows, getTable(), getTable().getTable("FACTURE_FOURNISSEUR"), "T_HT", "T_HT");
-
 
87
 
-
 
88
                        if (b) {
-
 
89
                            String label = "Attention ";
-
 
90
                            if (selectedRows.size() > 1) {
-
 
91
                                label += " les " + getPluralName() + " ont déjà été transféré!";
-
 
92
                            } else {
-
 
93
                                label += getSingularName() + " a déjà été transféré!";
-
 
94
                            }
-
 
95
                            label += "\n Voulez vous continuer?";
-
 
96
 
-
 
97
                            int ans = JOptionPane.showConfirmDialog(null, label, "Transfert " + getSingularName(), JOptionPane.YES_NO_OPTION);
-
 
98
                            if (ans == JOptionPane.NO_OPTION) {
-
 
99
                                return Boolean.FALSE;
-
 
100
                            }
-
 
101
                        }
-
 
102
 
-
 
103
                        return Boolean.TRUE;
-
 
104
 
-
 
105
                    }
-
 
106
 
-
 
107
                    @Override
-
 
108
                    protected void done() {
-
 
109
                        try {
-
 
110
                            Boolean b = get();
-
 
111
                            if (b) {
-
 
112
                                TransfertBaseSQLComponent.openTransfertFrame(selectedRows, "FACTURE_FOURNISSEUR");
-
 
113
                            }
-
 
114
                        } catch (Exception e) {
-
 
115
                            ExceptionHandler.handle("Erreur lors du transfert des " + getPluralName() + "!", e);
-
 
116
                        }
-
 
117
                    }
-
 
118
                };
-
 
119
                worker.execute();
-
 
120
            }
-
 
121
        }, false);
-
 
122
        actionsTRFA.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
-
 
123
        getRowActions().add(actionsTRFA);
-
 
124
 
75
        // Transfert vers facture
125
        // Transfert vers facture
76
        PredicateRowAction factureAction = new PredicateRowAction(new AbstractAction() {
126
        PredicateRowAction factureAction = new PredicateRowAction(new AbstractAction() {
77
            public void actionPerformed(ActionEvent e) {
127
            public void actionPerformed(ActionEvent e) {
78
 
128
 
79
                CommandeSQLElement.this.transfertFacture(IListe.get(e).getSelectedRow().getID());
129
                CommandeSQLElement.this.transfertFacture(IListe.get(e).getSelectedRow().getID());
Line 105... Line 155...
105
        final List<String> l = new ArrayList<>(8);
155
        final List<String> l = new ArrayList<>(8);
106
        l.add("NUMERO");
156
        l.add("NUMERO");
107
        l.add("NOM");
157
        l.add("NOM");
108
        l.add("DATE");
158
        l.add("DATE");
109
        l.add("ID_FOURNISSEUR");
159
        l.add("ID_FOURNISSEUR");
-
 
160
        l.add("ID_COMMERCIAL");
110
        l.add("T_HT");
161
        l.add("T_HT");
111
        l.add("T_TTC");
162
        l.add("T_TTC");
-
 
163
        Boolean useCommandeEnCours = SQLPreferences.getMemCached(getTable().getDBRoot()).getBoolean(GestionCommercialeGlobalPreferencePanel.COMMANDE_FOURNISSEUR_EN_COURS, false);
-
 
164
        if (useCommandeEnCours) {
112
        l.add("EN_COURS");
165
            l.add("EN_COURS");
-
 
166
        }
113
        l.add("INFOS");
167
        l.add("INFOS");
114
        return l;
168
        return l;
115
    }
169
    }
116
 
170
 
117
    @Override
171
    @Override