OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 73 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 73 Rev 180
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
10
 * 
10
 * 
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.core.supplychain.supplier.action;
14
 package org.openconcerto.erp.core.supplychain.supplier.action;
15
 
15
 
16
import org.openconcerto.erp.action.CreateFrameAbstractAction;
16
import org.openconcerto.erp.action.CreateFrameAbstractAction;
17
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.config.ComptaPropsConfiguration;
18
import org.openconcerto.erp.core.common.ui.PanelFrame;
18
import org.openconcerto.erp.core.common.ui.PanelFrame;
19
import org.openconcerto.erp.core.reports.history.ui.ListeHistoriquePanel;
19
import org.openconcerto.erp.core.reports.history.ui.ListeHistoriquePanel;
20
import org.openconcerto.erp.core.supplychain.supplier.ui.HistoriqueFournBilanPanel;
20
import org.openconcerto.erp.core.supplychain.supplier.ui.HistoriqueFournBilanPanel;
21
import org.openconcerto.sql.Configuration;
21
import org.openconcerto.sql.Configuration;
22
import org.openconcerto.sql.model.SQLBase;
22
import org.openconcerto.sql.model.SQLBase;
23
import org.openconcerto.sql.model.SQLRowAccessor;
23
import org.openconcerto.sql.model.SQLRowAccessor;
24
import org.openconcerto.sql.users.rights.JListSQLTablePanel;
24
import org.openconcerto.sql.users.rights.JListSQLTablePanel;
25
 
25
 
26
import java.util.Arrays;
26
import java.util.Arrays;
27
import java.util.HashMap;
27
import java.util.HashMap;
28
import java.util.List;
28
import java.util.List;
29
import java.util.Map;
29
import java.util.Map;
30
 
30
 
31
import javax.swing.Action;
31
import javax.swing.Action;
32
import javax.swing.JFrame;
32
import javax.swing.JFrame;
33
import javax.swing.event.ListSelectionEvent;
33
import javax.swing.event.ListSelectionEvent;
34
import javax.swing.event.ListSelectionListener;
34
import javax.swing.event.ListSelectionListener;
35
 
35
 
36
public class NouvelHistoriqueListeFournAction extends CreateFrameAbstractAction {
36
public class NouvelHistoriqueListeFournAction extends CreateFrameAbstractAction {
37
    public NouvelHistoriqueListeFournAction() {
37
    public NouvelHistoriqueListeFournAction() {
38
        super();
38
        super();
39
        this.putValue(Action.NAME, "Historique fournisseurs");
39
        this.putValue(Action.NAME, "Historique fournisseurs");
40
    }
40
    }
41
 
41
 
42
    public JFrame createFrame() {
42
    public JFrame createFrame() {
43
        SQLBase b = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
43
        SQLBase b = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
44
        // List<String> l = new ArrayList<String>();
44
        // List<String> l = new ArrayList<String>();
45
        // l.add("SAISIE_ACHAT");
45
        // l.add("SAISIE_ACHAT");
46
        // l.add("CHEQUE_FOURNISSEUR");
46
        // l.add("CHEQUE_FOURNISSEUR");
47
        Map<String, List<String>> mapList = new HashMap<String, List<String>>();
47
        Map<String, List<String>> mapList = new HashMap<String, List<String>>();
-
 
48
        mapList.put("Commandes", Arrays.asList("COMMANDE"));
-
 
49
        mapList.put("Bons de réception", Arrays.asList("BON_RECEPTION"));
-
 
50
        mapList.put("Factures", Arrays.asList("FACTURE_FOURNISSEUR"));
48
        mapList.put("Achats", Arrays.asList("SAISIE_ACHAT"));
51
        mapList.put("Achats", Arrays.asList("SAISIE_ACHAT"));
-
 
52
        mapList.put("Avoirs", Arrays.asList("AVOIR_FOURNISSEUR"));
49
        mapList.put("Chèques émis", Arrays.asList("CHEQUE_FOURNISSEUR"));
53
        mapList.put("Chèques émis", Arrays.asList("CHEQUE_FOURNISSEUR"));
50
 
54
 
51
        final HistoriqueFournBilanPanel panelBilan = new HistoriqueFournBilanPanel();
55
        final HistoriqueFournBilanPanel panelBilan = new HistoriqueFournBilanPanel();
52
        final ListeHistoriquePanel listHistoriquePanel = new ListeHistoriquePanel("Fournisseurs", JListSQLTablePanel.createComboRequest(
56
        final ListeHistoriquePanel listHistoriquePanel = new ListeHistoriquePanel("Fournisseurs", JListSQLTablePanel.createComboRequest(
53
                Configuration.getInstance().getDirectory().getElement(b.getTable("FOURNISSEUR")), true), mapList, panelBilan, null, null);
57
                Configuration.getInstance().getDirectory().getElement(b.getTable("FOURNISSEUR")), true), mapList, panelBilan, null, null);
54
 
58
 
55
        listHistoriquePanel.addListSelectionListener(new ListSelectionListener() {
59
        listHistoriquePanel.addListSelectionListener(new ListSelectionListener() {
56
            public void valueChanged(ListSelectionEvent e) {
60
            public void valueChanged(ListSelectionEvent e) {
57
                SQLRowAccessor row = listHistoriquePanel.getSelectedRow();
61
                SQLRowAccessor row = listHistoriquePanel.getSelectedRow();
58
                if (row != null) {
62
                if (row != null) {
59
                    panelBilan.updateData(row.getID());
63
                    panelBilan.updateData(row.getID());
60
                }
64
                }
61
            }
65
            }
62
        });
66
        });
63
 
67
 
64
        return new PanelFrame(listHistoriquePanel, "Historique fournisseurs");
68
        return new PanelFrame(listHistoriquePanel, "Historique fournisseurs");
65
    }
69
    }
66
}
70
}