📄 frmmain.pas
字号:
qrTemp:=TAdoQuery.Create(nil);
qrTemp.Connection :=G_ADOConnection;
qrTemp.SQL.Clear;
qrTemp.SQL.Text:=strSQL;
try
qrTemp.ExecSQL;
except
ShowMessage('核稿不成功!');
end;
//更新审核人员信息
SpeedButton02Click(nil);
end;
procedure TFrmmain.BitBtn8Click(Sender: TObject); //审批
var
qrTemp:TAdoQuery;
strSQL:string;
qrTemp2:TAdoQuery;
strSQL2:string;
begin
strSQL2:='select * from ent_operater where iindex='+inttostr(iindex)+' and step<3 and status=0 ';
qrTemp2:=TAdoQuery.Create(nil);
qrTemp2.Connection :=G_ADOConnection;
qrTemp2.SQL.Clear;
qrTemp2.SQL.Text:=strSQL2;
try
qrTemp2.Open;
if qrTemp2.RecordCount >0 then
begin
ShowMessage('该文件未到审批阶段,等前面都已处理完毕再审批!');
exit;
end;
except
ShowMessage('审批不成功!');
exit;
end;
///////////////////////////////////////////////////////////////////////////
strSQL:='update ent_operater set status=1 where iindex='+inttostr(iindex)+' and step=3 and status=0 and user_id='''+g_user_id+'''';
// showmessage(strSQL);
qrTemp:=TAdoQuery.Create(nil);
qrTemp.Connection :=G_ADOConnection;
qrTemp.SQL.Clear;
qrTemp.SQL.Text:=strSQL;
try
qrTemp.ExecSQL;
except
ShowMessage('审批不成功!');
end;
//更新审核人员信息
SpeedButton03Click(nil);
end;
procedure TFrmmain.BitBtn9Click(Sender: TObject); //阅稿
var
qrTemp:TAdoQuery;
strSQL:string;
qrTemp2:TAdoQuery;
strSQL2:string;
begin
strSQL2:='select * from ent_operater where iindex='+inttostr(iindex)+' and step<4 and status=0 ';
qrTemp2:=TAdoQuery.Create(nil);
qrTemp2.Connection :=G_ADOConnection;
qrTemp2.SQL.Clear;
qrTemp2.SQL.Text:=strSQL2;
try
qrTemp2.Open;
if qrTemp2.RecordCount >0 then
begin
ShowMessage('该文件未到阅稿阶段,等前面都已处理完毕再阅稿!');
exit;
end;
except
ShowMessage('阅稿不成功!');
exit;
end;
///////////////////////////////////////////////////////////////////////////
strSQL:='update ent_operater set status=1 where iindex='+inttostr(iindex)+' and step=4 and status=0 and user_id='''+g_user_id+'''';
// showmessage(strSQL);
qrTemp:=TAdoQuery.Create(nil);
qrTemp.Connection :=G_ADOConnection;
qrTemp.SQL.Clear;
qrTemp.SQL.Text:=strSQL;
try
qrTemp.ExecSQL;
except
ShowMessage('阅稿不成功!');
end;
//更新审核人员信息
SpeedButton04Click(nil);
end;
//////////////////ent_file当前记录的取得
procedure TFrmmain.ADOQuery1AfterScroll(DataSet: TDataSet);
begin ///////
unit_id:=ADOQuery1.FieldByName('unit_id').AsInteger;//分公司编号
iindex:=ADOQuery1.FieldByName('iindex').AsInteger;//文件编号
title:=ADOQuery1.FieldByName('title').AsString; //文件标题
path:=ADOQuery1.FieldByName('path').AsString; //文件名
creater:=ADOQuery1.FieldByName('creater').AsString; //文件的创建者
time:=ADOQuery1.FieldByName('time').AsDateTime; //文件的创建时间
iclass:=ADOQuery1.FieldByName('iclass').AsInteger; //文件分类号
memo:=ADOQuery1.FieldByName('memo').AsString; //文件说明
// showmessage('AfterScroll');
if (bShowed) then
begin
BitBtn6.Enabled:=false;
BitBtn7.Enabled:=false;
BitBtn8.Enabled:=false;
BitBtn9.Enabled:=false;
SpeedButton01Click(nil);
SpeedButton02Click(nil);
SpeedButton03Click(nil);
SpeedButton04Click(nil);
end;
end;
//////////////////ent_file当前记录的取得
procedure TFrmmain.DBGrid1CellClick(Column: TColumn);
begin
unit_id:=ADOQuery1.FieldByName('unit_id').AsInteger;//分公司编号
iindex:=ADOQuery1.FieldByName('iindex').AsInteger;//文件编号
title:=ADOQuery1.FieldByName('title').AsString; //文件标题
path:=ADOQuery1.FieldByName('path').AsString; //文件名
creater:=ADOQuery1.FieldByName('creater').AsString; //文件的创建者
time:=ADOQuery1.FieldByName('time').AsDateTime; //文件的创建时间
iclass:=ADOQuery1.FieldByName('iclass').AsInteger; //文件分类号
memo:=ADOQuery1.FieldByName('memo').AsString; //文件说明
// showmessage('CellClick');
//更新审核人员信息
BitBtn6.Enabled:=false;
BitBtn7.Enabled:=false;
BitBtn8.Enabled:=false;
BitBtn9.Enabled:=false;
SpeedButton01Click(nil);
SpeedButton02Click(nil);
SpeedButton03Click(nil);
SpeedButton04Click(nil);
end;
//////////////////ent_file当前记录的取得
procedure TFrmmain.FormShow(Sender: TObject);
var
qrTemp:TAdoQuery;
strSQL:string;
strdata:string;
i:integer;
begin
bShowed:=true;
//更新审核人员信息
SpeedButton01Click(nil);
SpeedButton02Click(nil);
SpeedButton03Click(nil);
SpeedButton04Click(nil);
/////////////////////////////////////////////////////报告未阅的文档
qrTemp:=TAdoQuery.Create(nil);
qrTemp.Connection :=G_ADOConnection;
qrTemp.SQL.Clear;
strSQL:='select title from ent_file where iindex in (select iindex from ent_operater where user_id='''+g_user_id+''' and status=0)';
// showmessage(strSQL);
qrTemp.SQL.Text:=strSQL;
try
qrTemp.Open;
if qrTemp.RecordCount>0 then
begin
qrTemp.First;
strdata:='您有下列新文件未批阅:'+#13;
for i:=0 to qrTemp.RecordCount-1 do
begin
strdata:= strdata+#13+qrTemp.fieldbyname('title').AsString;
qrTemp.Next;
end;
ShowMessage(strdata);
end;
except
end;
/////////////////////////////////////////////////////
end;
procedure TFrmmain.N2Click(Sender: TObject); //增加附件
var
nNow:TdateTime;
qrTemp:TAdoQuery;
strSQL:string;
bCopyed:boolean;
strName,strExt,strPath:string;
begin
if ADOQuery1.RecordCount>0 then //如果没有记录不让点击
begin
nNow:=Now;
strPath:=g_user_id+FormatDateTime('_yyyymmddhhnnss',nNow);
AddAccessoryOpenDialog1.Execute;
if AddAccessoryOpenDialog1.FileName<>'' then
begin
strExt:=GetFileExt(GetFileName(AddAccessoryOpenDialog1.FileName),strName);
strPath:=strPath+'.'+strExt;
bcopyed:=CopyFile(PChar(AddAccessoryOpenDialog1.FileName),PChar('\\'+ServerName+'\filetest\'+strPath), false);
// ShowMessage(strName+' '+ strExt);
qrTemp:=TAdoQuery.Create(nil);
qrTemp.Connection :=G_ADOConnection;
qrTemp.SQL.Clear;
strSQL:='insert into ent_accessary(unit_id,iindex,name,path) values('+inttostr(unit_id)+','+inttostr(iindex)+','''+strName+''','''+strPath+''')';
// showmessage(strSQL);
qrTemp.SQL.Text:=strSQL;
try
qrTemp.ExecSQL;
except
showMessage('用户操作不成功!');
exit;
end;
end;
end;
end;
procedure TFrmmain.TreeView1Change(Sender: TObject; Node: TTreeNode);
begin
g_iLevel:=TreeView1.Selected.Level;
g_itreeindex:=TreeView1.Selected.Index; //--文件分类号 0:AA;1:BB;2:CC;3:DD
g_iparentindex:=TreeView1.Selected.Parent.Index;
//showMessage('iparentindex='+inttostr(iparentindex)+' level:='+inttostr(TreeView1.Selected.Level)+' index='+inttostr(TreeView1.Selected.Index));
if g_iLevel=0 then //第一级目录
begin
if g_itreeindex=0 then //第一个子结点 收文件
begin
ADOQuery1.Close;
//select a.[unit_id],a.[iindex],a.[title],a.[path],a.[creater],a.[time],a.[iclass],a.[memo],b.[name] from ent_file a,ent_person b where a.creater=b.user_id and a.unit_id=b.unit_id
// ADOQuery1.SQL.Text:='select * from ent_file where iindex in (select iindex from ent_operater where user_id='''+g_user_id+''')';
if g_level=1 then //文档管理员
ADOQuery1.SQL.Text:='select a.[unit_id],a.[iindex],a.[title],a.[path],a.[creater],a.[time],a.[iclass],a.[memo],b.[name] from ent_file a,ent_person b where a.creater*=b.user_id and a.unit_id*=b.unit_id'
else
ADOQuery1.SQL.Text:='select a.[unit_id],a.[iindex],a.[title],a.[path],a.[creater],a.[time],a.[iclass],a.[memo],b.[name] from ent_file a,ent_person b where a.creater*=b.user_id and a.unit_id*=b.unit_id and a.iindex in (select iindex from ent_operater where user_id='''+g_user_id+''')';
ADOQuery1.Open;
end;
if g_itreeindex=1 then //第二个子结点 发文件
begin
ADOQuery1.Close;
// ADOQuery1.SQL.Text:='select * from ent_file where creater='''+g_user_id+'''';
if g_level=1 then //文档管理员
ADOQuery1.SQL.Text:='select a.[unit_id],a.[iindex],a.[title],a.[path],a.[creater],a.[time],a.[iclass],a.[memo],b.[name] from ent_file a,ent_person b where a.creater*=b.user_id and a.unit_id*=b.unit_id'
else
ADOQuery1.SQL.Text:='select a.[unit_id],a.[iindex],a.[title],a.[path],a.[creater],a.[time],a.[iclass],a.[memo],b.[name] from ent_file a,ent_person b where a.creater*=b.user_id and a.unit_id*=b.unit_id and a.creater='''+g_user_id+'''';
ADOQuery1.Open;
end;
end;
if g_iLevel=1 then //第二级目录
begin
if g_iparentindex=0 then //第一个子结点 收文件下的子结点
begin //--文件分类号 0:AA;1:BB;2:CC;3:DD
ADOQuery1.Close; //
// ADOQuery1.SQL.Text:='select * from ent_file where iclass='+inttostr(g_itreeindex)+' and iindex in (select iindex from ent_operater where user_id='''+g_user_id+''')';
if g_level=1 then //文档管理员
ADOQuery1.SQL.Text:='select a.[unit_id],a.[iindex],a.[title],a.[path],a.[creater],a.[time],a.[iclass],a.[memo],b.[name] from ent_file a,ent_person b where a.creater*=b.user_id and a.unit_id*=b.unit_id and a.iclass='+inttostr(g_itreeindex)
else
ADOQuery1.SQL.Text:='select a.[unit_id],a.[iindex],a.[title],a.[path],a.[creater],a.[time],a.[iclass],a.[memo],b.[name] from ent_file a,ent_person b where a.creater*=b.user_id and a.unit_id*=b.unit_id and a.iclass='+inttostr(g_itreeindex)+' and a.iindex in (select iindex from ent_operater where user_id='''+g_user_id+''')';
ADOQuery1.Open;
end;
if g_iparentindex=1 then //第二个子结点 发文件下的子结点
begin
ADOQuery1.Close;
// ADOQuery1.SQL.Text:='select * from ent_file where iclass='+inttostr(g_itreeindex)+' and creater='''+g_user_id+'''';
if g_level=1 then //文档管理员
ADOQuery1.SQL.Text:='select a.[unit_id],a.[iindex],a.[title],a.[path],a.[creater],a.[time],a.[iclass],a.[memo],b.[name] from ent_file a,ent_person b where a.creater*=b.user_id and a.unit_id*=b.unit_id and a.iclass='+inttostr(g_itreeindex)
else
ADOQuery1.SQL.Text:='select a.[unit_id],a.[iindex],a.[title],a.[path],a.[creater],a.[time],a.[iclass],a.[memo],b.[name] from ent_file a,ent_person b where a.creater*=b.user_id and a.unit_id*=b.unit_id and a.iclass='+inttostr(g_itreeindex)+' and a.creater='''+g_user_id+'''';
ADOQuery1.Open;
end;
end;
end;
procedure TFrmmain.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
DbGrid1.Canvas.Brush.Color:= clYellow;
{
Case ADOQuery1.RecNo mod 2 = 0 of //根据数据集的记录号进行判断
True : DbGrid1.Canvas.Brush.color:=clAqua;//偶数行用浅绿色显示
False: DbGrid1.Canvas.Brush.color:=clblue;//奇数行用蓝色表示
end;
}
if ((State = [gdSelected]) or (State=[gdSelected,gdFocused])) then
DbGrid1.Canvas.Brush.color:=clRed;//当前行以红色显示,其它行使用背景的浅绿色
DbGrid1.Canvas.pen.mode:=pmmask;
DbGrid1.DefaultDrawColumnCell (Rect,DataCol,Column,State);
end;
procedure TFrmmain.N1Click(Sender: TObject);
begin
close;
end;
procedure TFrmmain.WMNID(var msg:TMessage);
var
pt:tpoint;
begin
case msg.LParam of
WM_LBUTTONDBLCLK: Fmmain.Visible:=not Fmmain.Visible;
WM_RBUTTONUP:
begin
GetCursorPos(pt);
PopupMenu1.Popup(pt.x,pt.y);
end;
End;
End;
procedure TFrmmain.N3Click(Sender: TObject);
begin
if MessageDlg('确认要退出文档管理系统吗?',mtConfirmation, [mbNo,mbYes],0) = mrYes then
close;
end;
procedure TFrmmain.FormDestroy(Sender: TObject);
begin
Shell_NotifyIcon(NIM_DELETE,@NotifyIcon);
end;
procedure TFrmmain.ToolButton5Click(Sender: TObject);
begin
Visible:=false;
end;
procedure TFrmmain.WMSysCommand(var Message:TMessage);
begin
if Message.WParam = SC_ICON then
begin
Visible := False
end
else
begin //如果是其它的SystemCommand 消息则调用系统缺省处理函数处理之。
DefWindowProc(Handle,Message.Msg,Message.WParam,Message.LParam);
end;
end;
procedure TFrmmain.N4Click(Sender: TObject);
begin //用户管理
//
if g_level>0 then
begin
FuserMan:= TFuserMan.create(self);
FuserMan.ShowModal;
FuserMan.Release;
end
else
ShowMessage('您权限不够,不能管理用户!');
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -