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

📄 global.pas

📁 这是一个实用的软件
💻 PAS
字号:
//********************************//
//  模块:公用函数                 //
//  设计:杨凌      2005.06.20    //
//                                //
//********************************//
unit Global;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB, Grids, DBGrids,registry;

function getcode(tmp:string):string;
function getpy(hzchar:string):Char;
procedure updatedate;



var tmpname:string;

implementation

uses  dataform, KC_table, cg_master, pubdata;







function getcode(tmp:string):string;
begin
   fData.Global.Close;
   fData.Global.SQL.Clear;
   fData.Global.SQL.Add('select fcode from '+ tmpname +' where (fcode like '+''''+'%'+FormatDateTime('yyyymmdd',Date())+'%'+''''+') and( fcode like '+''''+'%'+tmp+'%'+''''+')');
   fData.Global.Open;
    if fData.Global.RecordCount>0 then
       begin
       fData.Global.Close;
       fData.Global.SQL.Clear;
       fData.Global.SQL.Add('select max(fcode) as temp from '+ tmpname +' where (fcode like '+''''+'%'+FormatDateTime('yyyymmdd',Date())+'%'+''''+') and( fcode like '+''''+'%'+tmp+'%'+''''+')');
       fData.Global.Open;
         if fData.Global.RecordCount>0   then
            begin
            //有记录
            Result:=tmp+IntToStr(StrToInt64(Copy(fData.Global['temp'],3,11))+1);
            end
       end
       else
       begin
       //无记录
       Result:=tmp+FormatDateTime('yyyymmdd',Date())+'001';
       end;
end;


procedure updatedate;
 var i:Integer;
  begin
       //刷新对照表
          with fpubdata do
           begin
             for i:= 0 to ComponentCount-1 do
               begin
               if Components[i] is TADOTable then
                 begin
                  (Components[i] as TADOTable).active:=false;
                  (Components[i] as TADOTable).active:=true;
                 end
               else
                 if Components[i] is TADOQuery then
                    begin
                      if ((Components[i] as TADOQuery).name<>'Qexecsql') and ((Components[i] as TADOQuery).name<>'Qsearch') then
                        begin
                         (Components[i] as TADOQuery).active:=false;
                         (Components[i] as TADOQuery).active:=true;
                        end;
                    end
               end;
           end;
   end;

function getpy(hzchar:string):Char;
begin
case WORD(hzchar[1]) shl 8 + WORD(hzchar[2]) of
$B0A1..$B0C4 : result := 'A';
$B0C5..$B2C0 : result := 'B';
$B2C1..$B4ED : result := 'C';
$B4EE..$B6E9 : result := 'D';
$B6EA..$B7A1 : result := 'E';
$B7A2..$B8C0 : result := 'F';
$B8C1..$B9FD : result := 'G';
$B9FE..$BBF6 : result := 'H';
$BBF7..$BFA5 : result := 'J';
$BFA6..$C0AB : result := 'K';
$C0AC..$C2E7 : result := 'L';
$C2E8..$C4C2 : result := 'M';
$C4C3..$C5B5 : result := 'N';
$C5B6..$C5BD : result := 'O';
$C5BE..$C6D9 : result := 'P';
$C6DA..$C8BA : result := 'Q';
$C8BB..$C8F5 : result := 'R';
$C8F6..$CBF9 : result := 'S';
$CBFA..$CDD9 : result := 'T';
$CDDA..$CEF3 : result := 'W';
$CEF4..$D188 : result := 'X';
$D1B9..$D4D0 : result := 'Y';
$D4D1..$D7F9 : result := 'Z';
else
result := char(32);
end;
end;



end.

⌨️ 快捷键说明

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