OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 177 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 177 Rev 180
Line 52... Line 52...
52
import javax.swing.SwingConstants;
52
import javax.swing.SwingConstants;
53
 
53
 
54
public class ListeDesEcheancesClientsPanel extends JPanel {
54
public class ListeDesEcheancesClientsPanel extends JPanel {
55
 
55
 
56
    private ListPanelEcheancesClients panelEcheances;
56
    private ListPanelEcheancesClients panelEcheances;
57
    private EditFrame editEncaisse = null;
-
 
58
    private EditFrame editRelance = null;
57
    private EditFrame editRelance = null;
59
    private JButton relancer;
58
    private JButton relancer;
60
    private JButton encaisser;
59
    private JButton encaisser;
61
 
60
 
62
    public ListeDesEcheancesClientsPanel() {
61
    public ListeDesEcheancesClientsPanel() {
Line 190... Line 189...
190
                        return;
189
                        return;
191
                    }
190
                    }
192
 
191
 
193
                }
192
                }
194
                SQLElement encaisseElt = Configuration.getInstance().getDirectory().getElement("ENCAISSER_MONTANT");
193
                SQLElement encaisseElt = Configuration.getInstance().getDirectory().getElement("ENCAISSER_MONTANT");
195
                if (ListeDesEcheancesClientsPanel.this.editEncaisse == null) {
-
 
196
                    ListeDesEcheancesClientsPanel.this.editEncaisse = new EditFrame(encaisseElt);
194
                EditFrame editEncaisse = new EditFrame(encaisseElt);
197
                    ListeDesEcheancesClientsPanel.this.editEncaisse.setIconImages(Gestion.getFrameIcon());
-
 
198
                }
-
 
199
 
195
 
200
                SQLRowValues rowVals = new SQLRowValues(encaisseElt.getTable());
196
                SQLRowValues rowVals = new SQLRowValues(encaisseElt.getTable());
201
                if (idClient > -1) {
197
                if (idClient > -1) {
202
                    rowVals.put("ID_CLIENT", idClient);
198
                    rowVals.put("ID_CLIENT", idClient);
203
                }
199
                }
Line 205... Line 201...
205
                rowVals.put("TIERS", tiers);
201
                rowVals.put("TIERS", tiers);
206
                if (idCptTiers > -1) {
202
                if (idCptTiers > -1) {
207
                    rowVals.put("ID_COMPTE_PCE_TIERS", idCptTiers);
203
                    rowVals.put("ID_COMPTE_PCE_TIERS", idCptTiers);
208
                }
204
                }
209
 
205
 
210
                final EncaisserMontantSQLComponent sqlComponent = (EncaisserMontantSQLComponent) ListeDesEcheancesClientsPanel.this.editEncaisse.getSQLComponent();
206
                final EncaisserMontantSQLComponent sqlComponent = (EncaisserMontantSQLComponent) editEncaisse.getSQLComponent();
211
 
207
 
212
                sqlComponent.resetValue();
208
                sqlComponent.resetValue();
213
                sqlComponent.select(rowVals);
209
                sqlComponent.select(rowVals);
214
                sqlComponent.loadEcheancesFromRows(selectedRows);
210
                sqlComponent.loadEcheancesFromRows(selectedRows);
215
                ListeDesEcheancesClientsPanel.this.editEncaisse.setTitle("Encaissement de factures clients");
211
                editEncaisse.setTitle("Encaissement de factures clients");
216
                ListeDesEcheancesClientsPanel.this.editEncaisse.pack();
212
                editEncaisse.pack();
217
                ListeDesEcheancesClientsPanel.this.editEncaisse.setVisible(true);
213
                editEncaisse.setVisible(true);
218
            }
-
 
219
        });
-
 
220
 
-
 
221
        // Gestion de la souris
-
 
222
        this.panelEcheances.getJTable().addMouseListener(new MouseAdapter() {
-
 
223
            @Override
-
 
224
            public void mousePressed(MouseEvent mE) {
-
 
225
                if (mE.getButton() == MouseEvent.BUTTON1) {
-
 
226
                    // Mise à jour de l'echeance sur la frame de reglement
-
 
227
                    // si cette derniere est cree
-
 
228
                    final SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
-
 
229
                    final SQLRowValues selectedRow = panelEcheances.getListe().getSelectedRow();
-
 
230
                    final SQLRow row = selectedRow.asRow();
-
 
231
                    if (row == null) {
-
 
232
                        JOptionPane.showMessageDialog(ListeDesEcheancesClientsPanel.this, "Selection", "Merci de sélectionner une ligne", JOptionPane.PLAIN_MESSAGE);
-
 
233
                        return;
-
 
234
                    }
-
 
235
                    if (ListeDesEcheancesClientsPanel.this.editEncaisse != null) {
-
 
236
                        final SQLRowValues rowVals = new SQLRowValues(base.getTable("ENCAISSER_MONTANT"));
-
 
237
                        rowVals.put("ID_ECHEANCE_CLIENT", row.getID());
-
 
238
 
-
 
239
                        ListeDesEcheancesClientsPanel.this.editEncaisse.getSQLComponent().select(rowVals);
-
 
240
                        ListeDesEcheancesClientsPanel.this.editEncaisse.pack();
-
 
241
                    }
-
 
242
                }
-
 
243
 
-
 
244
            }
214
            }
245
        });
215
        });
246
 
216
 
247
        liste.addIListener(new IListener() {
217
        liste.addIListener(new IListener() {
248
            public void selectionId(int id, int field) {
218
            public void selectionId(int id, int field) {
249
                if (id > 1) {
-
 
250
                    final SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
-
 
251
                    final SQLTable tableEch = base.getTable("ECHEANCE_CLIENT");
-
 
252
                    final SQLRow rowEch = tableEch.getRow(id);
-
 
253
                    final int idMvtSource = MouvementSQLElement.getSourceId(rowEch.getInt("ID_MOUVEMENT"));
-
 
254
                    final SQLRow rowMvtSource = base.getTable("MOUVEMENT").getRow(idMvtSource);
-
 
255
 
-
 
256
                    ListeDesEcheancesClientsPanel.this.relancer.setEnabled(rowMvtSource.getString("SOURCE").equalsIgnoreCase("SAISIE_VENTE_FACTURE"));
-
 
257
                    ListeDesEcheancesClientsPanel.this.encaisser.setEnabled(true);
-
 
258
                } else {
-
 
259
                    ListeDesEcheancesClientsPanel.this.relancer.setEnabled(false);
-
 
260
                    ListeDesEcheancesClientsPanel.this.encaisser.setEnabled(false);
-
 
261
                }
-
 
262
 
219
 
-
 
220
                ListeDesEcheancesClientsPanel.this.relancer.setEnabled(id > 1);
-
 
221
                ListeDesEcheancesClientsPanel.this.encaisser.setEnabled(id > 1);
263
            }
222
            }
264
        });
223
        });
265
        this.relancer.setEnabled(false);
224
        this.relancer.setEnabled(false);
266
        this.encaisser.setEnabled(false);
225
        this.encaisser.setEnabled(false);
267
 
226