OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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