TP->T64: gnucash/report/standard-reports/budget-barchart.scm

This commit is contained in:
Christopher Lam 2017-12-15 19:12:06 +08:00
parent db316c2d16
commit 811d4e5718

View File

@ -141,11 +141,9 @@
;; ;;
;; Create bar and and values ;; Create bar and and values
;; ;;
(define (gnc:chart-create-budget-actual budget acct running-sum chart-type width height from-tp to-tp) (define (gnc:chart-create-budget-actual budget acct running-sum chart-type width height report-start-time report-end-time)
(let* ( (let* (
(chart #f) (chart #f)
(report-start-time (car from-tp))
(report-end-time (car to-tp))
) )
(if (eqv? chart-type 'bars) (if (eqv? chart-type 'bars)
@ -183,7 +181,6 @@
(bgt-sum 0) (bgt-sum 0)
(act-sum 0) (act-sum 0)
(date (gnc-budget-get-period-start-date budget period)) (date (gnc-budget-get-period-start-date budget period))
(period-start-time (car date))
(bgt-vals '()) (bgt-vals '())
(act-vals '()) (act-vals '())
(date-iso-string-list '()) (date-iso-string-list '())
@ -206,7 +203,7 @@
(gnc-budget-get-account-period-actual-value budget acct period)))) (gnc-budget-get-account-period-actual-value budget acct period))))
) )
) )
(if (<= report-start-time period-start-time) (if (<= report-start-time date)
;; within reporting period, update the display lists ;; within reporting period, update the display lists
(begin (begin
(if (not running-sum) (if (not running-sum)
@ -221,14 +218,13 @@
) )
(set! bgt-vals (append bgt-vals (list bgt-sum))) (set! bgt-vals (append bgt-vals (list bgt-sum)))
(set! act-vals (append act-vals (list act-sum))) (set! act-vals (append act-vals (list act-sum)))
(set! date-iso-string-list (append date-iso-string-list (list (gnc-print-date date)))) (set! date-iso-string-list (append date-iso-string-list (list (qof-print-date date))))
) )
) )
;; prepare data for next loop repetition ;; prepare data for next loop repetition
(set! period (+ period 1)) (set! period (+ period 1))
(set! date (gnc-budget-get-period-start-date budget period)) (set! date (gnc-budget-get-period-start-date budget period))
(set! period-start-time (car date)) (if (< report-end-time date)
(if (< report-end-time period-start-time)
(set! period num-periods) ;; reporting period has ended, break the loop (set! period num-periods) ;; reporting period has ended, break the loop
) )
) )
@ -319,10 +315,10 @@
(report-title (get-option gnc:pagename-general (report-title (get-option gnc:pagename-general
gnc:optname-reportname)) gnc:optname-reportname))
(document (gnc:make-html-document)) (document (gnc:make-html-document))
(from-date-tp (gnc:timepair-start-day-time (from-date-t64 (gnc:time64-start-day-time
(gnc:date-option-absolute-time (gnc:date-option-absolute-time
(get-option gnc:pagename-general optname-from-date)))) (get-option gnc:pagename-general optname-from-date))))
(to-date-tp (gnc:timepair-end-day-time (to-date-t64 (gnc:time64-end-day-time
(gnc:date-option-absolute-time (gnc:date-option-absolute-time
(get-option gnc:pagename-general optname-to-date)))) (get-option gnc:pagename-general optname-to-date))))
) )
@ -357,7 +353,7 @@
) )
(gnc:html-document-add-object! (gnc:html-document-add-object!
document document
(gnc:chart-create-budget-actual budget acct running-sum chart-type width height from-date-tp to-date-tp) (gnc:chart-create-budget-actual budget acct running-sum chart-type width height from-date-t64 to-date-t64)
) )
) )
) )