A few fixes to make this work with Ledger 3.x instead of 2.6.2

* --wide-register-format is no long an option, use -F
  * %D now must be %(date)
This commit is contained in:
Bradley M. Kuhn 2012-09-07 12:48:30 -04:00
parent 6a104ecc3e
commit 0e8a0e8fb2

View file

@ -46,7 +46,7 @@ if (@ARGV < 2) {
my($beginDate, $endDate, @otherLedgerOpts) = @ARGV;
my(@chartOfAccountsOpts) = ('--wide-register-format', "%150A\n", '-w', '-s',
my(@chartOfAccountsOpts) = ('-F', "%150A\n", '-w', '-s',
'-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'reg');
open(CHART_DATA, "-|", $LEDGER_CMD, @chartOfAccountsOpts)
@ -94,8 +94,8 @@ open(GL_CSV_OUT, ">", "general-ledger.csv") or die "unable to write general-ledg
foreach my $acct (@sortedAccounts) {
print GL_TEXT_OUT "\n\nACCOUNT: $acct\nFROM: $beginDate TO $formattedEndDate\n\n";
my @acctLedgerOpts = ('--wide-register-format',
"%D %-.10C %-.80P %-.80N %18t %18T\n", '-w', '--sort', 'd',
my @acctLedgerOpts = ('-F',
"%(date) %-.10C %-.80P %-.80N %18t %18T\n", '-w', '--sort', 'd',
'-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'reg', $acct);
open(GL_TEXT_DATA, "-|", $LEDGER_CMD, @acctLedgerOpts)
or die "Unable to run $LEDGER_CMD @acctLedgerOpts: $!";
@ -107,8 +107,8 @@ foreach my $acct (@sortedAccounts) {
print GL_CSV_OUT "\n\"ACCOUNT:\",\"$acct\"\n\"PERIOD START:\",\"$beginDate\"\n\"PERIOD END:\",\"$formattedEndDate\"\n";
print GL_CSV_OUT '"DATE","CHECK NUM","NAME","MEMO","TRANSACTION AMT","RUNNING TOTAL"', "\n";
@acctLedgerOpts = ('--wide-register-format',
'"%D","%C","%P","%N","%t","%T"\n', '-w', '--sort', 'd',
@acctLedgerOpts = ('-F',
'"%(date)","%C","%P","%N","%t","%T"\n', '-w', '--sort', 'd',
'-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'reg', $acct);
open(GL_CSV_DATA, "-|", $LEDGER_CMD, @acctLedgerOpts)
or die "Unable to run $LEDGER_CMD @acctLedgerOpts: $!";