App or website to calculate change in Cambodian riel and US dollars

Here in Cambodia there's a fairly unique two-currency system in use, and it often gets really confusing to work out if you're getting the correct change.

The local currency is the Cambodian riel and the de facto currency is the US dollar.

There are no US coins here. In common street transactions USD \$1 is equal to KHR 4,000. (Though at a money changer it's more like 4,100 riel to the dollar, it's not relevant for this question.)

So very often riel notes are used as the equivalent to coins and you have to do some tricky mental arithmetic to calculate what your change should be.

• You might be given a price in dollars and cents, in dollars and riels, or just in riels.
• You might receive your change in dollars and riels, or just in riels.

So I'm looking for an app or website that can do these calculations for me, more reliably than my poor little brain.

• I think it's suited to both sites but this site is better and it's my home site so I'm asking here first. I've started writing a single-page webapp to do it but I don't know if I'll manage to finish it. – hippietrail Feb 5 '15 at 11:35
• @pnuts: Many questions would be within scope on two or more sites. But I think it's obvious that this site is more likely to have experts capable of answering hippietrail's question. The only way someone on SR is likely to know the answer is if they are also a traveler (since I doubt locals have this sort of question, having grown up with the two-currency system). So I think this is the most natural site for the question. +1 – Flimzy Feb 5 '15 at 15:41
• I finished a very ugly version of an app if anybody wants to try it or pour scorn over the code or apply awesome styling to it (-: – hippietrail Feb 5 '15 at 17:13
• @hippietrail where to get it? – Nean Der Thal Feb 5 '15 at 22:00
• @MeNoTalk: pastebin.com/frpvcg1n – hippietrail Feb 6 '15 at 5:30

I hacked up a basic version of such an app as a single-page of HTML with Javascript.

Then MeNoTalk came along and made it pretty!

When you edit any of the fields in the "price" or "paid" sections, all the other fields update. Not as you type but when you hit enter after editing. The bottom section tells you how much change you should get.

It's doesn't attempt to use any kind of official or true exchange rate between the two currencies that you would only find in a bank or money changers, just the usual de facto shopping rate of 4,000 riel to one dollar that you'll find here everywhere.

You can get the "current version" straight from PasteBin or try it in JSFiddle. I've also put it up on GitHub as a gist so you can hack it and contribute your changes back.

Apparently Google can convert multiple currencies to one. In the example showed it sums 1 British Pound, 2 US Dolars, 10 Swiss Francs and 1000 Indian Rupees and converts it to Euros. But when I try to sum any currency with Cambodian Riels it doesn't seem to work. Perhaps it's a bug or I don't know how to make Google understand what I wish.

Almost four years later, the rule hasn't changed. My direct experience of these days and some recent references I read confirm the schema:

• 1000 KHR = 25 cents
• 2000 KHR = 50 cents
• 4000 KHR = 1 \$
• 5000 KHR = 1,25 \$
• 10000 KHR = 2,5 \$
• 20000 KHR = 5 \$

No app and no more is needed in this basic table of conversion!

Yes, no coins around and KHRs may be the change if you pay in \$ (US Dollars).