OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 80 | Rev 180 | 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";
26
    public static final String TEMPLATE_PROPERTY_NAME = "LocationFacture";
18 ilm 27
 
19 ilm 28
    @Override
29
    public String getReference() {
30
        return this.row.getString("NOM");
31
    }
32
 
33
    @Override
25 ilm 34
    public String getName() {
35
        final String startName;
36
        if (row.getBoolean("COMPLEMENT")) {
37
            startName = "FactureComplement_";
38
        } else if (row.getBoolean("ACOMPTE")) {
39
            startName = "FactureAcompte_";
40
        } else {
41
            startName = "Facture_";
42
        }
43
        return startName + this.row.getString("NUMERO");
44
    }
45
 
46
    @Override
19 ilm 47
    public SQLRow getRowLanguage() {
48
        SQLRow rowClient = this.row.getForeignRow("ID_CLIENT");
49
        if (rowClient.getTable().contains("ID_LANGUE")) {
50
            return rowClient.getForeignRow("ID_LANGUE");
51
        } else {
52
            return super.getRowLanguage();
53
        }
54
    }
55
 
18 ilm 56
    public VenteFactureXmlSheet(SQLRow row) {
57
        super(row);
58
        this.printer = PrinterNXProps.getInstance().getStringProperty("FacturePrinter");
59
        this.elt = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
25 ilm 60
        getDefaultTemplateId();
21 ilm 61
    }
62
 
63
    @Override
25 ilm 64
    public String getType() {
65
        String type;
18 ilm 66
        if (row.getBoolean("COMPLEMENT")) {
25 ilm 67
            type = "Complement";
68
        } else if (row.getBoolean("ACOMPTE")) {
69
            type = "Acompte";
80 ilm 70
        } else if (row.getBoolean("PARTIAL") || row.getBoolean("SOLDE")) {
71
            type = "Situation";
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
}