PageRenderTime 476ms CodeModel.GetById 111ms app.highlight 285ms RepoModel.GetById 67ms app.codeStats 1ms

/src/mpv5/ui/panels/JournalPanel.java

http://mp-rechnungs-und-kundenverwaltung.googlecode.com/
Java | 1223 lines | 1035 code | 134 blank | 54 comment | 108 complexity | d433f5dba6b2624597f503a1ca595a41 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  1/*
  2 *  This file is part of YaBS.
  3 *
  4 *      YaBS is free software: you can redistribute it and/or modify
  5 *      it under the terms of the GNU General Public License as published by
  6 *      the Free Software Foundation, either version 3 of the License, or
  7 *      (at your option) any later version.
  8 *
  9 *      YaBS is distributed in the hope that it will be useful,
 10 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 11 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12 *      GNU General Public License for more details.
 13 *
 14 *      You should have received a copy of the GNU General Public License
 15 *      along with YaBS.  If not, see <http://www.gnu.org/licenses/>.
 16 */
 17/*
 18 * HistoryPanel.java
 19 *
 20 * Created on 30.03.2009, 12:05:51
 21 */
 22package mpv5.ui.panels;
 23
 24import enoa.handler.TableHandler;
 25import enoa.handler.TemplateHandler;
 26import java.awt.Component;
 27import java.awt.event.ActionEvent;
 28import java.awt.event.ActionListener;
 29import java.util.ArrayList;
 30import java.util.Arrays;
 31import java.util.Date;
 32import java.util.HashMap;
 33import java.util.List;
 34import javax.swing.DefaultComboBoxModel;
 35import javax.swing.DefaultListModel;
 36import javax.swing.JComponent;
 37import javax.swing.SwingUtilities;
 38import javax.swing.table.DefaultTableModel;
 39import javax.swing.table.TableCellRenderer;
 40import javax.swing.table.TableModel;
 41import mpv5.db.common.Context;
 42
 43import mpv5.db.common.DatabaseObject;
 44import mpv5.db.common.DatabaseObject.Entity;
 45import mpv5.db.common.NodataFoundException;
 46import mpv5.db.common.QueryCriteria2;
 47import mpv5.db.common.QueryHandler;
 48import mpv5.db.common.QueryParameter;
 49import mpv5.db.common.Templateable;
 50import mpv5.db.objects.Account;
 51import mpv5.db.objects.Contact;
 52import mpv5.db.objects.Expense;
 53import mpv5.globals.Headers;
 54import mpv5.db.objects.Group;
 55import mpv5.db.objects.Item;
 56import mpv5.db.objects.Revenue;
 57import mpv5.db.objects.Template;
 58import mpv5.db.objects.User;
 59import mpv5.globals.Constants;
 60import mpv5.globals.Messages;
 61import mpv5.logging.Log;
 62import mpv5.ui.beans.MPCombobox;
 63import mpv5.ui.dialogs.DialogForFile;
 64import mpv5.ui.dialogs.Popup;
 65import mpv5.ui.misc.MPTable;
 66import mpv5.ui.popups.TablePopUp;
 67import mpv5.utils.arrays.ArrayUtilities;
 68import mpv5.utils.date.DateConverter;
 69import mpv5.utils.date.vTimeframe;
 70import mpv5.utils.export.DTAFile;
 71import mpv5.utils.export.Export;
 72import mpv5.utils.jobs.Job;
 73import mpv5.utils.jobs.Waitable;
 74import mpv5.utils.models.MPComboBoxModelItem;
 75import mpv5.utils.models.MPTableModel;
 76import mpv5.utils.models.MPTreeModel;
 77import mpv5.utils.tables.ExcelAdapter;
 78import mpv5.utils.tables.TableFormat;
 79import mpv5.utils.text.TypeConversion;
 80import mpv5.ui.misc.TableViewPersistenceHandler;
 81import mpv5.utils.numberformat.FormatNumber;
 82
 83/**
 84 *
 85 * FIXME unpaid??
 86 */
 87public class JournalPanel extends javax.swing.JPanel implements ListPanel {
 88
 89    private static JournalPanel t;
 90    private static final long serialVersionUID = 1L;
 91    private java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle();
 92
 93    public static JComponent instanceOf() {
 94        if (t == null) {
 95            t = new JournalPanel();
 96        }
 97        return t;
 98    }
 99    private Contact dataOwner;
100    private Template journalOrContactTemplate;
101
102    /**
103     * Creates new form HistoryPanel
104     */
105    public JournalPanel() {
106        initComponents();
107        setName("journalpanel");
108        new ExcelAdapter(jTable1);
109        setPopup();
110        jPanel5.setEnabled(false);
111        jTabbedPane1.removeTabAt(0);
112        jLabel3.setEnabled(false);
113        jLabel4.setEnabled(false);
114        jLabel4.setText("");
115        jTabbedPane1.setSelectedComponent(jPanel4);
116        validate();
117        timeframeChooser1.setTime(new vTimeframe(DateConverter.getDate(DateConverter.getYear()), new Date()));
118        bydateend.setSelected(User.getCurrentUser().getProperties().getProperty(this, bydateend, Boolean.FALSE));
119        expbydateend.setSelected(User.getCurrentUser().getProperties().getProperty(this, expbydateend, Boolean.FALSE));
120        groups.setSearchEnabled(true);
121        groups.setContext(Context.getGroup());
122        groups.triggerSearch();
123        users.setSearchEnabled(true);
124        users.setContext(Context.getUser());
125        users.setModel();
126
127        try {
128            DefaultListModel al = new DefaultListModel();
129            ArrayList<DatabaseObject> accounts = DatabaseObject.getObjects(Context.getAccounts());
130            for (int i = 0; i < accounts.size(); i++) {
131                DatabaseObject databaseObject = accounts.get(i);
132                al.addElement((Account) databaseObject);
133            }
134            jList1.setModel(al);
135        } catch (NodataFoundException nodataFoundException) {
136            Log.Debug(this, nodataFoundException.getMessage());
137        }
138
139        statusc.getComboBox().setModel(new DefaultComboBoxModel(new Object[]{Messages.ALL, Messages.STATUS_PAID, Messages.STATUS_UNPAID, Messages.STATUS_CANCELLED}));
140        prinitingComboBox1.init(jTable1);
141        refresh(null, null);
142        jButton4.setEnabled(false);
143        loadTemplate();
144        ((MPTable) jTable1).setPersistanceHandler(new TableViewPersistenceHandler((MPTable) jTable1, this));
145
146    }
147
148    public JournalPanel(Contact dataOwner) {
149        initComponents();
150        setPopup();
151        jLabel4.setText(dataOwner.__getCname());
152        timeframeChooser1.setTime(new vTimeframe(DateConverter.getDate(DateConverter.getYear()), new Date()));
153        prinitingComboBox1.init(jTable1);
154
155        this.dataOwner = dataOwner;
156        groups.setSearchEnabled(true);
157        groups.setContext(Context.getGroup());
158        groups.triggerSearch();
159
160        try {
161            DefaultListModel al = new DefaultListModel();
162            ArrayList<DatabaseObject> accounts = DatabaseObject.getObjects(Context.getAccounts());
163            for (int i = 0; i < accounts.size(); i++) {
164                DatabaseObject databaseObject = accounts.get(i);
165                al.addElement((Account) databaseObject);
166            }
167            jList1.setModel(al);
168        } catch (NodataFoundException nodataFoundException) {
169            Log.Debug(this, nodataFoundException.getMessage());
170        }
171
172        statusc.getComboBox().setModel(new DefaultComboBoxModel(new Object[]{Messages.ALL, Messages.STATUS_PAID, Messages.STATUS_UNPAID}));
173
174        refresh(null, null);
175
176        jTree1.setCellRenderer(MPTreeModel.getRenderer());
177        jTree1.setModel(new MPTreeModel(dataOwner, null));
178        jTree1.addMouseListener(MPTreeModel.getDefaultTreeListener(jTree1));
179        prinitingComboBox1.init(jTable1);
180//        TreeFormat.expandTree(jTree1);
181        loadTemplate();
182        ((MPTable) jTable1).setPersistanceHandler(new TableViewPersistenceHandler((MPTable) jTable1, this));
183
184    }
185
186    /**
187     * This method is called from within the constructor to initialize the form.
188     * WARNING: Do NOT modify this code. The content of this method is always
189     * regenerated by the Form Editor.
190     */
191    @SuppressWarnings("unchecked")
192    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
193    private void initComponents() {
194
195        buttonGroup1 = new javax.swing.ButtonGroup();
196        buttonGroup2 = new javax.swing.ButtonGroup();
197        jPanel1 = new javax.swing.JPanel();
198        jTabbedPane1 = new javax.swing.JTabbedPane();
199        jPanel5 = new javax.swing.JPanel();
200        jScrollPane2 = new javax.swing.JScrollPane();
201        jTree1 = new javax.swing.JTree();
202        jPanel10 = new javax.swing.JPanel();
203        filternone = new javax.swing.JRadioButton();
204        filterinvoice = new javax.swing.JRadioButton();
205        filterorders = new javax.swing.JRadioButton();
206        filteroffers = new javax.swing.JRadioButton();
207        jPanel4 = new javax.swing.JPanel();
208        jScrollPane1 = new javax.swing.JScrollPane();
209        jTable1 = new  mpv5.ui.misc.MPTable(this) {
210            private static final long serialVersionUID = 1L;
211            public Component prepareRenderer(TableCellRenderer renderer,
212                int rowIndex, int vColIndex) {
213                Component c = super.prepareRenderer(renderer, rowIndex, vColIndex);
214                if (c instanceof JComponent) {
215                    JComponent jc = (JComponent)c;
216                    jc.setToolTipText(String.valueOf(getValueAt(rowIndex, vColIndex)));
217                }
218                return c;
219            }
220        };
221        jPanel2 = new javax.swing.JPanel();
222        jPanel7 = new javax.swing.JPanel();
223        bydateend = new javax.swing.JCheckBox();
224        groups = new mpv5.ui.beans.MPCombobox();
225        jLabel8 = new javax.swing.JLabel();
226        statusc = new mpv5.ui.beans.MPCombobox();
227        includechildgroups = new javax.swing.JCheckBox();
228        jLabel2 = new javax.swing.JLabel();
229        users = new mpv5.ui.beans.MPCombobox();
230        jLabel6 = new javax.swing.JLabel();
231        expbydateend = new javax.swing.JCheckBox();
232        jPanel8 = new javax.swing.JPanel();
233        jLabel3 = new javax.swing.JLabel();
234        jLabel5 = new javax.swing.JLabel();
235        jLabel4 = new javax.swing.JLabel();
236        timeframeChooser1 = new mpv5.ui.beans.TimeframeChooser();
237        jPanel6 = new javax.swing.JPanel();
238        jScrollPane3 = new javax.swing.JScrollPane();
239        jList1 = new javax.swing.JList();
240        jButton1 = new javax.swing.JButton();
241        count = new javax.swing.JLabel();
242        jPanel3 = new javax.swing.JPanel();
243        jButton4 = new javax.swing.JButton();
244        prinitingComboBox1 = new mpv5.ui.beans.PrinitingComboBox();
245        revenueNetto = new mpv5.ui.beans.LabeledTextField();
246        volumeNetto = new mpv5.ui.beans.LabeledTextField();
247        volumeBrutto = new mpv5.ui.beans.LabeledTextField();
248        taxVolume = new mpv5.ui.beans.LabeledTextField();
249        jPanel9 = new javax.swing.JPanel();
250
251        setName("Form"); // NOI18N
252
253        java.util.ResourceBundle bundle = mpv5.i18n.LanguageManager.getBundle(); // NOI18N
254        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("JournalPanel.jPanel1.border.title"))); // NOI18N
255        jPanel1.setName("jPanel1"); // NOI18N
256
257        jTabbedPane1.setName("jTabbedPane1"); // NOI18N
258
259        jPanel5.setName("jPanel5"); // NOI18N
260        jPanel5.setLayout(new java.awt.BorderLayout());
261
262        jScrollPane2.setName("jScrollPane2"); // NOI18N
263
264        javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("root");
265        jTree1.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
266        jTree1.setName("jTree1"); // NOI18N
267        jScrollPane2.setViewportView(jTree1);
268
269        jPanel5.add(jScrollPane2, java.awt.BorderLayout.CENTER);
270
271        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("JournalPanel.jPanel10.border.title"))); // NOI18N
272        jPanel10.setName("jPanel10"); // NOI18N
273        jPanel10.setPreferredSize(new java.awt.Dimension(874, 45));
274        jPanel10.setLayout(new javax.swing.BoxLayout(jPanel10, javax.swing.BoxLayout.LINE_AXIS));
275
276        buttonGroup2.add(filternone);
277        filternone.setSelected(true);
278        filternone.setText(bundle.getString("JournalPanel.filternone.text")); // NOI18N
279        filternone.setName("filternone"); // NOI18N
280        filternone.addItemListener(new java.awt.event.ItemListener() {
281            public void itemStateChanged(java.awt.event.ItemEvent evt) {
282                filternoneItemStateChanged(evt);
283            }
284        });
285        jPanel10.add(filternone);
286
287        buttonGroup2.add(filterinvoice);
288        filterinvoice.setText(bundle.getString("JournalPanel.filterinvoice.text")); // NOI18N
289        filterinvoice.setName("filterinvoice"); // NOI18N
290        filterinvoice.addItemListener(new java.awt.event.ItemListener() {
291            public void itemStateChanged(java.awt.event.ItemEvent evt) {
292                filterinvoiceItemStateChanged(evt);
293            }
294        });
295        jPanel10.add(filterinvoice);
296
297        buttonGroup2.add(filterorders);
298        filterorders.setText(bundle.getString("JournalPanel.filterorders.text")); // NOI18N
299        filterorders.setName("filterorders"); // NOI18N
300        filterorders.addItemListener(new java.awt.event.ItemListener() {
301            public void itemStateChanged(java.awt.event.ItemEvent evt) {
302                filterordersItemStateChanged(evt);
303            }
304        });
305        jPanel10.add(filterorders);
306
307        buttonGroup2.add(filteroffers);
308        filteroffers.setText(bundle.getString("JournalPanel.filteroffers.text")); // NOI18N
309        filteroffers.setName("filteroffers"); // NOI18N
310        filteroffers.addItemListener(new java.awt.event.ItemListener() {
311            public void itemStateChanged(java.awt.event.ItemEvent evt) {
312                filteroffersItemStateChanged(evt);
313            }
314        });
315        jPanel10.add(filteroffers);
316
317        jPanel5.add(jPanel10, java.awt.BorderLayout.NORTH);
318
319        jTabbedPane1.addTab(bundle.getString("JournalPanel.jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N
320
321        jPanel4.setName("jPanel4"); // NOI18N
322        jPanel4.setLayout(new java.awt.BorderLayout(2, 0));
323
324        jScrollPane1.setName("jScrollPane1"); // NOI18N
325        jScrollPane1.setPreferredSize(new java.awt.Dimension(452, 430));
326
327        jTable1.setAutoCreateRowSorter(true);
328        jTable1.setModel(new javax.swing.table.DefaultTableModel(
329            new Object [][] {
330
331            },
332            new String [] {
333
334            }
335        ));
336        jTable1.setFillsViewportHeight(true);
337        jTable1.setName("jTable1"); // NOI18N
338        jTable1.setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
339        jTable1.addMouseListener(new java.awt.event.MouseAdapter() {
340            public void mouseClicked(java.awt.event.MouseEvent evt) {
341                jTable1MouseClicked(evt);
342            }
343        });
344        jScrollPane1.setViewportView(jTable1);
345
346        jPanel4.add(jScrollPane1, java.awt.BorderLayout.CENTER);
347
348        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("JournalPanel.jPanel2.border.title"))); // NOI18N
349        jPanel2.setName("jPanel2"); // NOI18N
350        jPanel2.setPreferredSize(new java.awt.Dimension(734, 200));
351        jPanel2.setRequestFocusEnabled(false);
352
353        jPanel7.setBackground(new java.awt.Color(255, 255, 255));
354        jPanel7.setBorder(javax.swing.BorderFactory.createEtchedBorder());
355        jPanel7.setName("jPanel7"); // NOI18N
356
357        bydateend.setBackground(new java.awt.Color(255, 255, 255));
358        bydateend.setFont(bydateend.getFont());
359        bydateend.setText(bundle.getString("JournalPanel.bydateend.text")); // NOI18N
360        bydateend.setName("bydateend"); // NOI18N
361        bydateend.addItemListener(new java.awt.event.ItemListener() {
362            public void itemStateChanged(java.awt.event.ItemEvent evt) {
363                bydateendItemStateChanged(evt);
364            }
365        });
366
367        groups.setFont(groups.getFont());
368        groups.setName("groups"); // NOI18N
369
370        jLabel8.setFont(jLabel8.getFont());
371        jLabel8.setText(bundle.getString("JournalPanel.jLabel8.text_1")); // NOI18N
372        jLabel8.setName("jLabel8"); // NOI18N
373        jLabel8.setPreferredSize(new java.awt.Dimension(150, 21));
374
375        statusc.setFont(statusc.getFont());
376        statusc.setName("statusc"); // NOI18N
377
378        includechildgroups.setBackground(new java.awt.Color(255, 255, 255));
379        includechildgroups.setFont(includechildgroups.getFont());
380        includechildgroups.setSelected(true);
381        includechildgroups.setText(bundle.getString("JournalPanel.includechildgroups.text")); // NOI18N
382        includechildgroups.setName("includechildgroups"); // NOI18N
383
384        jLabel2.setFont(jLabel2.getFont());
385        jLabel2.setText(bundle.getString("JournalPanel.jLabel2.text")); // NOI18N
386        jLabel2.setName("jLabel2"); // NOI18N
387        jLabel2.setPreferredSize(new java.awt.Dimension(150, 21));
388
389        users.setFont(users.getFont());
390        users.setName("users"); // NOI18N
391
392        jLabel6.setFont(jLabel6.getFont());
393        jLabel6.setText(bundle.getString("JournalPanel.jLabel6.text")); // NOI18N
394        jLabel6.setName("jLabel6"); // NOI18N
395        jLabel6.setPreferredSize(new java.awt.Dimension(150, 21));
396
397        expbydateend.setBackground(new java.awt.Color(255, 255, 255));
398        expbydateend.setFont(expbydateend.getFont());
399        expbydateend.setText(bundle.getString("JournalPanel.expbydateend.text")); // NOI18N
400        expbydateend.setName("expbydateend"); // NOI18N
401        expbydateend.addItemListener(new java.awt.event.ItemListener() {
402            public void itemStateChanged(java.awt.event.ItemEvent evt) {
403                expbydateendItemStateChanged(evt);
404            }
405        });
406
407        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
408        jPanel7.setLayout(jPanel7Layout);
409        jPanel7Layout.setHorizontalGroup(
410            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
411            .addGroup(jPanel7Layout.createSequentialGroup()
412                .addContainerGap()
413                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
414                    .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
415                    .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
416                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
417                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
418                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
419                    .addComponent(groups, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
420                    .addComponent(users, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE)
421                    .addComponent(statusc, javax.swing.GroupLayout.DEFAULT_SIZE, 258, Short.MAX_VALUE))
422                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
423                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
424                    .addComponent(expbydateend, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
425                    .addComponent(bydateend, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE)
426                    .addComponent(includechildgroups, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE))
427                .addContainerGap())
428        );
429        jPanel7Layout.setVerticalGroup(
430            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
431            .addGroup(jPanel7Layout.createSequentialGroup()
432                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
433                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
434                    .addComponent(groups, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
435                    .addComponent(includechildgroups))
436                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
437                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
438                    .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
439                    .addComponent(users, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
440                    .addComponent(expbydateend))
441                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
442                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
443                    .addComponent(bydateend)
444                    .addComponent(statusc, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
445                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
446                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
447        );
448
449        jPanel8.setBackground(new java.awt.Color(255, 255, 255));
450        jPanel8.setBorder(javax.swing.BorderFactory.createEtchedBorder());
451        jPanel8.setName("jPanel8"); // NOI18N
452
453        jLabel3.setFont(jLabel3.getFont());
454        jLabel3.setText(bundle.getString("JournalPanel.jLabel3.text")); // NOI18N
455        jLabel3.setName("jLabel3"); // NOI18N
456
457        jLabel5.setFont(jLabel5.getFont());
458        jLabel5.setText(bundle.getString("JournalPanel.jLabel5.text")); // NOI18N
459        jLabel5.setName("jLabel5"); // NOI18N
460
461        jLabel4.setFont(jLabel4.getFont());
462        jLabel4.setText(bundle.getString("JournalPanel.jLabel4.text")); // NOI18N
463        jLabel4.setName("jLabel4"); // NOI18N
464
465        timeframeChooser1.setBackground(new java.awt.Color(255, 255, 255));
466        timeframeChooser1.setFont(timeframeChooser1.getFont());
467        timeframeChooser1.setName("timeframeChooser1"); // NOI18N
468
469        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
470        jPanel8.setLayout(jPanel8Layout);
471        jPanel8Layout.setHorizontalGroup(
472            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
473            .addGroup(jPanel8Layout.createSequentialGroup()
474                .addContainerGap()
475                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
476                    .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
477                    .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE))
478                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
479                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
480                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 269, javax.swing.GroupLayout.PREFERRED_SIZE)
481                    .addComponent(timeframeChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
482                .addContainerGap(134, Short.MAX_VALUE))
483        );
484        jPanel8Layout.setVerticalGroup(
485            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
486            .addGroup(jPanel8Layout.createSequentialGroup()
487                .addContainerGap()
488                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
489                    .addComponent(jLabel3)
490                    .addComponent(jLabel4))
491                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
492                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
493                    .addComponent(timeframeChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
494                    .addComponent(jLabel5))
495                .addContainerGap())
496        );
497
498        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("JournalPanel.jPanel6.border.title"))); // NOI18N
499        jPanel6.setName("jPanel6"); // NOI18N
500        jPanel6.setLayout(new java.awt.BorderLayout());
501
502        jScrollPane3.setName("jScrollPane3"); // NOI18N
503
504        jList1.setFont(jList1.getFont().deriveFont(jList1.getFont().getStyle() | java.awt.Font.BOLD));
505        jList1.setName("jList1"); // NOI18N
506        jList1.setSelectionBackground(new java.awt.Color(51, 51, 255));
507        jScrollPane3.setViewportView(jList1);
508
509        jPanel6.add(jScrollPane3, java.awt.BorderLayout.CENTER);
510
511        jButton1.setFont(jButton1.getFont());
512        jButton1.setText(bundle.getString("JournalPanel.jButton1.text")); // NOI18N
513        jButton1.setName("jButton1"); // NOI18N
514        jButton1.addActionListener(new java.awt.event.ActionListener() {
515            public void actionPerformed(java.awt.event.ActionEvent evt) {
516                jButton1ActionPerformed(evt);
517            }
518        });
519
520        count.setFont(count.getFont().deriveFont(count.getFont().getStyle() | java.awt.Font.BOLD));
521        count.setForeground(new java.awt.Color(102, 102, 102));
522        count.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
523        count.setText(bundle.getString("JournalPanel.count.text")); // NOI18N
524        count.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
525        count.setName("count"); // NOI18N
526
527        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
528        jPanel2.setLayout(jPanel2Layout);
529        jPanel2Layout.setHorizontalGroup(
530            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
531            .addGroup(jPanel2Layout.createSequentialGroup()
532                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
533                    .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
534                    .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
535                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
536                    .addGroup(jPanel2Layout.createSequentialGroup()
537                        .addGap(100, 100, 100)
538                        .addComponent(count, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))
539                    .addGroup(jPanel2Layout.createSequentialGroup()
540                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
541                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE))
542                    .addGroup(jPanel2Layout.createSequentialGroup()
543                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
544                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)))
545                .addContainerGap())
546        );
547        jPanel2Layout.setVerticalGroup(
548            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
549            .addGroup(jPanel2Layout.createSequentialGroup()
550                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
551                    .addGroup(jPanel2Layout.createSequentialGroup()
552                        .addComponent(jPanel6, 0, 0, Short.MAX_VALUE)
553                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
554                        .addComponent(jButton1))
555                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
556                        .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
557                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
558                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
559                .addGap(11, 11, 11)
560                .addComponent(count, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
561        );
562
563        jPanel4.add(jPanel2, java.awt.BorderLayout.NORTH);
564
565        jPanel3.setName("jPanel3"); // NOI18N
566
567        jButton4.setText(bundle.getString("JournalPanel.jButton4.text")); // NOI18N
568        jButton4.setName("jButton4"); // NOI18N
569        jButton4.addActionListener(new java.awt.event.ActionListener() {
570            public void actionPerformed(java.awt.event.ActionEvent evt) {
571                jButton4ActionPerformed(evt);
572            }
573        });
574
575        prinitingComboBox1.setName("prinitingComboBox1"); // NOI18N
576
577        revenueNetto.set_Label(bundle.getString("JournalPanel.revenueNetto._Label")); // NOI18N
578        revenueNetto.setName("revenueNetto"); // NOI18N
579
580        volumeNetto.set_Label(bundle.getString("JournalPanel.volumeNetto._Label")); // NOI18N
581        volumeNetto.setName("volumeNetto"); // NOI18N
582
583        volumeBrutto.set_Label(bundle.getString("JournalPanel.volumeBrutto._Label")); // NOI18N
584        volumeBrutto.setName("volumeBrutto"); // NOI18N
585
586        taxVolume.set_Label(bundle.getString("JournalPanel.taxVolume._Label")); // NOI18N
587        taxVolume.setName("taxVolume"); // NOI18N
588
589        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
590        jPanel3.setLayout(jPanel3Layout);
591        jPanel3Layout.setHorizontalGroup(
592            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
593            .addGroup(jPanel3Layout.createSequentialGroup()
594                .addContainerGap()
595                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
596                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
597                        .addComponent(volumeNetto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
598                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
599                        .addComponent(revenueNetto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
600                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
601                        .addComponent(prinitingComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
602                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
603                        .addComponent(jButton4)
604                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 145, Short.MAX_VALUE)
605                        .addComponent(volumeBrutto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
606                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
607                        .addComponent(taxVolume, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
608                .addContainerGap())
609        );
610        jPanel3Layout.setVerticalGroup(
611            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
612            .addGroup(jPanel3Layout.createSequentialGroup()
613                .addContainerGap()
614                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
615                    .addComponent(volumeNetto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
616                    .addComponent(revenueNetto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
617                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
618                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
619                    .addComponent(taxVolume, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
620                    .addComponent(volumeBrutto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
621                    .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
622                    .addComponent(prinitingComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
623                .addContainerGap())
624        );
625
626        jPanel4.add(jPanel3, java.awt.BorderLayout.SOUTH);
627
628        jTabbedPane1.addTab(bundle.getString("JournalPanel.jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N
629
630        jPanel9.setName("jPanel9"); // NOI18N
631
632        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
633        jPanel9.setLayout(jPanel9Layout);
634        jPanel9Layout.setHorizontalGroup(
635            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
636            .addGap(0, 874, Short.MAX_VALUE)
637        );
638        jPanel9Layout.setVerticalGroup(
639            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
640            .addGap(0, 297, Short.MAX_VALUE)
641        );
642
643        jTabbedPane1.addTab(bundle.getString("JournalPanel.jPanel9.TabConstraints.tabTitle"), jPanel9); // NOI18N
644
645        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
646        jPanel1.setLayout(jPanel1Layout);
647        jPanel1Layout.setHorizontalGroup(
648            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
649            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 879, Short.MAX_VALUE)
650        );
651        jPanel1Layout.setVerticalGroup(
652            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
653            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 325, Short.MAX_VALUE)
654        );
655
656        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
657        this.setLayout(layout);
658        layout.setHorizontalGroup(
659            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
660            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
661        );
662        layout.setVerticalGroup(
663            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
664            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
665        );
666    }// </editor-fold>//GEN-END:initComponents
667
668    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
669        setData();
670    }//GEN-LAST:event_jButton1ActionPerformed
671
672    private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTable1MouseClicked
673        if (evt.getClickCount() > 1) {
674            try {
675                int index = jTable1.convertRowIndexToModel(jTable1.getSelectedRow());
676                DatabaseObject obj = DatabaseObject.getObject((DatabaseObject.Entity<?, ?>) jTable1.getModel().getValueAt(index, 0));
677                mpv5.YabsViewProxy.instance().addTab(obj);
678            } catch (NodataFoundException ex) {
679                Log.Debug(ex);
680            }
681        }
682    }//GEN-LAST:event_jTable1MouseClicked
683
684    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
685
686        preview();
687    }//GEN-LAST:event_jButton4ActionPerformed
688
689    private void bydateendItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_bydateendItemStateChanged
690        User.getCurrentUser().getProperties().changeProperty(this, bydateend, bydateend.isSelected());
691    }//GEN-LAST:event_bydateendItemStateChanged
692
693    private void expbydateendItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_expbydateendItemStateChanged
694        User.getCurrentUser().getProperties().changeProperty(this, expbydateend, expbydateend.isSelected());
695    }//GEN-LAST:event_expbydateendItemStateChanged
696
697    private void filterinvoiceItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_filterinvoiceItemStateChanged
698        filter();
699    }//GEN-LAST:event_filterinvoiceItemStateChanged
700
701    private void filterordersItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_filterordersItemStateChanged
702        filter();
703    }//GEN-LAST:event_filterordersItemStateChanged
704
705    private void filteroffersItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_filteroffersItemStateChanged
706        filter();
707    }//GEN-LAST:event_filteroffersItemStateChanged
708
709    private void filternoneItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_filternoneItemStateChanged
710        filter();
711    }//GEN-LAST:event_filternoneItemStateChanged
712    // Variables declaration - do not modify//GEN-BEGIN:variables
713    private javax.swing.ButtonGroup buttonGroup1;
714    private javax.swing.ButtonGroup buttonGroup2;
715    private javax.swing.JCheckBox bydateend;
716    private javax.swing.JLabel count;
717    private javax.swing.JCheckBox expbydateend;
718    private javax.swing.JRadioButton filterinvoice;
719    private javax.swing.JRadioButton filternone;
720    private javax.swing.JRadioButton filteroffers;
721    private javax.swing.JRadioButton filterorders;
722    private mpv5.ui.beans.MPCombobox groups;
723    private javax.swing.JCheckBox includechildgroups;
724    private javax.swing.JButton jButton1;
725    private javax.swing.JButton jButton4;
726    private javax.swing.JLabel jLabel2;
727    private javax.swing.JLabel jLabel3;
728    private javax.swing.JLabel jLabel4;
729    private javax.swing.JLabel jLabel5;
730    private javax.swing.JLabel jLabel6;
731    private javax.swing.JLabel jLabel8;
732    private javax.swing.JList jList1;
733    private javax.swing.JPanel jPanel1;
734    private javax.swing.JPanel jPanel10;
735    private javax.swing.JPanel jPanel2;
736    private javax.swing.JPanel jPanel3;
737    private javax.swing.JPanel jPanel4;
738    private javax.swing.JPanel jPanel5;
739    private javax.swing.JPanel jPanel6;
740    private javax.swing.JPanel jPanel7;
741    private javax.swing.JPanel jPanel8;
742    private javax.swing.JPanel jPanel9;
743    private javax.swing.JScrollPane jScrollPane1;
744    private javax.swing.JScrollPane jScrollPane2;
745    private javax.swing.JScrollPane jScrollPane3;
746    private javax.swing.JTabbedPane jTabbedPane1;
747    private javax.swing.JTable jTable1;
748    private javax.swing.JTree jTree1;
749    private mpv5.ui.beans.PrinitingComboBox prinitingComboBox1;
750    private mpv5.ui.beans.LabeledTextField revenueNetto;
751    private mpv5.ui.beans.MPCombobox statusc;
752    private mpv5.ui.beans.LabeledTextField taxVolume;
753    private mpv5.ui.beans.TimeframeChooser timeframeChooser1;
754    private mpv5.ui.beans.MPCombobox users;
755    private mpv5.ui.beans.LabeledTextField volumeBrutto;
756    private mpv5.ui.beans.LabeledTextField volumeNetto;
757    // End of variables declaration//GEN-END:variables
758
759    private Object[][] parse(Object[][] data) {
760        //#entity date group account number type status value
761        double revenuenet = 0d;
762        double volumenet = 0d;
763        double taxvolume = 0d;
764        double volumebrut = 0d;
765        Object[][] d = new Object[data.length][16];
766        try {
767            for (int i = 0; i < d.length; i++) {
768                d[i][1] = data[i][1];
769                d[i][2] = data[i][2];
770                d[i][3] = data[i][3];
771                d[i][4] = data[i][4];
772                d[i][5] = data[i][5];
773                //d[i][14] = data[i][14];
774                d[i][8] = data[i][8];
775                d[i][9] = data[i][9];
776                d[i][7] = data[i][7];
777                d[i][6] = DateConverter.getDefDateString(DateConverter.getDate(data[i][6].toString()));
778
779                d[i][0] = data[i][0];
780
781                int type = Integer.valueOf(data[i][10].toString());
782                if (type == Revenue.TYPE_REVENUE) {
783                    d[i][10] = Messages.TYPE_REVENUE.toString();
784                } else if (type == Expense.TYPE_EXPENSE) {
785                    d[i][10] = Messages.TYPE_EXPENSE.toString();
786                } else {
787                    d[i][10] = Item.getTypeString(type);
788                }
789
790                double netVolume = Double.valueOf(data[i][12].toString());
791                double taxVal = Double.valueOf(data[i][13].toString());
792                double brutVolume = Double.valueOf(data[i][14].toString());
793                d[i][11] = Item.getStatusString(Integer.valueOf(data[i][11].toString()));
794
795                if (Integer.valueOf(data[i][11].toString()).intValue() == Item.STATUS_PAID) {
796                    revenuenet += netVolume;
797                    d[i][15] = "<html><p align=center>" + mpv5.utils.numberformat.FormatNumber.formatDezimal(netVolume);
798                } else if (Integer.valueOf(data[i][11].toString()).intValue() == 1000) {
799                    d[i][15] = "<html><p align=center>" + mpv5.utils.numberformat.FormatNumber.formatDezimal(-1 * netVolume);
800                    revenuenet -= netVolume;
801                    d[i][11] = Item.getStatusString(Item.STATUS_PAID);
802                } else if (Integer.valueOf(data[i][11].toString()).intValue() == 2000) {
803                    d[i][15] = "<html><p align=center>" + mpv5.utils.numberformat.FormatNumber.formatDezimal(-1 * netVolume);
804                    revenuenet -= netVolume;
805                    d[i][11] = Item.getStatusString(Item.STATUS_IN_PROGRESS);
806                } else {
807                    d[i][15] = "<html><p align=center>" + mpv5.utils.numberformat.FormatNumber.formatDezimal(0d);
808                }
809                d[i][12] = "<html><p align=center>" + mpv5.utils.numberformat.FormatNumber.formatDezimal(netVolume);
810                d[i][13] = "<html><p align=center>" + mpv5.utils.numberformat.FormatNumber.formatDezimal(taxVal);
811                d[i][14] = "<html><p align=center>" + mpv5.utils.numberformat.FormatNumber.formatDezimal(brutVolume);
812                volumenet += netVolume;
813                volumebrut += brutVolume;
814                taxvolume += taxVal;
815            }
816        } catch (Exception numberFormatException) {
817            Log.Debug(numberFormatException);
818            Log.Debug(this, Arrays.asList(data[0]));
819        }
820
821        volumeNetto.setText(mpv5.utils.numberformat.FormatNumber.formatDezimal(volumenet));
822        revenueNetto.setText(mpv5.utils.numberformat.FormatNumber.formatDezimal(revenuenet));
823        volumeBrutto.setText(mpv5.utils.numberformat.FormatNumber.formatDezimal(volumebrut));
824        taxVolume.setText(mpv5.utils.numberformat.FormatNumber.formatDezimal(taxvolume));
825
826        return d;
827    }
828
829    private void refresh(final Group forGroup, final User forUser) {
830        Runnable runnable = new Runnable() {
831
832            @Override
833            public void run() {
834
835                try {
836                    QueryCriteria2 itemsParams = new QueryCriteria2();
837                    Object[][] d = new Object[0][0];
838                    Object[][] d1 = new Object[0][0];
839                    Object[][] d2 = new Object[0][0];
840
841                    if (!includechildgroups.isSelected()) {
842                        if (forGroup != null && !forGroup.__getCname().equals("")) {
843                            itemsParams.and(new QueryParameter(Context.getItem(), forGroup.getDbIdentity() + "ids", forGroup.__getIDS(), QueryParameter.EQUALS));
844                        }
845                    } else {
846                        if (forGroup != null && !forGroup.__getCname().equals("")) {
847                            List<Group> gs = forGroup.getChildGroups();
848                            QueryParameter[] params = new QueryParameter[gs.size()];
849                            QueryParameter param1 = (new QueryParameter(Context.getItem(), forGroup.getDbIdentity() + "ids", forGroup.__getIDS(), QueryParameter.EQUALS));
850                            if (gs.size() >= 1) {
851                                for (int i = 0; i < gs.size(); i++) {
852                                    Group group = gs.get(i);
853                                    params[i] = (new QueryParameter(Context.getItem(), group.getDbIdentity() + "ids", group.__getIDS(), QueryParameter.EQUALS));
854                                }
855                                //System.err.println(params);
856                                itemsParams.or(param1, params);
857                            } else {
858                                itemsParams.and(param1);
859                            }
860                        }
861                    }
862
863                    if (forUser != null && !forUser.__getCname().equals("")) {
864                        itemsParams.and(new QueryParameter(Context.getItem(), "intaddedby", forUser.__getIDS(), QueryParameter.EQUALS));
865                    }
866
867
868                    ArrayList<QueryParameter> l = new ArrayList<QueryParameter>();
869
870                    for (int i = 0; i < jList1.getSelectedValues().length; i++) {
871                        l.add(new QueryParameter(Context.getItem(), "accountsids", ((Account) jList1.getSelectedValues()[i]).__getIDS(), QueryParameter.EQUALS));
872                    }
873                    if (l.size() > 1) {
874                        itemsParams.or(l);
875                    } else {
876                        itemsParams.and(l.toArray(new QueryParameter[0]));
877                    }
878
879                    if (dataOwner != null) {
880                        itemsParams.and(new QueryParameter(dataOwner.getContext(), "ids", dataOwner.__getIDS(), QueryParameter.EQUALS));
881                    }
882
883                    boolean additional = true;
884                    if (statusc.getComboBox().getSelectedItem().equals(Messages.STATUS_PAID)) {
885                        itemsParams.and(new QueryParameter(Context.getItem(), "intstatus", Item.STATUS_PAID, QueryParameter.EQUALS));
886                    } else if (statusc.getComboBox().getSelectedItem().equals(Messages.STATUS_UNPAID)) {
887//                        additional = false;
888                        itemsParams.or(
889                                new QueryParameter(Context.getItem(), "intstatus", Item.STATUS_QUEUED, QueryParameter.EQUALS),
890                                new QueryParameter(Context.getItem(), "intstatus", Item.STATUS_PAUSED, QueryParameter.EQUALS),
891                                new QueryParameter(Context.getItem(), "intstatus", Item.STATUS_IN_PROGRESS, QueryParameter.EQUALS),
892                                new QueryParameter(Context.getItem(), "intstatus", Item.STATUS_FINISHED, QueryParameter.EQUALS));
893                    } else if (statusc.getComboBox().getSelectedItem().equals(Messages.STATUS_CANCELLED)) {
894//                        additional = false;
895                        itemsParams.and(new QueryParameter(Context.getItem(), "intstatus", Item.STATUS_CANCELLED, QueryParameter.EQUALS));
896                    }
897
898                    try {
899                        Context c = Context.getItem();
900                        itemsParams.setOrder("accountsids", true);
901                        c.addReference(Context.getGroup());
902                        c.addReference(Context.getAccounts());
903                        c.addReference(Context.getContact());
904
905                        try {
906                            String datecriterium = "dateadded";
907                            if (bydateend.isSelected()) {
908                                datecriterium = "dateend";
909                            }
910                            d = QueryHandler.instanceOf().clone(c).select(Context.DETAILS_JOURNAL.replace("{date}", datecriterium), itemsParams, timeframeChooser1.getTime(), datecriterium).getData();
911                        } catch (NodataFoundException nodataFoundException) {
912                            d = new Object[0][15];
913                        }
914
915                        DatabaseObject.Entity<?, ?>[] es = new DatabaseObject.Entity<?, ?>[d.length];
916                        for (int i = 0; i < d.length; i++) {
917                            es[i] = new DatabaseObject.Entity<Context, Integer>(Context.getItem(), Integer.valueOf(d[i][0].toString()));
918                        }
919
920                        d = ArrayUtilities.replaceColumn(d, 0, es);
921                        if (!additional) {
922                            d = ArrayUtilities.removeRows(d, 11, Item.STATUS_PAID);
923                        }
924                    } catch (Exception ex) {
925                        Log.Debug(ex);
926                    }
927                    if (dataOwner == null && additional) {
928                        try {
929                            Context c = Context.getExpense();
930                            itemsParams.setOrder("dateadded", true);
931                            c.addReference(Context.getGroup());
932                            c.addReference(Context.getAccounts());
933                            QueryCriteria2 expensesParams = new QueryCriteria2();
934                            ArrayList<QueryParameter> l1 = new ArrayList<QueryParameter>();
935                            for (int i = 0; i < jList1.getSelectedValues().length; i++) {
936                                l1.add(new QueryParameter(Context.getExpense(), "accountsids", ((Account) jList1.getSelectedValues()[i]).__getIDS(), QueryParameter.EQUALS));
937                            }
938                            if (l1.size() > 1) {
939                                expensesParams.or(l1);
940                            } else {
941                                expensesParams.and(l1.toArray(new QueryParameter[0]));
942      

Large files files are truncated, but you can click here to view the full file