OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 18 | Rev 61 | 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.finance.payment.action;
15
 
19 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;
19 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.common.ui.ListeViewPanel;
24
import org.openconcerto.sql.Configuration;
25
import org.openconcerto.sql.element.SQLElement;
19 ilm 26
import org.openconcerto.sql.model.SQLField;
18 ilm 27
import org.openconcerto.sql.model.Where;
28
import org.openconcerto.sql.view.IListFrame;
19 ilm 29
import org.openconcerto.ui.DefaultGridBagConstraints;
18 ilm 30
 
31
import javax.swing.Action;
32
import javax.swing.JFrame;
33
 
34
public class ListeDesEncaissementsAction extends CreateFrameAbstractAction {
35
 
36
    public ListeDesEncaissementsAction() {
37
        super();
38
        this.putValue(Action.NAME, "Liste des encaissements");
39
    }
40
 
41
    public JFrame createFrame() {
42
 
43
        final SQLElement elementEchClient = Configuration.getInstance().getDirectory().getElement("ENCAISSER_MONTANT");
44
        final SQLElement elementModeRegl = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT");
45
        Where w = new Where(elementEchClient.getTable().getField("ID_MODE_REGLEMENT"), "=", elementModeRegl.getTable().getKey());
46
        Where w2 = new Where(elementModeRegl.getTable().getField("AJOURS"), "=", 0).and(new Where(elementModeRegl.getTable().getField("LENJOUR"), "=", 0));
19 ilm 47
        IListFrame frame = new IListFrame(new ListeViewPanel(elementEchClient));
18 ilm 48
 
19 ilm 49
        List<SQLField> fields = new ArrayList<SQLField>(2);
50
        fields.add(elementEchClient.getTable().getField("MONTANT"));
51
 
52
        IListTotalPanel totalPanel = new IListTotalPanel(frame.getPanel().getListe(), fields, null, "Total Global");
53
 
54
        GridBagConstraints c = new DefaultGridBagConstraints();
55
        c.gridwidth = GridBagConstraints.REMAINDER;
56
        c.fill = GridBagConstraints.NONE;
57
        c.weightx = 0;
58
 
59
        // Total panel
60
        c.gridwidth = GridBagConstraints.REMAINDER;
61
        c.fill = GridBagConstraints.NONE;
62
        c.anchor = GridBagConstraints.EAST;
63
        c.weightx = 1;
64
        c.gridy = 4;
65
 
66
        frame.getPanel().add(totalPanel, c);
67
 
68
        // Date panel
69
        IListFilterDatePanel datePanel = new IListFilterDatePanel(frame.getPanel().getListe(), elementEchClient.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap());
70
        c.gridy++;
71
        c.anchor = GridBagConstraints.CENTER;
72
        frame.getPanel().add(datePanel, c);
73
 
18 ilm 74
        return frame;
75
    }
76
}