OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev Author Line No. Line
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.sales.invoice.report;
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
83 ilm 17
import org.openconcerto.erp.core.common.element.BanqueSQLElement;
25 ilm 18
import org.openconcerto.erp.generationDoc.AbstractSheetXMLWithDate;
18 ilm 19
import org.openconcerto.erp.preferences.PrinterNXProps;
20
import org.openconcerto.sql.Configuration;
21
import org.openconcerto.sql.model.SQLRow;
22
 
25 ilm 23
public class VenteFactureXmlSheet extends AbstractSheetXMLWithDate {
18 ilm 24
 
25 ilm 25
    public static final String TEMPLATE_ID = "VenteFacture";
180 ilm 26
    public static final String TEMPLATE_SITUATION_SUFFIX = "Situation";
25 ilm 27
    public static final String TEMPLATE_PROPERTY_NAME = "LocationFacture";
18 ilm 28
 
19 ilm 29
    @Override
30
    public String getReference() {
31
        return this.row.getString("NOM");
32
    }
33
 
34
    @Override
25 ilm 35
    public String getName() {
36
        final String startName;
37
        if (row.getBoolean("COMPLEMENT")) {
38
            startName = "FactureComplement_";
39
        } else if (row.getBoolean("ACOMPTE")) {
40
            startName = "FactureAcompte_";
41
        } else {
42
            startName = "Facture_";
43
        }
44
        return startName + this.row.getString("NUMERO");
45
    }
46
 
47
    @Override
19 ilm 48
    public SQLRow getRowLanguage() {
49
        SQLRow rowClient = this.row.getForeignRow("ID_CLIENT");
180 ilm 50
 
19 ilm 51
        if (rowClient.getTable().contains("ID_LANGUE")) {
180 ilm 52
            if (!rowClient.isForeignEmpty("ID_LANGUE")) {
53
                return rowClient.getForeign("ID_LANGUE");
54
            } else {
55
                return null;
56
            }
19 ilm 57
        } else {
58
            return super.getRowLanguage();
59
        }
60
    }
61
 
18 ilm 62
    public VenteFactureXmlSheet(SQLRow row) {
63
        super(row);
64
        this.printer = PrinterNXProps.getInstance().getStringProperty("FacturePrinter");
65
        this.elt = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
25 ilm 66
        getDefaultTemplateId();
21 ilm 67
    }
68
 
69
    @Override
25 ilm 70
    public String getType() {
71
        String type;
18 ilm 72
        if (row.getBoolean("COMPLEMENT")) {
25 ilm 73
            type = "Complement";
74
        } else if (row.getBoolean("ACOMPTE")) {
75
            type = "Acompte";
80 ilm 76
        } else if (row.getBoolean("PARTIAL") || row.getBoolean("SOLDE")) {
180 ilm 77
            type = TEMPLATE_SITUATION_SUFFIX;
18 ilm 78
        } else {
28 ilm 79
            type = null;
25 ilm 80
 
18 ilm 81
        }
21 ilm 82
 
25 ilm 83
        return type;
84
    }
21 ilm 85
 
25 ilm 86
    @Override
87
    public String getDefaultTemplateId() {
88
        return TEMPLATE_ID;
18 ilm 89
    }
90
 
91
}