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 | 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
 
16
import org.openconcerto.erp.action.CreateFrameAbstractAction;
17
import org.openconcerto.erp.core.common.ui.DeviseNiceTableCellRenderer;
18
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
19
import org.openconcerto.sql.Configuration;
20
import org.openconcerto.sql.element.SQLElement;
21
import org.openconcerto.sql.model.Where;
22
import org.openconcerto.sql.request.ListSQLRequest;
23
import org.openconcerto.sql.view.IListFrame;
24
import org.openconcerto.sql.view.list.IListe;
25
 
26
import java.math.BigInteger;
27
 
28
import javax.swing.Action;
29
import javax.swing.JFrame;
30
import javax.swing.JTable;
31
 
32
 
33
public class ListeDesEncaissementsAction extends CreateFrameAbstractAction {
34
 
35
    public ListeDesEncaissementsAction() {
36
        super();
37
        this.putValue(Action.NAME, "Liste des encaissements");
38
    }
39
 
40
    public JFrame createFrame() {
41
 
42
        final SQLElement elementEchClient = Configuration.getInstance().getDirectory().getElement("ENCAISSER_MONTANT");
43
        final SQLElement elementModeRegl = Configuration.getInstance().getDirectory().getElement("MODE_REGLEMENT");
44
        Where w = new Where(elementEchClient.getTable().getField("ID_MODE_REGLEMENT"), "=", elementModeRegl.getTable().getKey());
45
        Where w2 = new Where(elementModeRegl.getTable().getField("AJOURS"), "=", 0).and(new Where(elementModeRegl.getTable().getField("LENJOUR"), "=", 0));
46
        ListSQLRequest req = ListSQLRequest.copy(elementEchClient.getListRequest(), null);
47
        IListe liste = new IListe(req);
48
        IListFrame frame = new IListFrame(new ListeViewPanel(elementEchClient, liste));
49
 
50
        DeviseNiceTableCellRenderer rend = new DeviseNiceTableCellRenderer();
51
        JTable table = frame.getPanel().getListe().getJTable();
52
        for (int i = 0; i < table.getColumnCount(); i++) {
53
            if (table.getColumnClass(i) == Long.class || table.getColumnClass(i) == BigInteger.class) {
54
                table.getColumnModel().getColumn(i).setCellRenderer(rend);
55
            }
56
        }
57
        return frame;
58
    }
59
}