OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 21 | Rev 67 | 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.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
 
31
    private static 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) {
36
        this.printer = PrinterNXProps.getInstance().getStringProperty("BonPrinter");
37
        this.row = row;
38
    }
39
 
40
    @Override
25 ilm 41
    public String getDefaultTemplateId() {
42
        return TEMPLATE_ID;
21 ilm 43
    }
44
 
45
    @Override
18 ilm 46
    protected void createListeValues() {
47
        final Map<String, Object> values = new HashMap<String, Object>();
25 ilm 48
        final List<Map<String, Object>> listValues = new ArrayList<Map<String, Object>>();
18 ilm 49
 
50
        final SQLRow clientRow = this.row.getForeignRow("ID_CLIENT");
51
        final SQLRow factureRow = this.row.getForeignRow("ID_SAISIE_VENTE_FACTURE");
52
        values.put("CLIENT", clientRow.getString("NOM"));
53
        values.put("DATE_RELANCE", this.row.getDate("DATE").getTime());
54
        values.put("TEL", clientRow.getString("TEL") + "\n" + clientRow.getString("FAX"));
55
        values.put("NUMERO_FACTURE", factureRow.getString("NUMERO"));
56
        values.put("DATE_FACTURE", dateFormat.format(factureRow.getDate("DATE").getTime()));
57
        values.put("MONTANT", GestionDevise.currencyToString(factureRow.getLong("T_TTC")));
58
        values.put("INFOS", this.row.getString("INFOS"));
59
 
60
        this.listAllSheetValues.put(0, listValues);
61
        this.mapAllSheetValues.put(0, values);
62
 
63
    }
64
 
25 ilm 65
    @Override
66
    public String getName() {
67
        return "FicheRelance" + new Date().getTime();
18 ilm 68
    }
69
 
70
}