mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[report-utilities] compact functions
This commit is contained in:
parent
edaa0d7eea
commit
a55d05f29d
@ -873,23 +873,14 @@ query instead.")
|
|||||||
;; Input: account-balances
|
;; Input: account-balances
|
||||||
;; Output: commodity-collector
|
;; Output: commodity-collector
|
||||||
(define (gnc:get-assoc-account-balances-total account-balances)
|
(define (gnc:get-assoc-account-balances-total account-balances)
|
||||||
(let ((total (gnc:make-commodity-collector)))
|
(apply gnc:collector+ (map cadr account-balances)))
|
||||||
(for-each
|
|
||||||
(lambda (account-balance)
|
|
||||||
(total 'merge (cadr account-balance) #f))
|
|
||||||
account-balances)
|
|
||||||
total))
|
|
||||||
|
|
||||||
(define (gnc:multiline-to-html-text str)
|
(define (gnc:multiline-to-html-text str)
|
||||||
;; simple function - splits string containing #\newline into
|
;; simple function - splits string containing #\newline into
|
||||||
;; substrings, and convert to a gnc:make-html-text construct which
|
;; substrings, and convert to a gnc:make-html-text construct which
|
||||||
;; adds gnc:html-markup-br after each substring.
|
;; adds gnc:html-markup-br after each substring.
|
||||||
(let loop ((list-of-substrings (string-split str #\newline))
|
(define (interleave a b) (cons* a (gnc:html-markup-br) b))
|
||||||
(result '()))
|
(apply gnc:make-html-text (fold-right interleave '() (string-split str #\nl))))
|
||||||
(if (null? list-of-substrings)
|
|
||||||
(apply gnc:make-html-text (if (null? result) '() (reverse (cdr result))))
|
|
||||||
(loop (cdr list-of-substrings)
|
|
||||||
(cons* (gnc:html-markup-br) (car list-of-substrings) result)))))
|
|
||||||
|
|
||||||
;; ***************************************************************************
|
;; ***************************************************************************
|
||||||
;; Business Functions
|
;; Business Functions
|
||||||
|
Loading…
Reference in New Issue
Block a user