2001-04-23 Christian Stimming <stimming@tuhh.de>

* 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
This commit is contained in:
Dave Peticolas 2001-04-23 21:09:24 +00:00
parent 28adf6a459
commit e4a5099dab
2 changed files with 76 additions and 47 deletions

View File

@ -1,3 +1,8 @@
2001-04-23 Christian Stimming <stimming@tuhh.de>
* src/scm/report/transaction-report.scm: Make more sanity
checks. Fix bugs.
2001-04-23 Dave Peticolas <dave@krondo.com> 2001-04-23 Dave Peticolas <dave@krondo.com>
* src/engine/Query.c (xaccQueryGetSplitsUniqueTrans): fix bug * src/engine/Query.c (xaccQueryGetSplitsUniqueTrans): fix bug

View File

@ -437,7 +437,7 @@
(gnc:make-multichoice-option (gnc:make-multichoice-option
pagename-sorting optname-prime-date-subtotal pagename-sorting optname-prime-date-subtotal
"d" (N_ "Do a date subtotal") "d" (N_ "Do a date subtotal")
'none 'monthly
subtotal-choice-list)) subtotal-choice-list))
(gnc:register-trep-option (gnc:register-trep-option
@ -474,7 +474,7 @@
(gnc:make-multichoice-option (gnc:make-multichoice-option
pagename-sorting optname-sec-date-subtotal pagename-sorting optname-sec-date-subtotal
"h" (N_ "Do a date subtotal") "h" (N_ "Do a date subtotal")
'none 'monthly
subtotal-choice-list)) subtotal-choice-list))
(gnc:register-trep-option (gnc:register-trep-option
@ -797,7 +797,7 @@ and Income accounts")))))
(car splits) table width primary-subtotal-style)) (car splits) table width primary-subtotal-style))
(if secondary-subheading-renderer (if secondary-subheading-renderer
(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 (do-rows-with-subtotals splits table used-columns width
multi-rows? #t multi-rows? #t
@ -916,53 +916,77 @@ and Income accounts")))))
(secondary-key (opt-val pagename-sorting optname-sec-sortkey)) (secondary-key (opt-val pagename-sorting optname-sec-sortkey))
(secondary-order (opt-val pagename-sorting "Secondary Sort Order")) (secondary-order (opt-val pagename-sorting "Secondary Sort Order"))
(splits '()) (splits '())
(table '())
(query (gnc:malloc-query))) (query (gnc:malloc-query)))
(gnc:query-set-group query (gnc:get-current-group)) ;;(warn "accts in trep-renderer:" c_accounts)
(gnc:query-add-account-match query (if (not (or (null? c_accounts) (and-map not c_accounts)))
(gnc:list->glist c_accounts) (begin
'acct-match-any 'query-and) (gnc:query-set-group query (gnc:get-current-group))
(gnc:query-add-date-match-timepair (gnc:query-add-account-match query
query #t begindate #t enddate 'query-and) (gnc:list->glist c_accounts)
(gnc:query-set-sort-order query 'acct-match-any 'query-and)
(get-query-sortkey primary-key) (gnc:query-add-date-match-timepair
(get-query-sortkey secondary-key) query #t begindate #t enddate 'query-and)
'by-none) (gnc:query-set-sort-order query
(gnc:query-set-sort-increasing query (get-query-sortkey primary-key)
(eq? primary-order 'ascend) (get-query-sortkey secondary-key)
(eq? secondary-order 'ascend) 'by-none)
#t) (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) (set! splits (gnc:glist->list (gnc:query-get-splits query)
<gnc:Split*>)) <gnc:Split*>))
;; (gnc:warn "Splits in trep-renderer:" splits) ;;(gnc:warn "Splits in trep-renderer:" splits)
(set! table (if (not (null? splits))
(make-split-table (let ((table
splits (make-split-table
options splits
(get-subtotal-pred optname-prime-sortkey options
optname-prime-subtotal (get-subtotal-pred optname-prime-sortkey
optname-prime-date-subtotal) optname-prime-subtotal
(get-subtotal-pred optname-sec-sortkey optname-prime-date-subtotal)
optname-sec-subtotal (get-subtotal-pred optname-sec-sortkey
optname-sec-date-subtotal) optname-sec-subtotal
(get-subheading-renderer optname-prime-sortkey optname-sec-date-subtotal)
optname-prime-subtotal (get-subheading-renderer optname-prime-sortkey
optname-prime-date-subtotal) optname-prime-subtotal
(get-subheading-renderer optname-sec-sortkey optname-prime-date-subtotal)
optname-sec-subtotal (get-subheading-renderer optname-sec-sortkey
optname-sec-date-subtotal))) optname-sec-subtotal
optname-sec-date-subtotal))))
(gnc:html-document-set-title! document (_ "Transaction Report"))
(gnc:html-document-add-object! (gnc:html-document-set-title! document
document (_ "Transaction Report"))
(gnc:make-html-text (gnc:html-document-add-object!
(gnc:html-markup-h3 (display-date-interval begindate enddate)))) document
(gnc:html-document-add-object! (gnc:make-html-text
document (gnc:html-markup-h3
table) (display-date-interval begindate enddate))))
(gnc:free-query query) (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)) document))