OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Rev 156 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
144 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.sales.order.element;
15
 
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
17
import org.openconcerto.erp.core.common.ui.DeviseTableCellRenderer;
18
import org.openconcerto.sql.element.SQLComponent;
19
import org.openconcerto.sql.element.UISQLComponent;
20
import org.openconcerto.sql.view.list.SQLTableModelSource;
21
import org.openconcerto.utils.ListMap;
22
 
23
import java.util.ArrayList;
24
import java.util.List;
25
 
26
public class ChiffrageCommandeClientSQLElement extends ComptaSQLConfElement {
27
 
28
    public ChiffrageCommandeClientSQLElement() {
29
        super("CHIFFRAGE_COMMANDE_CLIENT", "un chiffrage de commande client", "chffrages commandes clients");
30
 
31
    }
32
 
33
    /*
34
     * (non-Javadoc)
35
     *
36
     * @see org.openconcerto.devis.BaseSQLElement#getComboFields()
37
     */
38
    protected List<String> getComboFields() {
39
        final List<String> l = new ArrayList<String>();
149 ilm 40
        // remove id_commande_client for CIM
41
        if (!getTable().getDBRoot().contains("ID_AFFAIRE")) {
42
            l.add("ID_COMMANDE_CLIENT");
43
        }
144 ilm 44
        l.add("NOM");
45
        return l;
46
    }
47
 
48
    @Override
49
    protected String getParentFFName() {
50
        return "ID_COMMANDE_CLIENT";
51
    }
52
 
53
    @Override
54
    protected void _initTableSource(SQLTableModelSource res) {
55
        super._initTableSource(res);
149 ilm 56
        res.getColumn(getTable().getField("QTE")).setRenderer(new DeviseTableCellRenderer());
57
 
144 ilm 58
        res.getColumn(getTable().getField("PA_HT")).setRenderer(new DeviseTableCellRenderer());
59
        res.getColumn(getTable().getField("MARGE")).setRenderer(new DeviseTableCellRenderer());
60
        res.getColumn(getTable().getField("T_PA_HT")).setRenderer(new DeviseTableCellRenderer());
61
    }
62
 
63
    /*
64
     * (non-Javadoc)
65
     *
66
     * @see org.openconcerto.devis.BaseSQLElement#getListFields()
67
     */
68
    protected List<String> getListFields() {
69
        final List<String> l = new ArrayList<String>();
70
        l.add("ID_COMMANDE_CLIENT");
71
        l.add("NOM");
72
        l.add("ID_FAMILLE_ARTICLE");
73
        l.add("PA_HT");
74
        l.add("QTE");
75
        l.add("ID_UNITE_VENTE");
76
        l.add("T_PA_HT");
77
        l.add("MARGE");
78
        return l;
79
    }
80
 
81
    @Override
82
    public ListMap<String, String> getShowAs() {
83
        // TODO Auto-generated method stub
84
        ListMap<String, String> l = new ListMap<String, String>();
85
        l.putCollection(null, "ID_COMMANDE_CLIENT", "NOM", "ID_FAMILLE_ARTICLE", "PA_HT", "QTE", "T_PA_HT");
86
        return l;
87
    }
88
 
89
    /*
90
     * (non-Javadoc)
91
     *
92
     * @see org.openconcerto.devis.SQLElement#getComponent()
93
     */
94
    public SQLComponent createComponent() {
95
        return new UISQLComponent(this) {
96
            public void addViews() {
97
                this.addView("NOM");
98
                this.addView("ID_FAMILLE_ARTICLE");
99
                this.addView("PA_HT");
100
                this.addView("PV_HT");
101
                this.addView("QTE");
102
                this.addView("ID_UNITE_VENTE");
103
                this.addView("T_PA_HT");
104
                this.addView("T_PV_HT");
105
            }
106
        };
107
    }
108
 
109
    @Override
110
    protected String createCode() {
111
        return createCodeFromPackage() + ".chiffrage";
112
    }
113
 
114
}