[reports] use gnc_date_interval_format

This commit is contained in:
Christopher Lam 2024-09-14 21:57:52 +08:00
parent 0f2b613d46
commit d634902c1f
14 changed files with 27 additions and 54 deletions

View File

@ -256,10 +256,7 @@
chart (list chart (list
report-title report-title
(string-append (string-append
(format #f (gnc-date-interval-format from-date to-date)
(G_ "~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date))
(if show-total? (if show-total?
(let ((total (apply + daily-totals))) (let ((total (apply + daily-totals)))
(format (format

View File

@ -510,10 +510,7 @@ balance at a given time"))
chart (list report-title chart (list report-title
(string-append (string-append
(if do-intervals? (if do-intervals?
(format #f (gnc-date-interval-format from-date to-date)
(G_ "~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date))
(format #f (format #f
(G_ "Balance at ~a") (G_ "Balance at ~a")
(qof-print-date to-date))) (qof-print-date to-date)))

View File

@ -270,9 +270,7 @@ date point, a projected minimum balance including scheduled transactions."))
(gnc:html-chart-set-type! chart 'line) (gnc:html-chart-set-type! chart 'line)
;; Set the chart titles ;; Set the chart titles
(gnc:html-chart-set-title! (gnc:html-chart-set-title!
chart (list report-title chart (list report-title (gnc-date-interval-format from-date to-date)))
(format #f (G_ "~a to ~a")
(qof-print-date from-date) (qof-print-date to-date))))
;; Set the chart size ;; Set the chart size
(gnc:html-chart-set-width! chart plot-width) (gnc:html-chart-set-width! chart plot-width)
(gnc:html-chart-set-height! chart plot-height) (gnc:html-chart-set-height! chart plot-height)

View File

@ -859,8 +859,7 @@ also show overall period profit & loss."))
(display report-title) (display report-title)
(display " ") (display " ")
(if (or (not (eq? incr 'disabled)) (eq? report-type 'pnl)) (if (or (not (eq? incr 'disabled)) (eq? report-type 'pnl))
(format #t (G_ "~a to ~a") (gnc-date-interval-format startdate enddate)
(qof-print-date startdate) (qof-print-date enddate))
(display (qof-print-date enddate)))))) (display (qof-print-date enddate))))))
(if (eq? (get-option gnc:pagename-general optname-options-summary) 'always) (if (eq? (get-option gnc:pagename-general optname-options-summary) 'always)

View File

@ -465,9 +465,9 @@
((eq? (car column-list) 'total) ((eq? (car column-list) 'total)
(G_ "Total")) (G_ "Total"))
((list? (car column-list)) ((list? (car column-list))
(format #f (G_ "~a to ~a") (gnc-date-interval-format
(period-to-date-string (car (car column-list))) (gnc-budget-get-period-start-date budget (car (car column-list)))
(period-to-date-string (last (car column-list))))) (gnc-budget-get-period-start-date budget (last (car column-list)))))
(else (else
(period-to-date-string (car column-list))))) (period-to-date-string (car column-list)))))

View File

@ -180,8 +180,7 @@
doc (string-append doc (string-append
(get-option gnc:pagename-general gnc:optname-reportname) (get-option gnc:pagename-general gnc:optname-reportname)
" - " " - "
(format #f (G_ "~a to ~a") (gnc-date-interval-format from-date-t64 to-date-t64)))
(qof-print-date from-date-t64) (qof-print-date to-date-t64))))
(if (not (null? accounts)) (if (not (null? accounts))

View File

@ -254,11 +254,7 @@
(gnc:report-percent-done 90) (gnc:report-percent-done 90)
(gnc:html-chart-set-title! (gnc:html-chart-set-title!
chart (list report-title chart (list report-title (gnc-date-interval-format from-date-t64 to-date-t64)))
(format #f
(G_ "~a to ~a")
(qof-print-date from-date-t64)
(qof-print-date to-date-t64))))
(gnc:html-chart-set-width! chart width) (gnc:html-chart-set-width! chart width)
(gnc:html-chart-set-height! chart height) (gnc:html-chart-set-height! chart height)
(gnc:html-chart-set-y-axis-label! (gnc:html-chart-set-y-axis-label!

View File

@ -518,12 +518,8 @@ Please deselect the accounts with negative balances."))
(gnc:html-chart-set-title! (gnc:html-chart-set-title!
chart (list report-title chart (list report-title
(format #f (format #f (if do-intervals? "~a" (G_ "Balances ~a"))
(if do-intervals? (gnc-date-interval-format from-date-t64 to-date-t64))))
(G_ "~a to ~a")
(G_ "Balances ~a to ~a"))
(qof-print-date from-date-t64)
(qof-print-date to-date-t64))))
(gnc:html-chart-set-width! chart width) (gnc:html-chart-set-width! chart width)
(gnc:html-chart-set-height! chart height) (gnc:html-chart-set-height! chart height)

View File

@ -1960,10 +1960,9 @@
(gnc:html-document-set-title! (gnc:html-document-set-title!
document document
(format #f (format #f
(G_ "~a, ~a to ~a") (G_ "~a, ~a")
(get-option gnc:pagename-general gnc:optname-reportname) (get-option gnc:pagename-general gnc:optname-reportname)
(qof-print-date from-date) (gnc-date-interval-format from-date to-date)))
(qof-print-date to-date)))
(cond (cond
((not (null? accounts)) ((not (null? accounts))
@ -1986,11 +1985,7 @@
(list colname-unrealized-gain)) (list colname-unrealized-gain))
'())))) '()))))
(gnc:html-chart-set-title! chart (gnc:html-chart-set-title! chart
(list (N_ "Account Lot Gains") (list (N_ "Account Lot Gains") (gnc-date-interval-format from-date to-date)))
(format #f
(G_ "~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date))))
(gnc:html-chart-set-type! chart 'bar) (gnc:html-chart-set-type! chart 'bar)
(gnc:html-chart-set-width! chart chart-width) (gnc:html-chart-set-width! chart chart-width)
(gnc:html-chart-set-height! chart chart-height) (gnc:html-chart-set-height! chart chart-height)

View File

@ -312,10 +312,7 @@
(gnc:html-chart-set-width! chart width) (gnc:html-chart-set-width! chart width)
(gnc:html-chart-set-height! chart height) (gnc:html-chart-set-height! chart height)
(gnc:html-chart-set-title! (gnc:html-chart-set-title!
chart (list report-title chart (list report-title (gnc-date-interval-format from-date-t64 to-date-t64)))
(format #f (G_ "~a to ~a")
(qof-print-date from-date-t64)
(qof-print-date to-date-t64))))
(gnc:html-chart-set-y-axis-label! (gnc:html-chart-set-y-axis-label!
chart (gnc-commodity-get-mnemonic report-currency)) chart (gnc-commodity-get-mnemonic report-currency))
(gnc:html-chart-set-grid?! chart y-grid) (gnc:html-chart-set-grid?! chart y-grid)

View File

@ -1128,8 +1128,8 @@ and do not match the transaction."))))))))
(gnc:html-document-add-object! (gnc:html-document-add-object!
document (gnc:make-html-text document (gnc:make-html-text
(string-append (G_ "Date Range") ": " (qof-print-date start-date) (string-append (G_ "Date Range") ": "
" - " (qof-print-date end-date)))) (gnc-date-interval-format start-date end-date))))
(make-break! document) (make-break! document)

View File

@ -182,10 +182,7 @@
(string-append (string-append
(gnc-commodity-get-mnemonic base-commodity) (gnc-commodity-get-mnemonic base-commodity)
" - " " - "
(format #f (gnc-date-interval-format from-date to-date))))
(G_ "~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date)))))
(gnc:html-chart-set-width! chart width) (gnc:html-chart-set-width! chart width)
(gnc:html-chart-set-height! chart height) (gnc:html-chart-set-height! chart height)
(gnc:html-chart-set! chart (gnc:html-chart-set! chart

View File

@ -183,7 +183,7 @@ Select a different subset of transactions, or increase the limit in the options.
1 3 "total-label-cell" 1 3 "total-label-cell"
(gnc:make-html-text (gnc:make-html-text
(G_ "Total For ") (G_ "Total For ")
(format #f "~a to ~a" (qof-print-date from-date) (qof-print-date to-date)))) (gnc-date-interval-format from-date to-date)))
(map (lambda (acc total) (map (lambda (acc total)
(gnc:make-html-table-cell/markup (gnc:make-html-table-cell/markup
"total-number-cell" "total-number-cell"

View File

@ -291,6 +291,12 @@ in the Options panel."))
(define (split->time64 s) (define (split->time64 s)
(xaccTransGetDate (xaccSplitGetParent s))) (xaccTransGetDate (xaccSplitGetParent s)))
(define (date-get-week-year-string date)
(let ((beginweekt64 (* (gnc:time64-get-week (gnc-mktime date)) 7 86400)))
(gnc-date-interval-format (+ beginweekt64 (* 3 86400))
(+ beginweekt64 (* 9 86400)))))
(define date-subtotal-list (define date-subtotal-list
;; List for date option. ;; List for date option.
;; Defines the different date sorting keys, as an association-list. Each entry: ;; Defines the different date sorting keys, as an association-list. Each entry:
@ -316,7 +322,7 @@ in the Options panel."))
(cons 'split-sortvalue (lambda (s) (time64-week (split->time64 s)))) (cons 'split-sortvalue (lambda (s) (time64-week (split->time64 s))))
(cons 'date-sortvalue time64-week) (cons 'date-sortvalue time64-week)
(cons 'text (G_ "Weekly")) (cons 'text (G_ "Weekly"))
(cons 'renderer-fn (compose gnc:date-get-week-year-string (cons 'renderer-fn (compose date-get-week-year-string
gnc-localtime gnc-localtime
split->time64))) split->time64)))
@ -2542,11 +2548,7 @@ be excluded from periodic reporting.")
document document
(gnc:make-html-text (gnc:make-html-text
(gnc:html-markup-h3 (gnc:html-markup-h3
(format #f (gnc-date-interval-format begindate enddate))))
;; Translators: Both ~a's are dates
(G_ "From ~a to ~a")
(qof-print-date begindate)
(qof-print-date enddate)))))
(when (eq? infobox-display 'always) (when (eq? infobox-display 'always)
(gnc:html-document-add-object! (gnc:html-document-add-object!