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

Rev 21 Rev 25
Line 13... Line 13...
13
 
13
 
14
 package org.openconcerto.erp.core.finance.accounting.report;
14
 package org.openconcerto.erp.core.finance.accounting.report;
15
 
15
 
16
import org.openconcerto.erp.core.finance.payment.element.ModeDeReglementSQLElement;
16
import org.openconcerto.erp.core.finance.payment.element.ModeDeReglementSQLElement;
17
import org.openconcerto.erp.generationDoc.AbstractListeSheetXml;
17
import org.openconcerto.erp.generationDoc.AbstractListeSheetXml;
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.element.SQLElement;
20
import org.openconcerto.sql.element.SQLElement;
22
import org.openconcerto.sql.model.SQLRow;
21
import org.openconcerto.sql.model.SQLRow;
23
import org.openconcerto.sql.model.SQLRowListRSH;
22
import org.openconcerto.sql.model.SQLRowListRSH;
24
import org.openconcerto.sql.model.SQLSelect;
23
import org.openconcerto.sql.model.SQLSelect;
25
import org.openconcerto.sql.model.Where;
24
import org.openconcerto.sql.model.Where;
26
import org.openconcerto.utils.Tuple2;
-
 
27
 
25
 
28
import java.util.ArrayList;
26
import java.util.ArrayList;
29
import java.util.Calendar;
27
import java.util.Calendar;
30
import java.util.Date;
28
import java.util.Date;
31
import java.util.HashMap;
29
import java.util.HashMap;
32
import java.util.List;
30
import java.util.List;
33
import java.util.Map;
31
import java.util.Map;
34
 
32
 
35
public class BalanceAgeeListeSheetXML extends AbstractListeSheetXml {
33
public class BalanceAgeeListeSheetXML extends AbstractListeSheetXml {
36
 
34
 
37
    // private final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
-
 
38
    private Date deb, fin;
35
    private Date deb, fin;
39
 
-
 
40
    public static Tuple2<String, String> getTuple2Location() {
36
    public static String TEMPLATE_ID = "Balance agée";
41
        return tupleDefault;
-
 
42
    }
-
 
43
 
37
 
44
    public BalanceAgeeListeSheetXML(Date deb, Date fin) {
38
    public BalanceAgeeListeSheetXML(Date deb, Date fin) {
45
        this.printer = PrinterNXProps.getInstance().getStringProperty("BonPrinter");
39
        this.printer = PrinterNXProps.getInstance().getStringProperty("BonPrinter");
46
        this.deb = deb;
40
        this.deb = deb;
47
        this.fin = fin;
41
        this.fin = fin;
48
 
-
 
49
        this.locationOO = SheetXml.getLocationForTuple(tupleDefault, false);
-
 
50
        this.locationPDF = SheetXml.getLocationForTuple(tupleDefault, true);
-
 
51
    }
42
    }
52
 
43
 
53
    @Override
44
    @Override
54
    public String getDefaultModele() {
45
    public String getDefaultTemplateId() {
55
        return "BalanceAgee";
46
        return "BalanceAgee";
56
    }
47
    }
57
 
48
 
-
 
49
    @Override
58
    public String getFileName() {
50
    public String getName() {
59
        return getValidFileName("BalanceAgee" + new Date().getTime());
51
        return "BalanceAgee" + new Date().getTime();
60
    }
52
    }
61
 
53
 
62
    protected void createListeValues() {
54
    protected void createListeValues() {
63
 
-
 
64
        SQLElement ecr = Configuration.getInstance().getDirectory().getElement("ECRITURE");
55
        SQLElement ecr = Configuration.getInstance().getDirectory().getElement("ECRITURE");
65
        SQLElement cpt = Configuration.getInstance().getDirectory().getElement("COMPTE_PCE");
56
        SQLElement cpt = Configuration.getInstance().getDirectory().getElement("COMPTE_PCE");
66
        SQLElement fact = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
57
        SQLElement fact = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE");
67
 
58
 
68
        SQLSelect sel = new SQLSelect(ecr.getTable().getBase());
59
        SQLSelect sel = new SQLSelect(ecr.getTable().getBase());
Line 104... Line 95...
104
            }
95
            }
105
 
96
 
106
            long time = c.getTimeInMillis() - date;
97
            long time = c.getTimeInMillis() - date;
107
            long day = time / 86400000;
98
            long day = time / 86400000;
108
            if (day < 0) {
99
            if (day < 0) {
109
                // System.err.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
-
 
110
                continue;
100
                continue;
111
            }
101
            }
112
            final SQLRow rowCpt = sqlRow.getForeignRow("ID_COMPTE_PCE");
102
            final SQLRow rowCpt = sqlRow.getForeignRow("ID_COMPTE_PCE");
113
            String num = rowCpt.getString("NUMERO");
103
            String num = rowCpt.getString("NUMERO");
114
            Map<String, Object> m;
104
            Map<String, Object> m;
Line 183... Line 173...
183
                }
173
                }
184
 
174
 
185
                valuesTab.add(e);
175
                valuesTab.add(e);
186
            }
176
            }
187
        }
177
        }
188
        Map<String, Object> totalMap = new HashMap<String, Object>();
178
        final Map<String, Object> totalMap = new HashMap<String, Object>();
189
        totalMap.put("NOM", "TOTAL");
179
        totalMap.put("NOM", "TOTAL");
190
        totalMap.put("30", total30 / 100.0);
180
        totalMap.put("30", total30 / 100.0);
191
        totalMap.put("60", total60 / 100.0);
181
        totalMap.put("60", total60 / 100.0);
192
        totalMap.put("90", total90 / 100.0);
182
        totalMap.put("90", total90 / 100.0);
193
        totalMap.put("+90", totalPlus / 100.0);
183
        totalMap.put("+90", totalPlus / 100.0);
194
        totalMap.put("TOTAL", totalFull / 100.0);
184
        totalMap.put("TOTAL", totalFull / 100.0);
195
        valuesTab.add(totalMap);
185
        valuesTab.add(totalMap);
196
 
186
 
197
        // Map<String, Object> values = this.mapAllSheetValues.get(0);
-
 
198
        // if (values == null) {
-
 
199
        // values = new HashMap<String, Object>();
-
 
200
        // }
-
 
201
        // valuesHA.put("TOTAL", totalHA);
-
 
202
        // valuesE.put("TOTAL_HA", totalHA);
-
 
203
        // valuesE.put("TOTAL", totalE);
-
 
204
        // valuesE.put("TOTAL_VT", totalTPVTTC);
-
 
205
        // values.put("TOTAL", totalVC);
-
 
206
        // values.put("TOTAL_MARGE", totalTPVTTC - totalTPA);
-
 
207
        //
-
 
208
        // valuesE.put("TOTAL_GLOBAL", totalTPVTTC + totalHA);
-
 
209
        // values.put("TOTAL_PA", totalTPA);
-
 
210
        // values.put("TOTAL_PV_TTC", totalTPVTTC);
-
 
211
        //
-
 
212
        // String periode = "Période Du " + dateFormat.format(this.du) + " au " +
-
 
213
        // dateFormat.format(this.au);
-
 
214
        // values.put("DATE", periode);
-
 
215
        // valuesHA.put("DATE", periode);
-
 
216
        // valuesE.put("DATE", periode);
-
 
217
 
-
 
218
        this.listAllSheetValues.put(0, valuesTab);
187
        this.listAllSheetValues.put(0, valuesTab);
219
        // this.mapAllSheetValues.put(0, values);
-
 
220
 
188
 
221
    }
189
    }
222
}
190
}