Merge branch 'master' into ledger-mode-automatic-transactions
This commit is contained in:
commit
8b84aff855
5 changed files with 17 additions and 18 deletions
|
|
@ -67,8 +67,7 @@ if (@ARGV < 2) {
|
||||||
|
|
||||||
my($beginDate, $endDate, @otherLedgerOpts) = @ARGV;
|
my($beginDate, $endDate, @otherLedgerOpts) = @ARGV;
|
||||||
|
|
||||||
my(@chartOfAccountsOpts) = ('-V', '-F', "%150A\n", '-w', '-s',
|
my(@chartOfAccountsOpts) = ('-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'accounts');
|
||||||
'-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'reg');
|
|
||||||
|
|
||||||
open(CHART_DATA, "-|", $LEDGER_CMD, @chartOfAccountsOpts)
|
open(CHART_DATA, "-|", $LEDGER_CMD, @chartOfAccountsOpts)
|
||||||
or die "Unable to run $LEDGER_CMD @chartOfAccountsOpts: $!";
|
or die "Unable to run $LEDGER_CMD @chartOfAccountsOpts: $!";
|
||||||
|
|
|
||||||
|
|
@ -58,12 +58,11 @@ $formattedEndDate = $formattedEndDate->calc($oneDayLess);
|
||||||
$formattedEndDate = $formattedEndDate->printf("%Y/%m/%d");
|
$formattedEndDate = $formattedEndDate->printf("%Y/%m/%d");
|
||||||
|
|
||||||
my $formattedBeginDate = new Date::Manip::Date;
|
my $formattedBeginDate = new Date::Manip::Date;
|
||||||
die "badly formatted end date, $endDate" if $formattedBeginDate->parse($endDate);
|
die "badly formatted end date, $beginDate" if $formattedBeginDate->parse($beginDate);
|
||||||
$formattedBeginDate = $formattedBeginDate->printf("%Y/%m/%d");
|
$formattedBeginDate = $formattedBeginDate->printf("%Y/%m/%d");
|
||||||
|
|
||||||
|
|
||||||
my(@chartOfAccountsOpts) = ('-V', '-F', "%150A\n", '-w', '-s',
|
my(@chartOfAccountsOpts) = ('-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'accounts');
|
||||||
'-b', $beginDate, '-e', $endDate, @otherLedgerOpts, 'reg');
|
|
||||||
|
|
||||||
open(CHART_DATA, "-|", $LEDGER_CMD, @chartOfAccountsOpts)
|
open(CHART_DATA, "-|", $LEDGER_CMD, @chartOfAccountsOpts)
|
||||||
or die "Unable to run $LEDGER_CMD @chartOfAccountsOpts: $!";
|
or die "Unable to run $LEDGER_CMD @chartOfAccountsOpts: $!";
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ die "Date calculation error on $startDate" if ($err);
|
||||||
my %reportFields =
|
my %reportFields =
|
||||||
('Cash' => { args => [ '-e', $endDate, 'bal', '/^Assets/' ] },
|
('Cash' => { args => [ '-e', $endDate, 'bal', '/^Assets/' ] },
|
||||||
'Accounts Receivable' => {args => [ '-e', $endDate, 'bal', '/^Accrued:Accounts Receivable/' ]},
|
'Accounts Receivable' => {args => [ '-e', $endDate, 'bal', '/^Accrued:Accounts Receivable/' ]},
|
||||||
'Loans Receivable' => {args => [ '-e', $endDate, 'bal', '/^Accrued:Loans Receivable/' ]},
|
'Loans/Fraud Receivable' => {args => [ '-e', $endDate, 'bal', '/^Accrued:(Loans|Fraud) Receivable/' ]},
|
||||||
'Accounts Payable' => {args => [ '-e', $endDate, 'bal', '/^Accrued.*Accounts Payable/' ]},
|
'Accounts Payable' => {args => [ '-e', $endDate, 'bal', '/^Accrued.*Accounts Payable/' ]},
|
||||||
'Accrued Expenses' => {args => [ '-e', $endDate, 'bal', '/^Accrued.*Expenses/' ]},
|
'Accrued Expenses' => {args => [ '-e', $endDate, 'bal', '/^Accrued.*Expenses/' ]},
|
||||||
'Liabilities, Credit Cards' => {args => [ '-e', $endDate, 'bal', '/^Liabilities:Credit Card/' ]},
|
'Liabilities, Credit Cards' => {args => [ '-e', $endDate, 'bal', '/^Liabilities:Credit Card/' ]},
|
||||||
|
|
@ -161,7 +161,7 @@ print BALANCE_SHEET "\"BALANCE SHEET\"\n",
|
||||||
my $formatStr = "\"\",\"%-42s\",\"\$%13s\"\n";
|
my $formatStr = "\"\",\"%-42s\",\"\$%13s\"\n";
|
||||||
my $formatStrTotal = "\"\",\"%-45s\",\"\$%13s\"\n";
|
my $formatStrTotal = "\"\",\"%-45s\",\"\$%13s\"\n";
|
||||||
my $tot = $ZERO;
|
my $tot = $ZERO;
|
||||||
foreach my $item ('Cash', 'Accounts Receivable', 'Loans Receivable') {
|
foreach my $item ('Cash', 'Accounts Receivable', 'Loans/Fraud Receivable') {
|
||||||
next if $reportFields{$item}{total} == $ZERO;
|
next if $reportFields{$item}{total} == $ZERO;
|
||||||
print BALANCE_SHEET sprintf($formatStr, "$item:", Commify($reportFields{$item}{total}));
|
print BALANCE_SHEET sprintf($formatStr, "$item:", Commify($reportFields{$item}{total}));
|
||||||
$tot += $reportFields{$item}{total};
|
$tot += $reportFields{$item}{total};
|
||||||
|
|
@ -195,19 +195,19 @@ die "unable to write to balance-sheet.csv: $!" unless ($? == 0);
|
||||||
|
|
||||||
die "Cash+accounts receivable total does not equal net assets and liabilities total"
|
die "Cash+accounts receivable total does not equal net assets and liabilities total"
|
||||||
if (abs( ($reportFields{'Cash'}{total} + $reportFields{'Accounts Receivable'}{total}
|
if (abs( ($reportFields{'Cash'}{total} + $reportFields{'Accounts Receivable'}{total}
|
||||||
+ $reportFields{'Loans Receivable'}{total})) -
|
+ $reportFields{'Loans/Fraud Receivable'}{total})) -
|
||||||
abs($reportFields{'Accounts Payable'}{total} +
|
abs($reportFields{'Accounts Payable'}{total} +
|
||||||
$reportFields{'Accrued Expenses'}{total} +
|
$reportFields{'Accrued Expenses'}{total} +
|
||||||
$reportFields{'Unearned Income, Conference Registration'}{total} +
|
$reportFields{'Unearned Income, Conference Registration'}{total} +
|
||||||
$reportFields{'Unearned Income, Other'}{total} +
|
$reportFields{'Unearned Income, Other'}{total} +
|
||||||
$reportFields{'Liabilities, Credit Cards'}{total} +
|
$reportFields{'Liabilities, Credit Cards'}{total} +
|
||||||
$reportFields{'Liabilities, Other'}{total} +
|
$reportFields{'Liabilities, Other'}{total} +
|
||||||
$reportFields{'Total Net Assets'}{total}) > $ONE_PENNY);
|
$reportFields{'Total Net Assets'}{total}) > $TWO_CENTS);
|
||||||
|
|
||||||
die "Total net assets doesn't equal sum of restricted and unrestricted ones!"
|
die "Total net assets doesn't equal sum of restricted and unrestricted ones!"
|
||||||
if (abs($reportFields{'Total Net Assets'}{total}) -
|
if (abs($reportFields{'Total Net Assets'}{total}) -
|
||||||
abs($reportFields{'Unrestricted Net Assets'}{total} +
|
abs($reportFields{'Unrestricted Net Assets'}{total} +
|
||||||
$reportFields{'Temporarily Restricted Net Assets'}{total}) > $ONE_PENNY);
|
$reportFields{'Temporarily Restricted Net Assets'}{total}) > $TWO_CENTS);
|
||||||
|
|
||||||
|
|
||||||
my %incomeGroups = ('INTEREST INCOME' => { args => ['/^Income.*Interest/' ] },
|
my %incomeGroups = ('INTEREST INCOME' => { args => ['/^Income.*Interest/' ] },
|
||||||
|
|
@ -280,7 +280,7 @@ print INCOME "\n\n\n", sprintf($formatStrTotal, "OVERALL TOTAL:", Commify($overa
|
||||||
close INCOME; die "unable to write to income.csv: $!" unless ($? == 0);
|
close INCOME; die "unable to write to income.csv: $!" unless ($? == 0);
|
||||||
|
|
||||||
die "calculated total of $overallTotal does equal $incomeGroups{TOTAL}{total}"
|
die "calculated total of $overallTotal does equal $incomeGroups{TOTAL}{total}"
|
||||||
if (abs($overallTotal) - abs($incomeGroups{TOTAL}{total}) > $ONE_PENNY);
|
if (abs($overallTotal) - abs($incomeGroups{TOTAL}{total}) > $TWO_CENTS);
|
||||||
|
|
||||||
print STDERR "\n";
|
print STDERR "\n";
|
||||||
|
|
||||||
|
|
@ -380,7 +380,7 @@ die "GROUPS NOT INCLUDED : ", join(keys(%verifyAllGroups), ", "), "\n"
|
||||||
unless (keys %verifyAllGroups == 0);
|
unless (keys %verifyAllGroups == 0);
|
||||||
|
|
||||||
die "calculated total of $overallTotal does *not* equal $firstTotal"
|
die "calculated total of $overallTotal does *not* equal $firstTotal"
|
||||||
if (abs($overallTotal) - abs($firstTotal) > $ONE_PENNY);
|
if (abs($overallTotal) - abs($firstTotal) > $TWO_CENTS);
|
||||||
|
|
||||||
print STDERR "\n";
|
print STDERR "\n";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ Can indent, complete or align depending on context."
|
||||||
(ledger-schedule-check-available)
|
(ledger-schedule-check-available)
|
||||||
(ledger-post-setup)
|
(ledger-post-setup)
|
||||||
|
|
||||||
(set (make-local-variable 'comment-start) " ; ")
|
(set (make-local-variable 'comment-start) "; ")
|
||||||
(set (make-local-variable 'comment-end) "")
|
(set (make-local-variable 'comment-end) "")
|
||||||
(set (make-local-variable 'indent-tabs-mode) nil)
|
(set (make-local-variable 'indent-tabs-mode) nil)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,11 +117,12 @@ to choose from."
|
||||||
Return the width of the amount field as an integer and leave
|
Return the width of the amount field as an integer and leave
|
||||||
point at beginning of the commodity."
|
point at beginning of the commodity."
|
||||||
;;(beginning-of-line)
|
;;(beginning-of-line)
|
||||||
(when (re-search-forward ledger-amount-regex end t)
|
(let ((case-fold-search nil))
|
||||||
(goto-char (match-beginning 0))
|
(when (re-search-forward ledger-amount-regex end t)
|
||||||
(skip-syntax-forward " ")
|
(goto-char (match-beginning 0))
|
||||||
(- (or (match-end 4)
|
(skip-syntax-forward " ")
|
||||||
(match-end 3)) (point))))
|
(- (or (match-end 4)
|
||||||
|
(match-end 3)) (point)))))
|
||||||
|
|
||||||
|
|
||||||
(defun ledger-next-account (&optional end)
|
(defun ledger-next-account (&optional end)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue