Transaction report oddity

David J. Bakeman dbakeman at comcast.net
Fri Jan 27 19:08:22 EST 2012


   I have been using gnucash for years it's great!
   I have a small one man business and I setup the payroll according to
   the example in the gnucash docs:
   substituting social security and medicare for tax 1 and tax 2 since I'm
   in the states.  Then when it comes time for the yearly W2 I have a
   transaction report I run to get the totals.  I set it up to run on the
   Liabilities:Taxes:Employee Contribution:Medicare and
   Liabilities:Taxes:Employee Contribution:Social Security and
   Liabilities:Taxes:Income Tax accounts.  Ofcourse you don't get totals
   because those are temporary accounts so they always get zeroed out.
   However, I discovered if I filtered by Include Transactions to/from and
   set the accounts to the same as the above I would just get the goes
   intos so I got the totals I wanted.  (What I mean here is instead of
   seeing both the payroll split and the tax deposit split you just see
   the payroll)  Then I set the sign reverse to credit account to get a
   positive total.  Once this worked I never really thought about just
   double checked the numbers.
   Now this last year 2011 I screwed up my first 2 tax deposits and was
   putting in the old higher social security amount for the employee
   contribution (it went down to 4.2%).  I fixed it and got my money back
   from the feds and all was well until W2 time.  When I checked my report
   the refund was NOT accounted for so the social security total was off.
   I knew by how much and could have just ignored it and filled out the
   various tax forms with the correct number but I wanted to get gnucash
   to do it for me.
   I had originally put 2 transactions into my checking account.  The
   first from Liabilities:Taxes:Employee Contribution:Social Security to
   Assets:Checking and the second from Assets:Checking to
   Liabilities:Taxes:Employee Contribution:Social Security.  This is
   probably wrong perhaps I should have had another account for tax
   refund?  Anyway it got me thinking why the transaction report with the
   filter was working for the other transactions but not these.  So I
   started with the scheme code for the transaction report and it was
   calling gnc:split-get-corr-account-full-name which calls
   xaccSplitGetCorrAccountFullName in the engine which in turn calls
   get_corr_account_split which looks through the splits and if it sees
   more than one change from a negative to positive or positive to
   negative it causes "-- Split Transaction --" to be returned.  I looked
   at things and that's why my report is working.  The first split the
   payroll one has several in the first column (expenses:salary,
   expenses:taxes:social security etc) and several in the second column so
   it satisfies multiple switches gets the split return and the
   transaction.scm file applies the filter.  The second split the tax
   deposit split has just one entry in the second column for the money
   coming out of the assets:checking everything else is from the other
   column so it fails the test and returns the first account name instead
   of "-- Split Transaction --" and gets filtered out.  So I was able to
   "fix" my report by putting a dummy deposit and withdrawal(to zero it
   out) on the second refund transaction so it would satisfy the multiple
   switches and match the filter and then it got subtracted from my total
   like I wanted.
   So I got it working why am I bothering people you ask?  Well it because
   I think that the xaccSplitGetCorrAccountFullName function isn't doing
   the correct thing but I'm not sure.  Also if it isn't and it gets fixed
   my reports will break and I'll have to figure out a different way to
   get the data out.
   Thanks for reading this far :<)


More information about the gnucash-user mailing list