gnucash maint: [ifrs-cost-basis] compare register vs calculated capgain per transaction

Christopher Lam clam at code.gnucash.org
Sat Oct 22 20:39:21 EDT 2022


Updated	 via  https://github.com/Gnucash/gnucash/commit/2afd9792 (commit)
	from  https://github.com/Gnucash/gnucash/commit/70958279 (commit)



commit 2afd97923772cd4fa5ceb947407a6b373f5e5ba0
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sun Oct 23 08:27:37 2022 +0800

    [ifrs-cost-basis] compare register vs calculated capgain per transaction
    
    ifrs-cost-basis report calculate the ACB per stock transaction. It
    will compare the register vs calculated acb and report any
    variance.

diff --git a/gnucash/report/reports/standard/ifrs-cost-basis.scm b/gnucash/report/reports/standard/ifrs-cost-basis.scm
index bd116b838..1ce7dcebd 100644
--- a/gnucash/report/reports/standard/ifrs-cost-basis.scm
+++ b/gnucash/report/reports/standard/ifrs-cost-basis.scm
@@ -382,7 +382,8 @@ the split action field to detect capitalized fees on stock activity")
                    "conv-proceeds-val" "conv-proceeds-cost"
                    "cumulative-average-cost-basis"
                    "average-cost-basis/unit-for-sale" "average-cost-basis-of-sale"
-                   "net-proceeds" "gain-post-commission" "gain-pre-commission"
+                   "net-proceeds" "gain-post-commission" "gain-pre-commission (calc)"
+                   "gain-pre-commission (register)" "gain-pre-commission variance"
                    "cumul-gross-profit" "cumul-net-profit" "cumul-tot-return"))
 
       (let lp ((splits splits)
@@ -458,6 +459,11 @@ the split action field to detect capitalized fees on stock activity")
                   (gain-pre-commission (M+ conv-proceeds-value
                                            average-cost-basis-of-sale))
 
+                  ;; difference between calculated (assuming acb) and
+                  ;; actual capgain. should be <1/SCU if all capgains
+                  ;; are recorded correctly.
+                  (gain-variance (M+ gain-pre-commission capgains-val))
+
                   (new-gross-profit (M+ cumul-gross-profit gain-pre-commission))
                   (new-net-profit (M+ cumul-net-profit gain-post-commission))
                   (new-tot-return (M+ cumul-tot-return gain-post-commission
@@ -505,6 +511,8 @@ the split action field to detect capitalized fees on stock activity")
                       (to-cell (to-report-currency net-proceeds))
                       (to-cell (to-report-currency gain-post-commission))
                       (to-cell (to-report-currency gain-pre-commission))
+                      (to-cell (to-report-currency capgains-val))
+                      (to-cell (to-report-currency gain-variance))
                       (to-cell (to-report-currency new-gross-profit))
                       (to-cell (to-report-currency new-net-profit))
                       (to-cell (to-report-currency new-tot-return))))



Summary of changes:
 gnucash/report/reports/standard/ifrs-cost-basis.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list