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 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21 Rev 25
Line 12... Line 12...
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.core.sales.invoice.report;
14
 package org.openconcerto.erp.core.sales.invoice.report;
15
 
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.generationDoc.AbstractSheetXml;
17
import org.openconcerto.erp.generationDoc.AbstractSheetXMLWithDate;
18
import org.openconcerto.erp.generationDoc.SheetXml;
-
 
19
import org.openconcerto.erp.preferences.PrinterNXProps;
18
import org.openconcerto.erp.preferences.PrinterNXProps;
20
import org.openconcerto.sql.Configuration;
19
import org.openconcerto.sql.Configuration;
21
import org.openconcerto.sql.model.SQLRow;
20
import org.openconcerto.sql.model.SQLRow;
22
import org.openconcerto.sql.model.SQLTable;
21
import org.openconcerto.sql.model.SQLTable;
23
import org.openconcerto.utils.Tuple2;
22
import org.openconcerto.utils.Tuple2;
24
 
23
 
25
import java.io.File;
24
import java.io.File;
26
import java.util.Calendar;
-
 
27
import java.util.Date;
-
 
28
import java.util.List;
25
import java.util.List;
29
 
26
 
30
public class VenteFactureXmlSheet extends AbstractSheetXml {
27
public class VenteFactureXmlSheet extends AbstractSheetXMLWithDate {
31
 
28
 
32
    private String startName;
-
 
33
 
-
 
34
    private static final Tuple2<String, String> tuple = Tuple2.create("LocationFacture", "Factures");
29
    public static final String TEMPLATE_ID = "VenteFacture";
35
 
-
 
36
    public static Tuple2<String, String> getTuple2Location() {
30
    public static final String TEMPLATE_PROPERTY_NAME = "LocationFacture";
37
        return tuple;
-
 
38
    }
-
 
39
 
31
 
40
    @Override
32
    @Override
41
    public String getReference() {
33
    public String getReference() {
42
        return this.row.getString("NOM");
34
        return this.row.getString("NOM");
43
    }
35
    }
44
 
36
 
45
    @Override
37
    @Override
-
 
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
46
    public SQLRow getRowLanguage() {
51
    public SQLRow getRowLanguage() {
47
        SQLRow rowClient = this.row.getForeignRow("ID_CLIENT");
52
        SQLRow rowClient = this.row.getForeignRow("ID_CLIENT");
48
        if (rowClient.getTable().contains("ID_LANGUE")) {
53
        if (rowClient.getTable().contains("ID_LANGUE")) {
49
            return rowClient.getForeignRow("ID_LANGUE");
54
            return rowClient.getForeignRow("ID_LANGUE");
50
        } else {
55
        } else {
Line 54... Line 59...
54
 
59
 
55
    public VenteFactureXmlSheet(SQLRow row) {
60
    public VenteFactureXmlSheet(SQLRow row) {
56
        super(row);
61
        super(row);
57
        this.printer = PrinterNXProps.getInstance().getStringProperty("FacturePrinter");
62
        this.printer = PrinterNXProps.getInstance().getStringProperty("FacturePrinter");
58
        this.elt = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
63
        this.elt = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
59
        Calendar cal = Calendar.getInstance();
-
 
60
        cal.setTime((Date) row.getObject("DATE"));
-
 
61
        this.locationOO = SheetXml.getLocationForTuple(tuple, false) + File.separator + cal.get(Calendar.YEAR);
-
 
62
        this.locationPDF = SheetXml.getLocationForTuple(tuple, true) + File.separator + cal.get(Calendar.YEAR);
-
 
63
        getDefaultModele();
64
        getDefaultTemplateId();
64
    }
65
    }
65
 
66
 
66
    @Override
67
    @Override
67
    public String getDefaultModele() {
68
    public String getType() {
68
        String modele;
69
        String type;
69
        if (row.getBoolean("COMPLEMENT")) {
70
        if (row.getBoolean("COMPLEMENT")) {
70
            this.startName = "FactureComplement_";
-
 
71
            modele = "VenteFactureComplement";
71
            type = "Complement";
72
        } else {
-
 
73
            if (row.getBoolean("ACOMPTE")) {
72
        } else if (row.getBoolean("ACOMPTE")) {
74
                this.startName = "FactureAcompte_";
-
 
75
                modele = "VenteFactureAcompte";
73
            type = "Acompte";
76
            } else {
74
        } else {
77
                this.startName = "Facture_";
-
 
78
                modele = "VenteFacture";
-
 
79
            }
-
 
80
        }
-
 
81
 
-
 
82
        return modele;
75
            type = "null";
83
 
76
 
84
    }
77
        }
85
 
78
 
86
    public String getFileName() {
79
        return type;
-
 
80
    }
87
 
81
 
-
 
82
    @Override
88
        return getValidFileName(this.startName + this.row.getString("NUMERO"));
83
    public String getDefaultTemplateId() {
-
 
84
        return TEMPLATE_ID;
89
    }
85
    }
-
 
86
 
90
}
87
}