use of name.abuchen.portfolio.datatransfer.pdf.PDFParser.Block in project portfolio by buchen.
the class ConsorsbankPDFExtractor method addSellTransaction.
@SuppressWarnings("nls")
private void addSellTransaction() {
DocumentType type = new DocumentType("VERKAUF");
this.addDocumentTyp(type);
Block block = new Block("^VERKAUF AM .*$");
type.addBlock(block);
Transaction<BuySellEntry> pdfTransaction = new Transaction<>();
block.set(pdfTransaction);
pdfTransaction.subject(() -> {
BuySellEntry entry = new BuySellEntry();
entry.setType(PortfolioTransaction.Type.SELL);
return entry;
});
//
pdfTransaction.section("wkn", "isin", "name", "currency").find(//
"(Wertpapier|Bezeichnung) WKN ISIN").match(//
"^(?<name>.*) (?<wkn>[^ ]*) (?<isin>[^ ]*)$").match("(Kurs|Preis pro Anteil) (\\d+,\\d+) (?<currency>\\w{3}+) .*").assign((t, v) -> t.setSecurity(getOrCreateSecurity(v))).section(//
"shares").find(//
"Einheit Umsatz( F\\Dlligkeit)?").match(//
"^ST (?<shares>[\\d.]+(,\\d+)?).*$").assign((t, v) -> t.setShares(asShares(v.get("shares")))).section("date", "time").match("VERKAUF AM (?<date>\\d+\\.\\d+\\.\\d{4}+)\\s+UM (?<time>\\d+:\\d+:\\d+).*.*").assign((t, v) -> t.setDate(asDate(v.get("date"), v.get("time")))).section("amount", "currency").match(//
"Wert \\d+.\\d+.\\d{4}+ (?<currency>\\w{3}+) (?<amount>[\\d.]+,\\d+)").assign((t, v) -> {
t.setAmount(asAmount(v.get("amount")));
t.setCurrencyCode(asCurrencyCode(v.get("currency")));
}).wrap(BuySellEntryItem::new);
addFeesSectionsTransaction(pdfTransaction);
addTaxesSectionsTransaction(pdfTransaction);
}
use of name.abuchen.portfolio.datatransfer.pdf.PDFParser.Block in project portfolio by buchen.
the class ConsorsbankPDFExtractor method addBuyTransaction.
@SuppressWarnings("nls")
private void addBuyTransaction() {
DocumentType type = new DocumentType("KAUF");
this.addDocumentTyp(type);
Block block = new Block("^KAUF AM .*$");
type.addBlock(block);
Transaction<BuySellEntry> pdfTransaction = new Transaction<>();
block.set(pdfTransaction);
pdfTransaction.subject(() -> {
BuySellEntry entry = new BuySellEntry();
entry.setType(PortfolioTransaction.Type.BUY);
return entry;
});
//
pdfTransaction.section("wkn", "isin", "name", "currency").find(//
"(Wertpapier|Bezeichnung) WKN ISIN").match(//
"^(?<name>.*) (?<wkn>[^ ]*) (?<isin>[^ ]*)$").match("(Kurs|Preis pro Anteil) (\\d+,\\d+) (?<currency>\\w{3}+) .*").assign((t, v) -> t.setSecurity(getOrCreateSecurity(v))).section(//
"shares").find(//
"Einheit Umsatz( F\\Dlligkeit)?").match(//
"^ST (?<shares>[\\d.]+(,\\d+)?).*$").assign((t, v) -> t.setShares(asShares(v.get("shares")))).section("date", "time").match("KAUF AM (?<date>\\d+\\.\\d+\\.\\d{4}+)\\s+UM (?<time>\\d+:\\d+:\\d+).*").assign((t, v) -> t.setDate(asDate(v.get("date"), v.get("time")))).section("amount", "currency").match(//
"Wert \\d+.\\d+.\\d{4}+ (?<currency>\\w{3}+) (?<amount>[\\d.]+,\\d+)").assign((t, v) -> {
t.setAmount(asAmount(v.get("amount")));
t.setCurrencyCode(asCurrencyCode(v.get("currency")));
}).wrap(BuySellEntryItem::new);
addFeesSectionsTransaction(pdfTransaction);
}
use of name.abuchen.portfolio.datatransfer.pdf.PDFParser.Block in project portfolio by buchen.
the class ConsorsbankPDFExtractor method addIncomeTransaction.
@SuppressWarnings("nls")
private void addIncomeTransaction() {
DocumentType type = new DocumentType("ERTRAGSGUTSCHRIFT");
this.addDocumentTyp(type);
Block block = new Block("ERTRAGSGUTSCHRIFT.*");
type.addBlock(block);
block.set(newDividendTransaction(type));
}
use of name.abuchen.portfolio.datatransfer.pdf.PDFParser.Block in project portfolio by buchen.
the class ConsorsbankPDFExtractor method addDividendTransaction.
@SuppressWarnings("nls")
private void addDividendTransaction() {
DocumentType type = new DocumentType("DIVIDENDENGUTSCHRIFT");
this.addDocumentTyp(type);
Block block = new Block("DIVIDENDENGUTSCHRIFT.*");
type.addBlock(block);
block.set(newDividendTransaction(type));
}
use of name.abuchen.portfolio.datatransfer.pdf.PDFParser.Block in project portfolio by buchen.
the class ConsorsbankPDFExtractor method addTaxAdjustmentTransaction.
@SuppressWarnings("nls")
private void addTaxAdjustmentTransaction() {
DocumentType type = new DocumentType("Nachträgliche Verlustverrechnung");
this.addDocumentTyp(type);
Block block = new Block(" Erstattung/Belastung \\(-\\) von Steuern");
type.addBlock(block);
block.set(new Transaction<AccountTransaction>().subject(() -> {
AccountTransaction t = new AccountTransaction();
t.setType(AccountTransaction.Type.TAX_REFUND);
// nirgends im Dokument ist die Währung aufgeführt.
t.setCurrencyCode(CurrencyUnit.EUR);
return t;
}).section("date").match(" *Den Steuerausgleich buchen wir mit Wertstellung (?<date>\\d+.\\d+.\\d{4}) .*").assign((t, v) -> t.setDateTime(asDate(v.get("date")))).section("amount").find(" *Erstattung/Belastung \\(-\\) von Steuern *").find(" *=* *").match(" *(?<amount>[\\d.]+,\\d{2}) *").assign((t, v) -> t.setAmount(asAmount(v.get("amount")))).wrap(t -> new TransactionItem(t)));
}
Aggregations