Matthew McNey
Matthew McNey

Reputation: 23

Integrating Netsuite back-end into Snowflake - how to find the exact currency exchange rates?

I'm using imported back-end tables from Netsuite in Snowflake.

I'm trying to determine exact exchange rates for foreign currency transactions to get the identical totals Netsuite has on the front-end. So I tried using Netsuite's "Currency" and "CurrencyRate" tables, but the amounts I am getting are incorrect.

The exchange rates from the table don't seem the same as those used on the front-end. Every amount I get is off by a little, which adds up when there are many transactions.

Is there another table I should keep an eye out for, or do they do something completely different to keep track of all the effective exchange rates on the back-end? Here's the query I have so far:

select 
    transline.transaction, 
    transline.id as line_item_id, 
    transline.creditforeignamount, 
    transline.rate, 
    transline.rateamount, 
    tran.currency as transaction_currency, 
    tran.recordtype, 
    tran.trandate::date as trandate, 
    tran.TRANID as netsuite_document_number, 
    tran.custbody_cust_primcurrfxrate, 
    transline.custcol_invoice_prim_curr_fx_rate, tran.exchangerate as tran_exchange_rate,
    cr.exchangerate as officialexchangerate, 
    round((case 
        when cr.exchangerate not like 'null' then (cr.exchangerate * transline.creditforeignamount)
        else creditforeignamount
    end), 2) as amount
from transactionline transline
inner join transaction tran 
on tran.id = transline.transaction
left join currencyrate cr 
on (tran.currency = cr.transactioncurrency 
and tran.custbody_cust_primcurrfxrate = cr.basecurrency 
and tran.closedate = cr.effectivedate)

enter image description here

Upvotes: 0

Views: 180

Answers (1)

bknights
bknights

Reputation: 15412

The issue may be that each transaction has an exchangerate field. This is because each transaction may have been done at a custom rate and Netsuite should calculate an exchange rate gain/loss for you based on the difference between the transaction exchange rate and the official posted exchange rate (i.e. the currencyrate tables).

Common sources of differences:

  • bank transfers between currencies - you use the bank's forex rate
  • negotiated exchange rates for trading partners
  • user error where a transaction all takes place in one currency and the data entry person puts 1.0 as the rate. (e.g. Your company uses USD. You have a Canadian supplier who invoices in CAD and whom you pay from a CAD bank account. A naive user might put 1 as the exchange rate because all the transactions are in CAD but all the transactions actually should have had the USD - CAD rate for the date of the transaciton)

Upvotes: 1

Related Questions