OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 19 Rev 25
Line 23... Line 23...
23
import org.openconcerto.erp.core.finance.accounting.ui.ListeGestCommEltPanel;
23
import org.openconcerto.erp.core.finance.accounting.ui.ListeGestCommEltPanel;
24
import org.openconcerto.erp.core.sales.invoice.component.SaisieVenteFactureSQLComponent;
24
import org.openconcerto.erp.core.sales.invoice.component.SaisieVenteFactureSQLComponent;
25
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
25
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
26
import org.openconcerto.erp.core.sales.invoice.report.ListeFactureXmlSheet;
26
import org.openconcerto.erp.core.sales.invoice.report.ListeFactureXmlSheet;
27
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
27
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
-
 
28
import org.openconcerto.erp.core.sales.invoice.ui.DateEnvoiRenderer;
28
import org.openconcerto.erp.core.sales.invoice.ui.ListeFactureRenderer;
29
import org.openconcerto.erp.core.sales.invoice.ui.ListeFactureRenderer;
29
import org.openconcerto.erp.generationEcritures.GenerationMvtRetourNatexis;
30
import org.openconcerto.erp.generationEcritures.GenerationMvtRetourNatexis;
30
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
31
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
31
import org.openconcerto.erp.preferences.DefaultNXProps;
32
import org.openconcerto.erp.preferences.DefaultNXProps;
32
import org.openconcerto.erp.rights.NXRights;
33
import org.openconcerto.erp.rights.NXRights;
Line 44... Line 45...
44
import org.openconcerto.sql.view.EditFrame;
45
import org.openconcerto.sql.view.EditFrame;
45
import org.openconcerto.sql.view.EditPanel;
46
import org.openconcerto.sql.view.EditPanel;
46
import org.openconcerto.sql.view.EditPanelListener;
47
import org.openconcerto.sql.view.EditPanelListener;
47
import org.openconcerto.sql.view.IListFrame;
48
import org.openconcerto.sql.view.IListFrame;
48
import org.openconcerto.sql.view.list.IListe;
49
import org.openconcerto.sql.view.list.IListe;
-
 
50
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
49
import org.openconcerto.sql.view.list.RowAction;
51
import org.openconcerto.sql.view.list.RowAction;
50
import org.openconcerto.sql.view.list.SQLTableModelColumn;
52
import org.openconcerto.sql.view.list.SQLTableModelColumn;
-
 
53
import org.openconcerto.sql.view.list.SQLTableModelColumnPath;
51
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
54
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
-
 
55
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
52
import org.openconcerto.ui.DefaultGridBagConstraints;
56
import org.openconcerto.ui.DefaultGridBagConstraints;
-
 
57
import org.openconcerto.utils.ExceptionHandler;
53
import org.openconcerto.utils.Tuple2;
58
import org.openconcerto.utils.Tuple2;
-
 
59
import org.openconcerto.utils.cc.IClosure;
54
 
60
 
55
import java.awt.FlowLayout;
61
import java.awt.FlowLayout;
56
import java.awt.GridBagConstraints;
62
import java.awt.GridBagConstraints;
57
import java.awt.GridBagLayout;
63
import java.awt.GridBagLayout;
58
import java.awt.event.ActionEvent;
64
import java.awt.event.ActionEvent;
59
import java.awt.event.ActionListener;
65
import java.awt.event.ActionListener;
60
import java.sql.SQLException;
66
import java.sql.SQLException;
61
import java.util.ArrayList;
67
import java.util.ArrayList;
62
import java.util.List;
68
import java.util.List;
-
 
69
import java.util.concurrent.ExecutionException;
63
 
70
 
-
 
71
import javax.sql.rowset.Predicate;
64
import javax.swing.AbstractAction;
72
import javax.swing.AbstractAction;
65
import javax.swing.Action;
73
import javax.swing.Action;
66
import javax.swing.BorderFactory;
74
import javax.swing.BorderFactory;
67
import javax.swing.JButton;
75
import javax.swing.JButton;
68
import javax.swing.JFrame;
76
import javax.swing.JFrame;
69
import javax.swing.JLabel;
77
import javax.swing.JLabel;
70
import javax.swing.JPanel;
78
import javax.swing.JPanel;
71
import javax.swing.border.Border;
79
import javax.swing.border.Border;
-
 
80
import javax.swing.table.TableColumn;
72
 
81
 
73
public class ListeSaisieVenteFactureAction extends CreateFrameAbstractAction {
82
public class ListeSaisieVenteFactureAction extends CreateFrameAbstractAction {
74
 
83
 
75
    private IListFrame frame;
84
    private IListFrame frame;
76
    // private EditFrame editFrame;
85
    // private EditFrame editFrame;
Line 88... Line 97...
88
        SQLElement eltFacture = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
97
        SQLElement eltFacture = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
89
 
98
 
90
        final SQLTableModelSourceOnline src = eltFacture.getTableSource(true);
99
        final SQLTableModelSourceOnline src = eltFacture.getTableSource(true);
91
 
100
 
92
        for (SQLTableModelColumn column : src.getColumns()) {
101
        for (SQLTableModelColumn column : src.getColumns()) {
93
            // if (column.getValueClass() == Long.class || column.getValueClass() ==
102
            // if (column.getValueClass() == Long.class ||
-
 
103
            // column.getValueClass() ==
94
            // BigInteger.class || column.getValueClass() == BigDecimal.class)
104
            // BigInteger.class || column.getValueClass() == BigDecimal.class)
95
            column.setRenderer(ListeFactureRenderer.UTILS.getRenderer(column.getRenderer()));
105
            column.setRenderer(ListeFactureRenderer.UTILS.getRenderer(column.getRenderer()));
-
 
106
            if (column.getClass().isAssignableFrom(SQLTableModelColumnPath.class)) {
-
 
107
                ((SQLTableModelColumnPath) column).setEditable(false);
-
 
108
            }
-
 
109
        }
-
 
110
            final SQLTableModelColumn dateEnvoiCol = src.getColumn(eltFacture.getTable().getField("DATE_ENVOI"));
-
 
111
 
-
 
112
            ((SQLTableModelColumnPath) dateEnvoiCol).setEditable(true);
96
 
113
 
-
 
114
            final SQLTableModelColumn dateReglCol = src.getColumn(eltFacture.getTable().getField("DATE_REGLEMENT"));
-
 
115
            ((SQLTableModelColumnPath) dateReglCol).setEditable(true);
-
 
116
 
-
 
117
            dateEnvoiCol.setColumnInstaller(new IClosure<TableColumn>() {
-
 
118
                @Override
-
 
119
                public void executeChecked(TableColumn columnDateEnvoi) {
-
 
120
                    columnDateEnvoi.setCellEditor(new org.openconcerto.ui.table.TimestampTableCellEditor());
-
 
121
                    columnDateEnvoi.setCellRenderer(new DateEnvoiRenderer());
97
        }
122
                }
-
 
123
            });
98
 
124
 
-
 
125
            // Edition des dates de reglement
-
 
126
            dateReglCol.setColumnInstaller(new IClosure<TableColumn>() {
-
 
127
                @Override
-
 
128
                public void executeChecked(TableColumn columnDateReglement) {
-
 
129
                    columnDateReglement.setCellEditor(new org.openconcerto.ui.table.TimestampTableCellEditor());
-
 
130
                    columnDateReglement.setCellRenderer(new DateEnvoiRenderer());
-
 
131
                }
-
 
132
            });
99
        this.listeAddPanel = new ListeGestCommEltPanel(eltFacture, new IListe(src)) {
133
        this.listeAddPanel = new ListeGestCommEltPanel(eltFacture, new IListe(src)) {
100
 
134
 
101
 
135
 
102
            @Override
136
            @Override
103
            protected GridBagConstraints createConstraints() {
137
            protected GridBagConstraints createConstraints() {
Line 144... Line 178...
144
        this.listeAddPanel.add(datePanel, c);
178
        this.listeAddPanel.add(datePanel, c);
145
 
179
 
146
        this.frame = new IListFrame(this.listeAddPanel);
180
        this.frame = new IListFrame(this.listeAddPanel);
147
 
181
 
148
        // FIXME Maybe Stock rowSelection in new List
182
        // FIXME Maybe Stock rowSelection in new List
149
        final MouseSheetXmlListeListener mouseListener = new MouseSheetXmlListeListener(this.listeAddPanel.getListe(), VenteFactureXmlSheet.class) {
183
        final MouseSheetXmlListeListener mouseListener = new MouseSheetXmlListeListener(VenteFactureXmlSheet.class) {
150
            @Override
184
            @Override
151
            public List<AbstractAction> addToMenu() {
185
            public List<RowAction> addToMenu() {
152
 
186
 
153
                final SQLRow row = liste.getSelectedRow();
187
                // final SQLRow row = liste.getSelectedRow();
154
                List<AbstractAction> l = new ArrayList<AbstractAction>(5);
188
                List<RowAction> l = new ArrayList<RowAction>(5);
155
                if (row != null) {
-
 
156
                    AbstractAction actionAvoir = new AbstractAction("Transférer en avoir") {
189
                    PredicateRowAction actionBL = new PredicateRowAction(new AbstractAction("Transférer en bon de livraison") {
157
                        public void actionPerformed(ActionEvent e) {
190
                        public void actionPerformed(ActionEvent e) {
158
                            SaisieVenteFactureSQLElement elt = (SaisieVenteFactureSQLElement) Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
191
                            SaisieVenteFactureSQLElement elt = (SaisieVenteFactureSQLElement) Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
159
                            elt.transfertAvoir(row.getID());
192
                            elt.transfertBL(IListe.get(e).getSelectedId());
160
                        }
193
                        }
161
                    };
194
                    }, false);
-
 
195
                    actionBL.setPredicate(IListeEvent.getSingleSelectionPredicate());
162
                    l.add(actionAvoir);
196
                    l.add(actionBL);
163
                    AbstractAction actionBL = new AbstractAction("Transférer en bon de livraison") {
197
                PredicateRowAction actionClone = new PredicateRowAction(new AbstractAction("Créer à partir de ...") {
164
                        public void actionPerformed(ActionEvent e) {
198
                    public void actionPerformed(ActionEvent e) {
-
 
199
 
165
                            SaisieVenteFactureSQLElement elt = (SaisieVenteFactureSQLElement) Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
200
                        SQLElement eltFact = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
-
 
201
                        EditFrame editFrame = new EditFrame(eltFact, EditPanel.CREATION);
-
 
202
 
-
 
203
                        ((SaisieVenteFactureSQLComponent) editFrame.getSQLComponent()).loadFactureExistante(IListe.get(e).getSelectedId());
166
                            elt.transfertBL(row.getID());
204
                        editFrame.setVisible(true);
167
                        }
205
                    }
168
                    };
206
                }, false);
-
 
207
                actionClone.setPredicate(IListeEvent.getSingleSelectionPredicate());
169
                    l.add(actionBL);
208
                l.add(actionClone);
-
 
209
 
-
 
210
                PredicateRowAction actionAvoir = new PredicateRowAction(new AbstractAction("Transférer en avoir") {
-
 
211
                    public void actionPerformed(ActionEvent e) {
-
 
212
                        SaisieVenteFactureSQLElement elt = (SaisieVenteFactureSQLElement) Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
-
 
213
                        elt.transfertAvoir(IListe.get(e).getSelectedId());
170
                }
214
                    }
-
 
215
                }, false);
-
 
216
                actionAvoir.setPredicate(IListeEvent.getSingleSelectionPredicate());
-
 
217
                l.add(actionAvoir);
-
 
218
 
171
                return l;
219
                return l;
172
                // return super.addToMenu();
220
                // return super.addToMenu();
173
 
221
 
174
            }
222
            }
175
        };
223
        };
176
        // this.frame.getPanel().getListe().addRowActions(mouseListener.getRowActions());
224
        // this.frame.getPanel().getListe().addRowActions(mouseListener.getRowActions());
177
        this.frame.getPanel().getListe().getJTable().addMouseListener(mouseListener);
225
        this.frame.getPanel().getListe().addIListeActions(mouseListener.getRowActions());
178
 
226
 
179
 
227
 
180
        return this.frame;
228
        return this.frame;
181
    }
229
    }
182
 
230