OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 144 Rev 174
Line 11... Line 11...
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.core.sales.invoice.report;
14
 package org.openconcerto.erp.core.sales.invoice.report;
15
 
15
 
16
import org.openconcerto.erp.core.sales.invoice.report.ReportingVenteXmlSheet.Line;
-
 
17
import org.openconcerto.erp.generationDoc.AbstractListeSheetXml;
16
import org.openconcerto.erp.generationDoc.AbstractListeSheetXml;
18
import org.openconcerto.erp.preferences.PrinterNXProps;
17
import org.openconcerto.erp.preferences.PrinterNXProps;
19
import org.openconcerto.sql.Configuration;
18
import org.openconcerto.sql.Configuration;
20
import org.openconcerto.sql.element.SQLElement;
19
import org.openconcerto.sql.element.SQLElement;
21
import org.openconcerto.sql.model.SQLRow;
20
import org.openconcerto.sql.model.SQLRow;
Line 35... Line 34...
35
import java.util.HashMap;
34
import java.util.HashMap;
36
import java.util.List;
35
import java.util.List;
37
import java.util.Map;
36
import java.util.Map;
38
import java.util.TreeMap;
37
import java.util.TreeMap;
39
 
38
 
40
import javax.swing.JProgressBar;
-
 
41
 
-
 
42
public class ReportingStockXmlSheet extends AbstractListeSheetXml {
39
public class ReportingStockXmlSheet extends AbstractListeSheetXml {
43
 
40
 
44
    private final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
41
    private final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy");
45
 
42
 
46
    public static final String TEMPLATE_ID = "EtatStocks";
43
    public static final String TEMPLATE_ID = "EtatStocks";
Line 123... Line 120...
123
        final HashMap<Integer, String> style = new HashMap<Integer, String>();
120
        final HashMap<Integer, String> style = new HashMap<Integer, String>();
124
        for (SQLRowValues vals : values) {
121
        for (SQLRowValues vals : values) {
125
            Float qte = vals.getForeign("ID_STOCK").getFloat("QTE_REEL");
122
            Float qte = vals.getForeign("ID_STOCK").getFloat("QTE_REEL");
126
            BigDecimal ha = BigDecimal.ZERO;
123
            BigDecimal ha = BigDecimal.ZERO;
127
            if (qte > 0) {
124
            if (qte > 0) {
-
 
125
                final BigDecimal puHA = vals.getBigDecimal("PA_HT");
128
                ha = vals.getBigDecimal("PA_HT").multiply(new BigDecimal(qte));
126
                ha = puHA.multiply(new BigDecimal(qte));
129
 
127
 
130
                int idFamille = vals.getForeignID("ID_FAMILLE_ARTICLE");
128
                int idFamille = vals.getForeignID("ID_FAMILLE_ARTICLE");
131
                SQLRow rowF = mapF.get(idFamille);
129
                SQLRow rowF = mapF.get(idFamille);
132
                Line lineArt = new Line(vals.getString("NOM"), vals.getString("CODE"), ha, qte);
130
                Line lineArt = new Line(vals.getString("NOM"), vals.getString("CODE"), puHA, ha, qte);
133
 
131
 
134
                // Init des lines familles
132
                // Init des lines familles
135
 
133
 
136
                final Line lineF, lineSF;
134
                final Line lineF, lineSF;
137
                if (rowF == null) {
135
                if (rowF == null) {
Line 223... Line 221...
223
        this.mapAllSheetValues.put(0, valuesSheet);
221
        this.mapAllSheetValues.put(0, valuesSheet);
224
    }
222
    }
225
 
223
 
226
    class Line {
224
    class Line {
227
        final private String nomArt, codeArt;
225
        final private String nomArt, codeArt;
228
        private BigDecimal totalHA;
226
        private BigDecimal totalHA, puHA;
229
        private Float qte;
227
        private Float qte;
230
 
228
 
231
        public Line(String nomArt, String codeArt, BigDecimal totalHA, Float qte) {
229
        public Line(String nomArt, String codeArt, BigDecimal totalHA, Float qte) {
-
 
230
            this(nomArt, codeArt, BigDecimal.ZERO, totalHA, qte);
-
 
231
        }
-
 
232
 
-
 
233
        public Line(String nomArt, String codeArt, BigDecimal puHA, BigDecimal totalHA, Float qte) {
232
            this.nomArt = nomArt;
234
            this.nomArt = nomArt;
233
            this.codeArt = codeArt;
235
            this.codeArt = codeArt;
234
            this.totalHA = totalHA;
236
            this.totalHA = totalHA;
-
 
237
            this.puHA = puHA;
235
            this.qte = qte;
238
            this.qte = qte;
236
        }
239
        }
237
 
240
 
238
        public Float getQte() {
241
        public Float getQte() {
239
            return qte;
242
            return qte;
Line 241... Line 244...
241
 
244
 
242
        public String getCodeArt() {
245
        public String getCodeArt() {
243
            return codeArt;
246
            return codeArt;
244
        }
247
        }
245
 
248
 
-
 
249
        public BigDecimal getPuHA() {
-
 
250
            return puHA;
-
 
251
        }
-
 
252
 
246
        public String getNomArt() {
253
        public String getNomArt() {
247
            return nomArt;
254
            return nomArt;
248
        }
255
        }
249
 
256
 
250
        public BigDecimal getTotalHA() {
257
        public BigDecimal getTotalHA() {
Line 261... Line 268...
261
        public Map<String, Object> getMapXMLSheet() {
268
        public Map<String, Object> getMapXMLSheet() {
262
            Map<String, Object> m = new HashMap<String, Object>();
269
            Map<String, Object> m = new HashMap<String, Object>();
263
            m.put("CODE", getCodeArt());
270
            m.put("CODE", getCodeArt());
264
            m.put("NOM", getNomArt());
271
            m.put("NOM", getNomArt());
265
            m.put("QTE", getQte());
272
            m.put("QTE", getQte());
-
 
273
            m.put("PU_HA", getPuHA());
266
            m.put("TOTAL_HA", getTotalHA());
274
            m.put("TOTAL_HA", getTotalHA());
267
            return m;
275
            return m;
268
        }
276
        }
269
 
277
 
270
    }
278
    }