【delphi开源代码栏目提醒】:网学会员,鉴于大家对delphi开源代码十分关注,论文会员在此为大家搜集整理了“MRLLD_CX.pas”一文,供大家参考学习!
unit MRLLD_CX;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons;
type
TFRM_LLD_CX = class(TForm)
GroupBox1: TGroupBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
DateTimePicker1: TDateTimePicker;
ComboBox3: TComboBox;
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure RadioButton4Click(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FRM_LLD_CX: TFRM_LLD_CX;
implementation
USES MR_DATA, MRLLD;
{$R *.dfm}
procedure TFRM_LLD_CX.FormShow(Sender: TObject);
begin
combobox1.Clear;
combobox2.Clear;
combobox3.Text := '';
DateTimePicker1.Date := now();
with data.ADOb do
begin
close;
sql.Clear;
sql.Add('select distinct scddh from tb_ll');
open;
end;
if data.ADOb.RecordCount>0 then
begin
while not data.adob.Eof do
begin
combobox1.Items.Add(data.adob.fieldbyname('scddh').AsString);
data.ADOb.Next;
end;
end;
with data.ADOb do
begin
close;
sql.Clear;
sql.Add('select distinct cpmc from tb_ll');
open;
end;
if data.ADOb.RecordCount>0 then
begin
while not data.adob.Eof do
begin
combobox2.Items.Add(data.adob.fieldbyname('cpmc').AsString);
data.ADOb.Next;
end;
end;
end;
procedure TFRM_LLD_CX.BitBtn1Click(Sender: TObject);
var
s,p : string;
year,month,day :
word;
begin
p := 'aa';
if RadioButton1.Checked = true then
begin
s := 'scddh';
p := combobox1.Text;
end;
if RadioButton2.Checked = true then
begin
s := 'cpmc';
p := combobox2.Text;
end;
if RadioButton3.Checked = true then
begin
s := 'll';
decodedate(DateTimePicker1.Date,year,month,day);
with data.ADOa do
begin
close;
sql.Clear;
sql.Add('select * from tb_ll where year(lltime)='+floattostr(year)+' and month(lltime)='+floattostr(month)+' and day(lltime)='+floattostr(day));
open;
end;
if data.ADOa.RecordCount>0 then
begin
FRM_LLD.edit1.Text := data.ADOa.fieldbyname('scddh').AsString;
FRM_LLD.combobox1.Text := data.ADOa.fieldbyname('cpmc').AsString;
FRM_LLD.combobox2.Text := data.ADOa.fieldbyname('yn').AsString;
FRM_LLD.DateTimePicker1.Date := data.ADOa.fieldbyname('lltime').AsDateTime;
FRM_LLD.ToolButton8.Enabled := true;
FRM_LLD.ToolButton9.Enabled := true;
FRM_LLD.ToolButton10.Enabled := true;
FRM_LLD.ToolButton11.Enabled := true;
end
else
begin
FRM_LLD.edit1.Text := '';
FRM_LLD.combobox1.Text := '';
FRM_LLD.combobox2.Text := '';
FRM_LLD.DateTimePicker1.Date := now();
FRM_LLD.ToolButton8.Enabled := false;
FRM_LLD.ToolButton9.Enabled := false;
FRM_LLD.ToolButton10.Enabled := false;
FRM_LLD.ToolButton11.Enabled := false;
end;
end;
if RadioButton4.Checked = true then
begin
s := 'yn';
p := combobox3.Text;
end;
if s <> 'll' then
begin
if (p = '')or(p = 'aa') then
begin
showmessage('
查询条件不能为空。');
end
else
begin
with data.ADOa do
begin
close;
sql.Clear;
sql.Add('select * from tb_ll where '+s+'='+''''+p+'''');
open;
end;
if data.ADOa.RecordCount>0 then
begin
FRM_LLD.edit1.Text := data.ADOa.fieldbyname('scddh').AsString;
FRM_LLD.combobox1.Text := data.ADOa.fieldbyname('cpmc').AsString;
FRM_LLD.combobox2.Text := data.ADOa.fieldbyname('yn').AsString;
FRM_LLD.DateTimePicker1.Date := data.ADOa.fieldbyname('lltime').AsDateTime;
FRM_LLD.ToolButton8.Enabled := true;
FRM_LLD.ToolButton9.Enabled := true;
FRM_LLD.ToolButton10.Enabled := true;
FRM_LLD.ToolButton11.Enabled := true;
end
else
begin
FRM_LLD.edit1.Text := '';
FRM_LLD.combobox1.Text := '';
FRM_LLD.combobox2.Text := '';
FRM_LLD.DateTimePicker1.Date := now();
FRM_LLD.ToolButton8.Enabled := false;
FRM_LLD.ToolButton9.Enabled := false;
FRM_LLD.ToolButton10.Enabled := false;
FRM_LLD.ToolButton11.Enabled := false;
end;
end;
end;
end;
procedure TFRM_LLD_CX.BitBtn2Click(Sender: TObject);
begin
CLOSE;
end;
procedure TFRM_LLD_CX.RadioButton1Click(Sender: TObject);
begin
combobox2.Text := '';
combobox3.Text := '';
DateTimePicker1.Date := now();
end;
procedure TFRM_LLD_CX.RadioButton2Click(Sender: TObject);
begin
co