Skip to content

Commit

Permalink
QIF export for sinlgle split entry
Browse files Browse the repository at this point in the history
  • Loading branch information
fefe982 authored and codinguser committed Feb 18, 2015
1 parent 4ce198c commit 869649e
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public void generateExport(Writer writer) throws ExporterException {
SplitEntry.TABLE_NAME + "_" + SplitEntry.COLUMN_TYPE + " AS split_type",
SplitEntry.TABLE_NAME + "_" + SplitEntry.COLUMN_MEMO + " AS split_memo",
"trans_extra_info.trans_acct_balance AS trans_acct_balance",
"trans_extra_info.trans_split_count AS trans_split_count",
"account1." + AccountEntry.COLUMN_UID + " AS acct1_uid",
"account1." + AccountEntry.COLUMN_FULL_NAME + " AS acct1_full_name",
"account1." + AccountEntry.COLUMN_CURRENCY + " AS acct1_currency",
Expand All @@ -74,7 +75,9 @@ public void generateExport(Writer writer) throws ExporterException {
// exclude transactions involving multiple currencies
"trans_extra_info.trans_currency_count = 1 AND " +
// in qif, split from the one account entry is not recorded (will be auto balanced)
AccountEntry.TABLE_NAME + "_" + AccountEntry.COLUMN_UID + " != account1." + AccountEntry.COLUMN_UID +
"( " + AccountEntry.TABLE_NAME + "_" + AccountEntry.COLUMN_UID + " != account1." + AccountEntry.COLUMN_UID + " OR " +
// or if the transaction has only one split (the whole transaction would be lost if it is not selected)
"trans_split_count == 1 )" +
(
mParameters.shouldExportAllTransactions() ?
"" : " AND " + TransactionEntry.TABLE_NAME + "_" + TransactionEntry.COLUMN_EXPORTED + "== 0"
Expand Down Expand Up @@ -140,6 +143,10 @@ public void generateExport(Writer writer) throws ExporterException {
.append(newLine);
}
}
if (cursor.getInt(cursor.getColumnIndexOrThrow("trans_split_count")) == 1) {
// No other splits should be recorded if this is the only split.
continue;
}
// all splits
// amount associated with the header account will not be exported.
// It can be auto balanced when importing to GnuCash
Expand Down

0 comments on commit 869649e

Please sign in to comment.