80 |
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.supplychain.order.action;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.erp.action.CreateFrameAbstractAction;
|
|
|
17 |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
|
|
|
18 |
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
|
|
|
19 |
import org.openconcerto.erp.core.finance.accounting.ui.ListeGestCommEltPanel;
|
177 |
ilm |
20 |
import org.openconcerto.erp.core.sales.invoice.ui.DateEnvoiRenderer;
|
80 |
ilm |
21 |
import org.openconcerto.sql.Configuration;
|
|
|
22 |
import org.openconcerto.sql.element.SQLElement;
|
|
|
23 |
import org.openconcerto.sql.model.SQLField;
|
|
|
24 |
import org.openconcerto.sql.view.IListFrame;
|
|
|
25 |
import org.openconcerto.sql.view.list.IListe;
|
177 |
ilm |
26 |
import org.openconcerto.sql.view.list.SQLTableModelColumn;
|
|
|
27 |
import org.openconcerto.sql.view.list.SQLTableModelColumnPath;
|
|
|
28 |
import org.openconcerto.sql.view.list.SQLTableModelSource;
|
80 |
ilm |
29 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
177 |
ilm |
30 |
import org.openconcerto.utils.cc.IClosure;
|
80 |
ilm |
31 |
|
|
|
32 |
import java.awt.GridBagConstraints;
|
|
|
33 |
import java.util.Arrays;
|
|
|
34 |
import java.util.HashMap;
|
|
|
35 |
import java.util.Map;
|
|
|
36 |
|
|
|
37 |
import javax.swing.Action;
|
|
|
38 |
import javax.swing.JFrame;
|
177 |
ilm |
39 |
import javax.swing.table.TableColumn;
|
80 |
ilm |
40 |
|
|
|
41 |
public class ListeDesFacturesFournisseurAction extends CreateFrameAbstractAction {
|
|
|
42 |
|
|
|
43 |
public ListeDesFacturesFournisseurAction() {
|
|
|
44 |
super();
|
|
|
45 |
this.putValue(Action.NAME, "Liste des factures fournisseurs");
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
public JFrame createFrame() {
|
|
|
49 |
SQLElement element = Configuration.getInstance().getDirectory().getElement("FACTURE_FOURNISSEUR");
|
|
|
50 |
ListeGestCommEltPanel panel = new ListeGestCommEltPanel(element);
|
|
|
51 |
panel.setAddVisible(true);
|
|
|
52 |
IListFrame frame = new IListFrame(panel);
|
177 |
ilm |
53 |
panel.getListe().setModificationAllowed(true);
|
|
|
54 |
SQLTableModelSource src = panel.getListe().getSource();
|
|
|
55 |
for (SQLTableModelColumn column : src.getColumns()) {
|
|
|
56 |
if (column.getClass().isAssignableFrom(SQLTableModelColumnPath.class)) {
|
|
|
57 |
((SQLTableModelColumnPath) column).setEditable(false);
|
|
|
58 |
}
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
final SQLTableModelColumn dateReglCol = src.getColumn(element.getTable().getField("DATE_REGLEMENT"));
|
|
|
62 |
|
|
|
63 |
// Edition des dates de reglement
|
|
|
64 |
if (dateReglCol != null) {
|
|
|
65 |
((SQLTableModelColumnPath) dateReglCol).setEditable(true);
|
|
|
66 |
dateReglCol.setColumnInstaller(new IClosure<TableColumn>() {
|
|
|
67 |
|
|
|
68 |
@Override
|
|
|
69 |
public void executeChecked(TableColumn columnDateReglement) {
|
|
|
70 |
final org.openconcerto.ui.table.TimestampTableCellEditor cellEditor = new org.openconcerto.ui.table.TimestampTableCellEditor();
|
|
|
71 |
cellEditor.setAllowNull(true);
|
|
|
72 |
columnDateReglement.setCellEditor(cellEditor);
|
|
|
73 |
columnDateReglement.setCellRenderer(new DateEnvoiRenderer());
|
|
|
74 |
}
|
|
|
75 |
});
|
|
|
76 |
}
|
|
|
77 |
|
80 |
ilm |
78 |
IListTotalPanel total = new IListTotalPanel(frame.getPanel().getListe(), Arrays.asList(element.getTable().getField("T_HT"), element.getTable().getField("T_TTC")));
|
|
|
79 |
GridBagConstraints c = new DefaultGridBagConstraints();
|
|
|
80 |
c.gridy = 3;
|
|
|
81 |
c.weightx = 0;
|
|
|
82 |
c.fill = GridBagConstraints.NONE;
|
|
|
83 |
c.anchor = GridBagConstraints.EAST;
|
|
|
84 |
frame.getPanel().add(total, c);
|
|
|
85 |
|
|
|
86 |
// Date panel
|
|
|
87 |
Map<IListe, SQLField> map = new HashMap<IListe, SQLField>();
|
|
|
88 |
map.put(frame.getPanel().getListe(), element.getTable().getField("DATE"));
|
|
|
89 |
|
|
|
90 |
IListFilterDatePanel datePanel = new IListFilterDatePanel(map, IListFilterDatePanel.getDefaultMap());
|
|
|
91 |
c.gridy = 4;
|
|
|
92 |
c.anchor = GridBagConstraints.CENTER;
|
|
|
93 |
c.weighty = 0;
|
|
|
94 |
datePanel.setFilterOnDefault();
|
|
|
95 |
frame.getPanel().add(datePanel, c);
|
|
|
96 |
return frame;
|
|
|
97 |
}
|
|
|
98 |
}
|