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 | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 174
Line 63... Line 63...
63
import java.awt.GridBagConstraints;
63
import java.awt.GridBagConstraints;
64
import java.awt.GridBagLayout;
64
import java.awt.GridBagLayout;
65
import java.awt.event.ActionEvent;
65
import java.awt.event.ActionEvent;
66
import java.awt.event.KeyAdapter;
66
import java.awt.event.KeyAdapter;
67
import java.awt.event.KeyEvent;
67
import java.awt.event.KeyEvent;
68
import java.awt.event.MouseAdapter;
-
 
69
import java.awt.event.MouseEvent;
-
 
70
import java.math.BigDecimal;
68
import java.math.BigDecimal;
71
import java.math.BigInteger;
69
import java.math.BigInteger;
72
import java.sql.SQLException;
70
import java.sql.SQLException;
73
import java.util.ArrayList;
71
import java.util.ArrayList;
74
import java.util.Collection;
72
import java.util.Collection;
Line 78... Line 76...
78
 
76
 
79
import javax.swing.AbstractAction;
77
import javax.swing.AbstractAction;
80
import javax.swing.JFrame;
78
import javax.swing.JFrame;
81
import javax.swing.JLabel;
79
import javax.swing.JLabel;
82
import javax.swing.JOptionPane;
80
import javax.swing.JOptionPane;
83
import javax.swing.JPopupMenu;
-
 
84
import javax.swing.JTextField;
81
import javax.swing.JTextField;
85
import javax.swing.SwingUtilities;
82
import javax.swing.SwingUtilities;
86
 
83
 
87
import org.apache.commons.dbutils.handlers.ArrayListHandler;
84
import org.apache.commons.dbutils.handlers.ArrayListHandler;
88
 
85
 
Line 151... Line 148...
151
    @Override
148
    @Override
152
    protected String getParentFFName() {
149
    protected String getParentFFName() {
153
        return "ID_MOUVEMENT";
150
        return "ID_MOUVEMENT";
154
    }
151
    }
155
 
152
 
-
 
153
    @Override
-
 
154
    public boolean isPrivate() {
-
 
155
        return false;
-
 
156
    }
-
 
157
 
156
    // Impossible de modifier si validée
158
    // Impossible de modifier si validée
157
    // FIXME impossible de saisir une écriture avant la date de debut d'exercice --> de saisir de
159
    // FIXME impossible de saisir une écriture avant la date de debut d'exercice --> de saisir de
158
    // document de gest comm
160
    // document de gest comm
159
 
161
 
160
    public List<String> getListFields() {
162
    public List<String> getListFields() {
Line 194... Line 196...
194
        super._initListRequest(req);
196
        super._initListRequest(req);
195
        req.addToGraphToFetch("VALIDE");
197
        req.addToGraphToFetch("VALIDE");
196
    }
198
    }
197
 
199
 
198
    public void consultationCompte(SQLRowAccessor rowCpt) {
200
    public void consultationCompte(SQLRowAccessor rowCpt) {
199
        final ConsultationCompteFrame f = new ConsultationCompteFrame(new ListeDesEcrituresPanel(), "Consultation compte n°" + rowCpt.getString("NUMERO") + " " + rowCpt.getString("NOM"));
-
 
200
 
-
 
201
        f.getPanel().getListe().getJTable().addMouseListener(new MouseAdapter() {
-
 
202
 
-
 
203
            public void mousePressed(final MouseEvent mE) {
-
 
204
 
-
 
205
                if (mE.getButton() == MouseEvent.BUTTON3) {
-
 
206
                    JPopupMenu menuDroit = new JPopupMenu();
-
 
207
 
-
 
208
                    menuDroit.add(new AbstractAction("Voir les ecritures du journal") {
201
        final ListeDesEcrituresPanel panel = new ListeDesEcrituresPanel();
209
 
-
 
210
                        public void actionPerformed(ActionEvent e) {
-
 
211
                            int id = f.getPanel().getListe().idFromIndex(f.getPanel().getListe().getJTable().rowAtPoint(mE.getPoint()));
-
 
212
                            // int id = f.getPanel().getListe().getSelectedId();
-
 
213
 
-
 
214
                            SQLTable ecrTable = getTable().getTable("ECRITURE");
-
 
215
 
-
 
216
                            System.err.println("Ecritures ID ::: " + id);
-
 
217
                            SQLRow rowEcr = ecrTable.getRow(id);
-
 
218
 
-
 
219
                            System.err.println("Ecritures ID ::: " + id + " --> ID_JOURNAL = " + rowEcr.getInt("ID_JOURNAL"));
-
 
220
 
-
 
221
                            ConsultationCompteFrame f2 = new ConsultationCompteFrame(new ListeDesEcrituresPanel(),
202
        final ConsultationCompteFrame f = new ConsultationCompteFrame(panel, rowCpt);
222
                                    "Consultation du journal " + getTable().getTable("JOURNAL").getRow(rowEcr.getInt("ID_JOURNAL")).getString("NOM"));
-
 
223
 
-
 
224
                            Where w = new Where(ecrTable.getField("ID_JOURNAL"), "=", rowEcr.getInt("ID_JOURNAL"));
-
 
225
 
-
 
226
                            f2.getPanel().getListe().getRequest().setWhere(w);
-
 
227
                            f2.getPanel().getListe().setModificationAllowed(false);
-
 
228
                            f2.pack();
-
 
229
                            f2.setVisible(true);
-
 
230
                        }
-
 
231
                    });
-
 
232
 
-
 
233
                    menuDroit.add(new AbstractAction("Voir la source") {
-
 
234
 
-
 
235
                        public void actionPerformed(ActionEvent e) {
-
 
236
 
-
 
237
                            // int id = f.getPanel().getListe().getSelectedId();
-
 
238
                            int id = f.getPanel().getListe().idFromIndex(f.getPanel().getListe().getJTable().rowAtPoint(mE.getPoint()));
-
 
239
                            System.err.println("ID COMPTE SELECTED " + id);
-
 
240
                            SQLRow rowEcr = getTable().getTable("ECRITURE").getRow(id);
-
 
241
 
-
 
242
                            System.out.println("MOUVEMENT VALIDE ------------->>>>>>>>>>>>>> " + MouvementSQLElement.isEditable(rowEcr.getInt("ID_MOUVEMENT")));
-
 
243
 
-
 
244
                            MouvementSQLElement.showSource(rowEcr.getInt("ID_MOUVEMENT"));
-
 
245
 
-
 
246
                            System.out.println("Mouvement Numero : " + rowEcr.getInt("ID_MOUVEMENT"));
-
 
247
                        }
-
 
248
                    });
-
 
249
 
-
 
250
                    menuDroit.show(mE.getComponent(), mE.getX(), mE.getY());
-
 
251
                }
-
 
252
            }
-
 
253
        });
-
 
254
 
-
 
255
        SQLTable ecrTable = getTable().getTable("ECRITURE");
-
 
256
 
-
 
257
        Where w = new Where(ecrTable.getField("ID_COMPTE_PCE"), "=", rowCpt.getID());
-
 
258
        f.getPanel().getListe().getRequest().setWhere(w);
-
 
259
 
203
 
260
        f.getPanel().getListe().setModificationAllowed(false);
204
        f.getPanel().getListe().setModificationAllowed(false);
261
        f.pack();
205
        f.pack();
262
        f.setVisible(true);
206
        f.setVisible(true);
263
    }
207
    }
Line 694... Line 638...
694
        // on verifie que le mouvement n'est pas validé
638
        // on verifie que le mouvement n'est pas validé
695
        if (MouvementSQLElement.isEditable(idMvt)) {
639
        if (MouvementSQLElement.isEditable(idMvt)) {
696
 
640
 
697
            // on archive le mouvement
641
            // on archive le mouvement
698
            if (dropMvt) {
642
            if (dropMvt) {
-
 
643
 
699
                SQLElement elt = Configuration.getInstance().getDirectory().getElement(tableMvt);
644
                SQLElement elt = getDirectory().getElement(tableMvt);
-
 
645
 
700
                try {
646
                try {
701
                    elt.archive(idMvt);
647
                    elt.archive(idMvt);
702
                } catch (SQLException e) {
648
                } catch (SQLException e) {
703
                    ExceptionHandler.handle("Erreur lors de la suppression du mouvement d'id [" + idMvt + "]", e);
649
                    ExceptionHandler.handle("Erreur lors de la suppression du mouvement d'id [" + idMvt + "]", e);
704
                    e.printStackTrace();
650
                    e.printStackTrace();