OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 151 | 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
 *
182 ilm 4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
18 ilm 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.credit.action;
15
 
61 ilm 16
import java.awt.GridBagConstraints;
17
import java.util.ArrayList;
18
import java.util.List;
19
 
18 ilm 20
import org.openconcerto.erp.action.CreateFrameAbstractAction;
61 ilm 21
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
22
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
18 ilm 23
import org.openconcerto.erp.core.finance.accounting.ui.ListeGestCommEltPanel;
24
import org.openconcerto.erp.generationDoc.gestcomm.AvoirFournisseurXmlSheet;
25
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
26
import org.openconcerto.sql.Configuration;
61 ilm 27
import org.openconcerto.sql.element.SQLElement;
28
import org.openconcerto.sql.model.SQLField;
18 ilm 29
import org.openconcerto.sql.view.IListFrame;
61 ilm 30
import org.openconcerto.ui.DefaultGridBagConstraints;
18 ilm 31
 
32
import javax.swing.Action;
33
import javax.swing.JFrame;
34
 
35
public class ListeDesAvoirsFournisseurAction extends CreateFrameAbstractAction {
36
 
37
    public ListeDesAvoirsFournisseurAction() {
38
        super();
39
        this.putValue(Action.NAME, "Liste des avoirs fournisseurs");
40
    }
41
 
42
    public JFrame createFrame() {
61 ilm 43
        SQLElement element = Configuration.getInstance().getDirectory().getElement("AVOIR_FOURNISSEUR");
44
        ListeGestCommEltPanel panel = new ListeGestCommEltPanel(element);
45
 
46
        List<SQLField> fields = new ArrayList<SQLField>(2);
47
        fields.add(element.getTable().getField("MONTANT_HT"));
48
        fields.add(element.getTable().getField("MONTANT_TTC"));
49
        IListTotalPanel totalPanel = new IListTotalPanel(panel.getListe(), fields, "Total Global");
50
        GridBagConstraints c = new DefaultGridBagConstraints();
51
        c.gridwidth = GridBagConstraints.REMAINDER;
52
        c.fill = GridBagConstraints.NONE;
53
        c.weightx = 0;
54
 
55
        // Total panel
56
        c.gridwidth = GridBagConstraints.REMAINDER;
57
        c.fill = GridBagConstraints.NONE;
58
        c.anchor = GridBagConstraints.EAST;
59
        c.weightx = 1;
60
        c.gridy = 4;
61
        panel.add(totalPanel, c);
62
 
63
        // Date panel
64
        IListFilterDatePanel datePanel = new IListFilterDatePanel(panel.getListe(), element.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap());
65
        c.gridy++;
66
        c.anchor = GridBagConstraints.CENTER;
73 ilm 67
        datePanel.setFilterOnDefault();
61 ilm 68
        panel.add(datePanel, c);
69
 
70
        final IListFrame frame = new IListFrame(panel);
41 ilm 71
        frame.getPanel().setAddVisible(true);
182 ilm 72
        frame.getPanel().getListe().addIListeActions(new MouseSheetXmlListeListener(element, AvoirFournisseurXmlSheet.class).getRowActions());
151 ilm 73
        frame.getPanel().getListe().setModificationAllowed(false);
61 ilm 74
 
18 ilm 75
        return frame;
76
    }
77
}