src-db/database/model/functions/C_CURRENCY_RATE.xml
changeset 799 fef2c5e2feb7
parent 785 8dba91261590
child 1106 f75065410ec7
--- a/src-db/database/model/functions/C_CURRENCY_RATE.xml	Wed Apr 30 10:48:47 2008 +0000
+++ b/src-db/database/model/functions/C_CURRENCY_RATE.xml	Mon May 05 06:59:24 2008 +0000
@@ -51,13 +51,6 @@
   -- Currency From variables
   v_cf_IsEuro      char(1);
   v_cf_IsEMUMember char(1);
-  v_cf_EMUEntryDate DATE;
-  v_cf_EMURate NUMBER;
-  -- Currency To variables
-  v_ct_IsEuro      CHAR(1) ;
-  v_ct_IsEMUMember CHAR(1) ;
-  v_ct_EMUEntryDate DATE;
-  v_ct_EMURate NUMBER;
   -- Triangle
   v_CurrencyFrom NUMBER;
   v_CurrencyTo   NUMBER;
@@ -78,69 +71,9 @@
   IF(p_RateType IS NOT NULL) THEN
     v_RateType := p_RateType;
   END IF;
-  -- Get Currency Info
-  SELECT to_char(max(IsEuro)),
-    to_char(max(IsEMUMember)),
-    TO_DATE(MAX(EMUEntryDate)),
-    MAX(EMURate)
-  INTO   v_cf_IsEuro,
-    v_cf_IsEMUMember,
-    v_cf_EMUEntryDate,
-    v_cf_EMURate
-  FROM C_Currency
-  WHERE C_Currency_ID = p_CurFrom_ID;
-  -- Not Found
-  IF(v_cf_IsEuro IS NULL) THEN
-    DBMS_OUTPUT.PUT_LINE('From Currency Not Found') ;
-    RETURN NULL;
-  END IF;
-  SELECT TO_CHAR(MAX(IsEuro)),
-    TO_CHAR(MAX(IsEMUMember)),
-    TO_DATE(MAX(EMUEntryDate)),
-    MAX(EMURate)
-  INTO v_ct_IsEuro,
-    v_ct_IsEMUMember,
-    v_ct_EMUEntryDate,
-    v_ct_EMURate
-  FROM C_Currency
-  WHERE C_Currency_ID = p_CurTo_ID;
-  -- Not Found
-  IF(v_ct_IsEuro IS NULL) THEN
-    DBMS_OUTPUT.PUT_LINE('To Currency Not Found') ;
-    RETURN NULL;
-  END IF;
-  -- Fixed - From Euro to EMU
-  IF(v_cf_IsEuro = 'Y' AND v_ct_IsEMUMember = 'Y' AND v_ConvDate >= v_ct_EMUEntryDate) THEN
-    RETURN v_ct_EMURate;
-  END IF;
-  -- Fixed - From EMU to Euro
-  IF(v_ct_IsEuro = 'Y' AND v_cf_IsEMUMember = 'Y' AND v_ConvDate >= v_cf_EMUEntryDate) THEN
-    RETURN 1 / v_cf_EMURate;
-  END IF;
-  -- Fixed - From EMU to EMU
-  IF(v_cf_IsEMUMember = 'Y' AND v_cf_IsEMUMember = 'Y'  AND v_ConvDate >= v_cf_EMUEntryDate AND v_ConvDate >= v_ct_EMUEntryDate) THEN
-    RETURN v_ct_EMURate / v_cf_EMURate;
-  END IF;
   -- Flexible Rates
   v_CurrencyFrom := p_CurFrom_ID;
   v_CurrencyTo := p_CurTo_ID;
-  -- if EMU Member involved, replace From/To Currency
-  IF((v_cf_isEMUMember = 'Y' AND v_ConvDate >= v_cf_EMUEntryDate) OR(v_ct_isEMUMember = 'Y' AND v_ConvDate >= v_ct_EMUEntryDate)) THEN
-    SELECT MAX(C_Currency_ID)
-    INTO v_CurrencyEuro
-    FROM C_Currency
-    WHERE IsEuro = 'Y';
-    -- Conversion Rate not Found
-    IF(v_CurrencyEuro IS NULL) THEN
-      DBMS_OUTPUT.PUT_LINE('Euro Not Found') ;
-      RETURN NULL;
-    END IF;
-    IF(v_cf_isEMUMember = 'Y' AND v_ConvDate >= v_cf_EMUEntryDate) THEN
-      v_CurrencyFrom := v_CurrencyEuro;
-    ELSE
-      v_CurrencyTo := v_CurrencyEuro;
-    END IF;
-  END IF;
   -- Get Rate
   DECLARE
   TYPE RECORD IS REF CURSOR;
@@ -171,13 +104,6 @@
     RETURN NULL;
   END IF;
   -- Currency From was EMU
-  IF(v_cf_isEMUMember = 'Y' AND v_ConvDate >= v_cf_EMUEntryDate) THEN
-    RETURN v_Rate / v_cf_EMURate;
-  END IF;
-  -- Currency To was EMU
-  IF(v_ct_isEMUMember = 'Y' AND v_ConvDate >= v_ct_EMUEntryDate) THEN
-    RETURN v_Rate * v_ct_EMURate;
-  END IF;
   RETURN v_Rate;
 EXCEPTION
 WHEN OTHERS THEN