OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 151 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
149 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
 
156 ilm 16
import org.openconcerto.erp.action.CreateIListFrameAbstractAction;
17
import org.openconcerto.erp.config.ComptaPropsConfiguration;
149 ilm 18
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
19
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
20
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
156 ilm 21
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureItemSQLElement;
149 ilm 22
import org.openconcerto.sql.element.SQLElement;
23
import org.openconcerto.sql.model.SQLField;
24
import org.openconcerto.sql.model.Where;
25
import org.openconcerto.sql.view.IListFrame;
156 ilm 26
import org.openconcerto.sql.view.IListPanel;
149 ilm 27
import org.openconcerto.sql.view.list.IListe;
156 ilm 28
import org.openconcerto.sql.view.list.SQLTableModelSource;
149 ilm 29
import org.openconcerto.ui.DefaultGridBagConstraints;
30
 
31
import java.awt.GridBagConstraints;
32
import java.util.ArrayList;
33
import java.util.List;
34
 
156 ilm 35
public class ListeDesFactureItemsAction extends CreateIListFrameAbstractAction<SaisieVenteFactureItemSQLElement> {
149 ilm 36
 
156 ilm 37
    public ListeDesFactureItemsAction(final ComptaPropsConfiguration conf) {
38
        super(conf, SaisieVenteFactureItemSQLElement.class);
39
    }
149 ilm 40
 
156 ilm 41
    @Override
42
    protected SQLTableModelSource createTableSource() {
43
        final SQLTableModelSource res = super.createTableSource();
44
        res.getReq().setWhere(new Where(getElem().getTable().getField("ID_SAISIE_VENTE_FACTURE"), ">", 1));
45
        return res;
149 ilm 46
    }
156 ilm 47
 
48
    @Override
49
    protected IListPanel instantiateListPanel(SQLTableModelSource tableSource, String panelVariant) {
50
        return new ListeViewPanel(tableSource.getElem(), new IListe(tableSource));
51
    }
52
    @Override
53
    protected void initFrame(IListFrame frame) {
54
        final SQLElement element = this.getElem();
149 ilm 55
 
56
        List<SQLField> l = new ArrayList<SQLField>();
151 ilm 57
        l.add(element.getTable().getField("QTE"));
149 ilm 58
        l.add(element.getTable().getField("T_PA_HT"));
59
        l.add(element.getTable().getField("T_PV_HT"));
60
        l.add(element.getTable().getField("T_PV_TTC"));
156 ilm 61
        final IListPanel listeAddPanel = frame.getPanel();
149 ilm 62
        IListTotalPanel total = new IListTotalPanel(listeAddPanel.getListe(), l);
63
        GridBagConstraints c = new DefaultGridBagConstraints();
64
        c.gridy = 2;
65
        c.weightx = 0;
66
        c.weighty = 0;
67
        c.anchor = GridBagConstraints.EAST;
68
        c.fill = GridBagConstraints.NONE;
69
        listeAddPanel.add(total, c);
151 ilm 70
        frame.getPanel().getListe().setModificationAllowed(false);
149 ilm 71
        frame.getPanel().setAddVisible(false);
72
        frame.getPanel().setSearchFullMode(true);
73
 
74
        // Date panel
75
        IListFilterDatePanel datePanel = new IListFilterDatePanel(frame.getPanel().getListe(), element.getTable().getTable("SAISIE_VENTE_FACTURE").getField("DATE"),
76
                IListFilterDatePanel.getDefaultMap());
77
        c.gridy++;
78
        c.anchor = GridBagConstraints.CENTER;
79
        frame.getPanel().add(datePanel, c);
80
    }
81
}