Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
simpsus committed Jan 19, 2015
1 parent 4681dc7 commit c12d0c1
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -132,15 +132,17 @@ public List<Item> extract(String text, String filename, List<Exception> errors)
errors.add(e);
}
Number value = getNextNumber(text, jumpWord(text, text.indexOf("EUR", datePos), 1)); //$NON-NLS-1$
Number pieces = getNextNumber(text, text.indexOf("STK")+3);
t.setType(AccountTransaction.Type.DIVIDENDS);
t.setAmount(Math.round(value.doubleValue() * Values.Amount.factor()));
t.setShares(Math.round(pieces.doubleValue() * Values.Share.factor()));
t.setSecurity(security);
results.add(new TransactionItem(t));
}
// The buy transaction can be parsed from the name of the file
// this requires that the user does not change the name from the
// download
else if (filename.contains("Wertpapierabrechnung_Kauf")) //$NON-NLS-1$
else if (text.contains("Wertpapierkauf")) //$NON-NLS-1$
{
try
{
Expand All @@ -167,7 +169,7 @@ else if (filename.contains("Wertpapierabrechnung_Kauf")) //$NON-NLS-1$
results.add(item);
}
int stueckLinePos = text.indexOf("\n", text.indexOf("Zum Kurs von")); //$NON-NLS-1$ //$NON-NLS-2$
Number stueck = getNextNumber(text, jumpWord(text, stueckLinePos, 1));
Number shares = getNextNumber(text, jumpWord(text, stueckLinePos, 1));
// Fees need not be present
// In case they are a section is present in the file
int provPos = -1;
Expand All @@ -184,7 +186,7 @@ else if (filename.contains("Wertpapierabrechnung_Kauf")) //$NON-NLS-1$
purchase.setType(PortfolioTransaction.Type.BUY);
purchase.setDate(tag);
purchase.setSecurity(security);
purchase.setShares(Math.round(stueck.doubleValue() * Values.Share.factor()));
purchase.setShares(Math.round(shares.doubleValue() * Values.Share.factor()));
purchase.setAmount(Math.round(total.doubleValue() * Values.Amount.factor()));
results.add(new BuySellEntryItem(purchase));
}
Expand Down

0 comments on commit c12d0c1

Please sign in to comment.