@@ -63,6 +63,7 @@ public void generateExport(Writer writer) throws ExporterException {
6363 SplitEntry .TABLE_NAME + "_" + SplitEntry .COLUMN_TYPE + " AS split_type" ,
6464 SplitEntry .TABLE_NAME + "_" + SplitEntry .COLUMN_MEMO + " AS split_memo" ,
6565 "trans_extra_info.trans_acct_balance AS trans_acct_balance" ,
66+ "trans_extra_info.trans_split_count AS trans_split_count" ,
6667 "account1." + AccountEntry .COLUMN_UID + " AS acct1_uid" ,
6768 "account1." + AccountEntry .COLUMN_FULL_NAME + " AS acct1_full_name" ,
6869 "account1." + AccountEntry .COLUMN_CURRENCY + " AS acct1_currency" ,
@@ -74,7 +75,9 @@ public void generateExport(Writer writer) throws ExporterException {
7475 // exclude transactions involving multiple currencies
7576 "trans_extra_info.trans_currency_count = 1 AND " +
7677 // in qif, split from the one account entry is not recorded (will be auto balanced)
77- AccountEntry .TABLE_NAME + "_" + AccountEntry .COLUMN_UID + " != account1." + AccountEntry .COLUMN_UID +
78+ "( " + AccountEntry .TABLE_NAME + "_" + AccountEntry .COLUMN_UID + " != account1." + AccountEntry .COLUMN_UID + " OR " +
79+ // or if the transaction has only one split (the whole transaction would be lost if it is not selected)
80+ "trans_split_count == 1 )" +
7881 (
7982 mParameters .shouldExportAllTransactions () ?
8083 "" : " AND " + TransactionEntry .TABLE_NAME + "_" + TransactionEntry .COLUMN_EXPORTED + "== 0"
@@ -140,6 +143,10 @@ public void generateExport(Writer writer) throws ExporterException {
140143 .append (newLine );
141144 }
142145 }
146+ if (cursor .getInt (cursor .getColumnIndexOrThrow ("trans_split_count" )) == 1 ) {
147+ // No other splits should be recorded if this is the only split.
148+ continue ;
149+ }
143150 // all splits
144151 // amount associated with the header account will not be exported.
145152 // It can be auto balanced when importing to GnuCash
0 commit comments