📄 qxxxfwfind.~pas
字号:
unit qxxxfwfind;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, ADODB, StdCtrls, Grids, DBGrids;
type
TqxxxfinForm1 = class(TForm)
GroupBox1: TGroupBox;
Label2: TLabel;
Label18: TLabel;
Label1: TLabel;
Label17: TLabel;
Label16: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
CheckBox1: TCheckBox;
Edit14: TEdit;
Edit15: TEdit;
Edit13: TEdit;
Edit16: TEdit;
Edit17: TEdit;
GroupBox2: TGroupBox;
DBGrid1: TDBGrid;
GroupBox3: TGroupBox;
GroupBox4: TGroupBox;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label24: TLabel;
Edit4: TEdit;
ComboBox1: TComboBox;
Edit5: TEdit;
Button3: TButton;
GroupBox5: TGroupBox;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label22: TLabel;
Label25: TLabel;
ComboBox2: TComboBox;
Edit6: TEdit;
Edit7: TEdit;
Button4: TButton;
GroupBox6: TGroupBox;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
Label23: TLabel;
Label26: TLabel;
ComboBox3: TComboBox;
Edit8: TEdit;
Edit9: TEdit;
Button5: TButton;
GroupBox7: TGroupBox;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Edit10: TEdit;
Edit11: TEdit;
Button6: TButton;
Edit12: TEdit;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
qxxxfinForm1: TqxxxfinForm1;
con,con1,con2,con3,con5,con4,con6,con7,con8,con9,con10,con11,con13,con14,con15,con17,con19:string;
con12,con16,con18:integer;
implementation
{$R *.dfm}
procedure TqxxxfinForm1.Button1Click(Sender: TObject);
begin
con1:=edit1.Text;
con2:=edit2.Text;
con4:=edit13.Text;
con5:=edit14.Text;
con6:=edit15.Text;
con7:=edit16.Text;
con8:=edit17.Text;
if checkbox1.checked then
con1:='%'+con1+'%';
con2:='%'+con2+'%';
con3:='%'+con3+'%';
con4:='%'+con4+'%';
con5:='%'+con5+'%';
con6:='%'+con6+'%';
con7:='%'+con7+'%';
con8:='%'+con8+'%';
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select * from qxxxfw where yy>=:con1 and yy<=:con4 and mm>=:con5 and mm<=:con7 and dd>=:con6 and dd<=:con8 and dw like:dw');
adoquery1.Parameters.ParamByName('con1').value :=edit1.text;
adoquery1.Parameters.ParamByName('con4').value :=edit13.text;
adoquery1.Parameters.ParamByName('con5').value :=edit14.text;
adoquery1.Parameters.ParamByName('con7').value :=edit16.text;
adoquery1.Parameters.ParamByName('con6').value :=edit15.text;
adoquery1.Parameters.ParamByName('con8').value :=edit17.text;
//adoquery1.SQL.Text:='select * from qqfw where ysje like:ysje and ysk like:ysk ';
adoquery1.Parameters.ParamByName('dw').Value:=con2;
//adoquery1.Parameters.ParamByName('ysk').Value:=con3;
adoquery1.Open;
end;
end;
procedure TqxxxfinForm1.Button2Click(Sender: TObject);
begin
close();
end;
procedure TqxxxfinForm1.Button3Click(Sender: TObject);
begin
con9:=ComboBox1.Text;
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as mycount from qxxxfw where mm=:con9 and yy=:con19');
adoquery1.Parameters.ParamByName('con9').value :=ComboBox1.Text;
adoquery1.Parameters.ParamByName('con19').value :=edit1.Text;
adoquery1.open;
edit4.Text:=adoquery1.fieldbyname('mycount').asstring;
con16:=strtoint(edit4.Text);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as mycount from qxxxfw where mm=:con9 and yy=:con17');
adoquery1.Parameters.ParamByName('con9').value :=ComboBox1.Text;
adoquery1.Parameters.ParamByName('con17').value :=strtoint(edit1.Text)-1;
adoquery1.open;
con18:=strtoint(adoquery1.fieldbyname('mycount').asstring);
if con18<>0 then
edit5.Text:=floattostr(con16*100/con18)
else
showmessage('请输入年份');
end;
end;
procedure TqxxxfinForm1.Button4Click(Sender: TObject);
begin
case strtoint(ComboBox2.Text) of
1:
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as my3count from qxxxfw where mm=:con14');
adoquery1.Parameters.ParamByName('con14').value :=1;
adoquery1.open;
con12:=strtoint(adoquery1.fieldbyname('my3count').asstring);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as mycount from qxxxfw where mm=:con11');
adoquery1.Parameters.ParamByName('con11').value :=2;
adoquery1.open;
con12:=strtoint(adoquery1.fieldbyname('mycount').asstring)+con12;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as my2count from qxxxfw where mm=:con13');
adoquery1.Parameters.ParamByName('con13').value :=3;
adoquery1.open;
edit6.Text:=inttostr(strtoint(adoquery1.fieldbyname('my2count').asstring)+con12);
end;
2:
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as my3count from qxxxfw where mm=:con14');
adoquery1.Parameters.ParamByName('con14').value :=4;
adoquery1.open;
con12:=strtoint(adoquery1.fieldbyname('my3count').asstring);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as mycount from qxxxfw where mm=:con11');
adoquery1.Parameters.ParamByName('con11').value :=5;
adoquery1.open;
con12:=strtoint(adoquery1.fieldbyname('mycount').asstring)+con12;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as my2count from qxxxfw where mm=:con13');
adoquery1.Parameters.ParamByName('con13').value :=6;
adoquery1.open;
edit6.Text:=inttostr(strtoint(adoquery1.fieldbyname('my2count').asstring)+con12);
end;
3:
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as my3count from qxxxfw where mm=:con14');
adoquery1.Parameters.ParamByName('con14').value :=7;
adoquery1.open;
con12:=strtoint(adoquery1.fieldbyname('my3count').asstring);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as mycount from qxxxfw where mm=:con11');
adoquery1.Parameters.ParamByName('con11').value :=8;
adoquery1.open;
con12:=strtoint(adoquery1.fieldbyname('mycount').asstring)+con12;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as my2count from qxxxfw where mm=:con13');
adoquery1.Parameters.ParamByName('con13').value :=9;
adoquery1.open;
edit6.Text:=inttostr(strtoint(adoquery1.fieldbyname('my2count').asstring)+con12);
end;
4:
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as my3count from qxxxfw where mm=:con14');
adoquery1.Parameters.ParamByName('con14').value :=10;
adoquery1.open;
con12:=strtoint(adoquery1.fieldbyname('my3count').asstring);
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as mycount from qxxxfw where mm=:con11');
adoquery1.Parameters.ParamByName('con11').value :=11;
adoquery1.open;
con12:=strtoint(adoquery1.fieldbyname('mycount').asstring)+con12;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as my2count from qxxxfw where mm=:con13');
adoquery1.Parameters.ParamByName('con13').value :=12;
adoquery1.open;
edit6.Text:=inttostr(strtoint(adoquery1.fieldbyname('my2count').asstring)+con12);
end;
end;
end;
procedure TqxxxfinForm1.Button5Click(Sender: TObject);
begin
con10:=ComboBox3.Text;
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as mycount from qxxxfw where yy=:con10');
adoquery1.Parameters.ParamByName('con10').value :=ComboBox3.Text;
adoquery1.open;
edit8.Text:=adoquery1.fieldbyname('mycount').asstring;
end;
end;
procedure TqxxxfinForm1.Button6Click(Sender: TObject);
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select sum(je) as sun from qxxxfw');
adoquery1.open;
Edit12.Text:=adoquery1.FieldByName('sun').AsString;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Text:=('select count(*) as mycount from qxxxfw');
adoquery1.open;
edit10.Text:=adoquery1.fieldbyname('mycount').asstring;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -