PulsedMedia Posted September 5, 2010 Share Posted September 5, 2010 The income report (graph) does not adjust for currencies at all, it just sums them up. That makes one hell of a easy query, but the data is completely screwed up in that case and is unusable for any other purpose than fun. 0 Quote Link to comment Share on other sites More sharing options...
PulsedMedia Posted September 6, 2010 Author Share Posted September 6, 2010 The fix was completely trivial when i finally looked into it. As the rate is also stored in the same table as where the sum is taken, all it needed was adding some maths. The main query became: SELECT SUM( round((amountin / rate)) ) FROM tblaccounts WHERE date LIKE '$year-$month-%' This is still lightly incorrect as amountout values are not taken into account! Will post one with that as well shortly. 0 Quote Link to comment Share on other sites More sharing options...
PulsedMedia Posted September 6, 2010 Author Share Posted September 6, 2010 (edited) Adding refunds into the picture was just AS trivial as correcting the values, the query becomes now: SELECT (SUM( round((amountin / rate)) ) - SUM( round((amountout / rate)) )) FROM tblaccounts WHERE date LIKE '$year-$month-%' Moving the rounding to the outmost parenthesis would result in slightly more accurate data if needed. Edited September 6, 2010 by PulsedMedia typo 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.