Compiere 3.1

org.compiere.udf
Class Currency

java.lang.Object
  extended by COM.ibm.db2.app.UDF
      extended by org.compiere.udf.Currency

public class Currency
extends COM.ibm.db2.app.UDF

SQLJ Currency related Functions

Version:
$Id: Currency.java,v 1.3 2006/07/30 00:59:07 jjanke Exp $
Author:
Jorg Janke

Field Summary
 
Fields inherited from class COM.ibm.db2.app.UDF
SQLUDF_FIRST_CALL, SQLUDF_NORMAL_CALL, SQLUDF_TF_CLOSE, SQLUDF_TF_FETCH, SQLUDF_TF_FINAL, SQLUDF_TF_FIRST, SQLUDF_TF_OPEN
 
Constructor Summary
Currency()
           
 
Method Summary
static double base(BigDecimal p_Amount, int p_C_CurrencyFrom_ID, Timestamp p_ConversionDate, int p_AD_Client_ID, int p_AD_Org_ID)
           
static double base(Connection conn, BigDecimal p_Amount, int p_C_CurrencyFrom_ID, Timestamp p_ConversionDate, int p_AD_Client_ID, int p_AD_Org_ID)
          Convert Amount to base Currency.
static double baseD(double p_Amount, int p_C_CurrencyFrom_ID, Timestamp p_ConversionDate, int p_AD_Client_ID, int p_AD_Org_ID)
          Convert Amount to base Currency.
static double convert(BigDecimal p_Amount, int p_C_CurrencyFrom_ID, int p_C_CurrencyTo_ID, Timestamp p_ConversionDate, int p_C_ConversionType_ID, int p_AD_Client_ID, int p_AD_Org_ID)
           
static double convertD(double p_Amount, int p_C_CurrencyFrom_ID, int p_C_CurrencyTo_ID, Timestamp p_ConversionDate, int p_C_ConversionType_ID, int p_AD_Client_ID, int p_AD_Org_ID)
          Convert Amount to Currency.
static double rate(int p_C_CurrencyFrom_ID, int p_C_CurrencyTo_ID, Timestamp p_ConversionDate, int p_C_ConversionType_ID, int p_AD_Client_ID, int p_AD_Org_ID)
          Get Conversion Rate.
static double round(BigDecimal p_Amount, int p_C_Currency_ID, String p_Costing)
          Round amount to Currency precision.
 
Methods inherited from class COM.ibm.db2.app.UDF
close, getCallType, getConnection, getDBapplid, getDBauthid, getDBcodepg, getDBcolname, getDBinfo, getDBname, getDBplatform, getDBprocid, getDBtbname, getDBtbschema, getDBver_rel, getFunctionName, getScratchpad, getSpecificName, isNull, needToSet, set, set, set, set, set, set, set, set, set, set, set, setCodepage, setScratchpad, setSQLmessage, setSQLstate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Currency

public Currency()
Method Detail

baseD

public static double baseD(double p_Amount,
                           int p_C_CurrencyFrom_ID,
                           Timestamp p_ConversionDate,
                           int p_AD_Client_ID,
                           int p_AD_Org_ID)
                    throws SQLException
Convert Amount to base Currency. (default conversion type) Previously: C_Base_Convert - Now: currencyBase

Parameters:
p_Amount - amount
p_C_CurrencyFrom_ID - from currency
p_ConversionDate - conversion date
p_AD_Client_ID - client
p_AD_Org_ID - org
Returns:
rate or null
Throws:
SQLException

base

public static double base(BigDecimal p_Amount,
                          int p_C_CurrencyFrom_ID,
                          Timestamp p_ConversionDate,
                          int p_AD_Client_ID,
                          int p_AD_Org_ID)
                   throws SQLException
Throws:
SQLException

base

public static double base(Connection conn,
                          BigDecimal p_Amount,
                          int p_C_CurrencyFrom_ID,
                          Timestamp p_ConversionDate,
                          int p_AD_Client_ID,
                          int p_AD_Org_ID)
                   throws SQLException
Convert Amount to base Currency. (default conversion type) Previously: C_Base_Convert - Now: currencyBase

Parameters:
conn - Connection
p_Amount - amount
p_C_CurrencyFrom_ID - from currency
p_ConversionDate - conversion date
p_AD_Client_ID - client
p_AD_Org_ID - org
Returns:
rate or null
Throws:
SQLException

convertD

public static double convertD(double p_Amount,
                              int p_C_CurrencyFrom_ID,
                              int p_C_CurrencyTo_ID,
                              Timestamp p_ConversionDate,
                              int p_C_ConversionType_ID,
                              int p_AD_Client_ID,
                              int p_AD_Org_ID)
                       throws SQLException
Convert Amount to Currency. Previously: currencyConvert - Now: currencyConvert

Parameters:
p_Amount - amount
p_C_CurrencyFrom_ID - from currency
p_C_CurrencyTo_ID - to currency
p_ConversionDate - conversion date
p_C_ConversionType_ID - conversion type
p_AD_Client_ID - client
p_AD_Org_ID - org
Returns:
rate or null
Throws:
SQLException

convert

public static double convert(BigDecimal p_Amount,
                             int p_C_CurrencyFrom_ID,
                             int p_C_CurrencyTo_ID,
                             Timestamp p_ConversionDate,
                             int p_C_ConversionType_ID,
                             int p_AD_Client_ID,
                             int p_AD_Org_ID)
                      throws SQLException
Throws:
SQLException

rate

public static double rate(int p_C_CurrencyFrom_ID,
                          int p_C_CurrencyTo_ID,
                          Timestamp p_ConversionDate,
                          int p_C_ConversionType_ID,
                          int p_AD_Client_ID,
                          int p_AD_Org_ID)
                   throws SQLException
Get Conversion Rate. Previously: C_Currency_Rate - Now: currencyRate

Parameters:
p_C_CurrencyFrom_ID - from currency
p_C_CurrencyTo_ID - to currency
p_ConversionDate - conversion date
p_C_ConversionType_ID - conversion type
p_AD_Client_ID - client
p_AD_Org_ID - org
Returns:
rate or null
Throws:
SQLException

round

public static double round(BigDecimal p_Amount,
                           int p_C_Currency_ID,
                           String p_Costing)
                    throws SQLException
Round amount to Currency precision. SELECT ISO_CODE, currencyRound(111.111111, C_Currency_ID, 'N') "Std", currencyRound(111.111111, C_Currency_ID, 'Y') "Cost" FROM C_Currency WHERE C_Currency_ID IN (100,113)

Parameters:
p_Amount - amount
p_C_Currency_ID - currency
p_Costing - Y if costing precision
Returns:
rounded amount
Throws:
SQLException

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.