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
 *
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.credit.action;
15
 
156 ilm 16
import org.openconcerto.erp.action.CreateIListFrameAbstractAction;
17
import org.openconcerto.erp.config.ComptaPropsConfiguration;
18 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.finance.accounting.ui.ListeGestCommEltPanel;
156 ilm 21
import org.openconcerto.erp.core.sales.credit.element.AvoirClientSQLElement;
18 ilm 22
import org.openconcerto.sql.element.SQLElement;
23
import org.openconcerto.sql.model.SQLField;
156 ilm 24
import org.openconcerto.sql.view.IListPanel;
25
import org.openconcerto.sql.view.list.IListe;
26
import org.openconcerto.sql.view.list.SQLTableModelSource;
18 ilm 27
import org.openconcerto.ui.DefaultGridBagConstraints;
28
 
29
import java.awt.GridBagConstraints;
30
import java.util.ArrayList;
31
import java.util.List;
32
 
156 ilm 33
public class ListeDesAvoirsClientsAction extends CreateIListFrameAbstractAction<AvoirClientSQLElement> {
18 ilm 34
 
156 ilm 35
    public ListeDesAvoirsClientsAction(final ComptaPropsConfiguration conf) {
36
        super(conf, AvoirClientSQLElement.class);
18 ilm 37
    }
38
 
156 ilm 39
    @Override
40
    protected IListPanel instantiateListPanel(SQLTableModelSource tableSource, String panelVariant) {
41
        final SQLElement element = tableSource.getElem();
42
        final ListeGestCommEltPanel panel = new ListeGestCommEltPanel(element, new IListe(tableSource), panelVariant);
61 ilm 43
        panel.setAddVisible(true);
18 ilm 44
 
45
        List<SQLField> fields = new ArrayList<SQLField>(2);
46
        fields.add(element.getTable().getField("MONTANT_HT"));
47
        fields.add(element.getTable().getField("MONTANT_TTC"));
156 ilm 48
        IListTotalPanel totalPanel = new IListTotalPanel(panel.getListe(), fields, "Total Global");
18 ilm 49
        GridBagConstraints c = new DefaultGridBagConstraints();
50
        c.gridwidth = GridBagConstraints.REMAINDER;
51
        c.fill = GridBagConstraints.NONE;
52
        c.weightx = 0;
53
 
54
        // Total panel
55
        c.gridwidth = GridBagConstraints.REMAINDER;
56
        c.fill = GridBagConstraints.NONE;
57
        c.anchor = GridBagConstraints.EAST;
58
        c.weightx = 1;
59
        c.gridy = 4;
156 ilm 60
        panel.add(totalPanel, c);
18 ilm 61
 
62
        // Date panel
156 ilm 63
        IListFilterDatePanel datePanel = new IListFilterDatePanel(panel.getListe(), element.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap());
18 ilm 64
        c.gridy++;
65
        c.anchor = GridBagConstraints.CENTER;
73 ilm 66
        datePanel.setFilterOnDefault();
156 ilm 67
        panel.add(datePanel, c);
18 ilm 68
 
156 ilm 69
        panel.getListe().setModificationAllowed(false);
70
        return panel;
18 ilm 71
    }
72
}