OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 94 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 94 Rev 174
Line 29... Line 29...
29
import java.awt.GridBagConstraints;
29
import java.awt.GridBagConstraints;
30
import java.awt.GridBagLayout;
30
import java.awt.GridBagLayout;
31
import java.awt.event.ActionEvent;
31
import java.awt.event.ActionEvent;
32
import java.awt.event.ActionListener;
32
import java.awt.event.ActionListener;
33
import java.util.ArrayList;
33
import java.util.ArrayList;
-
 
34
import java.util.Collections;
-
 
35
import java.util.Comparator;
34
import java.util.List;
36
import java.util.List;
35
 
37
 
36
import javax.swing.JButton;
38
import javax.swing.JButton;
37
import javax.swing.JFrame;
39
import javax.swing.JFrame;
38
import javax.swing.JLabel;
40
import javax.swing.JLabel;
Line 107... Line 109...
107
                        SQLSelect sel = new SQLSelect(Configuration.getInstance().getBase());
109
                        SQLSelect sel = new SQLSelect(Configuration.getInstance().getBase());
108
                        final SQLDataSource dataSource = Configuration.getInstance().getBase().getDataSource();
110
                        final SQLDataSource dataSource = Configuration.getInstance().getBase().getDataSource();
109
                        sel.addSelectStar(tableFact);
111
                        sel.addSelectStar(tableFact);
110
                        sel.setDistinct(true);
112
                        sel.setDistinct(true);
111
                        sel.setWhere(new Where(tableFact.getField("DATE"), GenListeVentePanel.this.du.getDate(), GenListeVentePanel.this.au.getDate()));
113
                        sel.setWhere(new Where(tableFact.getField("DATE"), GenListeVentePanel.this.du.getDate(), GenListeVentePanel.this.au.getDate()));
112
                        List<SQLRow> l = (List<SQLRow>) dataSource.execute(sel.asString(), SQLRowListRSH.createFromSelect(sel, tableFact));
114
                        List<SQLRow> l = new ArrayList((List<SQLRow>) dataSource.execute(sel.asString(), SQLRowListRSH.createFromSelect(sel, tableFact)));
-
 
115
                        Collections.sort(l, new Comparator<SQLRow>() {
-
 
116
                            @Override
-
 
117
                            public int compare(SQLRow o1, SQLRow o2) {
-
 
118
                                int dateComp = o1.getDate("DATE").compareTo(o2.getDate("DATE"));
-
 
119
                                if (dateComp == 0) {
-
 
120
                                    return o1.getString("NUMERO").compareTo(o2.getString("NUMERO"));
-
 
121
                                } else {
-
 
122
                                    return dateComp;
-
 
123
                                }
-
 
124
                            }
-
 
125
                        });
-
 
126
 
113
                        SQLSelect sel2 = new SQLSelect(Configuration.getInstance().getBase());
127
                        SQLSelect sel2 = new SQLSelect(Configuration.getInstance().getBase());
114
                        sel2.addSelectStar(tableAvoir);
128
                        sel2.addSelectStar(tableAvoir);
115
                        sel2.setWhere(new Where(tableAvoir.getField("DATE"), GenListeVentePanel.this.du.getDate(), GenListeVentePanel.this.au.getDate()));
129
                        sel2.setWhere(new Where(tableAvoir.getField("DATE"), GenListeVentePanel.this.du.getDate(), GenListeVentePanel.this.au.getDate()));
116
                        sel2.setDistinct(true);
130
                        sel2.setDistinct(true);
117
                        List<SQLRow> l2 = (List<SQLRow>) dataSource.execute(sel2.asString(), SQLRowListRSH.createFromSelect(sel2, tableAvoir));
131
                        List<SQLRow> l2 = new ArrayList((List<SQLRow>) dataSource.execute(sel2.asString(), SQLRowListRSH.createFromSelect(sel2, tableAvoir)));
-
 
132
                        Collections.sort(l2, new Comparator<SQLRow>() {
-
 
133
                            @Override
-
 
134
                            public int compare(SQLRow o1, SQLRow o2) {
-
 
135
                                int dateComp = o1.getDate("DATE").compareTo(o2.getDate("DATE"));
-
 
136
                                if (dateComp == 0) {
-
 
137
                                    return o1.getString("NUMERO").compareTo(o2.getString("NUMERO"));
-
 
138
                                } else {
-
 
139
                                    return dateComp;
-
 
140
                                }
-
 
141
                            }
-
 
142
                        });
118
 
143
 
119
                        List<SQLRow> lTotal = new ArrayList<SQLRow>();
144
                        List<SQLRow> lTotal = new ArrayList<SQLRow>();
120
                        lTotal.addAll(l);
145
                        lTotal.addAll(l);
121
                        lTotal.addAll(l2);
146
                        lTotal.addAll(l2);
-
 
147
 
122
                        ListeVenteXmlSheet sheet = new ListeVenteXmlSheet(lTotal, GenListeVentePanel.this.du.getDate(), GenListeVentePanel.this.au.getDate(), GenListeVentePanel.this.bar);
148
                        ListeVenteXmlSheet sheet = new ListeVenteXmlSheet(lTotal, GenListeVentePanel.this.du.getDate(), GenListeVentePanel.this.au.getDate(), GenListeVentePanel.this.bar);
123
 
149
 
124
                        sheet.createDocumentAsynchronous().get();
150
                        sheet.createDocumentAsynchronous().get();
125
                        sheet.showPrintAndExport(true, false, false);
151
                        sheet.showPrintAndExport(true, false, false);
126
                    } catch (Exception e) {
152
                    } catch (Exception e) {