Esempio n. 1
0
 private void adjustSplitsDatetime() {
   if (splits != null) {
     for (QifTransaction split : splits) {
       split.date = this.date;
     }
   }
 }
Esempio n. 2
0
 private void parseCategory(QifTransaction t, String line) {
   String category = trimFirstChar(line);
   int i = category.indexOf('/');
   if (i != -1) {
     t.categoryClass = category.substring(i + 1);
     category = category.substring(0, i);
   }
   if (isTransferCategory(category)) {
     t.toAccount = category.substring(1, category.length() - 1);
   } else {
     t.category = category;
   }
 }
Esempio n. 3
0
 public void readFrom(QifBufferedReader r, QifDateFormat dateFormat, Currency currency)
     throws IOException {
   QifTransaction split = null;
   String line;
   while ((line = r.readLine()) != null) {
     if (line.startsWith("^")) {
       break;
     }
     if (line.startsWith("D")) {
       this.date = parseDate(trimFirstChar(line), dateFormat);
     } else if (line.startsWith("T")) {
       this.amount = parseMoney(trimFirstChar(line), currency);
     } else if (line.startsWith("P")) {
       this.payee = trimFirstChar(line);
     } else if (line.startsWith("M")) {
       this.memo = trimFirstChar(line);
     } else if (line.startsWith("C")) {
       this.status = trimFirstChar(line);
     } else if (line.startsWith("N")) {
       this.number = trimFirstChar(line);
     } else if (line.startsWith("L")) {
       parseCategory(this, line);
     } else if (line.startsWith("S")) {
       addSplit(split);
       split = new QifTransaction();
       parseCategory(split, line);
     } else if (line.startsWith("$")) {
       if (split != null) {
         split.amount = parseMoney(trimFirstChar(line), currency);
       }
     } else if (line.startsWith("E") && split != null) {
       split.memo = trimFirstChar(line);
     }
   }
   addSplit(split);
   adjustSplitsDatetime();
 }