1 |
/*
|
1 |
/*
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3 |
*
|
3 |
*
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
5 |
*
|
5 |
*
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
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
|
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
|
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.
|
9 |
* language governing permissions and limitations under the License.
|
10 |
*
|
10 |
*
|
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.order.action;
|
14 |
package org.openconcerto.erp.core.sales.order.action;
|
15 |
|
15 |
|
16 |
import org.openconcerto.erp.action.CreateFrameAbstractAction;
|
16 |
import org.openconcerto.erp.action.CreateListFrameAbstractAction;
|
- |
|
17 |
import org.openconcerto.erp.config.ComptaPropsConfiguration;
|
17 |
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
|
18 |
import org.openconcerto.erp.core.common.ui.ListeViewPanel;
|
18 |
import org.openconcerto.erp.core.sales.order.element.FacturationCommandeClientSQLElement;
|
19 |
import org.openconcerto.erp.core.sales.order.element.FacturationCommandeClientSQLElement;
|
19 |
import org.openconcerto.sql.Configuration;
|
- |
|
20 |
import org.openconcerto.sql.element.SQLElement;
|
20 |
import org.openconcerto.sql.element.SQLElement;
|
21 |
import org.openconcerto.sql.model.SQLField;
|
21 |
import org.openconcerto.sql.model.SQLField;
|
22 |
import org.openconcerto.sql.model.Where;
|
22 |
import org.openconcerto.sql.model.Where;
|
23 |
import org.openconcerto.sql.view.list.IListe;
|
23 |
import org.openconcerto.sql.view.list.IListe;
|
24 |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
|
24 |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline;
|
25 |
|
25 |
|
26 |
import javax.swing.Action;
|
- |
|
27 |
import javax.swing.JFrame;
|
26 |
import javax.swing.JFrame;
|
28 |
import javax.swing.JTabbedPane;
|
27 |
import javax.swing.JTabbedPane;
|
29 |
|
28 |
|
30 |
public class ListeDesFacturationCommandesClientAction extends CreateFrameAbstractAction {
|
29 |
public class ListeDesFacturationCommandesClientAction extends CreateListFrameAbstractAction<FacturationCommandeClientSQLElement, JFrame> {
|
31 |
|
30 |
|
32 |
public ListeDesFacturationCommandesClientAction() {
|
31 |
public ListeDesFacturationCommandesClientAction(final ComptaPropsConfiguration conf) {
|
33 |
super();
|
- |
|
34 |
this.putValue(Action.NAME, "Echéancier de commandes clients");
|
32 |
super(conf, FacturationCommandeClientSQLElement.class);
|
35 |
}
|
33 |
}
|
36 |
|
34 |
|
- |
|
35 |
@Override
|
37 |
public JFrame createFrame() {
|
36 |
protected JFrame instantiateFrame() {
|
38 |
final JFrame frame = new JFrame("Echéancier de commandes clients");
|
37 |
final JFrame frame = new JFrame(String.valueOf(getValue(NAME)));
|
39 |
final JTabbedPane pane = new JTabbedPane();
|
38 |
final JTabbedPane pane = new JTabbedPane();
|
40 |
|
39 |
|
41 |
final String tableName = FacturationCommandeClientSQLElement.TABLENAME;
|
- |
|
42 |
final SQLElement eltCmd = Configuration.getInstance().getDirectory().getElement(tableName);
|
- |
|
43 |
if (eltCmd == null) {
|
40 |
final SQLElement eltCmd = getElem();
|
44 |
throw new IllegalStateException("No elements for table " + tableName);
|
- |
|
45 |
}
|
41 |
|
46 |
final SQLField fieldFacture = eltCmd.getTable().getField("ID_SAISIE_VENTE_FACTURE");
|
42 |
final SQLField fieldFacture = eltCmd.getTable().getField("ID_SAISIE_VENTE_FACTURE");
|
47 |
// Elements à facturer
|
43 |
// Elements à facturer
|
48 |
final Where wToInvoice = new Where(fieldFacture, "=", 1).or(new Where(fieldFacture, "=", (Object) null));
|
44 |
final Where wToInvoice = new Where(fieldFacture, "=", 1).or(new Where(fieldFacture, "=", (Object) null));
|
49 |
final SQLTableModelSourceOnline tableSourceToInvoice = eltCmd.createTableSource(wToInvoice);
|
45 |
final SQLTableModelSourceOnline tableSourceToInvoice = eltCmd.createTableSource(wToInvoice);
|
50 |
final ListeViewPanel toInvoicePanel = new ListeViewPanel(eltCmd, new IListe(tableSourceToInvoice));
|
46 |
final ListeViewPanel toInvoicePanel = new ListeViewPanel(eltCmd, new IListe(tableSourceToInvoice));
|
51 |
pane.add("A facturer", toInvoicePanel);
|
47 |
pane.add("A facturer", toInvoicePanel);
|
52 |
// Elements facturées
|
48 |
// Elements facturées
|
53 |
final SQLTableModelSourceOnline tableSourceInvoiced = eltCmd.createTableSource(new Where(fieldFacture, ">", 1));
|
49 |
final SQLTableModelSourceOnline tableSourceInvoiced = eltCmd.createTableSource(new Where(fieldFacture, ">", 1));
|
54 |
final ListeViewPanel invoicedPanel = new ListeViewPanel(eltCmd, new IListe(tableSourceInvoiced));
|
50 |
final ListeViewPanel invoicedPanel = new ListeViewPanel(eltCmd, new IListe(tableSourceInvoiced));
|
55 |
pane.add("Facturés", invoicedPanel);
|
51 |
pane.add("Facturés", invoicedPanel);
|
56 |
|
52 |
|
57 |
frame.getContentPane().add(pane);
|
53 |
frame.getContentPane().add(pane);
|
58 |
|
54 |
|
59 |
return frame;
|
55 |
return frame;
|
60 |
}
|
56 |
}
|
61 |
|
57 |
|
62 |
}
|
58 |
}
|