Line 11... |
Line 11... |
11 |
* When distributing the software, include this License Header Notice in each file.
|
11 |
* When distributing the software, include this License Header Notice in each file.
|
12 |
*/
|
12 |
*/
|
13 |
|
13 |
|
14 |
package org.openconcerto.erp.core.sales.invoice.action;
|
14 |
package org.openconcerto.erp.core.sales.invoice.action;
|
15 |
|
15 |
|
16 |
import org.openconcerto.erp.action.CreateFrameAbstractAction;
|
16 |
import org.openconcerto.erp.action.CreateIListFrameAbstractAction;
|
- |
|
17 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
17 |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
|
18 |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel;
|
18 |
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
|
19 |
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
|
19 |
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
|
20 |
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
|
20 |
import org.openconcerto.sql.Configuration;
|
21 |
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureItemSQLElement;
|
21 |
import org.openconcerto.sql.element.SQLElement;
|
22 |
import org.openconcerto.sql.element.SQLElement;
|
22 |
import org.openconcerto.sql.model.SQLField;
|
23 |
import org.openconcerto.sql.model.SQLField;
|
23 |
import org.openconcerto.sql.model.Where;
|
24 |
import org.openconcerto.sql.model.Where;
|
24 |
import org.openconcerto.sql.view.IListFrame;
|
25 |
import org.openconcerto.sql.view.IListFrame;
|
- |
|
26 |
import org.openconcerto.sql.view.IListPanel;
|
25 |
import org.openconcerto.sql.view.list.IListe;
|
27 |
import org.openconcerto.sql.view.list.IListe;
|
- |
|
28 |
import org.openconcerto.sql.view.list.SQLTableModelSource;
|
26 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
29 |
import org.openconcerto.ui.DefaultGridBagConstraints;
|
27 |
|
30 |
|
28 |
import java.awt.GridBagConstraints;
|
31 |
import java.awt.GridBagConstraints;
|
29 |
import java.util.ArrayList;
|
32 |
import java.util.ArrayList;
|
30 |
import java.util.List;
|
33 |
import java.util.List;
|
31 |
|
34 |
|
32 |
import javax.swing.Action;
|
- |
|
33 |
import javax.swing.JFrame;
|
35 |
public class ListeDesFactureItemsAction extends CreateIListFrameAbstractAction<SaisieVenteFactureItemSQLElement> {
|
34 |
|
36 |
|
35 |
public class ListeDesFactureItemsAction extends CreateFrameAbstractAction {
|
37 |
public ListeDesFactureItemsAction(final ComptaPropsConfiguration conf) {
|
- |
|
38 |
super(conf, SaisieVenteFactureItemSQLElement.class);
|
- |
|
39 |
}
|
36 |
|
40 |
|
- |
|
41 |
@Override
|
37 |
public ListeDesFactureItemsAction() {
|
42 |
protected SQLTableModelSource createTableSource() {
|
- |
|
43 |
final SQLTableModelSource res = super.createTableSource();
|
- |
|
44 |
res.getReq().setWhere(new Where(getElem().getTable().getField("ID_SAISIE_VENTE_FACTURE"), ">", 1));
|
38 |
super();
|
45 |
return res;
|
39 |
this.putValue(Action.NAME, "Liste des articles facturés");
|
- |
|
40 |
}
|
46 |
}
|
41 |
|
47 |
|
- |
|
48 |
@Override
|
- |
|
49 |
protected IListPanel instantiateListPanel(SQLTableModelSource tableSource, String panelVariant) {
|
- |
|
50 |
return new ListeViewPanel(tableSource.getElem(), new IListe(tableSource));
|
- |
|
51 |
}
|
- |
|
52 |
@Override
|
42 |
public JFrame createFrame() {
|
53 |
protected void initFrame(IListFrame frame) {
|
43 |
final SQLElement element = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE_ELEMENT");
|
54 |
final SQLElement element = this.getElem();
|
44 |
|
55 |
|
45 |
IListe liste = new IListe(element.getTableSource(true));
|
- |
|
46 |
final ListeViewPanel listeAddPanel = new ListeViewPanel(element, liste);
|
- |
|
47 |
listeAddPanel.getListe().getRequest().setWhere(new Where(element.getTable().getField("ID_SAISIE_VENTE_FACTURE"), ">", 1));
|
- |
|
48 |
List<SQLField> l = new ArrayList<SQLField>();
|
56 |
List<SQLField> l = new ArrayList<SQLField>();
|
49 |
l.add(element.getTable().getField("QTE"));
|
57 |
l.add(element.getTable().getField("QTE"));
|
50 |
l.add(element.getTable().getField("T_PA_HT"));
|
58 |
l.add(element.getTable().getField("T_PA_HT"));
|
51 |
l.add(element.getTable().getField("T_PV_HT"));
|
59 |
l.add(element.getTable().getField("T_PV_HT"));
|
52 |
l.add(element.getTable().getField("T_PV_TTC"));
|
60 |
l.add(element.getTable().getField("T_PV_TTC"));
|
- |
|
61 |
final IListPanel listeAddPanel = frame.getPanel();
|
53 |
IListTotalPanel total = new IListTotalPanel(listeAddPanel.getListe(), l);
|
62 |
IListTotalPanel total = new IListTotalPanel(listeAddPanel.getListe(), l);
|
54 |
GridBagConstraints c = new DefaultGridBagConstraints();
|
63 |
GridBagConstraints c = new DefaultGridBagConstraints();
|
55 |
c.gridy = 2;
|
64 |
c.gridy = 2;
|
56 |
c.weightx = 0;
|
65 |
c.weightx = 0;
|
57 |
c.weighty = 0;
|
66 |
c.weighty = 0;
|
58 |
c.anchor = GridBagConstraints.EAST;
|
67 |
c.anchor = GridBagConstraints.EAST;
|
59 |
c.fill = GridBagConstraints.NONE;
|
68 |
c.fill = GridBagConstraints.NONE;
|
60 |
listeAddPanel.add(total, c);
|
69 |
listeAddPanel.add(total, c);
|
61 |
IListFrame frame = new IListFrame(listeAddPanel);
|
- |
|
62 |
frame.setTextTitle("Liste des articles facturés");
|
- |
|
63 |
frame.getPanel().getListe().setModificationAllowed(false);
|
70 |
frame.getPanel().getListe().setModificationAllowed(false);
|
64 |
frame.getPanel().setAddVisible(false);
|
71 |
frame.getPanel().setAddVisible(false);
|
65 |
frame.getPanel().setSearchFullMode(true);
|
72 |
frame.getPanel().setSearchFullMode(true);
|
66 |
|
73 |
|
67 |
// Date panel
|
74 |
// Date panel
|
68 |
IListFilterDatePanel datePanel = new IListFilterDatePanel(frame.getPanel().getListe(), element.getTable().getTable("SAISIE_VENTE_FACTURE").getField("DATE"),
|
75 |
IListFilterDatePanel datePanel = new IListFilterDatePanel(frame.getPanel().getListe(), element.getTable().getTable("SAISIE_VENTE_FACTURE").getField("DATE"),
|
69 |
IListFilterDatePanel.getDefaultMap());
|
76 |
IListFilterDatePanel.getDefaultMap());
|
70 |
c.gridy++;
|
77 |
c.gridy++;
|
71 |
c.anchor = GridBagConstraints.CENTER;
|
78 |
c.anchor = GridBagConstraints.CENTER;
|
72 |
frame.getPanel().add(datePanel, c);
|
79 |
frame.getPanel().add(datePanel, c);
|
73 |
|
- |
|
74 |
return frame;
|
- |
|
75 |
}
|
80 |
}
|
76 |
}
|
81 |
}
|