?? global.pas
?? Barcode And LabelPrint
?? PAS
字號:
??
{//標題:服裝MRP系統
//內容:總調用聲明,函數,過程等
//修改:
}
unit Global;
interface
uses Forms, Base, fcTreeView, ADODB, SysUtils;
const
c_Company = '漢科軟件';
c_AppTitle = '紡織制衣業管理系統';
c_AppType = ' 紡織,成衣';
{$IFDEF DEMO}
c_AppEdition = '試用版';
c_Day = 30;
{$ENDIF}
{$IFDEF 1.0}
c_AppEdition = '簡單版';
{$ENDIF}
{$IFDEF 2.0}
c_AppEdition = '標準版';
{$ENDIF}
{$IFDEF 3.0}
c_AppEdition = '增強版';
{$ENDIF}
{標準屏幕寬度}
c_ScreenWidth = 800;
c_ScreenHeight = 600;
{通信消息標識}
c_Msg = 'MSG';
c_Connect = 'Connect';
c_Close = 'Close';
c_DisConnect = 'Disconnect';
c_OpenAccount = 'OpenAccount';
{局域,遠程標識}
c_Lan = 'Lan';
c_Remote = 'Rem';
{權限Check表示符}
c_Check = '+';
c_UnCheck = '-';
{用于樹型結構}
C_CharArray = 'ABCDEFGH';
{星期數組}
sWeek: array[1..7] of string = ('日', '一', '二', '叁', '四', '五', '六');
type
TBaseFormClass = class of TfrmBase;
var
G_iUserID, G_iDepID: integer; {用戶內部ID,所屬部門內部ID}
G_sUserCode, G_sUserName, G_sDepName: string; {用戶代碼,用戶名,所屬部門名}
G_bAdmin, G_bTakeEffect: Boolean; {是否超級用戶,帳套是否啟用}
G_iAccountID: integer; {當前打開的帳套ID}
G_sPWD: string; {用戶密碼}
G_sSpace: string; {局域網/遠程}
G_bAppEnabled: Boolean; {程序是否可使用}
{$IFDEF DEMO}
G_StartDate: Double; {可用天數}
{$ENDIF}
function GFTreeFindItem(NodeItem: TfcTreeNode; TreeView: TfcTreeView; Name: string): TfcTreeNode;
{新建節點}
function GFTreeAddItem(eCount: Integer; bCheck: Boolean;
Query: TADOQuery; var TreeView: TfcTreeView): TfcTreeNode;
function SyRMB(NN: Real): string; {把小寫數字轉換成大寫金額}
{創建Normal窗口}
procedure ShowNormalForm(FormClass: TBaseFormClass; ParentFrom: TForm;
ModuleID: Integer; FunctionName: string; var Form: TForm);
{創建Modal窗口}
procedure ShowModalForm(FormClass: TFormClass; ParentFrom: TForm; var Form: TForm);
implementation
{創建Normal窗口}
procedure ShowNormalForm(FormClass: TBaseFormClass; ParentFrom: TForm; ModuleID: Integer; FunctionName: string; var Form: TForm);
begin
if not Assigned(Form) then
Form := FormClass.CreateWithFunction(ParentFrom, ModuleID, FunctionName);
Form.Show;
end;
{創建Modal窗口}
procedure ShowModalForm(FormClass: TFormClass; ParentFrom: TForm; var Form: TForm);
begin
if not Assigned(Form) then
Form := FormClass.Create(ParentFrom);
Form.ShowModal;
end;
function GFTreeFindItem(NodeItem: TfcTreeNode; TreeView: TfcTreeView; Name: string): TfcTreeNode;
begin
//得到子節點
if NodeItem = nil then
NodeItem := TreeView.Items.GetFirstNode
else
NodeItem := NodeItem.GetFirstChild;
//判斷是否是要找的節點,否則繼續找下一個同級節點,直到找到或找完為止
if (NodeItem <> nil) and (NodeItem.text <> Name) then
repeat
NodeItem := NodeItem.GetNextSibling;
until (NodeItem = nil) or (NodeItem.text = Name);
Result := NodeItem;
end;
function GFTreeAddItem(eCount: Integer; bCheck: Boolean;
Query: TADOQuery; var TreeView: TfcTreeView): TfcTreeNode;
var
ThisNode, Node: TfcTreeNode;
I: Integer;
sName: string;
pID: ^Integer;
begin
Node := nil;
//歷遍當前數組
for I := 1 to eCount do
begin
sName := Query.FieldbyName(C_CharArray[i] + 'Name').asString;
if Trim(sName) = '' then
Break;
New(pID);
pID^ := Query.FieldbyName(C_CharArray[i] + 'ID').asInteger;
ThisNode := GFTreeFindItem(node, TreeView, sName);
if ThisNode <> nil then
Node := ThisNode //如果找到,繼續找下一個字符串的節點
else
begin
if I = 1 then //根節點
Node := TreeView.items.AddObject(Node, sName, pID)
else //子節點
begin
Node := TreeView.items.AddChildObject(Node, sName, pID);
if bCheck then Node.CheckboxType := tvctCheckbox;
end;
end;
end;
Result := Node;
end;
function SyRMB(NN: Real): string; //將數據轉換為大寫金額
var
HZ, NS, NW, NA, N1, N2: string;
LA, X, Nk: Integer;
begin
if NN > 9999999999999.99 then
begin
HZ := '金額溢出';
Result := HZ;
exit;
end;
if NN = 0 then
begin
HZ := '零元';
result := HZ;
exit;
end; //if
NS := '零壹貳叁肆伍陸柒捌玖';
NW := '分角元拾佰仟萬拾佰仟億拾佰仟萬';
NA := FloatToStr(NN * 100);
LA := length(NA);
X := 1;
HZ := '';
while X <= LA do
begin
NK := Ord(NA[x]) - Ord('0');
N1 := Copy(NS, NK * 2 + 1, 2);
N2 := Copy(NW, LA * 2 + 1 - X * 2, 2);
if (NK = 0) and ((N2 = '億') or (N2 = '萬') or (N2 = '元')) then
begin
if copy(HZ, Length(HZ) - 1, 2) = '零' then
HZ := copy(HZ, 1, length(HZ) - 2);
if copy(HZ, Length(HZ) - 1, 2) = '億' then
if N2 = '元' then
begin
N1 := N2;
N2 := '零';
end
else
N2 := ''
else
begin
N1 := N2;
N2 := '零';
end
end
else if NK = 0 then
begin
if copy(HZ, length(HZ) - 1, 2) = '零' then
N1 := '';
if N2 = '分' then
begin
if copy(HZ, length(HZ) - 1, 2) = '零' then
HZ := copy(HZ, 1, length(HZ) - 2) + '整'
else
HZ := HZ + '整';
N1 := '';
end;
N2 := '';
end;
HZ := HZ + N1 + N2;
X := X + 1
end;
Result := HZ;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -