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

📄 basevar.pas

📁 财务软件:功能尚可,基于UML设计开发的delphi系统,文档齐全
💻 PAS
字号:
unit BaseVar;

interface

uses
  AccessDB,FdmMain ,Config,forms,SysUtils,Account,AccountCode;

var
  gAccessDB:IAccessDB ;
  AppConfig:TConfig;
  AppPath:String;
  IniFileName:String;
  vConnectionString:string;
  CurYear:Integer;
  CurPeriod:Integer;

  //定义科目代码访问类
  //科目代码访问
  gCodeAccess:TAccountCodeProxy;
  gCode:TAccountCode;
  //凭证访问
  gAccount:TAccount;
  gAccountAccess:TAccountProxy;

  UCode,UName,UDep,UPwd,UOther,UTmp:String;
  CodeStruct:string;

const
  RegSession:string='TinsFinance';
  SystemName:string='天翔财务';
  SepStr:String='-';

//用于接口的基础资料表
  DEPTABLE:String='V_Dep';
  CLIENTTABLE:string='V_Client';
  GOODSTABLE:string='V_Goods';
  CLERKTABLE:string='V_Clerk';

//取某年某月的最后一天
function GetLastDay(vYear, vMonth: Integer): Integer;
function GetString(s,se:String;n:Integer):String;
function Replacing(S,source,target:string):string; //替换指定字符串

//初始化系统
procedure InitSys;
//结束系统
procedure DestroySys;

implementation


function GetLastDay(vYear, vMonth: Integer): Integer;
var
  vd:TDateTime;
begin
  //TODO:取某年某月的最后一天
  try
      vd := EncodeDate(vYear, vMonth, 1);         //本月1号
      vd := IncMonth(vd, 1);                  //下月1号
      vd := vd - 1;                           //下月1号的前1天
  except
      vd := 0;
  end;
  Result :=StrToInt(FormatDateTime('d',vd));
end;

function GetString(s,se:String;n:Integer):String;
var
  rs:String;
  i,j:Integer;
begin
  i:=0;
  rs:='';
  if n=1 then
  begin
    while s[i]<>se do
    begin
      rs:=rs+s[i];
      i:=i+1;
    end;
    result:=trim(rs);
    exit;
  end;
  j:=1;
  i:=0;
  rs:='';
  while j<>n do
  begin
    while s[i]<>se do i:=i+1;
    while s[i]=' ' do i:=i+1;
    I:=I+1;
    j:=j+1;
  end;
//  I:=I+1;
  while (s[i]<>se) and (i<=Length(s)) do
  begin
    rs:=rs+s[i];
    i:=i+1;
  end;
  result:=trim(rs);
  exit;

end;

function Replacing(S,source,target:string):string;
var
	 site,StrLen:integer;
begin
	{source在S中出现的位置}
	site:=pos(source,s);
  while site<>0 do
  begin
  	{source的长度}
	  StrLen:=length(source);
	  {删除source字符串}
	  delete(s,site,StrLen);
	  {插入target字符串到S中}
	  insert(target,s,site);
    site:=pos(source,s);
  end;
  {返回新串}
	replacing:=s;
end;

procedure InitSys;
begin
  AppConfig:=TIniConfig.create(RegSession,IniFileName);
  vConnectionString:=AppConfig.ReadSetting('ConnString','Provider=SQLOLEDB.1;Persist Security Info=True;User ID=sa;Initial Catalog=Finance;Data Source=.');
  //创建数据连接
  Application.CreateForm(TdmMain,dmMain);
  gAccessDB:=TAccessSQL.Create(dmMain.conMain);
  //凭证信息
  CurYear:=StrToInt(dmMain.GetSysInfo('当前会计年度'));
  CurPeriod:=StrToInt(dmMain.GetSysInfo('当前会计期间'));

  //创建数据连接
  //创建科目代码访问
  gCodeAccess:=TAccountCodeProxy.Create(gAccessDB);
  gCode:=TAccountCode.Create;
  //创建凭证访问
  gAccount:=TAccount.Create;
  gAccountAccess:=TAccountProxy.Create(gAccessDB);


  //设置科目代码结构
  CodeStruct:=dmMain.GetSysInfo('科目结构') ;
  //缺省测试数据
  //TODO:使用Login
  UCode:='888888';
  UName:='Administrator';

end;

procedure DestroySys;
begin
  AppConfig.Free;
end;


end.

⌨️ 快捷键说明

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