|
|
|
|
unit t_ch_rate;
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
Dialogs, StdCtrls, BusinessSkinForm, bsSkinCtrls, DB;
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
Tfrm_ch_rate = class(TForm)
|
|
|
|
|
Edit1: TEdit;
|
|
|
|
|
Label1: TLabel;
|
|
|
|
|
Label2: TLabel;
|
|
|
|
|
Label3: TLabel;
|
|
|
|
|
Label4: TLabel;
|
|
|
|
|
Label5: TLabel;
|
|
|
|
|
Edit2: TEdit;
|
|
|
|
|
Label6: TLabel;
|
|
|
|
|
bsSkinButton10: TbsSkinButton;
|
|
|
|
|
bsSkinButton5: TbsSkinButton;
|
|
|
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
|
|
|
Label7: TLabel;
|
|
|
|
|
Label8: TLabel;
|
|
|
|
|
DataSource1: TDataSource;
|
|
|
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
procedure Edit1Change(Sender: TObject);
|
|
|
|
|
procedure Edit2Change(Sender: TObject);
|
|
|
|
|
procedure bsSkinButton10Click(Sender: TObject);
|
|
|
|
|
private
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
public
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
stltype:string;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
frm_ch_rate: Tfrm_ch_rate;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses u_data_share, my_sys_function;
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_rate.bsSkinButton5Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
close;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_rate.FormShow(Sender: TObject);
|
|
|
|
|
var aRate:real;
|
|
|
|
|
begin
|
|
|
|
|
aRate:=GetUsdExrate_Invoice(FormatDateTime('YYYY-MM-DD',Date));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (stltype='1') or (stltype='7') then
|
|
|
|
|
begin
|
|
|
|
|
if aRate>0 then
|
|
|
|
|
begin
|
|
|
|
|
frm_data_share.t_code_currency.requery;
|
|
|
|
|
if Label1.Caption='RMB' then
|
|
|
|
|
begin
|
|
|
|
|
if frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>',Label3.Caption,[]) then
|
|
|
|
|
begin
|
|
|
|
|
Edit2.Text:=FloatToStr(aRate);
|
|
|
|
|
Edit1.Text:=floattostr(s_w(8,(1/aRate)));
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else if Label3.Caption='RMB' then
|
|
|
|
|
begin
|
|
|
|
|
if frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>',Label1.Caption,[]) then
|
|
|
|
|
begin
|
|
|
|
|
Edit1.Text:=FloatToStr(aRate);
|
|
|
|
|
Edit2.Text:=floattostr(s_w(8,(1/aRate)));
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
frm_data_share.t_code_currency.requery;
|
|
|
|
|
if Label1.Caption='RMB' then
|
|
|
|
|
begin
|
|
|
|
|
if frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>',Label3.Caption,[]) then
|
|
|
|
|
begin
|
|
|
|
|
Edit2.Text:=frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
Edit1.Text:=floattostr(s_w(8,(1/frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat)));
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else if Label3.Caption='RMB' then
|
|
|
|
|
begin
|
|
|
|
|
if frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>',Label1.Caption,[]) then
|
|
|
|
|
begin
|
|
|
|
|
Edit1.Text:=frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
Edit2.Text:=floattostr(s_w(8,(1/frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat)));
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
frm_data_share.t_code_currency.requery;
|
|
|
|
|
if Label1.Caption='RMB' then
|
|
|
|
|
begin
|
|
|
|
|
if frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>',Label3.Caption,[]) then
|
|
|
|
|
begin
|
|
|
|
|
Edit2.Text:=frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
Edit1.Text:=floattostr(s_w(8,(1/frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat)));
|
|
|
|
|
end;
|
|
|
|
|
end
|
|
|
|
|
else if Label3.Caption='RMB' then
|
|
|
|
|
begin
|
|
|
|
|
if frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>',Label1.Caption,[]) then
|
|
|
|
|
begin
|
|
|
|
|
Edit1.Text:=frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asstring;
|
|
|
|
|
Edit2.Text:=floattostr(s_w(8,(1/frm_data_share.t_code_currency.fieldbyname('<27><><EFBFBD><EFBFBD>').asfloat)));
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_rate.Edit1Change(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if bsSkinButton10.Focused then
|
|
|
|
|
exit;
|
|
|
|
|
if Edit1.Focused then
|
|
|
|
|
if trim(Edit1.text)='' then
|
|
|
|
|
begin
|
|
|
|
|
edit2.text:='';
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
strtofloat(trim(Edit1.text));
|
|
|
|
|
except
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʴ<EFBFBD><CAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>룡');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if strtofloat(trim(Edit1.text))=0 then
|
|
|
|
|
begin
|
|
|
|
|
edit2.text:='0';
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
edit2.text:=floattostr(s_w(8,1/strtofloat(trim(Edit1.text))));
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_rate.Edit2Change(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
if bsSkinButton10.Focused then
|
|
|
|
|
exit;
|
|
|
|
|
if Edit2.Focused then
|
|
|
|
|
if trim(Edit2.text)='' then
|
|
|
|
|
begin
|
|
|
|
|
edit1.text:='';
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
strtofloat(trim(Edit2.text));
|
|
|
|
|
except
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʴ<EFBFBD><CAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>룡');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
if strtofloat(trim(Edit2.text))=0 then
|
|
|
|
|
begin
|
|
|
|
|
edit1.text:='0';
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
edit1.text:=floattostr(s_w(8,1/strtofloat(trim(Edit2.text))));
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure Tfrm_ch_rate.bsSkinButton10Click(Sender: TObject);
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
strtofloat(trim(Edit1.text));
|
|
|
|
|
except
|
|
|
|
|
showmessage('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʴ<EFBFBD><CAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD>룡');
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
DataSource1.DataSet.insert;
|
|
|
|
|
DataSource1.DataSet['currency']:=Label1.Caption;
|
|
|
|
|
DataSource1.DataSet['rate']:=strtofloat(trim(Edit1.text));
|
|
|
|
|
DataSource1.DataSet.post;
|
|
|
|
|
close;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|