OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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