OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 73 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
18 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
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
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.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.erp.core.supplychain.supplier.action;
15
 
16
import org.openconcerto.erp.action.CreateFrameAbstractAction;
17
import org.openconcerto.erp.config.ComptaPropsConfiguration;
18
import org.openconcerto.erp.core.common.ui.PanelFrame;
19
import org.openconcerto.erp.core.reports.history.ui.ListeHistoriquePanel;
20
import org.openconcerto.erp.core.supplychain.supplier.ui.HistoriqueFournBilanPanel;
21
import org.openconcerto.sql.Configuration;
22
import org.openconcerto.sql.model.SQLBase;
23
import org.openconcerto.sql.model.SQLRowAccessor;
65 ilm 24
import org.openconcerto.sql.users.rights.JListSQLTablePanel;
18 ilm 25
 
28 ilm 26
import java.util.Arrays;
27
import java.util.HashMap;
18 ilm 28
import java.util.List;
28 ilm 29
import java.util.Map;
18 ilm 30
 
31
import javax.swing.Action;
32
import javax.swing.JFrame;
33
import javax.swing.event.ListSelectionEvent;
34
import javax.swing.event.ListSelectionListener;
35
 
36
public class NouvelHistoriqueListeFournAction extends CreateFrameAbstractAction {
37
    public NouvelHistoriqueListeFournAction() {
38
        super();
39
        this.putValue(Action.NAME, "Historique fournisseurs");
40
    }
41
 
42
    public JFrame createFrame() {
43
        SQLBase b = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
28 ilm 44
        // List<String> l = new ArrayList<String>();
45
        // l.add("SAISIE_ACHAT");
46
        // l.add("CHEQUE_FOURNISSEUR");
47
        Map<String, List<String>> mapList = new HashMap<String, List<String>>();
180 ilm 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"));
28 ilm 51
        mapList.put("Achats", Arrays.asList("SAISIE_ACHAT"));
180 ilm 52
        mapList.put("Avoirs", Arrays.asList("AVOIR_FOURNISSEUR"));
28 ilm 53
        mapList.put("Chèques émis", Arrays.asList("CHEQUE_FOURNISSEUR"));
18 ilm 54
 
55
        final HistoriqueFournBilanPanel panelBilan = new HistoriqueFournBilanPanel();
73 ilm 56
        final ListeHistoriquePanel listHistoriquePanel = new ListeHistoriquePanel("Fournisseurs", JListSQLTablePanel.createComboRequest(
57
                Configuration.getInstance().getDirectory().getElement(b.getTable("FOURNISSEUR")), true), mapList, panelBilan, null, null);
18 ilm 58
 
59
        listHistoriquePanel.addListSelectionListener(new ListSelectionListener() {
60
            public void valueChanged(ListSelectionEvent e) {
61
                SQLRowAccessor row = listHistoriquePanel.getSelectedRow();
62
                if (row != null) {
63
                    panelBilan.updateData(row.getID());
64
                }
65
            }
66
        });
67
 
68
        return new PanelFrame(listHistoriquePanel, "Historique fournisseurs");
69
    }
70
}