OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 19 | Go to most recent revision | 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.sales.invoice.action;
15
 
16
import org.openconcerto.erp.action.CreateFrameAbstractAction;
19 ilm 17
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
18 ilm 18
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
19
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
20
import org.openconcerto.sql.Configuration;
21
import org.openconcerto.sql.element.SQLElement;
22
import org.openconcerto.sql.model.SQLField;
23
import org.openconcerto.sql.model.Where;
24
import org.openconcerto.sql.view.IListFrame;
83 ilm 25
import org.openconcerto.sql.view.list.IListe;
18 ilm 26
import org.openconcerto.ui.DefaultGridBagConstraints;
27
 
28
import java.awt.GridBagConstraints;
29
import java.util.ArrayList;
30
import java.util.List;
31
 
32
import javax.swing.Action;
33
import javax.swing.JFrame;
34
 
35
public class ListeDesElementsFactureAction extends CreateFrameAbstractAction {
36
 
37
    public ListeDesElementsFactureAction() {
38
        super();
39
        this.putValue(Action.NAME, "Liste des missions facturées");
40
    }
41
 
42
    public JFrame createFrame() {
43
        final SQLElement element = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE_ELEMENT");
44
 
83 ilm 45
        IListe liste = new IListe(element.getTableSource(true));
46
        final ListeViewPanel listeAddPanel = new ListeViewPanel(element, liste);
18 ilm 47
        listeAddPanel.getListe().getRequest().setWhere(new Where(element.getTable().getField("ID_SAISIE_VENTE_FACTURE"), ">", 1));
48
        List<SQLField> l = new ArrayList<SQLField>();
49
        l.add(element.getTable().getField("T_PV_HT"));
50
        l.add(element.getTable().getField("T_PV_TTC"));
51
        IListTotalPanel total = new IListTotalPanel(listeAddPanel.getListe(), l);
52
        GridBagConstraints c = new DefaultGridBagConstraints();
53
        c.gridy = 2;
54
        c.weightx = 0;
55
        c.weighty = 0;
56
        c.anchor = GridBagConstraints.EAST;
57
        c.fill = GridBagConstraints.NONE;
58
        listeAddPanel.add(total, c);
59
        IListFrame frame = new IListFrame(listeAddPanel);
60
        frame.setTextTitle("Liste des missions facturées");
61
        frame.getPanel().getListe().setSQLEditable(false);
62
        frame.getPanel().setAddVisible(false);
63
        frame.getPanel().setSearchFullMode(true);
64
 
19 ilm 65
        // Date panel
66
        IListFilterDatePanel datePanel = new IListFilterDatePanel(frame.getPanel().getListe(), element.getTable().getTable("SAISIE_VENTE_FACTURE").getField("DATE"),
67
                IListFilterDatePanel.getDefaultMap());
68
        c.gridy++;
69
        c.anchor = GridBagConstraints.CENTER;
70
        frame.getPanel().add(datePanel, c);
71
 
18 ilm 72
        return frame;
73
    }
74
}