OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 132 | 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.finance.accounting.report;
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.preferences.TemplateNXProps;
18
import org.openconcerto.sql.Configuration;
19
import org.openconcerto.sql.model.SQLRow;
20
 
21
public class PdfGenerator_2033A extends PdfGenerator {
22
 
23
    public PdfGenerator_2033A() {
156 ilm 24
        super("2033A.pdf", "2033A.pdf", TemplateNXProps.getInstance().getStringProperty("Location2033APDF"));
18 ilm 25
        setTemplateOffset(0, 0);
26
        setOffset(0, 0);
27
    }
28
 
29
    public void generate() {
30
        setFontBold(14);
31
 
32
        // TODO recupérer les infos de la societe
33
        SQLRow rowSociete = ((ComptaPropsConfiguration) Configuration.getInstance()).getRowSociete();
132 ilm 34
        addText("NOM", rowSociete.getString("TYPE") + " " + rowSociete.getString("NOM"), 120, 776);
18 ilm 35
        setFontRoman(12);
36
 
37
        SQLRow rowAdresse = Configuration.getInstance().getBase().getTable("ADRESSE_COMMON").getRow(rowSociete.getInt("ID_ADRESSE_COMMON"));
73 ilm 38
        String ville = rowAdresse.getString("VILLE");
18 ilm 39
        final Object cedex = rowAdresse.getObject("CEDEX");
40
        final boolean hasCedex = rowAdresse.getBoolean("HAS_CEDEX");
41
 
42
        if (hasCedex) {
43
            ville += " CEDEX";
44
            if (cedex != null && cedex.toString().trim().length() > 0) {
45
                ville += " " + cedex.toString().trim();
46
            }
47
        }
48
 
73 ilm 49
        final String adresse = rowAdresse.getString("RUE") + ", " + rowAdresse.getString("CODE_POSTAL") + " " + ville;
132 ilm 50
        addText("ADRESSE", adresse, 100, 759);
18 ilm 51
 
132 ilm 52
        addSplittedText("SIRET", rowSociete.getString("NUM_SIRET").replaceAll(" ", ""), 82, 735, 17);
18 ilm 53
 
156 ilm 54
        addSplittedText("CLOS1", "08202006", 502, 689, 9.7);
18 ilm 55
 
132 ilm 56
        addSplittedText("DUREE1", "12", 211 - 28, 758, 14);
18 ilm 57
 
58
        // Copyright
59
        setFontRoman(9);
156 ilm 60
        addText("", "Document généré par le logiciel OpenConcerto", getWidth() - 2, 16, 90);
18 ilm 61
 
62
        setFontRoman(10);
63
        long t = 53L;
64
        int yy = 0;
132 ilm 65
        int y = 652;
66
        final int netColN = 605;
67
        final int netColN1 = 705;
68
        final int amortCol = 515;
69
        final int brutCol = 415;
70
        for (y = 652; y > 390; y -= 18) {
18 ilm 71
            t *= y / 100;
72
            t += y;
132 ilm 73
            addTextRight("ACTIF1." + yy, insertCurrencySpaces("" + t), brutCol - 28, y);
74
            addTextRight("ACTIF2." + yy, insertCurrencySpaces("" + t), amortCol - 28, y);
75
            addTextRight("ACTIF3." + yy, insertCurrencySpaces("" + t), netColN - 28, y);
76
            addTextRight("ACTIF4." + yy, insertCurrencySpaces("" + t), netColN1 - 28, y);
18 ilm 77
            yy++;
78
        }
79
        y -= 18;
132 ilm 80
        for (; y > 310; y -= 18) {
18 ilm 81
 
82
            t += y;
132 ilm 83
            addTextRight("PASSIF3." + yy, insertCurrencySpaces("" + t), netColN - 28, y);
84
            addTextRight("PASSIF4." + yy, insertCurrencySpaces("" + t), netColN1 - 28, y);
18 ilm 85
            yy++;
86
        }
132 ilm 87
        for (; y > 280; y -= 18) {
88
            addTextRight("PASSIF2." + yy, insertCurrencySpaces("" + t / 10000), amortCol - 28 - 28, y);
89
            addTextRight("PASSIF3." + yy, insertCurrencySpaces("" + t), netColN - 28, y);
90
            addTextRight("PASSIF4." + yy, insertCurrencySpaces("" + t), netColN1 - 28, y);
18 ilm 91
            yy++;
92
        }
132 ilm 93
        for (; y > 140; y -= 18) {
94
            addTextRight("PASSIF3." + yy, insertCurrencySpaces("" + t), netColN - 28, y);
95
            addTextRight("PASSIF4." + yy, insertCurrencySpaces("" + t), netColN1 - 28, y);
18 ilm 96
            yy++;
97
        }
132 ilm 98
        for (; y > 120; y -= 18) {
99
            addTextRight("PASSIF2." + yy, insertCurrencySpaces("" + t / 10000), amortCol - 28 - 28, y);
100
            addTextRight("PASSIF3." + yy, insertCurrencySpaces("" + t), netColN - 28, y);
101
            addTextRight("PASSIF4." + yy, insertCurrencySpaces("" + t), netColN1 - 28, y);
18 ilm 102
            yy++;
103
        }
132 ilm 104
        for (; y > 70; y -= 18) {
105
            addTextRight("PASSIF3." + yy, insertCurrencySpaces("" + t), netColN - 28, y);
106
            addTextRight("PASSIF4." + yy, insertCurrencySpaces("" + t), netColN1 - 28, y);
18 ilm 107
            yy++;
108
        }
109
 
132 ilm 110
        for (; y > 10; y -= 18) {
18 ilm 111
            addTextRight("PASSIF1." + yy, insertCurrencySpaces("" + t), 294, y);
132 ilm 112
            addTextRight("PASSIF4." + yy, insertCurrencySpaces("" + t), netColN1 - 28, y);
18 ilm 113
            yy++;
114
        }
115
 
116
    }
117
 
118
}