You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

355 lines
11 KiB
Plaintext

11 months ago
unit u_code_UsdExRate;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
BusinessSkinForm, bsSkinCtrls, ExtCtrls, dxExEdtr, dxCntner, dxTL,
dxDBCtrl, dxDBGrid, dxDBTLCl, dxGrClms, DB, ADODB,Dialogs, StdCtrls,
wwdblook, RxLookup;
type
Tfrm_code_UsdExRate = class(TForm)
Panel1: TPanel;
bsSkinButton1: TbsSkinButton;
bsSkinButton2: TbsSkinButton;
bsSkinButton4: TbsSkinButton;
bsSkinButton3: TbsSkinButton;
bsSkinButton5: TbsSkinButton;
bsBusinessSkinForm1: TbsBusinessSkinForm;
dsrUsdExRate: TDataSource;
t_code_usdexrate: TADOQuery;
bsSkinGroupBox1: TbsSkinGroupBox;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column3: TdxDBGridDateColumn;
dxDBGrid1Column2: TdxDBGridDateColumn;
bsSkinGroupBox2: TbsSkinGroupBox;
dxDBGrid2: TdxDBGrid;
dxDBGridMaskColumn1: TdxDBGridMaskColumn;
dxDBGridDateColumn1: TdxDBGridDateColumn;
dxDBGridDateColumn2: TdxDBGridDateColumn;
ds_code_jpexrate1: TDataSource;
t_code_jpexrate: TADOQuery;
Panel2: TPanel;
bsSkinButton6: TbsSkinButton;
bsSkinButton7: TbsSkinButton;
bsSkinButton8: TbsSkinButton;
bsSkinButton9: TbsSkinButton;
dxDBGrid1Column4: TdxDBGridColumn;
dxDBGrid1Column5: TdxDBGridColumn;
bsSkinButton10: TbsSkinButton;
p_op_gain: TADOStoredProc;
dxDBGrid1Column6: TdxDBGridLookupColumn;
t_code_usdexrateID: TAutoIncField;
t_code_usdexrateDSDesigner2: TDateTimeField;
t_code_usdexrateDSDesigner3: TDateTimeField;
t_code_usdexrateDSDesigner6: TStringField;
t_code_usdexratelk_currency: TStringField;
RxDBLookupCombo2: TRxDBLookupCombo;
bsSkinButton11: TbsSkinButton;
t_code_usdexrateDSDesigner: TBCDField;
t_code_usdexrateDSDesigner4: TBCDField;
t_code_usdexrateDSDesigner5: TBCDField;
procedure FormShow(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure bsSkinButton5Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
procedure bsSkinButton4Click(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton6Click(Sender: TObject);
procedure bsSkinButton7Click(Sender: TObject);
procedure bsSkinButton8Click(Sender: TObject);
procedure bsSkinButton9Click(Sender: TObject);
procedure bsSkinButton10Click(Sender: TObject);
procedure t_code_usdexrateBeforeInsert(DataSet: TDataSet);
procedure t_code_usdexrateAfterInsert(DataSet: TDataSet);
procedure RxDBLookupCombo2Change(Sender: TObject);
procedure t_code_usdexrateBeforePost(DataSet: TDataSet);
procedure bsSkinButton11Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
procedure Upbsrate(bsno,aCurrency:string);
end;
var
frm_code_UsdExRate: Tfrm_code_UsdExRate;
implementation
uses u_data_share, my_sys_function, u_main, u_sys_progress;
{$R *.dfm}
procedure Tfrm_code_UsdExRate.FormShow(Sender: TObject);
begin
RxDBLookupCombo2.DisplayValue:='USD';
if not t_code_usdexrate.Active then
t_code_usdexrate.Open;
{
if not t_code_jpexrate.Active then
t_code_jpexrate.Open;
}
end;
procedure Tfrm_code_UsdExRate.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
CanClose:=frm_close_query(t_code_usdexrate);
// CanClose:=frm_close_query(t_code_jpexrate);
end;
procedure Tfrm_code_UsdExRate.bsSkinButton5Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_code_UsdExRate.bsSkinButton3Click(Sender: TObject);
begin
table_cancel(t_code_usdexrate);
end;
procedure Tfrm_code_UsdExRate.bsSkinButton2Click(Sender: TObject);
begin
table_post(t_code_usdexrate);
end;
procedure Tfrm_code_UsdExRate.bsSkinButton4Click(Sender: TObject);
begin
table_delete(t_code_usdexrate);
end;
procedure Tfrm_code_UsdExRate.bsSkinButton1Click(Sender: TObject);
begin
t_code_usdexrate.Insert;
end;
procedure Tfrm_code_UsdExRate.bsSkinButton6Click(Sender: TObject);
begin
// t_code_jpexrate.Insert;
end;
procedure Tfrm_code_UsdExRate.bsSkinButton7Click(Sender: TObject);
begin
// table_post(t_code_jpexrate);
end;
procedure Tfrm_code_UsdExRate.bsSkinButton8Click(Sender: TObject);
begin
// table_delete(t_code_jpexrate);
end;
procedure Tfrm_code_UsdExRate.bsSkinButton9Click(Sender: TObject);
begin
// table_cancel(t_code_jpexrate);
end;
procedure Tfrm_code_UsdExRate.Upbsrate(bsno,aCurrency:string);
var aAdoQuery:TAdoQuery;
begin
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;SQL.Clear;
sql.Add('Select * from t_ch_fee');
sql.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD> and <20>ұ<EFBFBD>=:<3A>ұ<EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=bsno;
Parameters.ParamByName('<27>ұ<EFBFBD>').Value:=trim(aCurrency);
Open;First;
while not Eof do
begin
Edit;
FieldByName('<27><><EFBFBD><EFBFBD>').Value:=t_code_usdexrate.FieldByName('<27><><EFBFBD><EFBFBD>').Value;
Post;
Next;
end;
finally
Free;
end;
end;
procedure Tfrm_code_UsdExRate.bsSkinButton10Click(Sender: TObject);
var aAdoQuery:TAdoQuery;
s:string;
begin
if trim(RxDBLookupCombo2.DisplayValues[0])='' then
begin
showmessage('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ұ<EFBFBD>');
Exit;
end;
if t_code_usdexrate.FieldByName('<27><><EFBFBD><EFBFBD>').IsNull then Exit;
s:='<27><>:'+t_code_usdexrate.FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsString+' <20><>:'+ t_code_usdexrate.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+' <20>Ļ<EFBFBD><C4BB><EFBFBD> '+'<27><><EFBFBD><EFBFBD>Ϊ'+t_code_usdexrate.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
if MessageDlg('ȷʵҪ<CAB5><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD>ĵ<EFBFBD>)'+s+'Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)<>mryes then
Exit;
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ򡣡<C8BA><F2A1A3A1><EFBFBD>';
frm_sys_progress.Show;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;SQL.Clear;
sql.Add('Select * from V_op_bscard_All where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><>ͨ<EFBFBD><CDA8>''');
sql.Add('and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> between :beginEtd and :endETD');
Parameters.ParamByName('beginEtd').Value:=t_code_usdexrate.FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime;
Parameters.ParamByName('endETD').Value:=t_code_usdexrate.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
Open;First;
if not IsEmpty then
begin
frm_sys_progress.bsSkinGauge1.MaxValue:=recordcount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
while not Eof do
begin
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><E1B5A5>:'+FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').Asstring;
Upbsrate(FieldByName('<27><><EFBFBD><EFBFBD>').Asstring,t_code_usdexrate.FieldByName('<27>ұ<EFBFBD>').Value);
Next;
end;
end;
Close;SQL.Clear;
sql.Add('Select * from V_op_bscard_All where ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>=''<27><><EFBFBD>ĵ<EFBFBD>''');
sql.Add('and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD> between :beginEtd and :endETD');
Parameters.ParamByName('beginEtd').Value:=t_code_usdexrate.FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime;
Parameters.ParamByName('endETD').Value:=t_code_usdexrate.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
Open;First;
if not IsEmpty then
begin
Open;First;
frm_sys_progress.bsSkinGauge1.MaxValue:=recordcount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
while not Eof do
begin
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><E1B5A5>:'+FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').Asstring;
Upbsrate(FieldByName('<27><><EFBFBD><EFBFBD>').Asstring,t_code_usdexrate.FieldByName('<27>ұ<EFBFBD>').Value);
Next;
end;
end;
finally
frm_sys_progress.close;
frm_sys_progress:=nil;
Free;
end;
end;
procedure Tfrm_code_UsdExRate.t_code_usdexrateBeforeInsert(
DataSet: TDataSet);
begin
if trim(RxDBLookupCombo2.DisplayValues[0])='' then
begin
showmessage('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ұ<EFBFBD>');
Abort;
end;
end;
procedure Tfrm_code_UsdExRate.t_code_usdexrateAfterInsert(
DataSet: TDataSet);
begin
t_code_usdexrate.FieldByName('<27>ұ<EFBFBD>').AsString:=trim(trim(RxDBLookupCombo2.DisplayValues[0]));
end;
procedure Tfrm_code_UsdExRate.RxDBLookupCombo2Change(Sender: TObject);
begin
if not frm_data_share.t_code_currency.Locate('<27>ұ<EFBFBD>',trim(RxDBLookupCombo2.DisplayValues[0]),[]) then
begin
exit;
end;
with t_code_usdexrate do
begin
close;sql.clear;
sql.add('select * from t_code_usdexrate');
sql.add('where <20>ұ<EFBFBD>=:<3A>ұ<EFBFBD>');
Parameters.ParamByName('<27>ұ<EFBFBD>').Value:=trim(RxDBLookupCombo2.DisplayValues[0]);
sql.add('order by <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> desc');
Open;First;
end;
end;
procedure Tfrm_code_UsdExRate.t_code_usdexrateBeforePost(DataSet: TDataSet);
begin
if t_code_usdexrate.FieldByName('<27>ұ<EFBFBD>').AsString<>trim(trim(RxDBLookupCombo2.DisplayValues[0])) then
begin
showmessage('<27>±ұ<C2B1>:'+t_code_usdexrate.FieldByName('<27>ұ<EFBFBD>').AsString+' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ѿ<EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ıұ<C4B1>: '+trim(trim(RxDBLookupCombo2.DisplayValues[0])));
abort;
end;
table_before_post(t_code_usdexrate,'<27>ұ<EFBFBD>');
table_before_post(t_code_usdexrate,'<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>');
table_before_post(t_code_usdexrate,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
procedure Tfrm_code_UsdExRate.bsSkinButton11Click(Sender: TObject);
var aAdoQuery:TAdoQuery;
s:string;
begin
if trim(RxDBLookupCombo2.DisplayValues[0])='' then
begin
showmessage('<27><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD>ұ<EFBFBD>');
Exit;
end;
if t_code_usdexrate.FieldByName('<27><><EFBFBD><EFBFBD>').IsNull then Exit;
s:='<27><>:'+t_code_usdexrate.FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsString+' <20><>:'+ t_code_usdexrate.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString+' <20>Ļ<EFBFBD><C4BB><EFBFBD> '+'<27><><EFBFBD><EFBFBD>Ϊ'+t_code_usdexrate.FieldByName('<27><><EFBFBD><EFBFBD>').AsString;
if MessageDlg('ȷʵҪ<CAB5><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+s+'Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)<>mryes then
Exit;
if not ASSIGNED(frm_sys_progress) then
frm_sys_progress:=tfrm_sys_progress.Create(self);
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱥ򡣡<C8BA><F2A1A3A1><EFBFBD>';
frm_sys_progress.Show;
aAdoQuery:=CreateAdoQuery;
with aAdoQuery do
try
Close;SQL.Clear;
sql.Add('Select * from V_op_bscard_All where 1=1 ');
sql.Add('and <20><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD> between :beginEtd and :endETD');
Parameters.ParamByName('beginEtd').Value:=t_code_usdexrate.FieldByName('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>').AsDateTime;
Parameters.ParamByName('endETD').Value:=t_code_usdexrate.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsDateTime;
Open;First;
if not IsEmpty then
begin
frm_sys_progress.bsSkinGauge1.MaxValue:=recordcount;
frm_sys_progress.bsSkinGauge1.MinValue:=0;
frm_sys_progress.bsSkinGauge1.Value:=0;
frm_sys_progress.Update;
while not Eof do
begin
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_sys_progress.bsSkinGauge1.ProgressText:='<27><><EFBFBD><EFBFBD><E1B5A5>:'+FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').Asstring;
Upbsrate(FieldByName('<27><><EFBFBD><EFBFBD>').Asstring,t_code_usdexrate.FieldByName('<27>ұ<EFBFBD>').Value);
Next;
end;
end;
finally
frm_sys_progress.close;
frm_sys_progress:=nil;
Free;
end;
end;
end.