summaryrefslogtreecommitdiff
path: root/contrib/non-profit-audit-reports/summary-reports.plx
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/non-profit-audit-reports/summary-reports.plx')
-rwxr-xr-xcontrib/non-profit-audit-reports/summary-reports.plx30
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/non-profit-audit-reports/summary-reports.plx b/contrib/non-profit-audit-reports/summary-reports.plx
index ce6d56da..30b27505 100755
--- a/contrib/non-profit-audit-reports/summary-reports.plx
+++ b/contrib/non-profit-audit-reports/summary-reports.plx
@@ -39,6 +39,36 @@ sub Commify ($) {
return scalar reverse $text;
}
+sub preferredAccountSorting ($$) {
+ if ($_[0] =~ /^Assets/) {
+ return -1;
+ } elsif ($_[1] =~ /^Assets/) {
+ return 1;
+ } elsif ($_[0] =~ /^Liabilities/ and $_[1] !~ /^Assets/) {
+ return -1;
+ } elsif ($_[1] =~ /^Liabilities/ and $_[0] !~ /^Assets/) {
+ return 1;
+ } elsif ($_[0] =~ /^(Accrued)/ and $_[1] !~ /^(Assets|Liabilities)/) {
+ return -1;
+ } elsif ($_[1] =~ /^(Accrued)/ and $_[0] !~ /^(Assets|Liabilities)/) {
+ return 1;
+ } elsif ($_[0] =~ /^(Unearned Income)/ and $_[1] !~ /^(Assets|Liabilities|Accrued)/) {
+ return -1;
+ } elsif ($_[1] =~ /^(Unearned Income)/ and $_[0] !~ /^(Assets|Liabilities|Accrued)/) {
+ return 1;
+ } elsif ($_[0] =~ /^Income/ and $_[1] !~ /^(Assets|Liabilities|Accrued|Unearned Income)/) {
+ return -1;
+ } elsif ($_[1] =~ /^Income/ and $_[0] !~ /^(Assets|Liabilities|Accrued|Unearned Income)/) {
+ return 1;
+ } elsif ($_[0] =~ /^Expense/ and $_[1] !~ /^(Assets|Liabilities|Accrued|Unearned Income|Expense)/) {
+ return -1;
+ } elsif ($_[1] =~ /^Expense/ and $_[0] !~ /^(Assets|Liabilities|Accrued|Unearned Income|Expense)/) {
+ return 1;
+ } else {
+ return $_[0] cmp $_[1];
+ }
+}
+
sub ParseNumber($) {
$_[0] =~ s/,//g;
return Math::BigFloat->new($_[0]);