📄 dataproc.pas
字号:
fm.Query4.ParamByName('pbmdm').asstring:=bmdm;
fm.Query4.ParamByName('pjsr').asstring:=jsr;
fm.Query4.ParamByName('pdjh').asstring:=djh;
fm.Query4.ParamByName('pjsfs').asinteger:=jsfs;
fm.Query4.ParamByName('pdqh').asstring:=dqh;
fm.Query4.ParamByName('pdwdm').asstring:=dwdm;
fm.Query4.ParamByName('pfphm').asstring:=fphm;
fm.Query4.ParamByName('pfprq').asdatetime:=fprq;
fm.Query4.ParamByName('pywbh').asstring:=ywbh;
fm.Query4.ParamByName('psl').asCurrency:=sl[i];
fm.Query4.ParamByName('pdj').asCurrency:=dj[i];
fm.Query4.ParamByName('pwb').asCurrency:=wb[i];
fm.Query4.ParamByName('phl').asCurrency:=hl[i];
fm.Query4.ParamByName('pczy').asstring:=curper.name;
fm.Query4.ParamByName('pid').asCurrency:=id;
fm.Query4.Prepare;
fm.Query4.ExecSQL;
end;
end;
fm.Query4.Active:=false;
fm.Query4.SQL.Clear;
cwpz:=0;
end;
function yysrpz(pzrq,pzlx,zy:string;kmdm,bmdm:array of string;jje,dje:array of Currency;ts:integer):integer;
var i,id:integer; jf,df:Currency;
begin
jf:=0;df:=0;
for i:=0 to ts do
begin
jf:=jf+jje[i];df:=df+dje[i];
end;
if jf<>df then
begin
yysrpz:=1;
exit;
end;
yysrpz:=2;
fm.Query4.Active:=false;
fm.Query4.SQL.Clear;
fm.Query4.SQL.Add('select max(id) from pazgs');
fm.Query4.Open;
id:=fm.Query4.Fields[0].AsInteger+1;
for i:=0 to ts do
begin
if trim(kmdm[i])<>'' then
begin
fm.Query4.Active:=false;
fm.Query4.SQL.Clear;
fm.Query4.SQL.Add('insert into pazgs (bz,pzrq,pzlx,pzh,zy,kmdm,j,d,bmdm,czy,id)');
fm.Query4.SQL.Add(' values(0,:ppzrq,:ppzlx,:ppzh,:pzy,:pkmdm,:pjje,:pdje,:pbmdm,:pczy,:pid)');
fm.Query4.ParamByName('ppzrq').asstring:=pzrq;
fm.Query4.ParamByName('ppzh').asstring:=inttostr(id);
fm.Query4.ParamByName('ppzlx').asstring:=pzlx;
fm.Query4.ParamByName('pzy').asstring:=zy;
fm.Query4.ParamByName('pkmdm').asstring:=kmdm[i];
fm.Query4.ParamByName('pbmdm').asstring:=bmdm[i];
fm.Query4.ParamByName('pjje').asfloat:=jje[i];
fm.Query4.ParamByName('pdje').asfloat:=dje[i];
fm.Query4.ParamByName('pczy').asstring:=curper.name;
fm.Query4.ParamByName('pid').asfloat:=id;
fm.Query4.Prepare;
fm.Query4.ExecSQL;
end;
end;
fm.Query4.Active:=false;
fm.Query4.SQL.Clear;
yysrpz:=0;
end;
procedure addlogo(code:string;dt:string;de:string);
VAR TT:TREGISTRY;
ls:string;
begin
TT:=TREGISTRY.CREATE;
TT.ROOTKEY:=HKEY_LOCAL_MACHINE;
if tt.openkey('system\currentcontrolset\control\computername\computername',false) then
ls:=tt.readstring('computername');
tt.free;
fm.query1.close;
fm.query1.RequestLive:=false;
fm.query1.sql.clear;
fm.Query1.sql.add('insert into logo values(:cc,:dd,:ss,:mm)');
fm.query1.ParamByName('cc').asstring:=code;
fm.query1.ParamByName('dd').asdatetime:=strtodatetime(dt);
fm.query1.ParamByName('ss').asstring:=de;
fm.query1.ParamByName('mm').asstring:=ls;
fm.query1.prepare;
fm.query1.ExecSQL;
fm.query1.Close;
fm.Query1.UnPrepare;
fm.query1.RequestLive:=false;
// fm.query1.RequestLive:=TRUE;
end;
function ICKcz(je,sjje:real;kh,jsr,cz,xf:string):integer;
var ls:string;
begin
if je=0 then
begin
ICKcz:=-1;
exit;
end;
if messagedlg('请插入IC卡!',mtwarning,[mbok,mbcancel],0)=mrok then
begin
ls:=w_ic(kh,floattostr(strtofloat(cz)+je),xf);
if ls<>'ok' then
begin
showmessage(ls);
ICKcz:=-2;
exit;
end
else
begin
fm.Query2.Active:=false;
fm.Query2.SQL.Clear;
fm.Query2.SQL.Add('update hykmx set 储值=储值+'+floattostr(je)+' where 卡号='''+kh+'''');
fm.Query2.SQL.Add('insert into hykczmx values('''+kh+''',:pdate,'+floattostr(je)+','+floattostr(sjje)+','''+jsr+''','''')');
fm.Query2.ParamByName('pdate').asdatetime:=now;
fm.Query2.Prepare;
fm.Query2.ExecSQL;
ICKcz:=0;
showmessage('写卡成功');
end;
end
else
begin
showmessage('取消写卡');
ICKcz:=-3;
exit;
end;
end;
{function ICKcz(je:real;kh,jsr,cz,xf:string):integer;
var ls:string;
begin
if je=0 then
begin
ICKcz:=-1;
exit;
end;
if messagedlg('请插入IC卡!',mtwarning,[mbok,mbcancel],0)=mrok then
begin
ls:=w_ic(kh,floattostr(strtofloat(cz)+je),xf);
if ls<>'ok' then
begin
showmessage(ls);
ICKcz:=-2;
exit;
end
else
begin
showmessage('写卡成功');
end;
end
else
begin
showmessage('取消写卡');
ICKcz:=-3;
exit;
end;
fm.Query2.Active:=false;
fm.Query2.SQL.Clear;
fm.Query2.SQL.Add('update hykmx set 储值=储值+'+floattostr(je)+' where 卡号='''+kh+'''');
fm.Query2.SQL.Add('insert into hykczmx values('''+kh+''',:pdate,'+floattostr(je)+','''+jsr+''','''')');
fm.Query2.ParamByName('pdate').asdatetime:=now;
fm.Query2.Prepare;
fm.Query2.ExecSQL;
ICKcz:=0;
end;}
function ICKxf(je:real;kh,jsr,xfdz,djcode,cz,xf:string):integer;
var ls:string;
begin
if je<=0 then
begin
Result:=-1;
exit;
end;
if messagedlg('请插入IC卡!',mtwarning,[mbok,mbcancel],0)=mrok then
begin
ls:=w_ic(kh,cz,floattostr(strtofloat(xf)+je));
if ls<>'ok' then
begin
showmessage(ls);
Result:=-2;
exit;
end
else
begin
fm.Query2.Active:=false;
fm.Query2.SQL.Clear;
fm.Query2.SQL.Add('update hykmx set 消费=消费+'+floattostr(je)+' where 卡号='''+kh+'''');
fm.Query2.SQL.Add(' insert into hykxfmx values('''+kh+''',:pdate,'''+djcode+''','''+xfdz+''','+floattostr(je)+','''+jsr+''','''')');
fm.Query2.ParamByName('pdate').asdatetime:=now;
fm.Query2.Prepare;
fm.Query2.ExecSQL;
Result:=0;
showmessage('写卡成功');
end;
end
else
begin
showmessage('取消写卡');
Result:=-3;
exit;
end;
end;
{function ICKxf(je:real;kh,jsr,djcode,cz,xf:string):integer;
var ls:string;
begin
if je<=0 then
begin
ICKxf:=-1;
exit;
end;
if messagedlg('请插入IC卡!',mtwarning,[mbok,mbcancel],0)=mrok then
begin
ls:=w_ic(kh,cz,floattostr(strtofloat(xf)+je));
if ls<>'ok' then
begin
showmessage(ls);
ICKxf:=-2;
exit;
end
else
begin
showmessage('写卡成功');
end;
end
else
begin
showmessage('取消写卡');
ICKxf:=-3;
exit;
end;
fm.Query2.Active:=false;
fm.Query2.SQL.Clear;
fm.Query2.SQL.Add('update hykmx set 消费=消费+'+floattostr(je)+' where 卡号='''+kh+'''');
fm.Query2.SQL.Add(' insert into hykxfmx values('''+kh+''',:pdate,'''+djcode+''','+floattostr(je)+','''+jsr+''','''')');
fm.Query2.ParamByName('pdate').asdatetime:=now;
fm.Query2.Prepare;
fm.Query2.ExecSQL;
ICKxf:=0;
end; }
procedure allunlock(wd:string);
begin
fm.Query2.Active:=false;
fm.Query2.SQL.Clear;
fm.Query2.SQL.Add('delete lockacc where wdno='''+wd+'''');
fm.Query2.ExecSQL;
showmessage('解锁成功');
end;
function getnewcode(code:string):string;
begin
fm.newcode.StoredProcName:='';
if code='accno' then fm.newcode.StoredProcName:='GetNewAccNo;1';
if code='welid' then fm.newcode.StoredProcName:='GetNewWel;1';
if code='djno' then fm.newcode.StoredProcName:='GetNewDjno;1';
if code='Beforeid' then fm.newcode.StoredProcName:='GetNewBeforeid;1';
if fm.newcode.StoredProcName<>'' then
begin
fm.newcode.Prepare;
fm.newcode.ExecProc;
getnewcode:=fm.newcode.Params[1].AsString;
fm.newcode.UnPrepare;
end
else
getnewcode:='';
end;
function pyjc(hz:string):string;
var i:integer; ls:string;
begin
i:=1;
ls:='';
while i<=length(hz) do
begin
if ord(hz[i])<128 then
begin
ls:=ls+hz[i];
i:=i+1;
continue;
end;
if ord(hz[i])*1000+ord(hz[i+1])<=176196 then
begin
ls:=ls+'A';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=178192) then
begin
ls:=ls+'B';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=180237) then
begin
ls:=ls+'C';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=182233) then
begin
ls:=ls+'D';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=183161) then
begin
ls:=ls+'E';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=184192) then
begin
ls:=ls+'F';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=185253) then
begin
ls:=ls+'G';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=187246) then
begin
ls:=ls+'H';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=191165) then
begin
ls:=ls+'J';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=192177) then
begin
ls:=ls+'K';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=194231) then
begin
ls:=ls+'L';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=196194) then
begin
ls:=ls+'M';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=197181) then
begin
ls:=ls+'N';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=197189) then
begin
ls:=ls+'O';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=198217) then
begin
ls:=ls+'P';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=200186) then
begin
ls:=ls+'Q';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=200245) then
begin
ls:=ls+'R';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=203249) then
begin
ls:=ls+'S';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=205216) then
begin
ls:=ls+'T';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=206243) then
begin
ls:=ls+'W';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=209184) then
begin
ls:=ls+'X';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=212208) then
begin
ls:=ls+'Y';
i:=i+2;
continue;
end;
if (ord(hz[i])*1000+ord(hz[i+1])<=215249) then
begin
ls:=ls+'Z';
i:=i+2;
continue;
end;
i:=i+1;
end;
pyjc:=ls;
end;
procedure Tfm.DataModuleCreate(Sender: TObject);
var ls:pchar;k:cardinal;
begin
shortdateformat:='yyyy-MM-dd';
ls:=stralloc(60);
getcurrentdirectory(60,ls);
k:=60;
curper.workpath:=StrPas(ls);
getcomputername(ls,k);
curper.workjsj:=StrPas(ls);
ls:=stralloc(60);
getsystemdirectory(ls,100);
curper.sysdir:=StrPas(ls);
end;
procedure cleargrid(gridname:TStringGrid;starcol:integer);
var
lsrow,lscol:integer;
begin
lsrow:=1;
while lsrow<gridname.rowcount do
begin
lscol:=starcol;
while lscol<gridname.colcount do
begin
gridname.cells[lscol,lsrow]:='';
lscol:=lscol+1;
end;
lsrow:=lsrow+1;
end;
end;
Function roommoney(rmno:string;isbj,iszd:integer):integer;
var
aa,bb:array [0..3] of string;
begin
aa[0]:='';
bb[0]:='';
getvalue(aa,'select roomtype from room where roomno='''+trim(rmno)+'''');
getvalue(bb,'select Price,Zdprice from roomtype where roomtype='''+trim(aa[0])+'''');
if (iszd=0) then
result:=strtoint(trim(bb[0]));
if (iszd=1) then
result:=strtoint(trim(bb[1]));
end;
Procedure addoldcom(combo:TComboBox;nr,db:string);
begin
combo.Items.Clear;
fm.Query1.Active:=false;
fm.Query1.SQL.Clear;
fm.Query1.SQL.Add('select distinct '+nr+' from '+db);
fm.Query1.Open;
while not fm.Query1.Eof do
begin
combo.Items.Add(fm.Query1.Fields[0].AsString);
fm.Query1.Next;
end;
fm.Query1.Active:=false;
fm.Query1.SQL.Clear;
combo.Text:='';
end;
procedure servertime(Sender: TObject);
var lls:_systemtime;
begin
shortdateformat:='yyyy-MM-dd';
fm.Query5.Active:=false;
fm.Query5.sql.clear;
fm.Query5.sql.add('SELECT DATEADD(hour,-8,GETDATE())');
fm.Query5.prepare;
fm.Query5.Open;
lls.wYear:=strtoint(formatdatetime('yyyy',fm.Query5.Fields[0].asdatetime));
lls.wMonth:=strtoint(formatdatetime('MM',fm.Query5.Fields[0].asdatetime));
lls.wDay:=strtoint(formatdatetime('dd',fm.Query5.Fields[0].asdatetime));
lls.wHour:=strtoint(formatdatetime('hh',fm.Query5.Fields[0].asdatetime));
lls.wMinute:=strtoint(copy(formatdatetime('hh:mm',fm.Query5.Fields[0].asdatetime),4,2));
lls.wSecond:=strtoint(formatdatetime('ss',fm.Query5.Fields[0].asdatetime));
setsystemtime(lls);
end;
function ICKjd(kh,cz,xf:string):integer;
var ls:string;
begin
ls:=w_ic(kh,floattostr(strtofloat(cz)),xf);
if ls<>'ok' then
begin
showmessage(ls);
ICKjd:=-2;
exit;
end
else
begin
showmessage('校对成功!');
end;
ICKjd:=0;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -