📄 unitkccx.~pas
字号:
unit UnitKCCX;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, Buttons;
type
TFrmKCCX = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
ComboBox1: TComboBox;
Edit1: TEdit;
ComboBox2: TComboBox;
ComboBox3: TComboBox;
GroupBox2: TGroupBox;
Label2: TLabel;
Label3: TLabel;
GroupBox3: TGroupBox;
Label1: TLabel;
BitBtn1: TBitBtn;
DBGrid1: TDBGrid;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
procedure RadioButton2Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure ComboBox1DropDown(Sender: TObject);
procedure ComboBox2DropDown(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmKCCX: TFrmKCCX;
implementation
uses UnitDM, KCCXQRT1;
{$R *.dfm}
procedure TFrmKCCX.RadioButton2Click(Sender: TObject);
begin
RadioButton1.Checked := false;
combobox2.Enabled := false;
combobox3.Enabled := false;
combobox2.Color := clLtGray;
combobox3.Color := clLtGray;
combobox1.Enabled := true;
combobox1.Color := clwindow;
Edit1.Enabled := true;
Edit1.Color := clwindow;
end;
procedure TFrmKCCX.RadioButton1Click(Sender: TObject);
begin
RadioButton2.Checked := false;
combobox2.Enabled := true;
combobox3.Enabled := true;
combobox2.Color := clwindow;
combobox3.Color := clwindow;
combobox1.Enabled := false;
combobox1.Color := clLtGray;
Edit1.Enabled := false;
Edit1.Color := clLtGray;
end;
procedure TFrmKCCX.ComboBox2Change(Sender: TObject);
var
str1: string;
begin
str1 := 'select prod_id from prod where prod_sort = :sort';
with DM.ADOQTEMP2 do
begin
close;
SQL.Clear;
SQL.Add(str1);
parameters.ParamByName('sort').Value := trim(combobox2.Text);
if (not prepared) then
prepared := true;
try
open;
except
ExecSQL;
end;
while (not eof) do
begin
Combobox3.Items.Add(fieldbyname('prod_id').AsString);
next;
end;
end;
end;
procedure TFrmKCCX.BitBtn2Click(Sender: TObject);
begin
self.Close;
end;
procedure TFrmKCCX.ComboBox1DropDown(Sender: TObject);
begin
Combobox1.Clear;
Combobox1.Items.Add('>');
Combobox1.Items.Add('<');
combobox1.Items.Add('>=');
combobox1.Items.Add('<=');
combobox1.Items.Add('=');
end;
procedure TFrmKCCX.ComboBox2DropDown(Sender: TObject);
var
str1: string;
begin
combobox2.Clear;
str1 := 'select prod_sort from prod';
with DM.ADOQTEMP2 do
begin
close;
SQL.Clear;
SQL.Add(str1);
if (not prepared) then
prepared := true;
try
open;
except
ExecSQL;
end;
while (not eof) do
begin
Combobox2.Items.Add(fieldbyname('prod_sort').AsString);
next;
end;
end;
end;
procedure TFrmKCCX.BitBtn1Click(Sender: TObject);
var
str1, str2: string;
begin
str1 := 'select * from prod where prod_stock :sign :stocks';
str2 := 'select * from prod where prod_id = :id';
if (Radiobutton2.Checked) then
begin
with DM.ADOQTEMP5 do
begin
close;
SQL.Clear;
SQL.Add(str1);
parameters.ParamByName('sign').Value := combobox1.Text;
parameters.ParamByName('stocks').Value := strtoint(Edit1.Text);
try
open;
except
ExecSQL;
end;
end;
end
else
if (Radiobutton1.Checked) then
begin
with DM.ADOQTEMP5 do
begin
close;
SQL.Clear;
SQL.Add(str2);
parameters.ParamByName('id').Value := strtoint(combobox3.Text);
if (not prepared) then
prepared := true;
try
open;
except
ExecSQL;
end;
end;
end;
end;
procedure TFrmKCCX.BitBtn3Click(Sender: TObject);
begin
QRTKCCX.Preview;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -