Skip to content

Commit c380b2e

Browse files
committed
remove check command
it cannot handle two related accounts reporting different dates for the same transaction e.g. payment from checking to credit card need to find a more flexible way to find common errors
1 parent e6f8831 commit c380b2e

File tree

4 files changed

+2
-49
lines changed

4 files changed

+2
-49
lines changed

README.md

-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ You should use this if
88

99
- You use ledger but only some of the features
1010
- You want an interactive script for importing CSV transactions from your bank (after downloading manually)
11-
- You want an automatic way to check your journal file for mistakes against your bank CSV
1211
- You want a simple way to implement envelope budgeting
1312
- You want a simple GUI for adjusting your budget
1413
- You like the idea of tinkering with AWK scripts when things break or you want new features
@@ -139,16 +138,6 @@ It just needs to know whether the fields are quoted and which fields hold the da
139138

140139
When importing a CSV, you don't need to worry about selecting a date range.
141140
Import will start after the last date in your journal file.
142-
You can also check for consistency with your bank record after importing.
143-
144-
```
145-
$ ledger.bash check Checking.csv Assets:Bank:Checking
146-
Potential problems with Assets:Bank:Checking
147-
Date Expected Actual
148-
...
149-
```
150-
151-
This command reports a difference in daily totals which has caught all problems for me so far.
152141

153142
The final noteworthy feature of this project is a simple GUI for building up a transaction that adjusts your budget.
154143
```

ledger.bash

-30
Original file line numberDiff line numberDiff line change
@@ -229,34 +229,6 @@ create table bank_transactions (date text not null, description text not null, a
229229
echo $db
230230
}
231231

232-
check_bank_csv() {
233-
db=$(bank_sqlite_db "$1")
234-
bank_account="$2"
235-
problems=$(fresh_file /tmp/ledger.problems)
236-
sqlite3 $db <<< "
237-
create table combined (date text not null, amount real not null);
238-
create table bank_combined (date text not null, amount real not null);
239-
insert into combined select date, sum(cast(amount as real)) from transactions where account = '$bank_account' group by date;
240-
insert into bank_combined select date, sum(cast(amount as real)) from bank_transactions group by date;
241-
.mode csv
242-
.output $problems
243-
.headers on
244-
select Date, Expected, Actual from (
245-
select
246-
b.date as Date,
247-
b.amount as Expected,
248-
case t.amount when null then 0 else t.amount end as Actual
249-
from bank_combined b left outer join combined t on b.date = t.date
250-
where abs(b.amount - t.amount) > .01 or t.date is null
251-
);
252-
"
253-
if [[ -s $problems ]]
254-
then
255-
echo Potential problems with $bank_account
256-
cat $problems | column -t -s,
257-
fi
258-
}
259-
260232
import_bank_csv() {
261233
bank_transactions=$(fresh_file /tmp/bank.csv)
262234
bank_account="$2"
@@ -340,7 +312,6 @@ usage() {
340312
echo " payees Report list of payees"
341313
echo " db <accounts> Open SQLite database of transactions"
342314
echo " import <file> Import bank transactions from csv file"
343-
echo " check <file> Validate bank transactions from csv file are recorded correctly"
344315
echo "Options"
345316
echo " --flat Flatten account tree in bal report"
346317
echo " --depth <num> Limit depth of account tree in bal report"
@@ -415,7 +386,6 @@ case "$report" in
415386
bankdb) sqlite3 $(bank_sqlite_db "$format") ;;
416387
import) import_bank_csv "$format" "$accounts" $(last_account_date "$accounts") ;;
417388
importall) import_bank_csv "$format" "$accounts" 0 ;;
418-
check) check_bank_csv "$format" "$accounts" ;;
419389
accounts) accounts_report ;;
420390
payees) payees_report ;;
421391
bankcsv) preprocess_"$format"_csv $(last_account_date "$accounts") ;;

test/t.4.1.txt

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
check --parse-bank wells_fargo test/t.4.csv Assets
2-
Potential problems with Assets
3-
Date Expected Actual
4-
2019/01/01 -1.0
5-
2019/01/03 -1.0 -2.0
6-
2019/01/05 -1.0
1+
bankcsv --parse-bank wells_fargo test/t.4.csv Assets
2+
2019/01/05,Description,-1.00

test/t.4.2.txt

-2
This file was deleted.

0 commit comments

Comments
 (0)