mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
ENH: Upgrade Sign Reversal to use global preference by default
This commit is contained in:
parent
e8dc5c545d
commit
c26af85e82
@ -321,6 +321,11 @@ options specified in the Options panels."))
|
|||||||
|
|
||||||
(define sign-reverse-list
|
(define sign-reverse-list
|
||||||
(list
|
(list
|
||||||
|
(cons 'global
|
||||||
|
(list
|
||||||
|
(cons 'text (_ "Use Global Preference"))
|
||||||
|
(cons 'tip (_ "Use reversing option specified in global preference."))
|
||||||
|
(cons 'acct-types #f)))
|
||||||
(cons 'none
|
(cons 'none
|
||||||
(list
|
(list
|
||||||
(cons 'text (N_ "None"))
|
(cons 'text (N_ "None"))
|
||||||
@ -762,7 +767,7 @@ tags within description, notes or memo. ")
|
|||||||
(gnc:make-multichoice-option
|
(gnc:make-multichoice-option
|
||||||
gnc:pagename-display (N_ "Sign Reverses")
|
gnc:pagename-display (N_ "Sign Reverses")
|
||||||
"m1" (N_ "Reverse amount display for certain account types.")
|
"m1" (N_ "Reverse amount display for certain account types.")
|
||||||
'credit-accounts
|
'global
|
||||||
(keylist->vectorlist sign-reverse-list))))
|
(keylist->vectorlist sign-reverse-list))))
|
||||||
|
|
||||||
(gnc:options-set-default-section options gnc:pagename-general)
|
(gnc:options-set-default-section options gnc:pagename-general)
|
||||||
@ -1136,8 +1141,20 @@ tags within description, notes or memo. ")
|
|||||||
(let* ((calculator (vector-ref cell 1))
|
(let* ((calculator (vector-ref cell 1))
|
||||||
(reverse? (vector-ref cell 2))
|
(reverse? (vector-ref cell 2))
|
||||||
(subtotal? (vector-ref cell 3))
|
(subtotal? (vector-ref cell 3))
|
||||||
(calculated (calculator split)))
|
(calculated (calculator split))
|
||||||
(vector calculated reverse? subtotal?)))
|
(reverse-amount (lambda (mon)
|
||||||
|
(let ((currency (gnc:gnc-monetary-commodity mon))
|
||||||
|
(amount (gnc:gnc-monetary-amount mon)))
|
||||||
|
(gnc:make-gnc-monetary
|
||||||
|
currency
|
||||||
|
(gnc-numeric-neg amount))))))
|
||||||
|
(vector (if (and reverse?
|
||||||
|
(if account-types-to-reverse
|
||||||
|
(member (xaccAccountGetType account) account-types-to-reverse)
|
||||||
|
(gnc-reverse-balance account)))
|
||||||
|
(reverse-amount calculated)
|
||||||
|
calculated)
|
||||||
|
subtotal?)))
|
||||||
cell-calculators))
|
cell-calculators))
|
||||||
|
|
||||||
(if (column-uses? 'date)
|
(if (column-uses? 'date)
|
||||||
|
Loading…
Reference in New Issue
Block a user