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 28... |
Line 28... |
28 |
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
|
28 |
import org.openconcerto.sql.model.SQLRowValuesListFetcher;
|
29 |
import org.openconcerto.sql.model.SQLSelect;
|
29 |
import org.openconcerto.sql.model.SQLSelect;
|
30 |
import org.openconcerto.sql.model.SQLSelectJoin;
|
30 |
import org.openconcerto.sql.model.SQLSelectJoin;
|
31 |
import org.openconcerto.sql.model.SQLTable;
|
31 |
import org.openconcerto.sql.model.SQLTable;
|
32 |
import org.openconcerto.sql.model.Where;
|
32 |
import org.openconcerto.sql.model.Where;
|
- |
|
33 |
import org.openconcerto.utils.ListMap;
|
33 |
import org.openconcerto.utils.Tuple2;
|
34 |
import org.openconcerto.utils.Tuple2;
|
34 |
|
35 |
|
35 |
import java.math.BigDecimal;
|
36 |
import java.math.BigDecimal;
|
36 |
import java.math.RoundingMode;
|
37 |
import java.math.RoundingMode;
|
37 |
import java.sql.Timestamp;
|
38 |
import java.sql.Timestamp;
|
Line 144... |
Line 145... |
144 |
final AliasedTable tableTicket = new AliasedTable(eltTicketCaisse.getTable(), "ticket");
|
145 |
final AliasedTable tableTicket = new AliasedTable(eltTicketCaisse.getTable(), "ticket");
|
145 |
|
146 |
|
146 |
// Stock
|
147 |
// Stock
|
147 |
SQLRowValues rowValsArtStock = new SQLRowValues(foreignTableArticle);
|
148 |
SQLRowValues rowValsArtStock = new SQLRowValues(foreignTableArticle);
|
148 |
rowValsArtStock.putNulls("ID", "CODE", "NOM");
|
149 |
rowValsArtStock.putNulls("ID", "CODE", "NOM");
|
- |
|
150 |
SQLRowValues rowValsStock = new SQLRowValues(tableFactureElement.getTable("STOCK"));
|
149 |
rowValsArtStock.putRowValues("ID_STOCK").putNulls("QTE_REEL", "QTE_TH", "QTE_MIN", "QTE_RECEPT_ATTENTE", "QTE_LIV_ATTENTE");
|
151 |
rowValsStock.putNulls("QTE_REEL", "QTE_TH", "QTE_MIN", "QTE_RECEPT_ATTENTE", "QTE_LIV_ATTENTE").put("ID_ARTICLE", rowValsArtStock);
|
150 |
SQLRowValuesListFetcher fetcherStock = SQLRowValuesListFetcher.create(rowValsArtStock);
|
152 |
SQLRowValuesListFetcher fetcherStock = SQLRowValuesListFetcher.create(rowValsArtStock);
|
151 |
List<SQLRowValues> resultStock = fetcherStock.fetch();
|
153 |
List<SQLRowValues> resultStock = fetcherStock.fetch();
|
- |
|
154 |
|
152 |
Map<Integer, SQLRowValues> mapStock = new HashMap<>();
|
155 |
ListMap<Integer, SQLRowValues> mapStock = new ListMap<>();
|
153 |
for (SQLRowValues sqlRowValues : resultStock) {
|
156 |
for (SQLRowValues sqlRowValues : resultStock) {
|
- |
|
157 |
final Set<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableFactureElement.getTable("STOCK").getField("ID_ARTICLE"));
|
- |
|
158 |
for (SQLRowValues sqlRowValues2 : referentRows) {
|
- |
|
159 |
|
154 |
mapStock.put(sqlRowValues.getID(), sqlRowValues);
|
160 |
mapStock.add(sqlRowValues.getID(), sqlRowValues2);
|
- |
|
161 |
}
|
155 |
}
|
162 |
}
|
156 |
|
163 |
|
157 |
// Requete Pour obtenir les quantités pour chaque type de réglement
|
164 |
// Requete Pour obtenir les quantités pour chaque type de réglement
|
158 |
SQLSelect sel = new SQLSelect();
|
165 |
SQLSelect sel = new SQLSelect();
|
159 |
|
166 |
|
Line 322... |
Line 329... |
322 |
Map<String, Object> mValuesStock = new HashMap<String, Object>();
|
329 |
Map<String, Object> mValuesStock = new HashMap<String, Object>();
|
323 |
mValuesStock.put("CODE", code);
|
330 |
mValuesStock.put("CODE", code);
|
324 |
mValuesStock.put("NOM", nom);
|
331 |
mValuesStock.put("NOM", nom);
|
325 |
mValuesStock.put("QTE", a.qte);
|
332 |
mValuesStock.put("QTE", a.qte);
|
326 |
if (mapStock.containsKey(articleID)) {
|
333 |
if (mapStock.containsKey(articleID)) {
|
327 |
SQLRowValues rowValsArt = mapStock.get(articleID);
|
334 |
List<SQLRowValues> rowValsArt = mapStock.get(articleID);
|
- |
|
335 |
BigDecimal totalTh = BigDecimal.ZERO;
|
- |
|
336 |
BigDecimal totalReel = BigDecimal.ZERO;
|
- |
|
337 |
BigDecimal min = BigDecimal.ZERO;
|
- |
|
338 |
BigDecimal attentR = BigDecimal.ZERO;
|
328 |
if (rowValsArt.getObject("ID_STOCK") != null && !rowValsArt.isForeignEmpty("ID_STOCK")) {
|
339 |
BigDecimal attenteL = BigDecimal.ZERO;
|
329 |
SQLRowAccessor rowValsStock = rowValsArt.getForeign("ID_STOCK");
|
340 |
for (SQLRowValues rowStock : rowValsArt) {
|
330 |
mValuesStock.put("QTE_TH", rowValsStock.getObject("QTE_TH"));
|
341 |
totalTh = totalTh.add(new BigDecimal(rowStock.getFloat("QTE_TH")));
|
331 |
mValuesStock.put("QTE_REEL", rowValsStock.getObject("QTE_REEL"));
|
342 |
totalReel = totalReel.add(new BigDecimal(rowStock.getFloat("QTE_REEL")));
|
332 |
mValuesStock.put("QTE_MIN", rowValsStock.getObject("QTE_MIN"));
|
343 |
min = min.add(new BigDecimal(rowStock.getFloat("QTE_MIN")));
|
333 |
mValuesStock.put("QTE_RECEPT_ATTENTE", rowValsStock.getObject("QTE_RECEPT_ATTENTE"));
|
344 |
attentR = attentR.add(new BigDecimal(rowStock.getFloat("QTE_RECEPT_ATTENTE")));
|
334 |
mValuesStock.put("QTE_LIV_ATTENTE", rowValsStock.getObject("QTE_LIV_ATTENTE"));
|
345 |
attenteL = attenteL.add(new BigDecimal(rowStock.getFloat("QTE_LIV_ATTENTE")));
|
335 |
}
|
346 |
}
|
- |
|
347 |
|
- |
|
348 |
mValuesStock.put("QTE_TH", totalTh);
|
- |
|
349 |
mValuesStock.put("QTE_REEL", totalReel);
|
- |
|
350 |
mValuesStock.put("QTE_MIN", min);
|
- |
|
351 |
mValuesStock.put("QTE_RECEPT_ATTENTE", attentR);
|
- |
|
352 |
mValuesStock.put("QTE_LIV_ATTENTE", attenteL);
|
336 |
styleStock.put(listValuesStock.size(), "Normal");
|
353 |
styleStock.put(listValuesStock.size(), "Normal");
|
337 |
listValuesStock.add(mValuesStock);
|
354 |
listValuesStock.add(mValuesStock);
|
- |
|
355 |
|
338 |
}
|
356 |
}
|
339 |
|
357 |
|
340 |
}
|
358 |
}
|
341 |
// System.out.println("EtatVentesXmlSheet.createListeValues():" + listValues);
|
359 |
// System.out.println("EtatVentesXmlSheet.createListeValues():" + listValues);
|
342 |
}
|
360 |
}
|