EuroConvConst.pas
资源名称:delphi.rar [点击查看]
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:3k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit EuroConvConst;
- interface
- uses
- ConvUtils;
- var
- // Euro Currency Conversion Units
- // basic unit of measurement is Euro
- cbEuroCurrency: TConvFamily;
- cuEUR: TConvType;
- cuDEM: TConvType; // Germany
- cuESP: TConvType; // Spain
- cuFRF: TConvType; // France
- cuIEP: TConvType; // Ireland
- cuITL: TConvType; // Italy
- cuBEF: TConvType; // Belgium
- cuNLG: TConvType; // Holland
- cuATS: TConvType; // Austria
- cuPTE: TConvType; // Portugal
- cuFIM: TConvType; // Finland
- cuGRD: TConvType; // Greece
- cuLUF: TConvType; // Luxembourg
- type
- TEuroDecimals = 3..6;
- function EuroConvert (const AValue: Double; const AFrom, ATo: TConvType;
- const Decimals: TEuroDecimals = 3): Double;
- implementation
- uses
- Math;
- const
- DEMPerEuros = 1.95583;
- ESPPerEuros = 166.386;
- FRFPerEuros = 6.55957;
- IEPPerEuros = 0.787564;
- ITLPerEuros = 1936.27;
- BEFPerEuros = 40.3399;
- NLGPerEuros = 2.20371;
- ATSPerEuros = 13.7603;
- PTEPerEuros = 200.482;
- FIMPerEuros = 5.94573;
- GRDPerEuros = 340.750;
- LUFPerEuros = 40.3399;
- function EuroConvert (const AValue: Double; const AFrom, ATo: TConvType;
- const Decimals: TEuroDecimals = 3): Double;
- begin
- // check special case: no conversion
- if AFrom = ATo then
- Result := AValue
- else
- begin
- // convert to Euro, than round
- Result := ConvertFrom (AFrom, AValue);
- Result := RoundTo (Result, -Decimals);
- // convert to currency than round again
- Result := ConvertTo (Result, ATo);
- Result := RoundTo (Result, -Decimals);
- end;
- end;
- initialization
- // Euro Currency's family type
- cbEuroCurrency := RegisterConversionFamily('EuroCurrency');
- cuEUR := RegisterConversionType(cbEuroCurrency, 'Euro (