OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 67 | 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.generationDoc.gestcomm;
15
 
16
import org.openconcerto.erp.generationDoc.AbstractListeSheetXml;
17
import org.openconcerto.erp.preferences.PrinterNXProps;
18
import org.openconcerto.sql.model.SQLRow;
19
import org.openconcerto.utils.GestionDevise;
20
 
21
import java.text.DateFormat;
22
import java.text.SimpleDateFormat;
23
import java.util.ArrayList;
24
import java.util.Date;
25
import java.util.HashMap;
26
import java.util.List;
27
import java.util.Map;
28
 
29
public class FicheRelanceSheet extends AbstractListeSheetXml {
30
 
142 ilm 31
    private final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
25 ilm 32
    public static final String TEMPLATE_ID = "FicheRelance";
33
    public static final String TEMPLATE_PROPERTY_NAME = DEFAULT_PROPERTY_NAME;
18 ilm 34
 
35
    public FicheRelanceSheet(SQLRow row) {
67 ilm 36
        super(row);
18 ilm 37
        this.printer = PrinterNXProps.getInstance().getStringProperty("BonPrinter");
38
    }
39
 
40
    @Override
67 ilm 41
    protected String getStoragePathP() {
42
        return "Relance";
43
    }
44
 
45
    @Override
25 ilm 46
    public String getDefaultTemplateId() {
47
        return TEMPLATE_ID;
21 ilm 48
    }
49
 
50
    @Override
18 ilm 51
    protected void createListeValues() {
52
        final Map<String, Object> values = new HashMap<String, Object>();
25 ilm 53
        final List<Map<String, Object>> listValues = new ArrayList<Map<String, Object>>();
18 ilm 54
 
55
        final SQLRow clientRow = this.row.getForeignRow("ID_CLIENT");
56
        final SQLRow factureRow = this.row.getForeignRow("ID_SAISIE_VENTE_FACTURE");
57
        values.put("CLIENT", clientRow.getString("NOM"));
58
        values.put("DATE_RELANCE", this.row.getDate("DATE").getTime());
59
        values.put("TEL", clientRow.getString("TEL") + "\n" + clientRow.getString("FAX"));
60
        values.put("NUMERO_FACTURE", factureRow.getString("NUMERO"));
61
        values.put("DATE_FACTURE", dateFormat.format(factureRow.getDate("DATE").getTime()));
62
        values.put("MONTANT", GestionDevise.currencyToString(factureRow.getLong("T_TTC")));
63
        values.put("INFOS", this.row.getString("INFOS"));
64
 
65
        this.listAllSheetValues.put(0, listValues);
66
        this.mapAllSheetValues.put(0, values);
67
 
68
    }
69
 
67 ilm 70
    Date d;
71
 
25 ilm 72
    @Override
73
    public String getName() {
67 ilm 74
        if (d == null) {
75
            d = new Date();
76
        }
77
        return "FicheRelance" + d.getTime();
18 ilm 78
    }
79
 
80
}