Jump to content

Currency - Invoice issue


Recommended Posts

Hello

 

I have next issue: I would like to have my default currency in EUR, but in invoie (both pdf and viewinvoice) I would like to display the price in secondary currency (for example USD).

 

How can i edit the .tpl files so the clients see the other currency (not default) ?

 

Thank you

Link to comment
Share on other sites

the problem with this is that, on one level, it's simple... but dig a little deeper and it becomes more complicated! :roll:

 

so the opening step would be to get the exchange rate from the database - but that's simple enough to do using an action hook. :idea:

 

http://forum.whmcs.com/showthread.php?112787-how-to-get-currency-exchange-rate&p=457891#post457891

 

with that value, you can then work out the total in your other currency - as it's simply...

 

total in currency B = total in currency A * exchange rate

 

the problem is that WHMCS doesn't archive exchange rates - it only stores the rate obtained from the last cron run... so on the day the invoice is generated, you could use the hook, tweak the templates to show the second currency and it would be correct.

 

however, if the client logs into WHMCS the next day, week or month later, and views the invoice, the exchange rate will be different and so the secondary total will now be wrong. :roll:

 

perhaps the only way around that would be to archive the exchange rates (or secondary totals) and then use the appropriate rate/total when viewing the invoice... or using an online API that can access historical rates and pulls the correct rate based on the invoice date. :?:

 

but those two last options would require an addon to be written - and i'm not aware of any existing addon that can do that.

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