Skip to content

Commit

Permalink
[reconcile-report] upgrade calculated-cells
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlam committed Apr 28, 2023
1 parent 93dd19e commit ab3ba99
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions gnucash/report/reports/standard/reconcile-report.scm
Expand Up @@ -68,26 +68,34 @@ to the Reconciliation Date.")

(define (reconcile-report-calculated-cells options)
(letrec
((split-amount (lambda (s)
((split-amount (lambda (s tr?)
(if (gnc:split-voided? s)
(xaccSplitVoidFormerAmount s)
(xaccSplitGetAmount s))))
(split-currency (compose xaccAccountGetCommodity xaccSplitGetAccount))
(amount (lambda (s)
(gnc:make-gnc-monetary (split-currency s) (split-amount s))))
(debit-amount (lambda (s)
(and (positive? (split-amount s))
(amount s))))
(credit-amount (lambda (s)
(and (not (positive? (split-amount s)))
(gnc:monetary-neg (amount s))))))
(amount (lambda (s tr?)
(gnc:make-gnc-monetary (split-currency s) (split-amount s tr?))))
(debit-amount (lambda (s tr?)
(and (positive? (split-amount s tr?))
(amount s tr?))))
(credit-amount (lambda (s tr?)
(and (not (positive? (split-amount s tr?)))
(gnc:monetary-neg (amount s tr?))))))
;; similar to default-calculated-cells but disable dual-subtotals.
(list (vector (G_ "Funds In")
debit-amount #f #t #f
(const "") #t)
(vector (G_ "Funds Out")
credit-amount #f #t #f
(const "") #f))))
(list (list (cons 'heading (G_ "Funds In"))
(cons 'calc-fn debit-amount)
(cons 'reverse-column? #f)
(cons 'subtotal? #t)
(cons 'start-dual-column? #f)
(cons 'friendly-heading-fn (const ""))
(cons 'merge-dual-column? #t))
(list (cons 'heading (G_ "Funds Out"))
(cons 'calc-fn credit-amount)
(cons 'reverse-column? #f)
(cons 'subtotal? #t)
(cons 'start-dual-column? #f)
(cons 'friendly-heading-fn (const ""))
(cons 'merge-dual-column? #f)))))

(define (reconcile-report-renderer rpt)
(gnc:trep-renderer
Expand Down

0 comments on commit ab3ba99

Please sign in to comment.