OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 80 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80 Rev 149
Line 23... Line 23...
23
import java.awt.FlowLayout;
23
import java.awt.FlowLayout;
24
import java.awt.GridBagConstraints;
24
import java.awt.GridBagConstraints;
25
import java.awt.GridBagLayout;
25
import java.awt.GridBagLayout;
26
import java.awt.event.ActionEvent;
26
import java.awt.event.ActionEvent;
27
import java.awt.event.ActionListener;
27
import java.awt.event.ActionListener;
-
 
28
import java.util.Calendar;
28
import java.util.Date;
29
import java.util.Date;
29
import java.util.Map;
30
import java.util.Map;
30
 
31
 
31
import javax.swing.DefaultComboBoxModel;
32
import javax.swing.DefaultComboBoxModel;
32
import javax.swing.JButton;
33
import javax.swing.JButton;
-
 
34
import javax.swing.JCheckBox;
33
import javax.swing.JComboBox;
35
import javax.swing.JComboBox;
34
import javax.swing.JFrame;
36
import javax.swing.JFrame;
35
import javax.swing.JLabel;
37
import javax.swing.JLabel;
36
import javax.swing.JPanel;
38
import javax.swing.JPanel;
37
import javax.swing.SwingUtilities;
39
import javax.swing.SwingUtilities;
Line 39... Line 41...
39
public class EtatVentesPanel extends JPanel implements ActionListener {
41
public class EtatVentesPanel extends JPanel implements ActionListener {
40
 
42
 
41
    private JDate du, au;
43
    private JDate du, au;
42
    private JButton buttonGen = new JButton("Créer");
44
    private JButton buttonGen = new JButton("Créer");
43
    private JButton buttonClose = new JButton("Fermer");
45
    private JButton buttonClose = new JButton("Fermer");
-
 
46
    JCheckBox boxTicket = new JCheckBox("Uniquement les ventes en caisse");
44
 
47
 
45
    public EtatVentesPanel() {
48
    public EtatVentesPanel() {
46
        super(new GridBagLayout());
49
        super(new GridBagLayout());
47
        GridBagConstraints c = new DefaultGridBagConstraints();
50
        GridBagConstraints c = new DefaultGridBagConstraints();
48
        c.gridwidth = GridBagConstraints.REMAINDER;
51
        c.gridwidth = GridBagConstraints.REMAINDER;
Line 57... Line 60...
57
        final Map<String, Tuple2<Date, Date>> map = IListFilterDatePanel.getDefaultMap();
60
        final Map<String, Tuple2<Date, Date>> map = IListFilterDatePanel.getDefaultMap();
58
        if (map != null && map.keySet().size() > 0) {
61
        if (map != null && map.keySet().size() > 0) {
59
            final JPanel p = new JPanel();
62
            final JPanel p = new JPanel();
60
            p.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 1));
63
            p.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 1));
61
            final DefaultComboBoxModel model = new DefaultComboBoxModel();
64
            final DefaultComboBoxModel model = new DefaultComboBoxModel();
-
 
65
            Calendar cal = Calendar.getInstance();
-
 
66
            cal.set(Calendar.HOUR_OF_DAY, 0);
-
 
67
            cal.set(Calendar.MINUTE, 0);
-
 
68
            cal.set(Calendar.SECOND, 0);
-
 
69
            Date d1 = cal.getTime();
-
 
70
            cal.set(Calendar.HOUR_OF_DAY, 23);
-
 
71
            cal.set(Calendar.MINUTE, 59);
-
 
72
            cal.set(Calendar.SECOND, 59);
-
 
73
            Date d2 = cal.getTime();
-
 
74
            map.put("Aujourd'hui", Tuple2.create(d1, d2));
62
            for (String s : map.keySet()) {
75
            for (String s : map.keySet()) {
63
                model.addElement(s);
76
                model.addElement(s);
64
            }
77
            }
65
 
78
 
66
            final JComboBox combo = new JComboBox(model);
79
            final JComboBox combo = new JComboBox(model);
Line 98... Line 111...
98
        this.au = new JDate(false);
111
        this.au = new JDate(false);
99
        this.add(this.au, c);
112
        this.add(this.au, c);
100
 
113
 
101
        c.gridy++;
114
        c.gridy++;
102
        c.gridx = 0;
115
        c.gridx = 0;
-
 
116
        c.weightx = 1;
-
 
117
        c.gridwidth = GridBagConstraints.REMAINDER;
-
 
118
 
-
 
119
        this.add(boxTicket, c);
-
 
120
 
-
 
121
        c.gridy++;
-
 
122
        c.gridx = 0;
103
 
123
 
104
        JPanel panelButton = new JPanel();
124
        JPanel panelButton = new JPanel();
105
        panelButton.add(this.buttonGen);
125
        panelButton.add(this.buttonGen);
106
        panelButton.add(this.buttonClose);
126
        panelButton.add(this.buttonClose);
107
        c.gridwidth = GridBagConstraints.REMAINDER;
127
        c.gridwidth = GridBagConstraints.REMAINDER;
Line 145... Line 165...
145
    @Override
165
    @Override
146
    public void actionPerformed(ActionEvent e) {
166
    public void actionPerformed(ActionEvent e) {
147
        if (e.getSource() == this.buttonGen) {
167
        if (e.getSource() == this.buttonGen) {
148
            final Date start = this.du.getDate();
168
            final Date start = this.du.getDate();
149
            final Date stop = this.au.getDate();
169
            final Date stop = this.au.getDate();
150
            final EtatVentesXmlSheet sheet = new EtatVentesXmlSheet(start, stop);
170
            final EtatVentesXmlSheet sheet = new EtatVentesXmlSheet(start, stop, boxTicket.isSelected());
151
            try {
171
            try {
152
                // FIXME probleme de rendu avec le viewer
172
                // FIXME probleme de rendu avec le viewer
153
                sheet.createDocumentAsynchronous().get();
173
                sheet.createDocumentAsynchronous().get();
154
                sheet.openDocument(false);
174
                sheet.openDocument(false);
155
            } catch (Exception e1) {
175
            } catch (Exception e1) {