OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 18 | Rev 21 | 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.shipment.report;
15
 
16
import org.openconcerto.erp.generationDoc.AbstractSheetXml;
17
import org.openconcerto.erp.generationDoc.SheetXml;
18
import org.openconcerto.erp.preferences.PrinterNXProps;
19
import org.openconcerto.sql.Configuration;
20
import org.openconcerto.sql.model.SQLRow;
21
import org.openconcerto.utils.Tuple2;
22
 
23
import java.io.File;
24
import java.util.Calendar;
25
import java.util.Date;
26
 
27
public class BonLivraisonXmlSheet extends AbstractSheetXml {
28
 
29
    private static final Tuple2<String, String> tuple = Tuple2.create("LocationBon", "Bon de livraison");
30
 
31
    public static Tuple2<String, String> getTuple2Location() {
32
        return tuple;
33
    }
34
 
19 ilm 35
    @Override
36
    public String getReference() {
37
        return this.row.getString("NOM");
38
    }
39
 
40
    @Override
41
    public SQLRow getRowLanguage() {
42
        SQLRow rowClient = this.row.getForeignRow("ID_CLIENT");
43
        if (rowClient.getTable().contains("ID_LANGUE")) {
44
            return rowClient.getForeignRow("ID_LANGUE");
45
        } else {
46
            return super.getRowLanguage();
47
        }
48
    }
49
 
18 ilm 50
    public BonLivraisonXmlSheet(SQLRow row) {
51
        super(row);
52
        this.printer = PrinterNXProps.getInstance().getStringProperty("BonPrinter");
53
        this.elt = Configuration.getInstance().getDirectory().getElement("BON_DE_LIVRAISON");
54
        Calendar cal = Calendar.getInstance();
55
        cal.setTime((Date) row.getObject("DATE"));
56
        this.locationOO = SheetXml.getLocationForTuple(tuple, false) + File.separator + cal.get(Calendar.YEAR);
57
        this.locationPDF = SheetXml.getLocationForTuple(tuple, true) + File.separator + cal.get(Calendar.YEAR);
58
        this.modele = "BonLivraison";
59
    }
60
 
61
    public String getFileName() {
62
        return getValidFileName("BonLivraison_" + this.row.getString("NUMERO"));
63
    }
64
}