{
if (startDate == null || date.before(startDate)) startDate = date;
if (endDate == null || date.after(endDate)) endDate = date;
}
Konto k = u.getKonto();
List<Umsatz> list = groups.get(k.getID());
if (list == null)
{
list = new LinkedList<Umsatz>();
groups.put(k.getID(),list);
}
list.add(u);
}
//////////////////////////////////////////////////////////////////////////
// Header mit dem Zeitraum
GridPrint grid = new GridPrint("l:d:g");
grid.add(new TextPrint(i18n.tr("Zeitraum: {0} - {1}",HBCI.DATEFORMAT.format(startDate),HBCI.DATEFORMAT.format(endDate)),fontTinyBold));
grid.add(new LineBreakPrint(fontTitle));
//////////////////////////////////////////////////////////////////////////
DefaultGridLook look = new DefaultGridLook();
look.setHeaderBackground(new RGB(220,220,220));
LineBorder border = new LineBorder(new RGB(100,100,100));
border.setGapSize(3);
look.setCellBorder(border);
GridPrint table = new GridPrint("l:p:n, l:d:n, l:p:g, r:p:n, r:p:n",look);
table.addHeader(new NoBreakPrint(new TextPrint(i18n.tr("Valuta/Datum"),fontTinyBold)));
table.addHeader(new TextPrint(i18n.tr("Gegenkonto"),fontTinyBold));
table.addHeader(new TextPrint(i18n.tr("Verwendungszweck"),fontTinyBold));
table.addHeader(new TextPrint(i18n.tr("Betrag"),fontTinyBold));
table.addHeader(new TextPrint(i18n.tr("Saldo"),fontTinyBold));
// Iteration pro Konto
Iterator<String> konten = groups.keySet().iterator();
while (konten.hasNext())
{
String id = konten.next();
List<Umsatz> umsaetze = groups.get(id);
// Header mit dem Konto
Konto k = (Konto) Settings.getDBService().createObject(Konto.class,id);
table.add(new TextPrint(k.getLongName(),fontTinyBold),GridPrint.REMAINDER);
// Liste der Umsaetze im Konto
for (Umsatz u:umsaetze)
{
String usage = VerwendungszweckUtil.toString(u,"\n");
StringBuffer sb = new StringBuffer();
{
String name = u.getGegenkontoName();
if (name != null && name.length() > 0)
sb.append(name + "\n");
String kto = u.getGegenkontoNummer();
String blz = u.getGegenkontoBLZ();
if (kto != null && kto.length() > 0 && blz != null && blz.length() > 0)
{
String gi = HBCIProperties.getNameForBank(blz);
if (gi != null && gi.length() > 0)
sb.append(i18n.tr("Kto. {0}, {1}",kto,gi));
else
sb.append(i18n.tr("Kto. {0}, BLZ {1}",kto,blz));
}
}
TextStyle typeHaben = new TextStyle().font(fontTiny).foreground(new RGB(0,0,0));
TextStyle typeSoll = new TextStyle().font(fontTiny).foreground(new RGB(200,0,0));
table.add(new TextPrint(HBCI.DATEFORMAT.format(u.getValuta()) + "\n" + HBCI.DATEFORMAT.format(u.getDatum()),fontTiny));
table.add(new TextPrint(sb.toString(),fontTiny));
table.add(new TextPrint(notNull(usage),fontTiny));
table.add(new NoBreakPrint(new TextPrint(HBCI.DECIMALFORMAT.format(u.getBetrag()) + " " + k.getWaehrung(),u.getBetrag() >= 0 ? typeHaben : typeSoll)));
table.add(new NoBreakPrint(new TextPrint(HBCI.DECIMALFORMAT.format(u.getSaldo()) + " " + k.getWaehrung(),fontTiny)));
}
}
grid.add(table);
return grid;