📄 urbfind.~pas
字号:
unit URBFind;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ComCtrls, ExtCtrls,ADODB;
type
TFrmRBFind = class(TForm)
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Panel1: TPanel;
Label1: TLabel;
Edit1: TEdit;
Panel2: TPanel;
Label2: TLabel;
Label3: TLabel;
DateTimePicker1: TDateTimePicker;
ComboBox1: TComboBox;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure ComboBox1DropDown(Sender: TObject);
private
{ Private declarations }
public
srecord:string;
{ Public declarations }
end;
var
FrmRBFind: TFrmRBFind;
implementation
uses U_DM;
{$R *.DFM}
procedure TFrmRBFind.BitBtn1Click(Sender: TObject);
var
sfx,code,sdate:string;
query:TADOQuery;
begin
if (radiobutton1.Checked =true) then
begin
if Trim(Edit1.Text)='' then
begin
Application.MessageBox('日报编号不能为空!','错误',16);
exit;
end;
srecord:=Trim(Edit1.Text);
FrmRbFind.ModalResult:=2;
close;
end;
if (radiobutton2.Checked =true) then
begin
if Trim(combobox1.Text)='' then
begin
Application.MessageBox('分销店不能为空!','错误',16);
exit;
end;
sfx:=trim(combobox1.text);
query:=TADOQuery.Create(NIl);
code:=copy(sfx,2,pos(')',sfx)-2);
sdate:=DateToStr(DateTimePicker1.date);
query.Connection :=DM.ADOConnection ;
query.Close ;
query.SQL.Clear ;
query.SQL.Add('select sxsrbno from xs_rbm where sclientno=:code');
query.sql.add(' and drbdate=:sdate');
query.Parameters[0].value:=code;
query.Parameters[1].value:=sdate;
query.open;
if (query.Fields[0].AsString='') then
begin
Application.MessageBox('没有符合条件的记录!','错误',16);
exit;
end
else
begin
srecord:=query.Fields[0].AsString;
FrmRbFind.ModalResult:=2;
close;
end;
end;
end;
procedure TFrmRBFind.BitBtn2Click(Sender: TObject);
begin
close;
FrmRbFind.ModalResult:=5;
end;
procedure TFrmRBFind.Edit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (key=13) then
BitBtn1.OnClick(Nil);
end;
procedure TFrmRBFind.RadioButton1Click(Sender: TObject);
begin
if Radiobutton1.Checked =true then
begin
panel1.Enabled :=true;
panel2.Enabled :=false;
edit1.Color :=clWindow;
DateTimePicker1.Color :=clBtnFace;
combobox1.Color :=clBtnFace;
end;
end;
procedure TFrmRBFind.RadioButton2Click(Sender: TObject);
begin
if Radiobutton2.Checked =true then
begin
panel1.Enabled :=false;
panel2.Enabled :=true;
edit1.Color :=clBtnFace;
DateTimePicker1.Color :=clWindow;
combobox1.Color :=clWindow;
end;
end;
procedure TFrmRBFind.ComboBox1DropDown(Sender: TObject);
var
selectquery:TADOQuery;
i:integer;
st:String;
begin
selectquery:=TADOQuery.Create(NIl);
selectquery.Connection :=DM.ADOConnection ;
selectquery.close;
selectquery.SQL.Clear ;
selectquery.SQL.Add('select nCCode,nCName from s_Customer ');
selectquery.Open;
selectquery.First;
combobox1.Items.Clear ;
for i:=0 to selectquery.RecordCount-1 do
begin
st:='('+selectquery.FieldByName('nCCode').AsString+')'+selectquery.FieldByName('nCName').AsString;
combobox1.items.Add(st);
selectquery.Next;
end;
selectquery.Free;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -