protected VATSumList getVATSums(List<TrPosition> positions, VATSumList vatSums) {
Iterator<TrPosition> it = positions.iterator();
while (it.hasNext()) {
TrPosition position = it.next();
if (position instanceof NormalPosition) {
ArticleVAT vat = ((NormalPosition) position).getVat();
if (vat != null) {
logger.debug("Position: " + position.getPosNumber() + ": " + ((NormalPosition) position).getVATValue());
VATSum vatSum = vatSums.getVatSum(vat);
if (vatSum == null) { //add a new vat-sum
logger.debug("Adding vat-sum for vat " + vat.getName());
vatSum = new VATSum();
vatSum.setVat(vat);
vatSums.add(vatSum);
}
vatSum.setSum(vatSum.getSum() + ((NormalPosition) position).getVATValue());