📄 personinfodelunit.pas
字号:
end;
procedure Tpersoninfodelform.Department_ComboBoxChange(Sender: TObject);
var
i:integer;
begin
departmentid_edit.Text :='';
spec_combobox.ItemIndex:=-1;
specid_edit.Text :='';
spec_combobox.Items.Clear;
ClassCode_Edit.Text :='';
if Department_ComboBox.ItemIndex<0 then exit;
departmentid_edit.Text :=inttostr(NewDepartment[Department_ComboBox.itemindex].id);
with oper_adoquery do
begin
close;
sql.Clear;
sql.Add('select * from spec where ScholarId=:ScholarId and departmentid=:departmentid order by id');
Parameters.ParamByName('ScholarId').Value :=scholarid_edit.Text ;
Parameters.ParamByName('departmentid').Value :=departmentid_edit.Text ;
open;
if not isempty then
begin
setlength(NewSpec,RecordCount);
for i := 0 to RecordCount-1 do
begin
NewSpec[i].Id :=fieldbyname('id').AsInteger ;
NewSpec[i].spec :=fieldbyname('spec').AsString ;
spec_combobox.Items.Add(fieldbyname('spec').AsString) ;
Next;
end;
end;
end;
end;
procedure Tpersoninfodelform.Spec_ComboBoxChange(Sender: TObject);
begin
ClassCode_Edit.Text :='';
if Spec_ComboBox.ItemIndex>-1 then
Specid_Edit.Text :=inttostr(NewSpec[Spec_ComboBox.itemindex].id);
end;
procedure Tpersoninfodelform.ButtonUse(CanUse: boolean);
begin
StudentN_Edit.Enabled :=CanUse;
search_BitBtn.Enabled :=CanUse;
bitbtn1.Enabled :=not canuse;
save_BitBtn.Enabled :=not CanUse;
new_BitBtn.Enabled :=not canuse;
//panel1.Enabled :=not canuse;
end;
procedure Tpersoninfodelform.ClassCode_BitBtnClick(Sender: TObject);
begin
if trim(ChargeYearID_ComboBox.Text )='' then
begin
MessageBox(application.handle,pchar('入学年份没有选择!'),'错误',MB_ICONWARNING+MB_OK);
ChargeYearID_ComboBox.SetFocus;
exit;
end;
if trim(Spec_ComboBox.Text )='' then
begin
MessageBox(application.handle,pchar('专业没有选择!'),'错误',MB_ICONWARNING+MB_OK);
Spec_ComboBox.SetFocus ;
exit;
end;
if trim(Length_ComboBox.Text )='' then
begin
MessageBox(application.handle,pchar('学制没有选择!'),'错误',MB_ICONWARNING+MB_OK);
Length_ComboBox.SetFocus ;
exit;
end;
ClassCode_Edit.Text :=copy(trim(ChargeYearID_ComboBox.Text),3,2)+trim(Spec_ComboBox.Text )+trim(Length_ComboBox.Text )+'1';
end;
procedure Tpersoninfodelform.save_BitBtnClick(Sender: TObject);
var
TmpID:String;
begin
TmpID:=trim(id_edit.Text );
if messagebox(handle,pchar('是否删除当前学生信息?'),pchar('请选择'), MB_ICONWARNING+mb_okcancel)=1 then
begin
dm.ADOConnection.BeginTrans ;
try
with oper_adoquery do
begin
close;
sql.Clear;
sql.Add('delete from ReturnDetail where studentid=:studentid'); //退费明细
Parameters.ParamByName('studentid').Value :=TmpID;
ExecSQL;
close;
sql.Clear;
sql.Add('delete from Decrease where studentid=:studentid'); //减免明细
Parameters.ParamByName('studentid').Value :=TmpID;
ExecSQL;
close;
sql.Clear;
sql.Add('delete from EditReg where studentid=:studentid'); //调整录入明细
Parameters.ParamByName('studentid').Value :=TmpID;
ExecSQL;
close;
sql.Clear;
sql.Add('delete from FirstReg where studentid=:studentid'); //收费录入明细
Parameters.ParamByName('studentid').Value :=TmpID;
ExecSQL;
close;
sql.Clear;
sql.Add('delete from Income where studentid=:studentid'); //收支总表
Parameters.ParamByName('studentid').Value :=TmpID;
ExecSQL;
close;
sql.Clear;
sql.Add('delete from Student where id=:id'); //学生基本信息
Parameters.ParamByName('id').Value :=TmpID;
ExecSQL;
end;
dm.ADOConnection.CommitTrans ;
messagebox(handle,pchar('学生信息已成功删除!'),pchar('成功'), MB_ICONINFORMATION+mb_ok);
except
on e:exception do
begin
dm.ADOConnection.RollbackTrans ;
messagebox(handle,pchar('删除学生信息出现错误!'+e.Message ),pchar('错误'), MB_ICONERROR+mb_ok);
end;
end;
buttonUse(true);
ClearContent ;
adoquery1.close;
adoquery2.close;
adoquery3.close;
adoquery4.close;
adoquery5.close;
StudentN_Edit.SetFocus ;
end;
end;
procedure Tpersoninfodelform.close_BitBtnClick(Sender: TObject);
begin
if save_BitBtn.Enabled then
begin
self.Close;
exit;
end;
self.Close;
end;
procedure Tpersoninfodelform.new_BitBtnClick(Sender: TObject);
begin
buttonUse(true);
ClearContent ;
adoquery1.close;
adoquery2.close;
adoquery3.close;
adoquery4.close;
adoquery5.close;
StudentN_Edit.SetFocus ;
end;
procedure Tpersoninfodelform.StudentN_EditKeyPress(Sender: TObject;
var Key: Char);
begin
if (key=#13) and (trim(studentn_edit.Text )<>'') then
search_bitbtn.Click ;
end;
procedure Tpersoninfodelform.search_BitBtnClick(Sender: TObject);
var
i:integer;
begin
if trim(studentn_edit.Text )='' then exit;
tipform:=Ttipform.create(self);
try
tipform.list_adoquery.close;
tipform.list_adoquery.SQL.Clear;
tipform.list_adoquery.SQL.Add(tipform.SqlText );
tipform.list_adoquery.SQL.Add('and student.studentname=:studentname');
tipform.list_adoquery.Parameters.ParamByName('studentname').Value := trim(StudentN_Edit.Text );
tipform.list_adoquery.open;
clearcontent;
if not tipform.list_adoquery.IsEmpty then
begin
if tipform.list_adoquery.RecordCount>1 then
begin
tipform.Caption :='请选择相应的学生信息';
case tipform.ShowModal of
mrcancel: exit;
end;
end;
StudentN_Edit.Text := tipform.list_adoquery.fieldbyname('StudentName').AsString ;
StudentName_Edit.Text := tipform.list_adoquery.fieldbyname('StudentName').AsString ;
id_edit.Text :=markid(tipform.list_adoquery.fieldbyname('id').AsString) ;
sex_combobox.ItemIndex:=sex_combobox.Items.IndexOf ( tipform.list_adoquery.fieldbyname('sexname').AsString );
Address_Edit .Text :=tipform.list_adoquery.fieldbyname('Address').AsString ;
Scholar_ComboBox.ItemIndex:=Scholar_ComboBox.Items.IndexOf(tipform.list_adoquery.fieldbyname('Scholar').AsString);
Scholar_ComboBox.OnChange(nil) ;
Department_combobox.itemindex:=Department_combobox.Items.IndexOf(tipform.list_adoquery.fieldbyname('department').AsString);
Department_combobox.OnChange(nil);
Spec_combobox.itemindex:=Spec_combobox.Items.IndexOf ( tipform.list_adoquery.fieldbyname('spec').AsString );
Spec_combobox.OnChange (nil);
Length_combobox.itemindex:=Length_combobox.Items.IndexOf ( tipform.list_adoquery.fieldbyname('length').AsString );
ClassCode_Edit.Text := tipform.list_adoquery.fieldbyname('classCode').AsString ;
Code_Edit .Text :=tipform.list_adoquery.fieldbyname('code').AsString ;
Source_Edit.Text :=tipform.list_adoquery.fieldbyname('Source').AsString ;
Tutor_Edit .Text :=tipform.list_adoquery.fieldbyname('Tutor').AsString ;
Circs_Edit.Text := tipform.list_adoquery.fieldbyname('Circs').AsString ;
Memo_Edit .Text :=tipform.list_adoquery.fieldbyname('Memo').AsString ;
end
else
begin
MessageBox(application.handle,pchar('没有查找到相应学生信息!'),'错误',MB_ICONWARNING+MB_OK);
exit;
end;
finally
freeandnil(tipform);
end;
//查找相应数据
adoquery1.close;
adoquery2.close;
adoquery3.close;
adoquery4.close;
adoquery5.close;
adoquery1.Parameters.ParamByName('studentid1').Value:=trim(id_edit.Text );
adoquery1.Parameters.ParamByName('studentid2').Value:=trim(id_edit.Text );
adoquery2.Parameters.ParamByName('studentid1').Value:=trim(id_edit.Text );
adoquery2.Parameters.ParamByName('studentid2').Value:=trim(id_edit.Text );
adoquery3.Parameters.ParamByName('studentid1').Value:=trim(id_edit.Text );
adoquery3.Parameters.ParamByName('studentid2').Value:=trim(id_edit.Text );
adoquery4.Parameters.ParamByName('studentid1').Value:=trim(id_edit.Text );
adoquery4.Parameters.ParamByName('studentid2').Value:=trim(id_edit.Text );
adoquery5.Parameters.ParamByName('studentid1').Value:=trim(id_edit.Text );
adoquery5.Parameters.ParamByName('studentid2').Value:=trim(id_edit.Text );
adoquery1.Open;
adoquery2.Open;
adoquery3.Open;
adoquery4.Open;
adoquery5.Open;
buttonuse(false);
end;
procedure Tpersoninfodelform.BitBtn1Click(Sender: TObject);
begin
if trim(Tutor_Edit.Text )='' then
begin
MessageBox(application.handle,pchar('没有指导人信息!'),'错误',MB_ICONWARNING+MB_OK);
exit;
end;
tipform:=Ttipform.create(self);
try
tipform.list_adoquery.close;
tipform.list_adoquery.SQL.Clear;
tipform.list_adoquery.SQL.Add(tipform.SqlText );
tipform.list_adoquery.SQL.Add('and student.tutor=:tutor');
tipform.list_adoquery.Parameters.ParamByName('tutor').Value := trim(Tutor_Edit.Text );
tipform.list_adoquery.open;
clearcontent;
if not tipform.list_adoquery.IsEmpty then
begin
tipform.Caption :='学生信息';
case tipform.ShowModal of
mrcancel: exit;
end;
end
else
begin
MessageBox(application.handle,pchar('没有查找到相应学生信息!'),'错误',MB_ICONWARNING+MB_OK);
exit;
end;
finally
freeandnil(tipform);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -