⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 global.pas

📁 三层ERP系统 (SQL)
💻 PAS
字号:
unit Global;

interface

uses
  Windows, Messages, SysUtils, Sconnect, Forms, Variants, DBClient, Controls,
  inifiles,Types;

const
  m_showform = 'ShowForm';
  m_LockColumn = 'LockColumn';
  m_unLockColumn = 'unLockColumn';
  m_Close = 'Close';
  c_Succeed = 'Succeed';
  c_Failed = 'Failed';

var
  SaveApplication:TApplication;
  DllName:String;
  DLLSCT : TSocketConnection;
  DLLUcode:String;
  DLLCDS:TClientDataset;
  LockCount:integer;
  G_bAdmin:boolean;
  iModuleID:Integer;
  sFunctionName:String;
  FromInterface:String;
  Searchtiao:String;
  FormHandle:hwnd;
  CurrentDBName:String;
  ItemImages:String;
  ProductDATA:OleVariant;
  FormPrintName:string;
  SelectUnits:String;
  SelectUnitPrices:Double;
  ItemID:integer;
  UserSelectBillNo:String;



  function getnewname:String;
  function vartosql(value: variant): string;
  function cexecsql(const cmdStr: WideString): WordBool;
  function getscreenpoint(sender:Tcontrol):Tpoint;
  function csyslog(const fform, fevent: WideString): WordBool;
  function f_GetComputerName():String ;
  function CISunique(const TableName,MasterField,CheckValue:WideString):WordBool;
  function gs_GetAppPath:String;
  procedure SendDataToMain(handle:THandle;formname:String;IsDestry:integer=0);
  function SRNow():String;
  function space(len:integer):string;
  function MainApplicationHandle(MainFormName:String): HWND;
  function GetLogDir(RootDir:String):String;
  function getinnumber(pbilltypeid: Integer): integer;
  function getOutnumber(pbilltypeid: Integer): String;
  function syRmb(sourcemoney: real): widestring;
  procedure ShowModalForm(FormClass: TFormClass; ParentFrom: TForm; var Form: TForm);
  function WriteDraft(pStatus:Integer;pBillName,pBillNo,pBillSelfNo,pCompany,pRemark,pCreaUser:WideString):WordBool;
  function GetBillStatus(const pSqlTiao: WideString): OleVariant;

implementation

function getnewname:String;
var
  Newname:String;
  n:integer;
begin
  n:=1111+Random(9999-1111);
  Newname:=inttostr(n);
  Result:=Newname;
end;

function vartosql(value: variant): string;
begin
  if varisnull(value) then
    Result:='NULL'
    else
    case vartype(value) of
      vardate:
        Result:=Quotedstr(Datetimetostr(vartodatetime(value)));
      varString,varOlestr:
        Result:=Quotedstr(Trim(Vartostr(value)));
      varboolean:
        begin
          if value then
            result:='1'
            else
            result:='0';
        end;
      else
        Result:=quotedstr(Trim(Vartostr(value)));
     end;
end;

function f_GetComputerName():String ;
var
  CNameBuffer : PChar;
  fl_loaded : Boolean;
  CLen : ^DWord;
begin
   GetMem(CNameBuffer,255);
    New(CLen);
    CLen^:= 255;
    fl_loaded := GetComputerName(CNameBuffer,CLen^);
    if fl_loaded then
      Result := StrPas(CNameBuffer)
    else
      Result := 'Unkown';
    FreeMem(CNameBuffer,255);
    Dispose(CLen);
end;

function getscreenpoint(sender:Tcontrol):Tpoint;
var
  clientpoint:Tpoint;
begin
  clientpoint:=point(0,sender.Height);
  while sender.Parent<>nil do
    begin
      clientpoint:=point(sender.Left+clientpoint.X,sender.Top+clientpoint.Y);
      sender:=Sender.Parent;
    end;
  clientpoint:=sender.ClientToScreen(clientpoint);
  Result:=clientpoint;
end;

function cexecsql(const cmdStr: WideString): WordBool;
begin
  Result:=DLLSCT.AppServer.execsql(CurrentDBName,cmdstr);
end;

function csyslog(const fform, fevent: WideString): WordBool;
begin
  Result:=DLLSCT.AppServer.syslog(CurrentDBName,c_Succeed,fform,fevent,DLLUcode,f_GetComputerName());
end;

function CISunique(const TableName,MasterField,CheckValue:WideString):WordBool;
begin
  Result:=DLLSCT.AppServer.IsUnique(CurrentDBName,TableName,MasterField,CheckValue);
end;

function SRNow():String;
begin
  Result:=DllSCT.AppServer.GetServerTime;
end;

function gs_GetAppPath:String;
begin
  Result:=Extractfilepath(Application.ExeName);
end;

procedure SendDataToMain(handle:THandle;formname:String;IsDestry:integer=0);
Var
  ds:TCopyDataStruct;
  cFormName:String;
begin
  try
    cFormName :=formname;
    ds.cbData:=Length(cFormName)+1;
    ds.dwData := IsDestry;
    GetMem(ds.lpData,ds.cbData);
    strcopy(ds.lpData,Pchar(cFormName));
    SendMessage(FormHandle,WM_COPYDATA,handle,Cardinal(@ds));
  finally
    FreeMem(ds.lpData);
  end;
end;

function space(len:integer):string;
Var
  i:integer;
   sResult:string;
begin
for i := 1 to len do
   begin
   sResult := sResult + ' ';
   end;
   Result := sResult;
end;

function MainApplicationHandle(MainFormName:String): HWND;
var
  MainModule: HMODULE;
  CurrentPID: DWORD;
  WindowsPID: DWORD;
begin
  MainModule := GetModuleHandle(nil);
  CurrentPID := GetCurrentProcessID();

  Result := 0;
  while True do
  begin
    Result := FindWindowEx(0, Result, Pchar(MainFormName), nil);
    if (Result = 0) then Exit; // ゼт

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -