📄 lkcycj_u.pas
字号:
if (groupbox1.Controls[i] is TEdit) then
(groupbox1.controls[i] as TEdit).Text:='';
//初始化DBCheckBox为'false'
for i:=0 to groupbox2.ControlCount-1 do
if (groupbox2.Controls[i] is TDBCheckBox) then
(groupbox2.Controls[i] as TDBCheckBox).Checked:=false;
end;
procedure Tlkcycj.Edit1Exit(Sender: TObject);
begin
with table1 do
begin
if (edit1.Text<>'') and (locate('姓名',edit1.Text,[loCaseInsensitive])) then
begin
edit1.Text:=fieldbyname('姓名').AsString;
edit2.Text:=fieldbyname('性别').AsString;
edit3.Text:=fieldbyname('学习车型').AsString;
edit4.Text:=fieldbyname('身份证号').AsString;
edit5.Text:=fieldbyname('准考证编号').AsString;
exit;
end;
if (edit1.Text<>'') and (not locate('姓名',edit1.Text,[locaseinsensitive])) then
begin
MessageDlg('没有此人!', mtWarning, [mbOk], 0);
exit;
end;
end;
end;
procedure Tlkcycj.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
dbradiogroup1.SetFocus
else
if table2.state<>dsedit then table2.Edit;
end;
procedure Tlkcycj.Edit4Exit(Sender: TObject);
begin
with table1 do
begin
if (edit4.Text<>'') and (locate('身份证号',edit4.Text,[loCaseInsensitive])) then
begin
edit1.Text:=fieldbyname('姓名').AsString;
edit2.Text:=fieldbyname('性别').AsString;
edit3.Text:=fieldbyname('学习车型').AsString;
edit4.Text:=fieldbyname('身份证号').AsString;
edit5.Text:=fieldbyname('准考证编号').AsString;
exit;
end;
if (edit4.Text<>'') and (not locate('身份证号',edit4.Text,[locaseinsensitive])) then
begin
MessageDlg('无此记录!', mtWarning, [mbOk], 0);
exit;
end;
end;
end;
procedure Tlkcycj.Edit4KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
dbradiogroup1.SetFocus
else
if table2.state<>dsedit then table2.Edit;
end;
procedure Tlkcycj.Edit5Exit(Sender: TObject);
begin
with table1 do
begin
if (edit5.Text<>'') and (locate('准考证编号',edit5.Text,[loCaseInsensitive])) then
begin
edit1.Text:=fieldbyname('姓名').AsString;
edit2.Text:=fieldbyname('性别').AsString;
edit3.Text:=fieldbyname('学习车型').AsString;
edit4.Text:=fieldbyname('身份证号').AsString;
edit5.Text:=fieldbyname('准考证编号').AsString;
exit;
end;
if (edit5.Text<>'') and (not locate('准考证编号',edit5.Text,[locaseinsensitive])) then
begin
MessageDlg('无此记录!', mtWarning, [mbOk], 0);
exit;
end;
end;
end;
procedure Tlkcycj.Edit5KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
dbradiogroup1.SetFocus
else
if table2.state<>dsedit then table2.Edit;
end;
procedure Tlkcycj.SpeedButton1Click(Sender: TObject);
var
mysqlstr:string;
search_tmpstr:variant;
begin
search_tmpstr:=Edit1.Text;
pub_search:=Tpub_search.Create(self);
mysqlstr:='select 学号,姓名,性别,学习车型 as 证别,身份证号,准考证编号 from student';
pub_search.myselect(mysqlstr,'学员档案');
pub_search.ShowModal;
if (search_tmpstr<>myarr[1]) and (myarr[1]<>'') then
begin
Edit1.Text:=myarr[1];
table2.Edit;
end;
//设置自身为有焦点
if not Edit1.Focused then edit1.SetFocus;
dbradiogroup1.SetFocus; //设置下一控件焦点
end;
procedure Tlkcycj.SpeedButton2Click(Sender: TObject);
var
mysqlstr:string;
search_tmpstr:variant;
begin
search_tmpstr:=Edit4.Text;
pub_search:=Tpub_search.Create(self);
mysqlstr:='select 学号,姓名,性别,学习车型 as 证别,身份证号,准考证编号 from student';
pub_search.myselect(mysqlstr,'学员档案');
pub_search.ShowModal;
if (search_tmpstr<>myarr[1]) and (myarr[1]<>'') then
begin
Edit4.Text:=myarr[4];
table2.Edit;
end;
//设置自身为有焦点
if not Edit4.Focused then edit4.SetFocus;
dbradiogroup1.SetFocus; //设置下一控件焦点
end;
procedure Tlkcycj.SpeedButton3Click(Sender: TObject);
var
mysqlstr:string;
search_tmpstr:variant;
begin
search_tmpstr:=Edit5.Text;
pub_search:=Tpub_search.Create(self);
mysqlstr:='select 学号,姓名,性别,学习车型 as 证别,身份证号,准考证编号 from student';
pub_search.myselect(mysqlstr,'学员档案');
pub_search.ShowModal;
if (search_tmpstr<>myarr[1]) and (myarr[1]<>'') then
begin
Edit5.Text:=myarr[5];
table2.Edit;
end;
//设置自身为有焦点
if not Edit5.Focused then edit5.SetFocus;
dbradiogroup1.SetFocus; //设置下一控件焦点
end;
procedure Tlkcycj.Table2AfterScroll(DataSet: TDataSet);
begin
if table2.state<>dsinsert then
begin
with table1 do
begin
Locate('学号',table2.fieldbyname('学号').AsString,[]);
edit1.Text:=fieldbyname('姓名').AsString;
edit2.Text:=fieldbyname('性别').AsString;
edit3.Text:=fieldbyname('学习车型').AsString;
edit4.Text:=fieldbyname('身份证号').AsString;
edit5.Text:=fieldbyname('准考证编号').AsString;
end;
end;
end;
procedure Tlkcycj.FormCreate(Sender: TObject);
var
sqlstr:string;
wherestr:string;
i:integer;
begin
//初始化combobox_items
with query1 do
begin
close;
sql.Clear;
sqlstr:='SELECT a.姓名, a.性别, a.身份证号, a.学习车型, a.准考证编号, b.* FROM Student a, 路考测验成绩 b';
wherestr:='WHERE a.学号 = b.学号 ';
sql.Add(sqlstr);
sql.Add(wherestr);
open;
for i:=0 to FieldCount-1 do
combobox1.Items.Add(Fields[i].FieldName);
combobox1.ItemIndex:=0;
close;
end;
end;
procedure Tlkcycj.BitBtn5Click(Sender: TObject);
var
comitem_clsname:string;
wherestr:string;
begin
query1.Open;
comitem_clsname:=query1.FieldByName(combobox1.Text).ClassName;
with query1 do
begin
close;
sql.Clear;
wherestr:='WHERE a.学号 = b.学号 ';
sql.Add('SELECT a.姓名, a.性别, a.身份证号, a.学习车型, a.准考证编号, case b.成绩 when True then '+'及格'+' else '+'不及格'+' end as 成绩,b.测验时间, b.建档人, b.建档日期,');
sql.add('b.不关车门, b.后溜大于30CM, b.跑方向, b.双手脱把, b.低头看档, b.空档滑行, b.挂错档, b.熄火, b.响齿, 协调差, b.掉桥, b.抢档不入, b.扎中心线, b.强行超车, b.不鸣号, b.车身位置感觉差, b.不拉手刹, b.不松手刹, b.不检查仪表, b.制动不平顺, ');
sql.add('b.不会使用转向灯, b.不会使用二脚离合器,b.起步油门过大, b.车轮出线, b.定点停车过点, b.停车横纵向距离大于50CM, b.停车距右边线大于30CM, b.不系保险带, b.过限制门车速低于20KM, b.百米不能完成加减档, b.抢道行驶, ');
sql.Add('b.违返路口规定, b.不按导向线行车, b.加档不加油, b.减档不松油, b.空油时机与大小欠准, b.起步窜动, b.不能根据目标做相应动作 from Student a,路考测验成绩 b');
sql.Add(wherestr);
if edit6.text<>'' then
begin
showmessage(comitem_clsname);
if comitem_clsname='TStringField' then
wherestr:='and '+combobox1.Text+' '+combobox2.Text+' '+''''+edit6.Text+'''';
if comitem_clsname='TDateTimeField' then
wherestr:='and b.'+combobox1.Text+' '+combobox2.Text+' #'+edit6.Text+'#';
if (comitem_clsname='TIntegerField') or (comitem_clsname='TBooleanField') then
wherestr:='and '+combobox1.Text+' '+combobox2.Text+' '+edit6.Text;
sql.add(wherestr);
end;
if not Prepared then Prepare;
open;
end;
if query1.RecordCount=0 then
showmessage('无记录')
else
dbgrideh1.datasource:=datasource3;
end;
procedure Tlkcycj.frxReport1ProgressStart(Sender: TfrxReport;
ProgressType: TfrxProgressType; Progress: Integer);
begin
if frxdbDataSet1.Value['成绩'] then
//frxreport1.page.comco['成绩']:='及格'
else
//frVariables['成绩']:='不及格';
end;
procedure Tlkcycj.frxReport1GetValue(const VarName: String;
var Value: Variant);
begin
{
if VarName='Memo9' then
if query1.FieldByName('成绩').AsBoolean then
Value:='及格'
else
Value:='不及格';
}
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -