📄 browjzform.pas
字号:
if Panel3.Visible then
Panel3.Visible:=false
else
Panel3.Visible:=true;
end;
procedure Tbrownewjz.Panel10DblClick(Sender: TObject);
begin
application.CreateForm(Tjzbprintform,jzbprintform);
jzbprintform.hide;
jzbprintform.qr1.preview;
jzbprintform.Close;
jzbprintform.free;
end;
procedure Tbrownewjz.khDblClick(Sender: TObject);
var ls:string; aa:array[0..3] of string;
begin
if messagedlg('请插入IC卡!',mtwarning,[mbok,mbcancel],0)=mrok then
begin
ls:=read_ic;
if copy(ls,1,2)<>'ok' then
showmessage(ls)
else
begin
kh.Text:=trim(copy(ls,11,10));
getvalue(aa,'select 卡号,储值,消费,ic卡号 from hykmx where 卡号='''+trim(copy(ls,11,10))+'''');
kcz.Text:=trim(copy(ls,21,10));
kxf.Text:=trim(copy(ls,31,10));
kye.text:=floattostr(strtofloat(trim(copy(ls,21,10)))-strtofloat(trim(copy(ls,31,10))));
{ if aa[3]<>trim(copy(ls,3,8)) then
begin
showmessage('卡已挂失!');
kh.Text:='';
kye.text:='';
kcz.Text:='';
kxf.Text:='';
exit;
end; }
if aa[1]<>trim(copy(ls,21,10)) then
begin
showmessage('卡内储值金额不对!需要校对');
// ICKjd(aa[0],aa[1],aa[2]);
kh.Text:='';
kye.text:='';
kcz.Text:='';
kxf.Text:='';
exit;
end;
if aa[2]<>trim(copy(ls,31,10)) then
begin
showmessage('卡内消费金额不对!需要校对');
// ICKjd(aa[0],aa[1],aa[2]);
kh.Text:='';
kye.text:='';
kcz.Text:='';
kxf.Text:='';
exit;
end;
end;
end;
end;
procedure Tbrownewjz.skChange(Sender: TObject);
begin
if trim(sk.Text)='' then sk.Text:='0';
if trim(djq.Text)='' then djq.Text:='0';
if trim(djq.Text)='-' then exit;
ling.Text:=floattostr(strtofloat(jym.Text)+strtofloat(sk.Text)+strtofloat(djq.Text));
end;
procedure Tbrownewjz.khKeyPress(Sender: TObject; var Key: Char);
begin
key:=#0;
end;
procedure Tbrownewjz.kycChange(Sender: TObject);
begin
BitBtn7.Enabled:=(kyc.Text<>'');
end;
procedure Tbrownewjz.kycKeyPress(Sender: TObject; var Key: Char);
var ls:real;
begin
try
if key='-' then exit;
ls:=strtofloat(kyc.text+key);
except
key:=#0;
end;
end;
procedure Tbrownewjz.BitBtn7Click(Sender: TObject);
var dy:integer;
begin
{ dy:= ICKcz(strtofloat(kyc.Text),kh.text,czy.text,kcz.Text,kxf.Text);
if dy=-1 then showmessage('储值金额不对,请输入正确金额');
if dy=0 then
begin
showmessage('储值完成');
kyc.Text:='';
khExit(nil);
end;}
end;
procedure Tbrownewjz.BitBtn2Click(Sender: TObject);
var i:integer; str1,str2,str3,str4,str5,str6:string;
begin
str1:='消费单号:';
str2:='消费单号:';
str3:='消费单号:';
str4:='消费单号:';
str5:='消费单号:';
str6:='消费单号:';
Query1.Active:=false;
Query1.sql.Clear;
Query1.SQL.Add('delete jzdtemp ');
Query1.sql.Add('insert into jzdtemp select cusname,(select isnull(sum(cusprice*cusnum),0) from custom where substring(cuscode,1,2)=custype.custype');
Query1.sql.Add(' and accno='''+trim(paccount)+''') as ymoney,');
Query1.sql.Add('(select isnull(sum(money),0) from custom where substring(cuscode,1,2)=custype.custype and isxj=0 and ismd=0 ');
Query1.sql.Add(' and accno='''+trim(paccount)+''') as smoney');
Query1.sql.Add(' from custype where parentcode=''0'' or parentcode=''00''');
if mcs.Text<>'0' then
Query1.sql.Add('union (select ''免超时'' as cusname,-'+mcs.Text+' as ymoney ,-'+mcs.Text+' as smoney)');
if jj.Text<>'0' then
Query1.sql.Add('union (select ''加收'' as cusname,'+jj.Text+' as ymoney,'+jj.Text+' as smoney)');
if mm.Text<>'0' then
Query1.sql.Add('union (select ''免收'' as cusname,-'+mm.Text+' as ymoney,-'+mm.Text+' as smoney)');
Query1.SQL.Add('delete jzdtemp where ymoney=0 and smoney=0');
if mxf.Checked then
Query1.SQL.Add('update jzdtemp set smoney=0');
Query1.ExecSQL;
Query1.Active:=false;
Query1.sql.Clear;
application.CreateForm(Tjyxfdprint,jyxfdprint);
jyxfdprint.fh.Caption:=fh;
jyxfdprint.djdh.Caption:=djdh.Caption;
jyxfdprint.syym.Caption:=curper.name;
jyxfdprint.hykh.Caption:=kh.Text;
jyxfdprint.ysff.Caption:=floattostr(room+san+strtofloat(rcsm.Text)+strtofloat(scsm.Text));
if mfj.Checked then
jyxfdprint.ssff.Caption:='0'
else
jyxfdprint.ssff.Caption:=floattostr(strtofloat(rm.Text)+strtofloat(sm.Text)+strtofloat(rcsm.Text)+strtofloat(scsm.Text));
jyxfdprint.yjmoney.Caption:=rmb(strtofloat(yjm.Text));
// jyxfdprint.ssmoney.Caption:=rmb(strtofloat(jym.Text));
jyxfdprint.jzfs.Caption:=jzfsname.Text;
jyxfdprint.ldsj.Caption:=formatdatetime('yyyy''年''MM''月''dd''日'' hh:mm',now);
jyxfdprint.rzsj.Caption:=rzsj;
jyxfdprint.rs.Caption:=inttostr(rs);
jyxfdprint.QRLabel1.Caption:=curper.sydw+'消费单';
jyxfdprint.ysh.Caption:=jyxfdprint.ysff.Caption;
jyxfdprint.ssh.Caption:=jyxfdprint.ssff.Caption;
Query1.Active:=false;
Query1.sql.Clear;
Query1.SQL.Add('select * from jzdtemp ');
Query1.Open;
while not Query1.Eof do
begin
jyxfdprint.ysh.Caption:=floattostr(strtofloat(jyxfdprint.ysh.Caption)+Query1.Fields[1].AsFloat);
// jyxfdprint.ssh.Caption:=floattostr(strtofloat(jyxfdprint.ssh.Caption)+Query1.Fields[2].AsFloat);
Query1.Next;
end;
jyxfdprint.ssh.Caption:=floattostr(int(strtofloat(jyxfdprint.ssh.Caption)+0.5));
Query1.Active:=false;
Query1.sql.Clear;
query1.SQL.Add('select distinct djcode from custom where accno='''+paccount+'''');
query1.Prepare;
query1.Open;
i:=1;
while not query1.Eof do
begin
if i<=5 then str1:=str1+','+query1.Fields[0].AsString;
if (i>5)and(i<=10) then str2:=str2+','+query1.Fields[0].AsString;
if (i>10)and(i<=15) then str3:=str3+','+query1.Fields[0].AsString;
if (i>15)and(i<=20) then str4:=str4+','+query1.Fields[0].AsString;
if (i>20)and(i<=25) then str5:=str5+','+query1.Fields[0].AsString;
if (i>25)and(i<=30) then str6:=str6+','+query1.Fields[0].AsString;
i:=i+1;
query1.Next;
end;
jyxfdprint.xfdh1.caption:=str1;
jyxfdprint.xfdh2.caption:=str2;
jyxfdprint.xfdh3.caption:=str3;
jyxfdprint.xfdh4.caption:=str4;
jyxfdprint.xfdh5.caption:=str5;
jyxfdprint.xfdh6.caption:=str6;
jyxfdprint.ssh.Caption:=ym.text;//floattostr(strtofloat(jyxfdprint.ssh.Caption)+Query1.Fields[2].AsFloat);
jyxfdprint.ssmoney.Caption:=rmb(strtofloat(jyxfdprint.ssh.Caption));
jyxfdprint.Query1.Active:=true;
jyxfdprint.hide;
if dy.Checked then
jyxfdprint.QuickRep1.print
else
jyxfdprint.QuickRep1.Preview;
jyxfdprint.Close;
jyxfdprint.free;
{ application.CreateForm(Tjyxfdprint,jyxfdprint);
jyxfdprint.hide;
if dy.Checked then
jyxfdprint.QuickRep1.print
else
jyxfdprint.QuickRep1.Preview;
jyxfdprint.Close;
jyxfdprint.free;
}
end;
procedure Tbrownewjz.kczKeyPress(Sender: TObject; var Key: Char);
begin
key:=#0;
end;
procedure Tbrownewjz.N1Click(Sender: TObject);
begin
fm.Query2.Active:=false;
fm.Query2.SQL.Clear;
fm.Query2.SQL.Add('select * from GuestMx where accno='''+paccount+''' and roomno='''+q2.Fields[0].AsString+'''');
fm.Query2.Open;
if trim(fm.Query2.fieldbyname('name').asstring)<>'' then
begin
Application.CreateForm(Tbkzlform, bkzlform);
bkzlform.name.Text:=fm.Query2.fieldbyname('name').asstring;
bkzlform.roomno.Text:=fm.Query2.fieldbyname('roomno').asstring;
bkzlform.age.Text:=fm.Query2.fieldbyname('Age').asstring;
bkzlform.zj.Text:=fm.Query2.fieldbyname('zj').asstring;
bkzlform.id.Text:=fm.Query2.fieldbyname('zjid').asstring;
bkzlform.workdw.Text:=fm.Query2.fieldbyname('WorkUnit').asstring;
bkzlform.rmmoney.Visible:=false;
bkzlform.zd.Visible:=false;
bkzlform.rs.Visible:=false;
bkzlform.Label5.Visible:=false;
bkzlform.Label6.Visible:=false;
bkzlform.ShowModal;
bkzlform.Free;
end;
fm.Query2.Active:=false;
fm.Query2.SQL.Clear;
end;
procedure Tbrownewjz.FormShow(Sender: TObject);
begin
if (not xfhdno.Enabled) and (trim(xfhdno.text)<>'') then xfhdnoExit(nil);
end;
procedure Tbrownewjz.N2Click(Sender: TObject);
begin
Application.CreateForm(TgzdwForm, gzdwForm);
gzdwForm.showmodal;
gzdwForm.free;
gzno.Text:=dzdwunit.zhhao+' '+dzdwunit.danwei;
end;
procedure Tbrownewjz.gznoChange(Sender: TObject);
begin
if trim(gzno.Text)<>'' then
dbgrid1.SetFocus;
end;
procedure Tbrownewjz.mxfClick(Sender: TObject);
begin
if ((Sender as TCheckBox)=mfj) then
begin
if (mfj.Checked) then str:=str+',选免房费' else
str:=str+',取消免房费';
end;
if ((Sender as TCheckBox)=mxf) then
begin
if (mxf.Checked) then str:=str+',选免消费' else
str:=str+',取消免消费';
end;
if zk.Value<>100 then CheckBox1.Checked:=false;
zk.Enabled:=CheckBox1.Checked;
// if czy1.Caption<>'' then
// mxffjval ;
// else begin
// if (bbzz0=1)and((Sender as TCheckBox)=mxf) then exit;
// if (bbzz1=1)and((Sender as TCheckBox)=mfj) then exit;
// if (bbzz2=1)and((Sender as TCheckBox)=CheckBox1) then exit;
// if (Sender as TCheckBox).Checked=false then exit;
{ Application.CreateForm(Tqxrzform, qxrzform);
qxrzform.showmodal;
if qxrzform.name.Caption<>'' then czy1.Caption:=qxrzform.name.Caption;
qxrzform.free;
if (czy1.Caption='')then
begin
if (Sender as TCheckBox)=mxf then mxf.Checked:=false;
if (Sender as TCheckBox)=mfj then mfj.Checked:=false;
if (Sender as TCheckBox)=CheckBox1 then CheckBox1.Checked:=false;
end
else }
mxffjval;
{ if (not mxf.Checked) or (not mxf.Checked) then
begin
jzfsname.ItemIndex:=0;
jzfs.ItemIndex:=0;
jzfsname.Text:=jzfsname.Items[jzfsname.ItemIndex];
end; }
// end;
// mcs.Enabled:=(czy1.Caption<>'');
end;
procedure Tbrownewjz.BitBtn8Click(Sender: TObject);
begin
if trim(kh.Text)<>'' then
begin
application.CreateForm(ThykdyForm,hykdyForm);
hykdyForm.QRLabel3.Caption:=kh.Text;
hykdyForm.QRLabel5.Caption:=kcz.Text;
hykdyForm.QRLabel12.Caption:=ym.Text;
hykdyForm.QRLabel7.Caption:=kxf.Text;
hykdyForm.QRLabel15.Caption:=kye.Text;
hykdyForm.QRLabel9.Caption:=floattostr(strtofloat(kye.Text)-strtofloat(ym.Text));
hykdyForm.QRLabel10.Caption:=curper.sydw;
hykdyForm.QRLabel13.Caption:=curper.code;
hykdyForm.hide;
if dy.Checked then
hykdyForm.QuickRep1.print
else
hykdyForm.QuickRep1.Preview;
hykdyForm.Close;
hykdyForm.free;
end;
end;
procedure Tbrownewjz.CheckBox2Click(Sender: TObject);
begin
if CheckBox2.Checked then
begin
query3.Active:=false;
query3.SQL.Clear;
query3.SQL.Add('select roomno,roomprice,truntime from nowin where accno=:paccno and istime=0');
query3.SQL.Add('union (select handno,roomprice,turntime from changeroom where accno=:paccno and istime=0)');
query3.ParamByName('paccno').asstring:=paccount;
query3.Prepare;
query3.Open;
while not query3.Eof do
begin
query4.Active:=false ;
query4.SQL.Clear;
query4.SQL.Add('update nowin set roomprice=(select max(vipprice12) from roomtype where roomtype=(select max(roomtype) from room1 where roomno=:proom)) where truntime=''12'' and roomno=:proom');
query4.SQL.Add('update nowin set roomprice=(select max(vipprice24) from roomtype where roomtype=(select max(roomtype) from room1 where roomno=:proom)) where truntime=''24'' and roomno=:proom');
query4.SQL.Add('update changeroom set roomprice=(select max(vipprice12) from roomtype where roomtype=(select max(roomtype) from room1 where roomno=:proom)) where turntime=''12'' and handno=:proom');
query4.SQL.Add('update changeroom set roomprice=(select max(vipprice24) from roomtype where roomtype=(select max(roomtype) from room1 where roomno=:proom)) where turntime=''24'' and handno=:proom');
query4.ParamByName('proom').asstring:=query3.fields[0].asstring;
query4.Prepare;
query4.ExecSQL;
query3.Next;
end;
end else
begin
query3.Active:=false;
query3.SQL.Clear;
query3.SQL.Add('select roomno,roomprice,truntime from nowin where accno=:paccno and istime=0');
query3.SQL.Add('union (select handno,roomprice,turntime from changeroom where accno=:paccno and istime=0)');
query3.ParamByName('paccno').asstring:=paccount;
query3.Prepare;
query3.Open;
while not query3.Eof do
begin
query4.Active:=false ;
query4.SQL.Clear;
query4.SQL.Add('update nowin set roomprice=(select max(price) from roomtype where roomtype=(select max(roomtype) from room1 where roomno=:proom)) where truntime=''12'' and roomno=:proom');
query4.SQL.Add('update nowin set roomprice=(select max(roomprice) from roomtype where roomtype=(select max(roomtype) from room1 where roomno=:proom)) where truntime=''24'' and roomno=:proom');
query4.SQL.Add('update changeroom set roomprice=(select max(price) from roomtype where roomtype=(select max(roomtype) from room1 where roomno=:proom)) where turntime=''12'' and handno=:proom');
query4.SQL.Add('update changeroom set roomprice=(select max(roomprice) from roomtype where roomtype=(select max(roomtype) from room1 where roomno=:proom)) where turntime=''24'' and handno=:proom');
query4.ParamByName('proom').asstring:=query3.fields[0].asstring;
query4.Prepare;
query4.ExecSQL;
query3.Next;
end;
end;
BitBtn4Click(nil);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -