Jump to content

Income report currencies in correct


Recommended Posts

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.

Link to comment
Share on other sites

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 by PulsedMedia
typo
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated