From e4a5099dab6ddcd328fb9faa9340b658b3d5fcc3 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Mon, 23 Apr 2001 21:09:24 +0000 Subject: [PATCH] 2001-04-23 Christian Stimming * src/scm/report/transaction-report.scm: Make more sanity checks. Fix bugs. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4023 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 5 ++ src/scm/report/transaction-report.scm | 118 ++++++++++++++++---------- 2 files changed, 76 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index 56e8ea4859..0420c0df07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-04-23 Christian Stimming + + * src/scm/report/transaction-report.scm: Make more sanity + checks. Fix bugs. + 2001-04-23 Dave Peticolas * src/engine/Query.c (xaccQueryGetSplitsUniqueTrans): fix bug diff --git a/src/scm/report/transaction-report.scm b/src/scm/report/transaction-report.scm index 0f71f8c30d..163b2076d5 100644 --- a/src/scm/report/transaction-report.scm +++ b/src/scm/report/transaction-report.scm @@ -437,7 +437,7 @@ (gnc:make-multichoice-option pagename-sorting optname-prime-date-subtotal "d" (N_ "Do a date subtotal") - 'none + 'monthly subtotal-choice-list)) (gnc:register-trep-option @@ -474,7 +474,7 @@ (gnc:make-multichoice-option pagename-sorting optname-sec-date-subtotal "h" (N_ "Do a date subtotal") - 'none + 'monthly subtotal-choice-list)) (gnc:register-trep-option @@ -797,7 +797,7 @@ and Income accounts"))))) (car splits) table width primary-subtotal-style)) (if secondary-subheading-renderer (secondary-subheading-renderer - (car splits) table widthsecondary-subtotal-style))) + (car splits) table width secondary-subtotal-style))) (do-rows-with-subtotals splits table used-columns width multi-rows? #t @@ -916,53 +916,77 @@ and Income accounts"))))) (secondary-key (opt-val pagename-sorting optname-sec-sortkey)) (secondary-order (opt-val pagename-sorting "Secondary Sort Order")) (splits '()) - (table '()) (query (gnc:malloc-query))) - (gnc:query-set-group query (gnc:get-current-group)) - (gnc:query-add-account-match query - (gnc:list->glist c_accounts) - 'acct-match-any 'query-and) - (gnc:query-add-date-match-timepair - query #t begindate #t enddate 'query-and) - (gnc:query-set-sort-order query - (get-query-sortkey primary-key) - (get-query-sortkey secondary-key) - 'by-none) - (gnc:query-set-sort-increasing query - (eq? primary-order 'ascend) - (eq? secondary-order 'ascend) - #t) + ;;(warn "accts in trep-renderer:" c_accounts) + (if (not (or (null? c_accounts) (and-map not c_accounts))) + (begin + (gnc:query-set-group query (gnc:get-current-group)) + (gnc:query-add-account-match query + (gnc:list->glist c_accounts) + 'acct-match-any 'query-and) + (gnc:query-add-date-match-timepair + query #t begindate #t enddate 'query-and) + (gnc:query-set-sort-order query + (get-query-sortkey primary-key) + (get-query-sortkey secondary-key) + 'by-none) + (gnc:query-set-sort-increasing query + (eq? primary-order 'ascend) + (eq? secondary-order 'ascend) + #t) - (set! splits (gnc:glist->list (gnc:query-get-splits query) - )) - ;; (gnc:warn "Splits in trep-renderer:" splits) - (set! table - (make-split-table - splits - options - (get-subtotal-pred optname-prime-sortkey - optname-prime-subtotal - optname-prime-date-subtotal) - (get-subtotal-pred optname-sec-sortkey - optname-sec-subtotal - optname-sec-date-subtotal) - (get-subheading-renderer optname-prime-sortkey - optname-prime-subtotal - optname-prime-date-subtotal) - (get-subheading-renderer optname-sec-sortkey - optname-sec-subtotal - optname-sec-date-subtotal))) - - (gnc:html-document-set-title! document (_ "Transaction Report")) - (gnc:html-document-add-object! - document - (gnc:make-html-text - (gnc:html-markup-h3 (display-date-interval begindate enddate)))) - (gnc:html-document-add-object! - document - table) - (gnc:free-query query) + (set! splits (gnc:glist->list (gnc:query-get-splits query) + )) + ;;(gnc:warn "Splits in trep-renderer:" splits) + (if (not (null? splits)) + (let ((table + (make-split-table + splits + options + (get-subtotal-pred optname-prime-sortkey + optname-prime-subtotal + optname-prime-date-subtotal) + (get-subtotal-pred optname-sec-sortkey + optname-sec-subtotal + optname-sec-date-subtotal) + (get-subheading-renderer optname-prime-sortkey + optname-prime-subtotal + optname-prime-date-subtotal) + (get-subheading-renderer optname-sec-sortkey + optname-sec-subtotal + optname-sec-date-subtotal)))) + + (gnc:html-document-set-title! document + (_ "Transaction Report")) + (gnc:html-document-add-object! + document + (gnc:make-html-text + (gnc:html-markup-h3 + (display-date-interval begindate enddate)))) + (gnc:html-document-add-object! + document + table) + (gnc:free-query query)) + ;; error condition: no splits found + (let ((p (gnc:make-html-text))) + (gnc:html-text-append! + p + (gnc:html-markup-h2 + (_ "No matching transactions found")) + (gnc:html-markup-p + (_ "No transactions were found that \ +match the given time interval and account selection."))) + (gnc:html-document-add-object! document p)))) + + ;; error condition: no accounts specified + (let ((p (gnc:make-html-text))) + (gnc:html-text-append! + p + (gnc:html-markup-h2 (_ "No accounts selected")) + (gnc:html-markup-p + (_ "This report requires accounts to be selected."))) + (gnc:html-document-add-object! document p))) document))