Hi David, I'd had a review of transaction-report and can attempt fix signs for subtotals when sorting by 'account name'. The difficult issue remains how to handle reversals when sorting by 'other account name'. I think it's buggy and not sure how to handle it. Try this patch to trep-engine.scm in a recent build.
On Mon, 12 Aug 2019 at 08:45, David T. <sunfis...@yahoo.com> wrote: > Well, it seems odd to me that "Double" display (as Adrien noted)(thank > you, Adrien!) is able to display the figures as the user prefers. It is > also odd to me that the report knows to switch the values of the individual > transactions, but is unable to remember that fact when it comes to the > totals. That right there is the problem. > > As for the FAQ, it seems to me that there is a mistake in the example > there: the GnuCash option is to change signs for Income *and* Expenses. But > the example provided reverses Income but not Expenses. Were it to reverse > both sets of accounts as the preference indicates, then the math should > work out correctly ($100+10-20=$90). Or am I missing something here? > > Why is it not possible to perform the calculation for totals and then > apply a display modifier so that the user sees numbers as they prefer? > > The current solution is a poor one. > On 8/12/2019 11:12 AM, Christopher Lam wrote: > > > https://wiki.gnucash.org/wiki/FAQ#Q:_Why_does_the_Transaction_Report_.27Sign_Reversal.27_setting_not_work_on_subtotals > > This issue could be fixed if the scenario addressed in this FAQ can be > resolved. I don't really know how to handle that particular case. > > On Mon., 12 Aug. 2019, 13:02 David T. via gnucash-user, < > gnucash-u...@gnucash.org> wrote: > >> Hello, >> >> I am trying to create a YTD Capital Gains report, and am encountering a >> problem with how the Transaction Report implements the Sign Reverses >> setting. >> >> I recall some time back a discussion about the fact that the Sign >> Reverses setting reverses signs in these reports in a confusing way. >> There was some discussion about reversing the individual transactions >> but not the totals. Although I do not recall the specifics of the >> discussion, I am encountering the same situation now, where the >> transactions themselves respect the user setting, but the totals do not. >> To say this is confusing is an understatement. >> >> It seems to me that other financial applications must have encountered >> the problem of displaying income to users as a positive value (since >> that is how most of us view income!) while still finding a way to >> display the correct accounting information. >> >> To display my YTD report of Capital Gains, I ran a Transaction Report >> and selected the Income:Realized Gains accounts for the current year. >> The result shows losses as positive numbers, and gains as negative. I >> don't know about you, but my expectation is reversed from this. If I >> change the Sign Reverses setting to Income and Expense, then the >> transactions switch, but the totals do not. This result was the gist of >> the discussion in an earlier thread. Bleah! >> >> Now, I know that I can copy the data, paste it into another program and >> change all the settings to my heart's content, but I am looking for a >> way to run a report in GnuCash that directly and unambiguously shows me >> whether I have gained money (a positive) or lost it (a negative) over >> the current year. Does anyone have suggestions? >> >> FWIW, I attempted to turn this report around and have a report that >> lists transactions in the asset accounts, filtered by the >> Income:Realized Gains accounts, but that seems to report only the Asset >> account currency--in this case, the mutual fund or stock shares involved >> on the Gain/Loss transaction. Unfortunately, that's not the actual >> Gain/Loss value... >> >> It would be nice if the sign reverses setting could be fixed. Barring >> that, does anyone have a workaround report setup that can give me a >> sensible YTD Capital Gains total as described? >> >> David T. >> >> _______________________________________________ >> gnucash-user mailing list >> gnucash-u...@gnucash.org >> To update your subscription preferences or to unsubscribe: >> https://lists.gnucash.org/mailman/listinfo/gnucash-user >> If you are using Nabble or Gmane, please see >> https://wiki.gnucash.org/wiki/Mailing_Lists for more information. >> ----- >> Please remember to CC this list on all your replies. >> You can do this by using Reply-To-List or Reply-All. >> >
diff --git a/gnucash/report/report-system/trep-engine.scm b/gnucash/report/report-system/trep-engine.scm index fbcce9f05..b63fcebcb 100644 --- a/gnucash/report/report-system/trep-engine.scm +++ b/gnucash/report/report-system/trep-engine.scm @@ -1422,16 +1422,25 @@ be excluded from periodic reporting.") data)))))))) (define (add-subtotal-row subtotal-string subtotal-collectors - subtotal-style level row col) + subtotal-style level row col curr-sortvalue) (let* ((left-indent (case level ((total) 0) ((primary) primary-indent) ((secondary) (+ primary-indent secondary-indent)))) + (sortkey (case level + ((primary) (opt-val pagename-sorting optname-prime-sortkey)) + ((secondary) (opt-val pagename-sorting optname-sec-sortkey)) + (else #f))) (right-indent (- indent-level left-indent)) (merge-list (map (lambda (cell) (vector-ref cell 4)) calculated-cells)) + (reverse? (and curr-sortvalue + (memq sortkey ACCOUNT-SORTING-TYPES) + (gnc-reverse-balance curr-sortvalue))) (columns (map (lambda (coll) (coll 'format gnc:make-gnc-monetary #f)) - subtotal-collectors)) + (if reverse? + (map gnc:collector- subtotal-collectors) + subtotal-collectors))) (list-of-commodities (delete-duplicates (map gnc:gnc-monetary-commodity (concatenate columns)) @@ -1690,7 +1699,7 @@ be excluded from periodic reporting.") (add-subtotal-row (render-grand-total) total-collectors - def:grand-total-style 'total 'row-total 'col-total)) + def:grand-total-style 'total 'row-total 'col-total #f)) (let* ((current (car splits)) (rest (cdr splits)) @@ -1738,7 +1747,8 @@ be excluded from periodic reporting.") (cons (primary-subtotal-comparator current) (render-summary current 'primary #f)) (cons (secondary-subtotal-comparator current) - (render-summary current 'secondary #f))) + (render-summary current 'secondary #f)) + ((secondary-get-info 'renderer-fn) current)) (for-each (lambda (coll) (coll 'reset #f #f)) @@ -1750,7 +1760,8 @@ be excluded from periodic reporting.") 'primary (cons (primary-subtotal-comparator current) (render-summary current 'primary #f)) - 'col-total) + 'col-total + ((primary-get-info 'renderer-fn) current)) (for-each (lambda (coll) (coll 'reset #f #f)) @@ -1778,7 +1789,8 @@ be excluded from periodic reporting.") (render-summary current 'primary #f)) (cons #f "")) (cons (secondary-subtotal-comparator current) - (render-summary current 'secondary #f))) + (render-summary current 'secondary #f)) + ((secondary-get-info 'renderer-fn) current)) (for-each (lambda (coll) (coll 'reset #f #f))
_______________________________________________ gnucash-devel mailing list gnucash-devel@gnucash.org https://lists.gnucash.org/mailman/listinfo/gnucash-devel