Currency Conversion Form with Dividing

jessicar2591187

11-03-2016

I have been searching all over and I cannot figure this out.  I am creating and almost done with a form that will calculate the currency conversion rate for Foreign Lodging Receipts.  Basically I need to be able to show how much the lodging is per night in U.S. Dollars.  We use the Total Foreign Currency on the receipt / Total U.S. Dollars charged on the credit card statement.  There are some times, when we need to round a nightly rate up or down by a cent in order to equal the Total U.S. Dollars charged on the statement.

For example, $270.11 was charged on the credit card.  The individual stayed only 2 nights.  $270.11 / 2 = $135.055 per night.  However, I need my Livecycle Table Calculation comes to $135.06 per night and shows the Total Lodging as $270.11.  But I need it to round one night to $135.05.  Otherwise, the credit card will be overpaid by 1 cent.

I can send or upload the form, however I do not see where i can upload.

Jessica

Accepted Solutions (0)

Answers (3)

Answers (3)

_Bruce_Robertson

MVP

15-03-2016

‌Hi Jessica, You have to upload the file to any file sharing site, Google docs, Dropbox, etc. Then you can post a link here.  You should be able to replace the numbers with references to your fields.  Bruce

jessicar2591187

14-03-2016

That didn't work for me.  The numbers were example numbers where I run into this problem.  Do you know how I could upload my form to show you?

Jessica

_Bruce_Robertson

MVP

11-03-2016

Hi Jessica,

(270.11 / 2).toFixed(2) Will give you "135.06" as a string.  If you need it as a number try +(270.11 / 2).toFixed(2) ... with a plus in front or Number((270.11 / 2).toFixed(2))

or

Math.round((270.11 / 2) * 100) / 100 will also do it and faster but to my eye looks clumsy.

Regards

Bruce