Working with currencies in SuperOffice Analyze (5.1)

2 posts / 0 new
Last post
goranf
goranf's picture
Working with currencies in SuperOffice Analyze (5.1)

Hi!

It's great that SA i using the "My currency" setting to recalculate all sales.

My question is if calculating from one "not leading currency" to an other "not leading currecy" is it then calculated via the leading currency, meaning that the calcuation is done twice?

Erik
Erik's picture
The conversion is as direct

The conversion is as direct as possible. Also when the source and destination currencies are the same it does no calculation at all to prevent decimal errors in the calculation. This is the t-SQL source code:

create function [crm7].[ba_cur_conv4]
  (
    @sr float -- Source Currency Rate
    ,@su float -- Source Currency Unit
    ,@currency_id int -- Destination currency id
  )
  -- =============================================
  -- Author: Erik Burøy
  -- Create date: 2011-05-18
  -- Description: Return amount in desired currency based on currency_id
  -- =============================================
  returns float
  as
  begin
  declare 
    @dx float
    ,@res float
 
  select
    @dx = units / rate
  from 
    crm7.currency
  where 
    Currency_id = @currency_id
 
  set @res = 1.0
  if @dx != (@su / @sr)
    set @res = (@sr / @su) * @dx
  return @res
  end
Log in or register to post comments