"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gnucash/report/reports/example/average-balance.scm" between
gnucash-5.0.tar.bz2 and gnucash-5.1.tar.bz2

About: GnuCash is personal and small-business financial-accounting software.

average-balance.scm  (gnucash-5.0.tar.bz2):average-balance.scm  (gnucash-5.1.tar.bz2)
skipping to change at line 291 skipping to change at line 291
(dosubs? (get-option gnc:pagename-accounts optname-subacct)) (dosubs? (get-option gnc:pagename-accounts optname-subacct))
(accounts (if dosubs? (accounts (if dosubs?
(gnc-accounts-and-all-descendants accounts) (gnc-accounts-and-all-descendants accounts)
accounts)) accounts))
(plot-type (get-option gnc:pagename-display (N_ "Plot Type"))) (plot-type (get-option gnc:pagename-display (N_ "Plot Type")))
(show-plot? (get-option gnc:pagename-display (N_ "Show plot"))) (show-plot? (get-option gnc:pagename-display (N_ "Show plot")))
(show-table? (get-option gnc:pagename-display (N_ "Show table"))) (show-table? (get-option gnc:pagename-display (N_ "Show table")))
(document (gnc:make-html-document)) (document (gnc:make-html-document))
(commodity-list #f) (commodity-list #f)
(exchange-fn #f) (exchange-fn #f)
(all-zeros? #t)) (all-zeros? #t))
;;(warn commodity-list) ;;(warn commodity-list)
(if (not (null? accounts)) (if (not (null? accounts))
(let ((query (qof-query-create-for-splits)) (let ((query (qof-query-create-for-splits))
(data '())) (data '()))
;; The percentage done numbers here are a hack so that ;; The percentage done numbers here are a hack so that
;; something gets displayed. On my system the ;; something gets displayed. On my system the
;; gnc:case-exchange-time-fn takes about 20% of the time ;; gnc:case-exchange-time-fn takes about 20% of the time
;; building up a list of prices for later use. Either this ;; building up a list of prices for later use. Either this
;; routine needs to send progress reports, or the price ;; routine needs to send progress reports, or the price
;; lookup should be distributed and done when actually ;; lookup should be distributed and done when actually
;; needed so as to amortize the cpu time properly. ;; needed so as to amortize the cpu time properly.
(gnc:report-percent-done 1) (gnc:report-percent-done 1)
(set! commodity-list (gnc:accounts-get-commodities (set! commodity-list (gnc:accounts-get-commodities
accounts report-currency)) accounts report-currency))
(gnc:report-percent-done 5) (gnc:report-percent-done 5)
(set! exchange-fn (gnc:case-exchange-time-fn (set! exchange-fn (gnc:case-exchange-time-fn
price-source report-currency price-source report-currency
commodity-list enddate commodity-list enddate
5 20)) 5 20))
(gnc:report-percent-done 20) (gnc:report-percent-done 20)
;; initialize the query to find splits in the right ;; initialize the query to find splits in the right
;; date range and accounts ;; date range and accounts
(qof-query-set-book query (gnc-get-current-book)) (qof-query-set-book query (gnc-get-current-book))
;; for balance purposes, we don't need to do this, but it cleans up ;; for balance purposes, we don't need to do this, but it cleans up
;; the table display. ;; the table display.
(xaccQueryAddClearedMatch (xaccQueryAddClearedMatch
query (logand CLEARED-ALL (lognot CLEARED-VOIDED)) QOF-QUERY-AND) query (logand CLEARED-ALL (lognot CLEARED-VOIDED)) QOF-QUERY-AND)
;; add accounts to the query (include subaccounts ;; add accounts to the query (include subaccounts
;; if requested) ;; if requested)
(gnc:report-percent-done 25) (gnc:report-percent-done 25)
(xaccQueryAddAccountMatch query accounts QOF-GUID-MATCH-ANY QOF-QUERY- AND) (xaccQueryAddAccountMatch query accounts QOF-GUID-MATCH-ANY QOF-QUERY- AND)
;; match splits between start and end dates ;; match splits between start and end dates
(xaccQueryAddDateMatchTT (xaccQueryAddDateMatchTT
query #t begindate #t enddate QOF-QUERY-AND) query #t begindate #t enddate QOF-QUERY-AND)
(qof-query-set-sort-order query (qof-query-set-sort-order query
(list SPLIT-TRANS TRANS-DATE-POSTED) (list SPLIT-TRANS TRANS-DATE-POSTED)
(list QUERY-DEFAULT-SORT) (list QUERY-DEFAULT-SORT)
'()) '())
(gnc:report-percent-done 40) (gnc:report-percent-done 40)
(let* ((splits (qof-query-run query)) (let* ((splits (qof-query-run query))
(daily-dates (gnc:make-date-list begindate enddate DayDelta)) (daily-dates (gnc:make-date-list begindate enddate DayDelta))
(interval-dates (gnc:make-date-list begindate enddate stepsize) ) (interval-dates (gnc:make-date-list begindate enddate stepsize) )
;; for accounts-balances generation ;; for accounts-balances generation
(work-to-do (length accounts)) (work-to-do (length accounts))
(accounts-balances (map (accounts-balances (map
(lambda (work-done acc) (lambda (work-done acc)
(gnc:report-percent-done (gnc:report-percent-done
skipping to change at line 452 skipping to change at line 452
(gnc:html-chart-set-width! barchart width) (gnc:html-chart-set-width! barchart width)
(gnc:html-chart-set-height! barchart height) (gnc:html-chart-set-height! barchart height)
(gnc:html-chart-set-height! barchart height) (gnc:html-chart-set-height! barchart height)
(gnc:html-document-add-object! document barchart)) (gnc:html-document-add-object! document barchart))
(gnc:html-document-add-object! (gnc:html-document-add-object!
document document
(gnc:html-make-empty-data-warning (gnc:html-make-empty-data-warning
report-title (gnc:report-id report-obj)))))) report-title (gnc:report-id report-obj))))))
;; make a table (optionally) ;; make a table (optionally)
(gnc:report-percent-done 80) (gnc:report-percent-done 80)
(if show-table? (if show-table?
(let ((table (gnc:make-html-table)) (let ((table (gnc:make-html-table))
(scu (gnc-commodity-get-fraction report-currency))) (scu (gnc-commodity-get-fraction report-currency)))
(gnc:html-table-set-col-headers! (gnc:html-table-set-col-headers!
table columns) table columns)
(for-each (for-each
(lambda (row) (lambda (row)
(gnc:html-table-append-row! (gnc:html-table-append-row!
table table
(map (map
skipping to change at line 482 skipping to change at line 482
report-currency report-currency
(gnc-numeric-convert amt scu GNC-RND-ROUND))) (gnc-numeric-convert amt scu GNC-RND-ROUND)))
(cddr row)))))) (cddr row))))))
data) data)
(gnc:html-document-add-object! document table)))) (gnc:html-document-add-object! document table))))
;; if there are no accounts selected... ;; if there are no accounts selected...
(gnc:html-document-add-object! (gnc:html-document-add-object!
document document
(gnc:html-make-no-account-warning (gnc:html-make-no-account-warning
report-title (gnc:report-id report-obj)))) report-title (gnc:report-id report-obj))))
(gnc:report-finished) (gnc:report-finished)
document)) document))
(gnc:define-report (gnc:define-report
'version 1 'version 1
'name reportname 'name reportname
'report-guid "d5adcc61c62e4b8684dd8907448d7900" 'report-guid "d5adcc61c62e4b8684dd8907448d7900"
'menu-path (list gnc:menuname-example) 'menu-path (list gnc:menuname-example)
'options-generator options-generator 'options-generator options-generator
'renderer renderer) 'renderer renderer)
 End of changes. 10 change blocks. 
17 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)