18 |
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.finance.payment.element;
|
|
|
15 |
|
|
|
16 |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
|
|
|
17 |
import org.openconcerto.sql.element.SQLComponent;
|
177 |
ilm |
18 |
import org.openconcerto.sql.model.FieldPath;
|
|
|
19 |
import org.openconcerto.sql.model.SQLRowAccessor;
|
|
|
20 |
import org.openconcerto.sql.model.graph.Path;
|
|
|
21 |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
|
|
|
22 |
import org.openconcerto.sql.view.list.SQLTableModelSource;
|
|
|
23 |
import org.openconcerto.utils.CollectionUtils;
|
18 |
ilm |
24 |
|
|
|
25 |
import java.util.ArrayList;
|
|
|
26 |
import java.util.List;
|
177 |
ilm |
27 |
import java.util.Set;
|
18 |
ilm |
28 |
|
|
|
29 |
public class ReglerMontantSQLElement extends ComptaSQLConfElement {
|
|
|
30 |
|
|
|
31 |
public ReglerMontantSQLElement() {
|
|
|
32 |
super("REGLER_MONTANT", "un règlement à un fournisseur", "règlements aux fournisseurs");
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
protected List<String> getListFields() {
|
|
|
36 |
final List<String> l = new ArrayList<String>();
|
|
|
37 |
l.add("DATE");
|
177 |
ilm |
38 |
l.add("ID_FOURNISSEUR");
|
18 |
ilm |
39 |
l.add("ID_MODE_REGLEMENT");
|
|
|
40 |
l.add("MONTANT");
|
|
|
41 |
return l;
|
|
|
42 |
}
|
|
|
43 |
|
|
|
44 |
protected List<String> getComboFields() {
|
|
|
45 |
final List<String> l = new ArrayList<String>();
|
|
|
46 |
l.add("DATE");
|
|
|
47 |
l.add("MONTANT");
|
|
|
48 |
return l;
|
|
|
49 |
}
|
|
|
50 |
|
177 |
ilm |
51 |
@Override
|
|
|
52 |
protected void _initTableSource(SQLTableModelSource res) {
|
|
|
53 |
super._initTableSource(res);
|
|
|
54 |
final BaseSQLTableModelColumn racCol = new BaseSQLTableModelColumn("Report échéance", Boolean.class) {
|
|
|
55 |
@Override
|
|
|
56 |
protected Object show_(SQLRowAccessor r) {
|
|
|
57 |
|
|
|
58 |
return !r.getForeign("ID_MODE_REGLEMENT").getBoolean("COMPTANT");
|
|
|
59 |
}
|
|
|
60 |
|
|
|
61 |
@Override
|
|
|
62 |
public Set<FieldPath> getPaths() {
|
|
|
63 |
Path p = new Path(getTable());
|
|
|
64 |
Path p2 = p.add(p.getLast().getField("ID_MODE_REGLEMENT"));
|
|
|
65 |
return CollectionUtils.createSet(new FieldPath(p2, "COMPTANT"));
|
|
|
66 |
}
|
|
|
67 |
};
|
|
|
68 |
|
|
|
69 |
res.getColumns().add(racCol);
|
|
|
70 |
}
|
|
|
71 |
|
18 |
ilm |
72 |
public SQLComponent createComponent() {
|
80 |
ilm |
73 |
return new ReglerMontantSQLComponent(this);
|
18 |
ilm |
74 |
};
|
57 |
ilm |
75 |
|
|
|
76 |
@Override
|
|
|
77 |
protected String createCode() {
|
156 |
ilm |
78 |
return createCodeOfPackage() + ".regulation";
|
57 |
ilm |
79 |
}
|
18 |
ilm |
80 |
}
|