?? frmmain.~pas
字號(hào):
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當(dāng)前記錄的取得
procedure TFrmmain.ADOQuery1AfterScroll(DataSet: TDataSet);
begin ///////
unit_id:=ADOQuery1.FieldByName('unit_id').AsInteger;//分公司編號(hào)
iindex:=ADOQuery1.FieldByName('iindex').AsInteger;//文件編號(hào)
title:=ADOQuery1.FieldByName('title').AsString; //文件標(biāo)題
path:=ADOQuery1.FieldByName('path').AsString; //文件名
creater:=ADOQuery1.FieldByName('creater').AsString; //文件的創(chuàng)建者
time:=ADOQuery1.FieldByName('time').AsDateTime; //文件的創(chuàng)建時(shí)間
iclass:=ADOQuery1.FieldByName('iclass').AsInteger; //文件分類號(hào)
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當(dāng)前記錄的取得
procedure TFrmmain.DBGrid1CellClick(Column: TColumn);
begin
unit_id:=ADOQuery1.FieldByName('unit_id').AsInteger;//分公司編號(hào)
iindex:=ADOQuery1.FieldByName('iindex').AsInteger;//文件編號(hào)
title:=ADOQuery1.FieldByName('title').AsString; //文件標(biāo)題
path:=ADOQuery1.FieldByName('path').AsString; //文件名
creater:=ADOQuery1.FieldByName('creater').AsString; //文件的創(chuàng)建者
time:=ADOQuery1.FieldByName('time').AsDateTime; //文件的創(chuàng)建時(shí)間
iclass:=ADOQuery1.FieldByName('iclass').AsInteger; //文件分類號(hào)
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當(dāng)前記錄的取得
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);
/////////////////////////////////////////////////////報(bào)告未閱的文檔
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 //如果沒有記錄不讓點(diǎn)擊
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; //--文件分類號(hào) 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 //第一級(jí)目錄
begin
if g_itreeindex=0 then //第一個(gè)子結(jié)點(diǎn) 收文件
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 //第二個(gè)子結(jié)點(diǎn) 發(fā)文件
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 //第二級(jí)目錄
begin
if g_iparentindex=0 then //第一個(gè)子結(jié)點(diǎn) 收文件下的子結(jié)點(diǎn)
begin //--文件分類號(hào) 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 //第二個(gè)子結(jié)點(diǎn) 發(fā)文件下的子結(jié)點(diǎn)
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 //根據(jù)數(shù)據(jù)集的記錄號(hào)進(jìn)行判斷
True : DbGrid1.Canvas.Brush.color:=clAqua;//偶數(shù)行用淺綠色顯示
False: DbGrid1.Canvas.Brush.color:=clblue;//奇數(shù)行用藍(lán)色表示
end;
}
if ((State = [gdSelected]) or (State=[gdSelected,gdFocused])) then
DbGrid1.Canvas.Brush.color:=clRed;//當(dāng)前行以紅色顯示,其它行使用背景的淺綠色
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('確認(rèn)要退出文檔管理系統(tǒng)嗎?',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
end
else
begin //如果是其它的SystemCommand 消息則調(diào)用系統(tǒng)缺省處理函數(shù)處理之。
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('您權(quán)限不夠,不能管理用戶!');
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -