Line 1... |
Line 1... |
1 |
/*
|
1 |
/*
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3 |
*
|
3 |
*
|
4 |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
|
4 |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
|
5 |
*
|
5 |
*
|
6 |
* The contents of this file are subject to the terms of the GNU General Public License Version 3
|
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
|
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
|
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.
|
9 |
* language governing permissions and limitations under the License.
|
Line 82... |
Line 82... |
82 |
rowValsArt.put("ID_FAMILLE_ARTICLE", null);
|
82 |
rowValsArt.put("ID_FAMILLE_ARTICLE", null);
|
83 |
rowValsArt.put("CODE", null);
|
83 |
rowValsArt.put("CODE", null);
|
84 |
rowValsArt.put("NOM", null);
|
84 |
rowValsArt.put("NOM", null);
|
85 |
rowValsArt.put("PA_HT", null);
|
85 |
rowValsArt.put("PA_HT", null);
|
86 |
rowValsArt.put("PV_HT", null);
|
86 |
rowValsArt.put("PV_HT", null);
|
- |
|
87 |
rowValsArt.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("NOM");
|
- |
|
88 |
rowValsArt.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("NOM");
|
87 |
|
89 |
|
88 |
SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(rowVals);
|
90 |
SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(rowVals);
|
89 |
List<SQLRowValues> values = fetch.fetch(new Where(rowVals.getTable().getField("ID_ETAT_STOCK"), "=", this.row.getID()));
|
91 |
List<SQLRowValues> values = fetch.fetch(new Where(rowVals.getTable().getField("ID_ETAT_STOCK"), "=", this.row.getID()));
|
90 |
|
92 |
|
91 |
final SQLTable tableF = this.row.getTable().getTable("FAMILLE_ARTICLE");
|
93 |
final SQLTable tableF = this.row.getTable().getTable("FAMILLE_ARTICLE");
|
Line 113... |
Line 115... |
113 |
|
115 |
|
114 |
Map<String, Line> linesFamilles = new HashMap<String, Line>();
|
116 |
Map<String, Line> linesFamilles = new HashMap<String, Line>();
|
115 |
Map<Line, Map<Line, List<Line>>> myValues = new TreeMap<Line, Map<Line, List<Line>>>(new Comparator<Line>() {
|
117 |
Map<Line, Map<Line, List<Line>>> myValues = new TreeMap<Line, Map<Line, List<Line>>>(new Comparator<Line>() {
|
116 |
@Override
|
118 |
@Override
|
117 |
public int compare(Line o1, Line o2) {
|
119 |
public int compare(Line o1, Line o2) {
|
- |
|
120 |
// TODO ajouter tri sur taille et couleur
|
118 |
return o1.getNomArt().compareTo(o2.getNomArt());
|
121 |
return o1.getNomArt().compareTo(o2.getNomArt());
|
119 |
}
|
122 |
}
|
120 |
});
|
123 |
});
|
121 |
Line lineTotal = new Line("Total", "", BigDecimal.ZERO, BigDecimal.ZERO);
|
124 |
Line lineTotal = new Line("Total", "", BigDecimal.ZERO, BigDecimal.ZERO);
|
122 |
final HashMap<Integer, String> style = new HashMap<Integer, String>();
|
125 |
final HashMap<Integer, String> style = new HashMap<Integer, String>();
|
Line 126... |
Line 129... |
126 |
SQLRowAccessor rowValsArticle = vals.getForeign("ID_ARTICLE");
|
129 |
SQLRowAccessor rowValsArticle = vals.getForeign("ID_ARTICLE");
|
127 |
BigDecimal ha = rowValsArticle.getBigDecimal("PA_HT").multiply(qte);
|
130 |
BigDecimal ha = rowValsArticle.getBigDecimal("PA_HT").multiply(qte);
|
128 |
|
131 |
|
129 |
int idFamille = rowValsArticle.getForeignID("ID_FAMILLE_ARTICLE");
|
132 |
int idFamille = rowValsArticle.getForeignID("ID_FAMILLE_ARTICLE");
|
130 |
SQLRow rowF = mapF.get(idFamille);
|
133 |
SQLRow rowF = mapF.get(idFamille);
|
- |
|
134 |
String nomArticle = rowValsArticle.getString("NOM");
|
- |
|
135 |
String couleur = "";
|
- |
|
136 |
String taille = "";
|
- |
|
137 |
if (rowValsArticle.getObject("ID_ARTICLE_DECLINAISON_COULEUR") != null && !rowValsArticle.isForeignEmpty("ID_ARTICLE_DECLINAISON_COULEUR")) {
|
- |
|
138 |
couleur = rowValsArticle.getForeign("ID_ARTICLE_DECLINAISON_COULEUR").getString("NOM");
|
- |
|
139 |
}
|
- |
|
140 |
if (rowValsArticle.getObject("ID_ARTICLE_DECLINAISON_TAILLE") != null && !rowValsArticle.isForeignEmpty("ID_ARTICLE_DECLINAISON_TAILLE")) {
|
- |
|
141 |
taille = rowValsArticle.getForeign("ID_ARTICLE_DECLINAISON_TAILLE").getString("NOM");
|
- |
|
142 |
}
|
131 |
Line lineArt = new Line(rowF == null || rowF.isUndefined() ? "Sans famille" : rowF.getString("NOM"), rowValsArticle.getString("NOM"), rowValsArticle.getString("CODE"), ha, qte);
|
143 |
Line lineArt = new Line(rowF == null || rowF.isUndefined() ? "Sans famille" : rowF.getString("NOM"), taille, couleur, nomArticle, rowValsArticle.getString("CODE"), ha, qte);
|
132 |
|
144 |
|
133 |
// Init des lines familles
|
145 |
// Init des lines familles
|
134 |
|
146 |
|
135 |
final Line lineF, lineSF;
|
147 |
final Line lineF, lineSF;
|
136 |
if (rowF == null) {
|
148 |
if (rowF == null) {
|
Line 224... |
Line 236... |
224 |
|
236 |
|
225 |
class Line {
|
237 |
class Line {
|
226 |
private final String nomArt;
|
238 |
private final String nomArt;
|
227 |
private final String codeArt;
|
239 |
private final String codeArt;
|
228 |
private final String famille;
|
240 |
private final String famille;
|
- |
|
241 |
private final String taille;
|
- |
|
242 |
private final String couleur;
|
229 |
private BigDecimal totalHA;
|
243 |
private BigDecimal totalHA;
|
230 |
private BigDecimal qte;
|
244 |
private BigDecimal qte;
|
231 |
|
245 |
|
232 |
public Line(String nomArt, String codeArt, BigDecimal totalHA, BigDecimal qte) {
|
246 |
public Line(String nomArt, String codeArt, BigDecimal totalHA, BigDecimal qte) {
|
233 |
this("", nomArt, codeArt, totalHA, qte);
|
247 |
this("", "", "", nomArt, codeArt, totalHA, qte);
|
234 |
}
|
248 |
}
|
235 |
|
249 |
|
236 |
public Line(String famille, String nomArt, String codeArt, BigDecimal totalHA, BigDecimal qte) {
|
250 |
public Line(String famille, String taille, String couleur, String nomArt, String codeArt, BigDecimal totalHA, BigDecimal qte) {
|
237 |
this.famille = famille;
|
251 |
this.famille = famille;
|
238 |
this.nomArt = nomArt;
|
252 |
this.nomArt = nomArt;
|
- |
|
253 |
this.taille = taille;
|
- |
|
254 |
this.couleur = couleur;
|
239 |
this.codeArt = codeArt;
|
255 |
this.codeArt = codeArt;
|
240 |
this.totalHA = totalHA;
|
256 |
this.totalHA = totalHA;
|
241 |
this.qte = qte;
|
257 |
this.qte = qte;
|
242 |
}
|
258 |
}
|
243 |
|
259 |
|
Line 265... |
Line 281... |
265 |
public Map<String, Object> getMapXMLSheet() {
|
281 |
public Map<String, Object> getMapXMLSheet() {
|
266 |
Map<String, Object> m = new HashMap<String, Object>();
|
282 |
Map<String, Object> m = new HashMap<String, Object>();
|
267 |
m.put("FAMILLE", this.famille);
|
283 |
m.put("FAMILLE", this.famille);
|
268 |
m.put("CODE", getCodeArt());
|
284 |
m.put("CODE", getCodeArt());
|
269 |
m.put("NOM", getNomArt());
|
285 |
m.put("NOM", getNomArt());
|
- |
|
286 |
m.put("TAILLE", this.taille);
|
- |
|
287 |
m.put("COULEUR", this.couleur);
|
270 |
m.put("QTE", getQte());
|
288 |
m.put("QTE", getQte());
|
271 |
m.put("TOTAL_HA", getTotalHA());
|
289 |
m.put("TOTAL_HA", getTotalHA());
|
272 |
return m;
|
290 |
return m;
|
273 |
}
|
291 |
}
|
274 |
|
292 |
|