?? upublic.~pas
字號:
unit uPublic;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, DBGrids, DBClient, DB, Registry, winsock;
type
TCurrentParam = record
userAliasName: string;
LoginTime: string;
Host: string;
IP: string;
userBH: string;
userName: string;
userZH: string;
end;
//==
procedure DbGridSort(dbgrid: TDBGrid; Column: TColumn);
//===輔助錄入窗口,得到職工的姓名
function GetEmployeeName: string;
//==輔助錄入窗口,得到部門名稱
function GetDeptName: string;
//==輔助錄入窗口,得到工程項目名稱
function GetProjectName: string;
var
CurrentParam: TCurrentParam;
psIndexName: string; //
plAscend: Boolean;
implementation
uses u_fzlr_zgxm , u_bmda_fzlr;
procedure DbGridSort(dbgrid: TDBGrid; Column: TColumn);
var
//本模塊使用到的psIndexName, plAscend兩個變量見上定義
mode: char; //記錄是“升序”還是“降序”
ColName: string; //記錄當前字段名
iCol: Integer; //記錄當前列號
begin
with dbgrid.DataSource.DataSet as Tclientdataset do //Table0
begin
//檢測當前工作表是否已打開
if not Active
then begin
Application.MessageBox('工作表尚未打開!', '停止', MB_OK + MB_ICONSTOP);
Abort
end;
//檢測當前字段是否“能排序”。以下字段類型不能排序
case Column.Field.DataType of
ftBoolean,
ftBytes,
ftBlob, //Binary
ftMemo,
ftGraphic,
ftFmtMemo, //Formatted memo
ftParadoxOle: //OLE
begin
Abort
end;
end; //case
mode := '0';
iCol := Column.Field.FieldNo - 1;
try
ColName := Column.fieldname;
if psIndexName = Column.fieldname then
begin //與原來同列
if plAscend //升序
then begin
mode := '2';
IndexName := ColName + '2'; //應“降序”
end
else begin
mode := '1';
IndexName := ColName + '1'; //應“升序”
end;
plAscend := not plAscend;
end
else begin //新列
IndexName := ColName + '2';
plAscend := false;
psIndexName := ColName;
end;
except
on EDatabaseError do //若未有索引,則重新建立
begin
//以下新建索引
IndexName := '';
if mode = '1'
then AddIndex(ColName + '1', ColName, [], '', '', 0) //
else //包括'0'
AddIndex(ColName + '2', ColName, [ixDescending], '', '', 0);
try //try 1
if mode <> '1'
then begin
mode := '2'; //轉換
plAscend := false;
end
else plAscend := true;
IndexName := ColName + mode;
psIndexName := ColName;
except
IndexName := '';
end //try 2
end
end;
first;
end; //with
dbgrid.SelectedIndex := iCol;
end;
//===輔助錄入窗口,得到職工的姓名
function GetEmployeeName: string;
begin
//創建TfrmZgda_fzlr窗體對象
with TfrmZgda_fzlr.Create(Application) do
begin
pub_zgxm := '';
try
//模式顯示窗口
showModal;
finally
free;
end;
result := pub_zgxm;
end;
end;
//===輔助錄入窗口,得到部門的名稱
function GetDeptName: string;
begin
with TfrmBmda_fzlr.Create(Application) do
begin
pub_Bmmc := '';
try
showModal;
finally
free;
end;
result := pub_Bmmc;
end;
end;
//==輔助錄入窗口,得到工程項目名稱
function GetProjectName: string;
begin
{ with TfrmGcxmdy_fzlr.Create(Application) do
begin
pub_Gcxmmc := '';
try
showModal;
finally
free;
end;
result := pub_Gcxmmc;
end; }
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -