This topic contains 2 replies, has 0 voices, and was last updated by Olivier Gagnon NC 8 years, 2 months ago.

  • Author
    Posts
  • #6198

    greg_vp

    I have an invoice in our Canadian subsidiary that I am trying to get the tax amount for via SuiteScript.

    The TAXTOTAL field shows the dollar amount in our base currency – not the currency of the transaction. In talking to NetSuite support there is no foreign version of this field (like we have FXAMOUNT for TOTAL).

    So, I’ve determined that I need to determine the CONSOLIDATED EXCHANGE RATE between the two subsidiaries for the date of the invoice. And then multiply the base currency version of the TAXTOTAL by this rate to get the amount shown on screen.

    The code below is for getting these consolidated rates for a given period, but how do I 1) determine the period for a given date and 2) find the internal ID of that period?

    var filters = new Array();

    var columns = new Array();

    filters[0] = new nlobjSearchFilter(‘fromsubsidiary’, null, ‘is’, 1);

    filters[1] = new nlobjSearchFilter(‘tosubsidiary’, null, ‘is’, 2);

    filters[2] = new nlobjSearchFilter(‘period’, null, ‘is’, PERIODID);

    var results = nlapiSearchRecord(‘consolidatedexchangerate’, null, filters, columns);

    And guidance would be appreciated.

    ~ Greg
    This is a cached copy. Click here to see the original post.

  • #6199

    samzad

    there is a way to create a saved search for FX rate even though there is no option available for this in the list for available search types. Go to List –> Accounting –> Currency Exchange Rate –> New, now in the create exchange rate page click “Search” on the top right had corner – you will have standard saved search form, create your saved search to show FX rate between your base currency and foreign currency, you use the date as filter. You call this search in your suitescript without any issues. I have used this type of FX rate search for quite a bit of customization so I know that it works. Also dont forget to note down the search internal ID and make sure to add a distinct custom name for the search, reason is once created this search does not show up on your saved search list because it is not a standard NS search type. I hope NS guys doesn’t shut this down.

  • #6200

    Olivier Gagnon NC

    Hi Greg,

    If you create a UI transaction saved search, on the results tab, you can set the “Consolidated Exchange Rate” field to “None”. This will stop figures from converting to top subsidiary.

    You can then call this UI search in your code (rather than building a search directly from code).

You must be logged in to reply to this topic.