protected void addLines(List<TrPosition> positions, ArrayList<HashMap> posLines) {
HashMap posLine;
Iterator<TrPosition> it = positions.iterator();
int counter = 0;
while (it.hasNext()) {
TrPosition position = it.next();
posLine = new HashMap();
posLine.put("position.type", this.getPositionType(position));
String hs = "";
if (position instanceof NormalPosition) {
hs = ClientGlobals.getPriceFormat().format(((NormalPosition) position).getQuantity());
}
posLine.put("position.quantity", hs);
hs="";
if ((position instanceof NormalPosition) && (((NormalPosition)position).getQtyUnit()!=null)) {
hs = ((NormalPosition)position).getQtyUnit().getShortName(ClientGlobals.getMainDbLanguage());
}
posLine.put("position.qtyUnit", hs);
posLine.put("position.posNumber", position.getPosNumber());
hs="";
if ((position instanceof ArticlePosition) && (((ArticlePosition)position).getArticle()!=null)) {
hs=((ArticlePosition)position).getArticle().getUserNo();
}
posLine.put("position.artNo", hs);
posLine.put("position.shortText", position.getShortText(ClientGlobals.getMainDbLanguage()));
posLine.put("position.longText", this.cleanupHTML(position.getLongText(ClientGlobals.getMainDbLanguage())));
hs = "";
if (position instanceof NormalPosition) {
hs = ClientGlobals.getPriceFormat().format(((NormalPosition) position).getPieceSalesPrice());
} else if (position instanceof DiscountPosition) {
hs = ClientGlobals.getPriceFormat().format(((DiscountPosition) position).getPercentValue()) + " %";
}
if (this.isAllNegative())
hs="-"+hs;
posLine.put("position.pieceSalesPrice", hs);
hs = "";
if (position instanceof NormalPosition) {
hs = ClientGlobals.getPriceFormat().format(((NormalPosition) position).getSalesPrice());
} else if (position instanceof DiscountPosition) {
hs = ClientGlobals.getPriceFormat().format(((DiscountPosition) position).getValue());
}
if (this.isAllNegative())
hs="-"+hs;
posLine.put("position.salesPrice", hs);
posLines.add(posLine);
if (position.getSubPositions() != null) {
this.addLines(position.getSubPositions(), posLines);
}
hs="";
if ((position instanceof NormalPosition) && (((NormalPosition)position).getQtyUnit()!=null)) {
hs=((NormalPosition)position).getQtyUnit().getShortName(ClientGlobals.getMainDbLanguage());
}
posLine.put("position.qtyUnit", hs);
//Add an additional line for the group-sum:
if (position instanceof GroupPosition) {
posLine = new HashMap();
posLine.put("position.type", POS_GROUPSUM);
posLine.put("position.quantity", "");
posLine.put("position.posNumber", "");
posLine.put("position.shortText", "Summe " + position.getShortText(ClientGlobals.getMainDbLanguage()));
posLine.put("position.pieceSalesPrice", "");
hs = ClientGlobals.getPriceFormat().format(((GroupPosition) position).getSalesPriceSum());
if (this.isAllNegative())
hs="-"+hs;
posLine.put("position.salesPrice", hs);