OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 25 | 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.accounting.ui;
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.core.finance.accounting.report.BalanceAgeeListeSheetXML;
18
import org.openconcerto.sql.Configuration;
19
import org.openconcerto.sql.model.SQLRow;
20
import org.openconcerto.ui.DefaultGridBagConstraints;
21
import org.openconcerto.ui.JDate;
22
 
23
import java.awt.GridBagConstraints;
24
import java.awt.GridBagLayout;
25
import java.awt.event.ActionEvent;
26
import java.awt.event.ActionListener;
27
import java.util.Calendar;
28
 
29
import javax.swing.JButton;
73 ilm 30
import javax.swing.JCheckBox;
18 ilm 31
import javax.swing.JLabel;
32
import javax.swing.JPanel;
33
 
34
public class BalanceAgeePanel extends JPanel {
35
 
36
    public BalanceAgeePanel() {
37
        super(new GridBagLayout());
38
 
39
        JLabel label = new JLabel("Créer la balance agée client pour la période du ");
40
 
41
        SQLRow rowExercice = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete().getForeignRow("ID_EXERCICE_COMMON");
42
        Calendar dDebut = rowExercice.getDate("DATE_DEB");
43
        final JDate dateDeb = new JDate();
44
        dateDeb.setDate(dDebut.getTime());
45
        final JDate dateFin = new JDate(true);
46
 
47
        DefaultGridBagConstraints c = new DefaultGridBagConstraints();
48
        c.gridx = GridBagConstraints.RELATIVE;
49
        this.add(label, c);
50
        this.add(dateDeb, c);
51
        this.add(new JLabel("au"), c);
52
        this.add(dateFin, c);
53
 
54
        c.gridy++;
73 ilm 55
        c.gridx = 0;
18 ilm 56
        c.gridwidth = GridBagConstraints.REMAINDER;
73 ilm 57
        final JCheckBox boxExcludeEcr = new JCheckBox("Exclure les écritures de clotures");
58
        boxExcludeEcr.setSelected(true);
59
        this.add(boxExcludeEcr, c);
60
 
61
        c.gridy++;
62
        c.gridwidth = GridBagConstraints.REMAINDER;
18 ilm 63
        c.anchor = GridBagConstraints.EAST;
64
        c.fill = GridBagConstraints.NONE;
65
        JButton gen = new JButton("Créer");
66
 
67
        this.add(gen, c);
68
 
69
        gen.addActionListener(new ActionListener() {
70
 
71
            @Override
72
            public void actionPerformed(ActionEvent e) {
73 ilm 73
                BalanceAgeeListeSheetXML l = new BalanceAgeeListeSheetXML(dateDeb.getDate(), dateFin.getDate(), boxExcludeEcr.isSelected());
18 ilm 74
 
75
                try {
25 ilm 76
                    l.createDocument();
77
                    l.openDocument(false);
78
                } catch (Exception e1) {
18 ilm 79
                    e1.printStackTrace();
80
                }
81
            }
82
        });
83
    }
84
}