OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 80 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 80 Rev 185
Line 1... Line 1...
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-2019 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.
Line 20... Line 20...
20
 
20
 
21
import java.util.Collection;
21
import java.util.Collection;
22
 
22
 
23
public class LabelAccountInvoiceProvider implements SpreadSheetCellValueProvider {
23
public class LabelAccountInvoiceProvider implements SpreadSheetCellValueProvider {
24
 
24
 
-
 
25
    private final String label;
-
 
26
 
-
 
27
    public LabelAccountInvoiceProvider(String label) {
-
 
28
        this.label = label;
-
 
29
    }
-
 
30
 
25
    public Object getValue(SpreadSheetCellValueContext context) {
31
    public Object getValue(SpreadSheetCellValueContext context) {
26
        final SQLRowAccessor row = context.getRow();
32
        final SQLRowAccessor row = context.getRow();
27
        final Collection<? extends SQLRowAccessor> rows = row.getReferentRows(row.getTable().getTable("TR_COMMANDE_CLIENT"));
33
        final Collection<? extends SQLRowAccessor> rows = row.getReferentRows(row.getTable().getTable("TR_COMMANDE_CLIENT"));
28
        String result;
34
        String result;
29
        if (row.getBoolean("PARTIAL")) {
35
        if (row.getBoolean("PARTIAL")) {
30
            result = "Facturation intermédiaire, commande N°";
36
            result = this.label + ", commande N°";
31
        } else {
37
        } else {
32
            result = "Solde, commande N°";
38
            result = "Solde, commande N°";
33
        }
39
        }
34
        for (SQLRowAccessor sqlRowAccessor : rows) {
40
        for (SQLRowAccessor sqlRowAccessor : rows) {
35
            if (!sqlRowAccessor.isForeignEmpty("ID_COMMANDE_CLIENT")) {
41
            if (!sqlRowAccessor.isForeignEmpty("ID_COMMANDE_CLIENT")) {
Line 39... Line 45...
39
        }
45
        }
40
        return result;
46
        return result;
41
    }
47
    }
42
 
48
 
43
    public static void register() {
49
    public static void register() {
-
 
50
        SpreadSheetCellValueProviderManager.put("sales.account.label", new LabelAccountInvoiceProvider("Facturation intermédiaire"));
44
        SpreadSheetCellValueProviderManager.put("sales.account.label", new LabelAccountInvoiceProvider());
51
        SpreadSheetCellValueProviderManager.put("sales.account.label.account", new LabelAccountInvoiceProvider("Facture d'acompte"));
45
    }
52
    }
46
 
53
 
47
}
54
}