?? main.pas
字號:
wIcon, wButton:integer; //1--------------------------
TheCaption,ExpandString: String; //1--------------------------
SpaceNum,RIndex,InsertSpaceNum: Integer; //1--------------------------
IsRotate,IsRightShift: Boolean; //1--------------------------
procedure getStructure(TreeView1: TTreeView);
function getDS(s1:string):string;
function getStatus(ss:string):string;
implementation
{$R *.dfm}
uses login, About,data, password, RealtyL11,RealtyA11,RealtyA12,RealtyA13,RealtyA14,RealtyA15,RealtyA22,RealtyA32,
RealtyB11,RealtyB12,RealtyB13,RealtyB14,RealtyB15,RealtyB21,RealtyB22,RealtyB23,RealtyB31,RealtyB32,
RealtyB33,RealtyB35,RealtyB41,RealtyB42,realtyE11,realtyE12,realtyE13,realtyE15,realtyE16,
realtyE32,RealtyC21,realtyE33,realtyE34,realtyF11,realtyF12,realtyF13,realtyF14,realtyF61,
realtyF22,realtyF31,realtyF32,realtyF41,realtyF42,realtyF43,realtyF51,realtyF52,
realtyI1,RealtyI2,realtyF33,RealtyI3,RealtyI4,RealtyI5,RealtyC25,RealtyC26,
RealtyJ1,RealtyJ2,RealtyJ3,RealtyJ4,RealtyB51,RealtyB61,
RealtyJ6,RealtyJ8,RealtyJA21,RealtyJ22,Realtyk1,RealtyK2,RealtyK3,RealtyK4,
RealtyK61,RealtyK62,RealtyK71,RealtyK72,RealtyK81,RealtyK82,RealtyK91,RealtyK92,RealtyK101,RealtyK102,
RealtyK111,RealtyK112,RealtyG11,RealtyG12,RealtyG13,RealtyG14,RealtyG15,RealtyG16,RealtyG21,RealtyG31,
RealtyG41,RealtyG51,RealtyG52,RealtyG53,RealtyG61,RealtyH21,RealtyH22,RealtyH11,Realtyf62,RealtyF63,
RealtyE42,RealtyL22,RealtyL23,RealtyL32,RealtyL31,RealtyL33,
RealtyL41,RealtyJ31,realtyF21,RealtyA26,RealtyA27,RealtyL26,Initial,
RealtyA41,RealtyA42,backupA,backupB,realtyC62,RealtyF64,RealtyF65,
RealtyC34,RealtyC35,
RealtyC41,RealtyC22,RealtyC24,RealtyC31,RealtyC32,RealtyC33,
RealtyC36,RealtyC42,RealtyC43,RealtyC44,
RealtyC61,RealtyJ23,RealtyB43,
realtyH31,realtyH33,realtyH41,
realtyD81,realtyD27,
realtyD95,
Car4ss63,Car4ss64,Car4ss65,RealtyC42B,RealtyH12,RealtyH13,
RealtyH23,RealtyH32,RealtyH42,RealtyH43,Car4ss62,RealtyJA2,RealtyJA3,RealtyJA4,
realtyPro,realtyUse,Car4ss106,area,Car4ss102,Car4ss66,Car4ss67,RealtyE41,
RealtyA32A,RealtyA32B,RealtyA32C,RealtyA32D,RealtyA32E,realtyE22,ExitPrompt,
Ver,Car4ss101,RealtyJ23A;
//2
procedure Tmainform.JudgeAndAdjust;
var
i,Formeri,Lstr:integer;
begin
Label11.Caption:=TheCaption;
SpaceNum:=((Width-wIcon-wButton*10-wButton)-Label11.Width) div 3;
if SpaceNum>=0 then
begin
ExpandString:=Concat(StringOfChar(' ',SpaceNum),TheCaption);
self.Caption:=ExpandString;
end
else
begin
Timer2.Enabled:=False;
Lstr:=Length(TheCaption);
i:=0;Formeri:=i;
Label11.Caption:='...';
while (Label11.Width<(Width-wIcon-wButton*10-wButton)) and (i<Lstr) do
begin
Formeri:=i;
if Ord(TheCaption[Lstr-i])>127 then
Inc(i);
Inc(i);
Label11.Caption:=Concat('...',Copy(TheCaption,Lstr-(i-1),i));
end;
self.Caption:=Concat('...',Copy(TheCaption,Lstr-(Formeri-1),Formeri));
end;
end;
procedure Tmainform.CaptionRotateLeft();
var
Tstr:String;
Lstr:Integer;
begin
Tstr:=ExpandString;
Lstr:=Length(Tstr);
if Ord(Tstr[RIndex])>127 then
begin
self.Caption:=Concat(Copy(Tstr,RIndex+2,Lstr-RIndex-1),Copy(Tstr,1,RIndex+1));
Inc(RIndex);
end
else
self.Caption:=Concat(Copy(Tstr,RIndex+1,Lstr-RIndex),Copy(Tstr,1,RIndex));
Inc(RIndex);
if RIndex>Lstr then
RIndex:=1;
end;
procedure getStructure(TreeView1: TTreeView);
var
Query,query1:TADOQuery;
i,ii,iii:integer;
FirstNode,Node,tmpNode,tmpNode1,tmpN,tmpN1: TTreeNode;
sNum,s,s1:string;
begin
treeview1.images:=mainform.ImageList1;
FirstNode := treeview1.Items.GetFirstNode;
Node:=treeview1.Items.AddChild(firstNode,'所有組織機構');
Node.ImageIndex:=1;
Query:=TADOQuery.Create(nil);
Query.Connection:=DataModuleADO.ADOConnection1;
Query1:=TADOQuery.Create(nil);
Query1.Connection:=DataModuleADO.ADOConnection1;
i:=0;
Query.SQL.Add('select top 1 * from 組織機構 order by level1 desc');
Query.Open ;
if query.RecordCount > 0 then i:=Query.FieldByName('level1').AsInteger;
if i>0 then
begin
for ii:=1 to i do
begin
query.SQL.Clear;
Query.SQL.Add('select * from 組織機構 where level1='+inttostr(ii));
Query.Open ;
while not query.Eof do
begin
if ii=1 then
begin
sNum:=query.fieldbyname('名稱').Value;
tmpN:=treeview1.Items.AddChild(Node,sNum);
tmpN.ImageIndex:=1;
end
else
begin
for iii:=0 to TreeView1.Items.Count-1 do
begin
if TreeView1.Items[iii].Text = Query.FieldByName('所屬機構').Value then
begin
tmpNode:=treeview1.Items[iii];
sNum:=query.fieldbyname('名稱').Value;
tmpN:=treeview1.Items.AddChild(tmpNode,sNum);
break;
end;
end;
end;
query.Next;
end;
end;
end;
treeview1.FullExpand;
query.SQL.Clear;
Query.SQL.Add('select * from 組織機構 where level1=1');
Query.Open ;
while not query.Eof do
begin
for iii:=0 to TreeView1.Items.Count-1 do
begin
if TreeView1.Items[iii].Text = Query.FieldByName('名稱').Value then
begin
treeview1.Items[iii].Expanded:=false;
end;
end;
query.Next;
end;
Treeview1.Items[0].Selected := True;
//TreeView1Click(Sender);
end;
Function Tmainform.getPodo(str1,str2:String):bool;
var
Query:TADOQuery;
s:string;
b:bool;
begin
b:=false;
Query:=TADOQuery.Create(nil);
Query.Connection:=DataModuleADO.ADOConnection1;
Query.SQL.Add('select * from 操作員權限 where 操作權限='''+'Y'+''' and 操作員='''+czy+''' and 功能類別='''+str1+''' and 功能名稱='''+str2+'''');
Query.Open ;
if query.RecordCount>0 then b:=true
else showmessage('操作權限不夠。');
query.close;
query.free;
result:=b;
end;
function HtmlHelpA (hwndcaller:Longint; lpHelpFile:string;
wCommand:Longint;dwData:string): HWND;
stdcall; external 'hhctrl.ocx';
procedure Tmainform.showChmHelp(sTopic:string);
Const HH_DISPLAY_TOPIC=0;
var i:integer;
begin
i:=HtmlHelpA(Application.Handle,Pchar(ExtractFileDir(application.exename)+'\hhh.chm'),HH_DISPLAY_TOPIC,sTopic);
if i=0 then
begin
showmessage('help.chm 幫助文件不存在或者文件格式損壞!');
exit;
end;
end;
procedure Tmainform.OutputExcel(ListView1: TListView);
var
bm: TBookmark;
col, row: Integer;
sline: String;
mem: TMemo;
ExcelApp: Variant;
begin
Screen.Cursor := crHourglass;
ExcelApp := CreateOleObject('Excel.Application');
ExcelApp.WorkBooks.Add(xlWBatWorkSheet);
ExcelApp.WorkBooks[1].WorkSheets[1].Name := 'Grid Data';
mem := TMemo.Create(Self);
mem.Visible := false;
mem.Parent := MainForm;
mem.Clear;
sline := '';
for col:= 0 to listview1.Columns.Count-1 do
if col=listview1.Columns.Count-1 then sline := sline + listview1.Column[col].Caption
else sline := sline + listview1.Column[col].Caption + #9;
mem.Lines.Add(sline);
for row := 0 to listview1.Items.Count-1 do
begin
sline := '';
for col := 0 to listview1.Columns.Count-1 do
if col=0 then sline := sline + listview1.Items[row].Caption +#9
else if col=listview1.Columns.Count-1 then sline := sline + listview1.Items[row].SubItems[col-1]
else sline := sline + listview1.Items[row].SubItems[col-1]+#9;
mem.Lines.Add(sline);
end;
mem.SelectAll;
mem.CopyToClipboard;
begin
ExcelApp.Workbooks[1].WorkSheets['Grid Data'].Paste;
ExcelApp.Visible := true;
end;
FreeAndNil(mem);
Screen.Cursor := crDefault;
end;
function getDS(s1:string):string;
var
s,s2:string;
begin
s:=s1;
s2:=s1;
s:=mainform.StdInt(s1);
if s='0' then
begin
s:=s1;
if length(s)=1 then
begin
if not (s[1] in ['a'..'z','A'..'Z']) then
begin
s2:='';
end;
end
else s2:='';
end;
Result:=s2;
end;
function getStatus(ss:string):string;
var
s,s1,s2,s3,sStatus:string;
begin
//Edit3.Text:= chr(65);
//Edit4.Text:= inttostr(ord(s[1]));
s1:=ss;
s:=mainform.StdInt(ss);
sStatus:='';
//數字
if s<>'0' then
begin
//01
if (copy(s1,1,1)='0') and (length(s1)>1) then
begin
sStatus:='1';
end;
//001
if (copy(s1,1,2)='00') and (length(s1)>2) then
begin
sStatus:='2';
end;
//0001
if (copy(s1,1,3)='000') and (length(s1)>3) then
begin
sStatus:='3';
end;
//00001
if (copy(s1,1,4)='0000') and (length(s1)>4) then
begin
sStatus:='4';
end;
if (sStatus<>'1') and (sStatus<>'2') and (sStatus<>'3') and (sStatus<>'4') then
begin
sStatus:='0';
end;
end;
//字母
if (s='0') and (s1<>'0') then
begin
if length(s1)=1 then
begin
//A--Z a-z
if ((ord(s1[1])>=65) and (ord(s1[1])<91)) or ((ord(s1[1])>=97) and (ord(s1[1])<123))then
begin
sStatus:='5';
end;
end;
end;
Result:=sStatus;
end;
function Tmainform.getNum(s:string):string;
var
i:integer;
s1:string;
begin
s1:=s;
if s1='' then s1:='-';
i:=pos('--',s1);
if i<>0 then
s1:=copy(s1,1,i-1);
Result:=s1;
end;
function Tmainform.getLastName(s:string):string;
var
i,j:integer;
s1:string;
sStyle:array of string;
begin
s1:=s;
if s1='' then s1:='-';
i:=pos('--',s1);
j:=length(s1);
if i<>0 then
s1:=copy(s1,i+2,j);
Result:=s1;
end;
function Tmainform.ClearLine(s:string):string;
var
i,j:integer;
s1,s2:string;
begin
s1:=s;
if s1='' then s1:='-';
i:=pos('--',s1);
if i<>0 then
begin
s1:=copy(s1,1,i-1);
j:=length(s);
s2:=copy(s,i+1,j);
s1:=s1+s2;
end;
Result:=s1;
end;
function Tmainform.getPY(hzchar:string):string;
var
i,j,k,l:integer;
charstr:array of char;
s,s1,hz:string;
str:string;
Query:TADOQuery;
begin
if hzchar = '' then exit;
Query:=TADOQuery.Create(nil);
Query.Connection:=DataModuleADO.ADOConnection1;
str:=hzchar ;
SetLength(charstr,length(str)) ;
for J:=1 to length(str) do
begin
charstr[J-1]:=str[J];
end;
k:= length(hzchar);
s:='';
i:=1;
while i<length(hzchar)+1 do
begin
if(ord(charstr[i-1])) > 128 then
begin
l := i+1;
if l < k+1 then
begin
hz:=Copy(hzchar,i,2);
query.sql.clear;
Query.SQL.Add('select * from sysdef where A1=''' + hz + '''');
Query.Open ;
if query.RecordCount > 0 then s1:=Query.FieldByName('A2').Value
else s1:='';
s:=s+s1;
i:=i+2;
end
else
begin
if (ord(charstr[i-1])>96) and (ord(charstr[i-1])<123) then s:=s+charstr[i-1];
if (ord(charstr[i-1])>64) and (ord(charstr[i-1])<91) then s:=s+charstr[i-1];
if (ord(charstr[i-1])>47) and (ord(charstr[i-1])<58) then s:=s+charstr[i-1];
if ord(charstr[i-1])=32 then s:=s+charstr[i-1];
i:=i+1;
end;
end
else
begin
if (ord(charstr[i-1])>96) and (ord(charstr[i-1])<123) then s:=s+charstr[i-1];
if (ord(charstr[i-1])>64) and (ord(charstr[i-1])<91) then s:=s+charstr[i-1];
if (ord(charstr[i-1])>47) and (ord(charstr[i-1])<58) then s:=s+charstr[i-1];
if ord(charstr[i-1])=32 then s:=s+charstr[i-1];
i:=i+1;
end;
end;
result:= s;
end;
function Tmainform.getName(s1,s2:string):string;
var
Query:TADOQuery;
s:string;
begin
s:='-';
Query:=TADOQuery.Create(nil);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -