谁有这样的程序,发一个我。(100分)

  • 主题发起人 主题发起人 appleyao
  • 开始时间 开始时间
unit Unit6;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls;

type
TForm6 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Panel1: TPanel;
Panel2: TPanel;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Panel3: TPanel;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
CheckBox5: TCheckBox;
CheckBox6: TCheckBox;
Edit3: TEdit;
Label1: TLabel;
Bevel1: TBevel;
Bevel2: TBevel;
Label2: TLabel;
Label3: TLabel;
Edit2: TEdit;
Label4: TLabel;
Label5: TLabel;
Bevel3: TBevel;
Bevel4: TBevel;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form6: TForm6;

implementation

uses Unit2, Unit5, Unit9,unit19;

{$R *.DFM}

procedure TForm6.Button1Click(Sender: TObject);
begin
form6.Visible:=false;
form2.show;
end;

procedure TForm6.Button2Click(Sender: TObject);

var op1:string;
label lable1,lable2,lable3;
begin
form9.Query1.Filter :='';
form9.Query1.Filtered:=false;
button3.Enabled:=false;

if (edit1.text='') and (edit2.Text='') and (edit3.text='') then goto lable1;
if (edit1.text<>'') and (edit2.text<>'') and (radiobutton1.checked=false) and (radiobutton2.checked=false) then goto lable1;
if not((checkbox4.checked and checkbox5.checked and checkbox6.checked) or (checkbox1.checked and checkbox2.checked and checkbox3.checked)) then
begin
form6.Visible:=false;
form9.show;
form9.query1.close;
form9.query1.sql.Clear;
form9.query1.SQL.Add('SELECT distinct Buybill.商品号, Buybill.订单号,Buybill.订货总金额(元),Buybill2.类别, Buybill2.单价(元), Buybill2.订购数量, Buybill.订货日期 FROM ":BUY1:buybill" Buybill, ":buy2:buybill2" Buybill2');
form9.query1.sql.Add('where ');
//--------------------------------------------
if (edit1.text<>'') and (edit2.text<>'') then
begin
if (edit1.text>'2016') or (edit2.text<'1999') then begin form9.Button2.Enabled:=false;
showmessage('查询不到你所需要的信息!');
goto lable3;
end;
if (edit2.text>'2016') or (edit1.text<'1999') then begin form9.Button2.Enabled:=false;
showmessage('查询不到你所需要的信息!');
goto lable3;
end;
form9.query1.sql.Add('buybill.订单号=buybill2.订单号 and buybill.商品号=buybill2.商品号 and buybill2.商品号 ');
op1:='';
if checkbox1.checked then
op1:=op1+'<';
if checkbox3.checked then
op1:=op1+'>';
if checkbox2.Checked then
op1:=op1+'=';
form9.query1.sql.add(op1);
form9.query1.sql.add(':text1');
if radiobutton1.checked then op1:=' OR';
if radiobutton2.checked then op1:=' AND';
op1:=op1+' buybill.订单号=buybill2.订单号 and buybill.商品号=buybill2.商品号 and buybill2.商品号 ';
if checkbox4.checked then
op1:=op1+'<';
if checkbox6.checked then
op1:=op1+'>';
if checkbox5.Checked then
op1:=op1+'=';
form9.query1.sql.add(op1);

form9.query1.sql.add(':text2');
form9.query1.ParamByName('text1').asinteger:=strtoint(edit1.Text);
form9.query1.ParamByName('text2').asinteger:=strtoint(edit2.Text);
end else
//-----------------------------------------//
begin
if edit1.text<>'' then
begin
if (edit1.text>'2016') or (edit1.text<'1999') then begin form9.Button2.Enabled:=false;
showmessage('查询不到你所需要的信息!');
goto lable3;
end;
form9.query1.sql.Add(' buybill.订单号=buybill2.订单号 and buybill.商品号=buybill2.商品号 and buybill2.商品号 ');
op1:='';
if checkbox1.checked then
op1:=op1+'<';
if checkbox3.checked then
op1:=op1+'>';
if checkbox2.Checked then
op1:=op1+'=';

form9.query1.sql.add(op1);
form9.query1.sql.add(':text1');
form9.query1.ParamByName('text1').asinteger:=strtoint(edit1.Text);
end ;
//----------------------------------------------
if edit2.text<>'' then
begin
if (edit2.text>'2015') or (edit2.text<'2001') then begin form9.Button2.Enabled:=false;
showmessage('查询不到你所需要的信息!');
goto lable3;
end;
form9.query1.sql.Add(' buybill.订单号=buybill2.订单号 and buybill.商品号=buybill2.商品号 and buybill2.商品号 ');
op1:='';
if checkbox4.checked then
op1:=op1+'<';
if checkbox6.checked then
op1:=op1+'>';
if checkbox5.Checked then
op1:=op1+'=';

form9.query1.sql.add(op1);
form9.query1.sql.add(':text2');
form9.query1.ParamByName('text2').asinteger:=strtoint(edit2.Text);
end;
end;
//-------------------------------------------------- //
if ( (edit1.Text <>'') or (edit2.text<>''))and ( edit3.text<>'') then goto lable1

else begin
if edit3.Text<>'' then
begin
form9.query1.sql.Add(' buybill.商品号=buybill2.商品号 and buybill.订单号=buybill2.订单号 and buybill2.类别= ');
form9.query1.sql.add(':text3');
form9.query1.ParamByName('text3').asstring:=edit3.Text;
end;

//--------------------------------------------------//
form9.query1.prepare;
form9.Query1.Open;
end ;
end
else showmessage('错误的操作!');
goto lable2;
lable1: if true then begin
showmessage('错误的操作!');
form6.RadioButton1.Checked:=false;
form9.Button2.Enabled :=false;

lable3:
form6.RadioButton2.Checked:=false;
form6.Edit1.Text:='';
form6.Edit2.Text:='';
form6.edit3.text:='';
form6.checkbox1.checked:=false;
form6.CheckBox2.Checked:=false;
form6.CheckBox3.Checked:=false;
form6.CheckBox4.Checked:=false;
form6.CheckBox5.Checked:=false;
form6.CheckBox6.Checked:=false;
end;
lable2:
end;


procedure TForm6.Button3Click(Sender: TObject);
begin
form6.Visible:=false;
form19.show;
end;

end.
呵呵这是我做的系统中的一个界面的主程序,呵呵~~不懂再来问我~~呵呵~~
 
也给我一份好了
fors@263.net
我也出200
 
好象挺喜欢用“goto”,小心啊
 
多人接受答案了。
 
后退
顶部