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

📄 commfun.pas.svn-base

📁 这是一个功能齐全的,代码完整的ERP企业信息管理系统,现在上传和大家分享
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
unit CommFun;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, StdCtrls, CommCtrl, DBGrids, DB, DBTables, menus, Registry,
  Wwintl, Buttons, Extctrls, dbctrls, Wait, SYSDATA, ComObj, ActiveX,
  dxDBGrid, wwfltdlg, wwDialog, Wwlocate, ADODB, dxTL, dxDBCtrl, dxDBTL, IniFiles,
  ShellApi, WinInet, atScript, atPascal, ActnList, StrUtils, IdGlobal, DateUtils,
  winsock, fr_Class, FR_DBSet, HwSelReport, ShlObj;
       
type
  //硬盘ID号
  TSrbIoControl = packed record
    HeaderLength: ULONG;
    Signature: array[0..7] of Char;
    Timeout: ULONG;
    ControlCode: ULONG;
    ReturnCode: ULONG;
    Length: ULONG;
  end;
  SRB_IO_CONTROL = TSrbIoControl;
  PSrbIoControl = ^TSrbIoControl;

  TIDERegs = packed record
    bFeaturesReg: Byte; // Used for specifying SMART "commands".
    bSectorCountReg: Byte; // IDE sector count register
    bSectorNumberReg: Byte; // IDE sector number register
    bCylLowReg: Byte; // IDE low order cylinder value
    bCylHighReg: Byte; // IDE high order cylinder value
    bDriveHeadReg: Byte; // IDE drive/head register
    bCommandReg: Byte; // Actual IDE command.
    bReserved: Byte; // reserved.  Must be zero.
  end;
  IDEREGS = TIDERegs;
  PIDERegs = ^TIDERegs;

  TSendCmdInParams = packed record
    cBufferSize: DWORD;
    irDriveRegs: TIDERegs;
    bDriveNumber: Byte;
    bReserved: array[0..2] of Byte;
    dwReserved: array[0..3] of DWORD;
    bBuffer: array[0..0] of Byte;
  end;
  SENDCMDINPARAMS = TSendCmdInParams;
  PSendCmdInParams = ^TSendCmdInParams;

  TIdSector = packed record
    wGenConfig: Word;
    wNumCyls: Word;
    wReserved: Word;
    wNumHeads: Word;
    wBytesPerTrack: Word;
    wBytesPerSector: Word;
    wSectorsPerTrack: Word;
    wVendorUnique: array[0..2] of Word;
    sSerialNumber: array[0..19] of Char;
    wBufferType: Word;
    wBufferSize: Word;
    wECCSize: Word;
    sFirmwareRev: array[0..7] of Char;
    sModelNumber: array[0..39] of Char;
    wMoreVendorUnique: Word;
    wDoubleWordIO: Word;
    wCapabilities: Word;
    wReserved1: Word;
    wPIOTiming: Word;
    wDMATiming: Word;
    wBS: Word;
    wNumCurrentCyls: Word;
    wNumCurrentHeads: Word;
    wNumCurrentSectorsPerTrack: Word;
    ulCurrentSectorCapacity: ULONG;
    wMultSectorStuff: Word;
    ulTotalAddressableSectors: ULONG;
    wSingleWordDMA: Word;
    wMultiWordDMA: Word;
    bReserved: array[0..127] of Byte;
  end;
  PIdSector = ^TIdSector;

  TFileInfo = packed record
    CommpanyName: string;
    FileDescription: string;
    FileVersion: string;
    InternalName: string;
    LegalCopyright: string;
    LegalTrademarks: string;
    OriginalFileName: string;
    ProductName: string;
    ProductVersion: string;
    Comments: string;
    VsFixedFileInfo:VS_FIXEDFILEINFO;
    UserDefineValue:string;
  end;
{
  PFixedFileInfo = ^TFixedFileInfo;
  TFixedFileInfo = record
     dwSignature       : DWORD;
     dwStrucVersion    : DWORD;
     wFileVersionMS    : WORD;  // 次版本号
     wFileVersionLS    : WORD;  // 主版本号
     wProductVersionMS : WORD;  // 建立次数(build)
     wProductVersionLS : WORD;  // 发行次数(release)
     dwFileFlagsMask   : DWORD;
     dwFileFlags       : DWORD;
     dwFileOS          : DWORD;
     dwFileType        : DWORD;
     dwFileSubtype     : DWORD;
     dwFileDateMS      : DWORD;
     dwFileDateLS      : DWORD;
  end; // TFixedFileInfo
}

  DWORD_PTR = ^DWORD;

  PCustomerInfo = ^TCustomerInfo;
  TCustomerInfo = record
    CustNo : Integer;  //客户电脑编号
    CustCode : string;  //客户编号
    CustName : string;  //客户名称
    CustShort : string;  //客户简称
    CustAddress : string;  //交货地址
    CustEmail : string;  //客戶电邮
    CustContact : string;  //联系人名
    CustPosition : string;  //职务名称
    CustPhone : string;  //电话号码
    CustFax : string;  //传真号码
  end;

  PCustItemInfo = ^TCustItemInfo;
  TCustItemInfo = record
    Reference:String;     //控制器号
    InstallDate:TDateTime;  //安装日期
    StartDate:TDateTime;  //免费保养开始日期
    EndDate:TDateTime;  //免费保养结束日期
    FromDate:TDateTime;  //收费保养开始日期
    ToDate:TDateTime;  //收费保养结束日期
  end;

  POrderInfo = ^TOrderInfo;
  TOrderInfo = record
    CustNo : Integer;      //客户编号
    SaleNo : Integer;      //销售员号
    RegionNo : Integer;    //交货地区
    OrderDate : TDateTime; //定单日期
    CurrNo : Integer;      //币别编号
    ItemNo : Integer;      //料品编号
    UnitNo : Integer;      //计量单位
    OrderQty : Double;     //定单数量
    LineSumAmt : Double;   //定单行销售总额
    LineDisAmt : Double;   //定单行总折扣额
    ChargeAmt : Double;    //特殊费用
    OrdDisAmt : Double;    //定单总折扣额
    IsSumDis : Boolean;    //总额折扣
    IsOrderDis : Boolean;  //定单折扣
    InvAmount : Boolean;   //发票金额
  end;

  PPriceInfo = ^TPriceInfo;
  TPriceInfo = record
    StdPrice : Double;  //标准价格
    OrderAmt : Double;  //定单金额
    OrdPrice : Double;  //折后价格
    DisRate : Double;   //折扣比率
    DisAmt : Double;    //折扣金额
    NetAmt : Double;    //折后金额
    TaxRate: Double;    //销售税率
    TaxAmount: Double;  //销售税额
    Amount : Double;    //总额
    IsBySum : Boolean;  //是否依据总额计价
  end;

  PItemInfo = ^TItemInfo;
  TItemInfo = record
    ItemNo : Integer;    //料品电脑编号
    ItemID : String;     //料品编号
    ItemName : String;   //料品名称
    ItemSpec : String;   //规格型号
    UnitNo : Integer;    //计量单位电脑编号
    UnitID : String;     //计量单位编号
    UnitName : String;   //计量单位名称
    ItemNum:double;
    OrderNo : String;    //来源单号
    LineNo : Integer;    //来源行号
    OtherNo:string;      //其他编号
    COrder:string;       //客户订单编号
  end;

  PSpecInfo = ^TSpecInfo;
  TSpecInfo = record
    AType : Integer;
    AFromDate : TDateTime;
    AToDate : TDateTime;
    ACurr : String;
    AIsSum : Boolean;
    AItemNo : Integer;
    AItemClass : Integer;
    ACustNo : Integer;
    ACustClass : Integer;
    ACustGrade : Integer;
    ASaleNo : Integer;
    ASaleGrade : Integer;
    ARegionNo : Integer;
    AIsSame : Boolean;
    ARange : Integer;
    AAmtType : Integer;
  end;
  PLangInfo = ^TLangInfo;
  TLangInfo = record
    AFormName:string;
    AComponentName:string;
    AComponentCaption:string;
    APrefix:string;
    APostfix:string;
    ACode:string;
  end;

const
  dwCookie :DWORD = 0;

  IDE_ID_FUNCTION = $EC;
  IDENTIFY_BUFFER_SIZE = 512;
  DFP_RECEIVE_DRIVE_DATA = $0007C088;
  IOCTL_SCSI_MINIPORT = $0004D008;
  IOCTL_SCSI_MINIPORT_IDENTIFY = $001B0501;
  DataSize = sizeof(TSendCmdInParams) - 1 + IDENTIFY_BUFFER_SIZE;
  BufferSize = SizeOf(SRB_IO_CONTROL) + DataSize;
  W9xBufferSize = IDENTIFY_BUFFER_SIZE + 16;

var
  ADataSetName:string;  //数据集名称
  ARecord:array of Variant;

  //如果对话框被打开,则在指定时间后关闭,并在标题栏进行提示
  nWndCount: Integer = 0;
  SavWnds, SavWnds2: array of THandle;
  hDlgWnd: THandle = 0;
  hTimerk: Integer = 0;
  nTimerTick: Integer = 0;
  nLastTrk: Integer = 0;
  nDoHint: Integer = 0;
  nCapCt: Integer = 0;
  nSavCapt: String = '';
  fTimer1: TTimer = nil;

  //设置全局变量
  AUserID:Integer;
  AUserName:string;
  ASuper:Boolean;    //超级用户
  ACompanyID:string;
  ACompanyName:string;
  ALoginDate:TDateTime;
  ALogoutDate:TDateTime;
  AProgramID:string;
  AHostID:string;
  AServerName:string;   //服务器名称
  AFontName:string;
  ACharset:string;  //字符集

  AKeyColor:TColor;     //关键字段字体颜色
  AKeyStyle:TFontStyles;  //关键字段字体类型 [fsBold],[fsItalic],[fsUnderline]
  ADateFormat:array[0..11] of string;   //日期格式
  AQtyFormat:array[0..5] of string;  //数量格式
  APriceFormat:array[0..5] of string;  //单价格式
  AAmountFormat:array[0..5] of string;  //金额格式
  ARateFormat:array[0..5] of string;  //汇率格式
  ANegaFormat:array[0..1] of string;  //负数格式
  ANegaColor:TColor;  //负数字体颜色
  AAlterTime:Integer;  //预警时间间隔(秒)
  ALanguageID:integer;   //语言编号(2052=简体中文,1028=繁体中文,1033=英文)

  ADemoFlag:Boolean;     //True=演示版,False=正式版
  APackageHandle:TStringList;
  AContainsUnit:TStringList;    //包文件中所包含的单元文件
  AImgHandle:THandle;
  ARegPath:string;   //注册表路径
  AFileName:string;  //数据库文件
  AHandle:THandle;
  ALangTable:string;  //语言表
  AHelpFile:string;  //帮助文件
  ADatabase:Integer;  //0=Access, 1=SQL Server

  HHControlInstance:THandle=0;
  HtmlHelpA:function( hwndCaller:HWND; pszFile:PChar; uCommand:UINT; dwData:DWORD_PTR ):HWND;stdcall;

  AStartTime:Double;  //开始时间
  ARunTime:Double;  //执行时间
  ASystemDate:array[0..9] of Char;  //系统日期格式
  ASystemPath:string;  //系统路径
  AVerPath:string;  //版本路徑

  AIsSaveReg:Boolean;  //是否保存界面信息到注册表

  AUpdateMain:Boolean;  //是否更新程序 Ture=更新
  AOEM:Boolean;  //是否OEM版本  如果是OEM版本则帮助菜单中的与浩晖公司相关的菜单不显示
  AIsExit:Boolean;  //直接退出系统
  AModule:string;  //模块编号

  AStatusNo:String;  //已完成数量统计包含的状态
  AByTotal:string;  //按照“申报日期”统计任务计划的总数量
  AByFinish:string;  //按照“实际完成日期”统计任务计划的完成数量

  ARegUsers:Integer;  //注册用户总数量

  AVersion:string;  //版本号
  AHome:string;    //官方网站
  AEmail:string;   //作者邮箱

  ACurrNo:Integer;  //本位币号
  ACurrID,ACurrName:string;  //本位币=币别编号,本位币=币别名称

  AReportTitle:string;  //报表名称

  AIsUpgrade:Boolean;  //在线升级中

  arXlsBegin: array[0..5] of Word = ($809, 8, 0, $10, 0, 0);
  arXlsEnd: array[0..1] of Word = ($0A, 00);
  arXlsString: array[0..5] of Word = ($204, 0, 0, 0, 0, 0);
  arXlsNumber: array[0..4] of Word = ($203, 14, 0, 0, 0);
  arXlsInteger: array[0..4] of Word = ($27E, 10, 0, 0, 0);
  arXlsBlank: array[0..4] of Word = ($201, 6, 0, 0, $17);

  ADisableColor:TColor=$00DDDDDD;  //编辑柜失效时的颜色
  AEnableColor:TColor=clWindow;  //编辑柜有效时的颜色
  AFormColor:TColor=clBtnFace;  //窗口的颜色


//开启窗体函数
procedure OpenForm(InstanceClass: TComponentClass; var Reference);
//开启MDICHILD子窗体过程
procedure OpenChildForm(AFormClass:TFormClass;AForm:TComponent);
//错误信息显示
function ShowMsg(AMsg:string;AType:Integer=0):Integer;
//显示确认对话框
function ShowDialog(AMsg:string;AType:Integer=0;DEFBUTTON:Integer=MB_DEFBUTTON2):Integer;
//防止程序执行两次 注意主窗体的CAPTION不能和APPLICATION。TITLE相同
procedure CheckInstance(AProgram:string);
//创建新的数据库别名
procedure NewAlias(AliasName:string);
//复制记录
procedure CopyRecord(ADataSet:TDataSet);
//粘贴记录
procedure PasteRecord(ADataSet:TDataSet);
//字符串加密函数
function Encrypt(AStr:String):String;
//字符串解密函数
function Decrypt(AStr:String):String;

//取得某月的第一天的日期
function GetMonthFirstDate(ADate:TDate):TDate;
//取得某月的最后一天的日期
function GetMonthEndDate(ADate:TDate):TDate;
//取得上月的第一天的日期
function GetLastMonthFirstDate(ADate:TDate):TDate;
//取得上月的最后一天的日期
function GetLastMonthEndDate(ADate:TDate):TDate;
//取得本季的第一天的日期
function GetSeasonFirstDate(ADate:TDate):TDate;
//取得本季的最后一天的日期
function GetSeasonEndDate(ADate:TDate):TDate;
//取得上季的第一天的日期
function GetLastSeasonFirstDate(ADate:TDate):TDate;
//取得上季的最后一天的日期
function GetLastSeasonEndDate(ADate:TDate):TDate;
//取得本年的第一天的日期
function GetYearFirstDate(ADate:TDate):TDate;
//取得本年的最后一天的日期
function GetYearEndDate(ADate:TDate):TDate;
//取得上年的第一天的日期
function GetLastYearFirstDate(ADate:TDate):TDate;
//取得上年的最后一天的日期
function GetLastYearEndDate(ADate:TDate):TDate;
//取得上年同期
function GetLastYearSameDate(ADate:TDate):TDate;

//检查输入是否数字
procedure ValidInteger(Sender: TObject; var Key: Char);
//检查输入是否浮点数
procedure ValidFloat(Sender: TObject; var Key: Char);
//计算注册码
function Registered(AHardWareNo,AProduct:string):string;
//取得本机的名称
function ComputerName:string;
//取得报表名称
function GetReportName(ARepName:string):string;
//取硬盘序列号
function GetHDSerialNumber:String;
//转换"N"为人民币大写
function Money_convert(N:Double):String;
//取得数据库中的字符串
function GetDBString(ID:String;AFlag:Integer=1):String;
//动态载入Package
function LoadPack(APackName:String):Boolean;
//创建Package中的Form
function CreateFormInPackage(AFormName:string;AParent:TPanel):TForm; overload;
//创建Package中的Form
function CreateFormInPackage(AFormName:string;AFlag:Boolean):Integer; overload;
//取系统参数

⌨️ 快捷键说明

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