OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 18 | Rev 73 | 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
import java.util.concurrent.ExecutionException;
29
 
30
import javax.swing.JButton;
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++;
55
        c.gridwidth = GridBagConstraints.REMAINDER;
56
        c.anchor = GridBagConstraints.EAST;
57
        c.fill = GridBagConstraints.NONE;
58
        JButton gen = new JButton("Créer");
59
 
60
        this.add(gen, c);
61
 
62
        gen.addActionListener(new ActionListener() {
63
 
64
            @Override
65
            public void actionPerformed(ActionEvent e) {
66
                BalanceAgeeListeSheetXML l = new BalanceAgeeListeSheetXML(dateDeb.getDate(), dateFin.getDate());
67
 
68
                try {
25 ilm 69
                    l.createDocument();
70
                    l.openDocument(false);
71
                } catch (Exception e1) {
18 ilm 72
                    e1.printStackTrace();
73
                }
74
            }
75
        });
76
    }
77
}