📄 browjzform.pas
字号:
end;
i:=1;
while i<= mangrid.RowCount do
begin
if length(trim(mangrid.Cells [0,i]))>0 then
mangrid.Cells [0,i]:='';
i:=i+1;
end;
i:=1;
while i<= womangrid.RowCount do
begin
if length(trim(womangrid.Cells [0,i]))>0 then
womangrid.Cells [0,i]:='';
i:=i+1;
end;
rmgrid.row:=1;
mangrid.row:=1;
womangrid.row:=1;
q2.Close;
str:='';
end;
end;
procedure seeother;
begin
with brownewjz do
begin
if man.Checked then
plssex:='1';
if woman.Checked then
plssex:='0';
q1.Active :=false;
q1.sql.clear;
q1.sql.add('select sex,accno,isleft,ismd from nowin where (handno=:phdno and sex=:psex)');
q1.ParamByName ('phdno').asstring:=trim(xfhdno.text);
q1.ParamByName ('psex').asstring:=plssex;
q1.Prepare;
q1.open;
paccount:=q1.fieldbyname('accno').asstring;
pleft:=q1.fieldbyname('isleft').asboolean;
pmd:=q1.FieldByName ('ismd').asboolean;
end
end;
procedure seemx;
begin
with brownewjz do
begin
n1.Enabled:=false;
if rmmx.Checked then
begin
q2.Active :=false;
q2.sql.clear;
q2.sql.add('select handno,s.sexname,begtime,acctime,istime,money,csmoney,num,roomprice,truntime,endtime from nowin,lssex s where ((accno=:paccno) and (nowin.sex=s.sex)) ');
q2.sql.add('union (select handno,s.sexname,begtime,acctime,istime,money,csmoney,0 as num,roomprice,turntime,endtime from changeroom,lssex s where ((accno=:pac) and (changeroom.sex=s.sex)) )');
q2.ParamByName ('paccno').asstring:=paccount;
q2.ParamByName ('pac').asstring:=paccount;
q2.Prepare;
q2.Open;
fh:='';
rs:=0;
while not q2.Eof do
begin
n1.Enabled:=true;
fh:=fh+q2.Fields[0].asstring+',';
rs:=rs+q2.Fieldbyname('num').asinteger;
q2.Next;
end;
q2.First;
chinesegrid(dbgrid1);
q2.active:=true;
end;
if xfmx.Checked then
begin
q2.Active :=false;
q2.sql.clear;
q2.sql.add('select custom.handno,lssex.sexname,cusitem.cusname,custom.cusprice,custom.cusnum,custom.money,custom.isxj,custom.ismd,custom.regtime,custom.djcode');
q2.sql.add(' from custom,cusitem,lssex where ((accno=:paccno) and (custom.cuscode=cusitem.cuscode) and (custom.sex=lssex.sex))');
q2.ParamByName ('paccno').asstring:=paccount;
q2.Prepare;
q2.Open;
chinesegrid(dbgrid1);
q2.active:=true;
end;
if (dhmx.Checked) and (trim(dhf.Text)<>'0') and (trim(dhf.Text)<>'') then
begin
q2.Active :=false;
q2.sql.clear;
q2.sql.add('select roomno,extension,begtime,address,phmoney,agnomen,fwf,hjmoney,dftel from phonedb where roomno in (select roomno from nowin where accno=:paccno) and begtime>=(select min(begtime) from nowin where accno=:paccno)');
q2.ParamByName ('paccno').asstring:=paccount;
q2.Prepare;
q2.Open;
chinesegrid(dbgrid1);
DBGrid1.fields[3].displaylabel:='时长';
dbgrid1.Columns[3].width:=30;
dbgrid1.Columns[5].width:=40;
dbgrid1.Columns[6].width:=40;
dbgrid1.Columns[4].width:=40;
dbgrid1.Columns[1].width:=40;
q2.active:=true;
end;
end;
end;
procedure mxffjval;
var j:integer;
begin
with brownewjz do
begin
//rm.text:=floattostr(room*zk.value/100);
// rcsm.text:=floattostr(roomcs*zk.value/100);
rm.text:=floattostr(room);
rcsm.text:=floattostr(roomcs);
hm.text:=floattostr(int((strtofloat(rm.text)+strtofloat(rcsm.text)+strtofloat(sm.text)+strtofloat(scsm.text)+strtofloat(xm.text)+strtofloat(dhf.Text))+0.5));
if ((not mxf.Checked ) and (not mfj.Checked )) then
begin
ym.text:=floattostr(strtofloat(hm.text)-strtofloat(mcs.text)-strtofloat(mm.text)+strtofloat(jj.text));
jym.text:=floattostr(strtofloat(yjm.text)-INT(strtofloat(ym.text)+0.5));
end;
if ((mxf.Checked) and (not mfj.Checked )) then
begin
ym.text:=floattostr(strtofloat(hm.text)-strtofloat(xm.text)-strtofloat(mcs.text)-strtofloat(mm.text)+strtofloat(jj.text));
jym.text:=floattostr(strtofloat(yjm.text)-int(strtofloat(ym.text)+0.5));
end;
if ((mfj.Checked ) and (not mxf.Checked )) then
begin
ym.text:=floattostr(strtofloat(xm.text)-strtofloat(mcs.text)-strtofloat(mm.text)+strtofloat(jj.text));
jym.text:=floattostr(strtofloat(yjm.text)-int(strtofloat(ym.text)+0.5));
end;
if ((mfj.Checked ) and (mxf.Checked )) then
begin
ym.text:='0';
jym.text:=floattostr(strtofloat(yjm.text)-int(strtofloat(ym.text)+0.5));
end;
if ((mfj.Checked ) and (mxf.Checked)) then
begin
jzfsname.Enabled :=false;
gzno.Enabled :=false;
jzfsname.Text:='免费';
for j:=0 to jzfsname.Items.Count do
if jzfsname.Items[j]=trim(jzfsname.text) then
jzfsname.ItemIndex:=j;
jzfs.ItemIndex:=jzfsname.ItemIndex;
jzfsname.TEXT:=jzfsname.Items[jzfsname.ItemIndex];
end
else
begin
// jzfsname.Enabled :=true;
if jzfsname.Text='免费' then
begin
gzno.Enabled :=false;
// jzfsname.Text:='现金';
// jzfs.text:='01';
end;
end;
ling.Text:=floattostr(strtofloat(jym.Text)+strtofloat(sk.Text)+strtofloat(djq.Text));
end;
{ for j:=0 to jzfsname.Items.Count do
if jzfsname.Items[j]=trim(jzfsname.text) then
jzfsname.ItemIndex:=j;
jzfs.ItemIndex:=jzfsname.ItemIndex;
jzfsname.TEXT:=jzfsname.Items[jzfsname.ItemIndex]; }
end;
procedure jjzz;
var
cus,yj:double;
begin
room:=0;
roomcs:=0;
san:=0;
sancs:=0;
// cus:=0;
// yj:=0;
with brownewjz do
begin
caljz.UnPrepare;
caljz.prepare;
caljz.ParamByName('@ihand').asstring:=trim(xfhdno.text);
caljz.ParamByName('@isex').asstring:=plssex;
caljz.ParamByName('@itime').asdatetime:=now;
// (maskedit1.text);
caljz.ParamByName('@ilftime').asdatetime:=strtodatetime(datetostr(lfdate.date)+' '+timetostr(lftime.time));
caljz.parambyname('@iiszd').asboolean:=false;
caljz.prepare;
caljz.ExecProc;
caljz.UnPrepare;
// room
q1.active:=false;
q1.sql.clear;
q1.sql.add('select roommoney=sum(money), roomcsmoney=sum(csmoney) from nowin where isbj=1 ');
q1.sql.add(' and accno=:pacc');
q1.parambyname('pacc').asstring:=trim(paccount);
q1.open;
room:=room+q1.fieldbyname('roommoney').asfloat;
roomcs:=roomcs+q1.fieldbyname('roomcsmoney').asfloat;
q1.active:=false;
q1.sql.clear;
q1.sql.add('select sum(money) as roommoney,sum(csmoney) as roomcsmoney from changeroom where accno=:pacc and isbj=1 ');
q1.parambyname('pacc').asstring:=trim(paccount);
q1.open;
room:=room+q1.fieldbyname('roommoney').asfloat;
roomcs:=roomcs+q1.fieldbyname('roomcsmoney').asfloat;
// san
q1.active:=false;
q1.sql.clear;
q1.sql.add('select sum(money) as sanmoney,sum(csmoney) as sancsmoney from nowin where accno=:pacc and isbj=0 ');
q1.parambyname('pacc').asstring:=trim(paccount);
q1.open;
san:=san+q1.fieldbyname('sanmoney').asfloat;
sancs:=sancs+q1.fieldbyname('sancsmoney').asfloat;
q1.active:=false;
q1.sql.clear;
q1.sql.add('select sum(money) as sanmoney,sum(csmoney) as sancsmoney from changeroom where accno=:pacc and isbj=0 ');
q1.parambyname('pacc').asstring:=trim(paccount);
q1.open;
san:=san+q1.fieldbyname('sanmoney').asfloat;
sancs:=sancs+q1.fieldbyname('sancsmoney').asfloat;
//cus
q1.active:=false;
q1.sql.clear;
q1.sql.add('select sum(money) as cusmoney from custom where (accno=:pacc and isxj=:pisxj and ismd=:pismd) ');
q1.parambyname('pacc').asstring:=trim(paccount);
q1.parambyname('pisxj').asboolean:=false;;
q1.parambyname('pismd').asboolean:=false;;
q1.open;
cus:=q1.fieldbyname('cusmoney').asfloat;
q1.active:=false;
q1.sql.clear;
q1.sql.add('select rzsj=min(begtime) from nowin where ');
q1.sql.add(' accno=:pacc');
q1.parambyname('pacc').asstring:=trim(paccount);
q1.open;
rzsj:=formatdatetime('yyyy''年''MM''月''dd''日'' hh:mm',q1.fieldbyname('rzsj').asdatetime);
{ q1.active:=false;
q1.sql.clear;
q1.sql.add('select sum(hjmoney) as phmoney from phonedb where roomno in (select roomno from nowin where accno=:pacc and ismd=:pismd) and begtime>=(select min(begtime) from nowin where accno=:pacc and ismd=:pismd)');
q1.parambyname('pacc').asstring:=paccount;
q1.parambyname('pismd').asboolean:=false;
q1.open;
dhf.Text:=floattostr(q1.fieldbyname('phmoney').asfloat);
q1.active:=false;
// deposit }
q1.sql.clear;
q1.sql.add('select sum(deposit) as deposit from deposit where accno=:pacc ');
q1.parambyname('pacc').asstring:=trim(paccount);
q1.open;
yj:=q1.fieldbyname('deposit').asfloat;
q1.active:=false;
q1.UnPrepare;
rcsm.text:=floattostr(roomcs);
sm.text:=floattostr(san);
scsm.text:=floattostr(sancs);
xm.text:=floattostr(cus);
yjm.text:=floattostr(yj);
mxffjval;
caljz.unprepare;
end;
end;
procedure Tbrownewjz.xfhdnoExit(Sender: TObject);
var
i:integer;
begin
formini;
if length(trim(xfhdno.Text))>0 then
begin
q1.Active :=false;
q1.sql.clear; //and sex=:psex
q1.sql.add('select accno,isleft,ismd,jzfs,zkl,djcode,sdjcode,ismxf,ismff,pzr from nowin where handno=:phdno ');
q1.ParamByName ('phdno').asstring:=trim(xfhdno.text);
if (GroupBox4.Visible) then
begin
if (man.Checked) then
plssex:='1';
if (woman.Checked) then
plssex:='0';
end
else
begin
if copy(xfhdno.Text,1,1)>'9' then
plssex:='3'
else
plssex:='2';
end;
// q1.ParamByName ('psex').asstring:=plssex;
q1.Prepare;
q1.open;
paccount:=trim(q1.fieldbyname('accno').asstring);
zk.Value:=q1.fieldbyname('zkl').asinteger;
czy1.Caption:=trim(q1.FieldByName('pzr').asstring);
// if (q1.FieldByName('ismxf').asboolean=true) then bbzz0:=1;
// if (q1.FieldByName('ismff').asboolean=true) then bbzz1:=1;
// if (q1.FieldByName('zkl').asinteger<>100) then bbzz2:=1;
mxf.Checked:=q1.FieldByName('ismxf').asboolean;
mfj.Checked:=q1.FieldByName('ismff').asboolean;
pleft:=q1.FieldByName('isleft').asboolean;
pmd:=q1.FieldByName('ismd').asboolean;
djdh.Caption:=q1.FieldByName('djcode').asstring;
djkh.Caption:=q1.FieldByName('sdjcode').asstring;
for i:=0 to jzfs.Items.Count-1 do
if trim(q1.fieldbyname('jzfs').asstring)=trim(jzfs.Items[i]) then
begin
jzfsname.ItemIndex:=i;
jzfs.ItemIndex:=i;
end;
jzfsname.TEXT:=jzfsname.Items[jzfsname.ItemIndex];
q1.Active :=false;
q1.sql.clear;
q1.sql.add('select roomno,num, xcode from nowin where accno='''+trim(paccount)+'''');
q1.Open;
while not q1.Eof do
begin
for i:=1 to q1.fieldbyname('num').asinteger do
hd.Text:=hd.Text+q1.fieldbyname('roomno').asstring+' ';
xd.Text:=xd.Text+q1.fieldbyname('xcode').asstring+' ';
q1.Next;
end;
q1.Active :=false;
q1.UnPrepare;
q1.sql.clear;
kh.SetFocus;
BitBtn4.SetFocus;
BitBtn4Click(nil);
end
else
if brownewjz.ActiveControl<>BitBtn3 then
xfhdno.setfocus;
end;
procedure Tbrownewjz.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=113 then
if Panel3.Visible then
Panel3.Visible:=false
else
Panel3.Visible:=true;
if key=112 then
begin
if xt=0 then help(22);
end;
if key=13 then
selectnext(activecontrol,true,true);
if key=27 then
close;
end;
procedure Tbrownewjz.FormCreate(Sender: TObject);
begin
shortdateformat:='yyyy-MM-dd';
czy.Text :=curper.name;
rmgrid.Cells [0,0]:='房间';
mangrid.cells[0,0]:='男散';
womangrid.cells[0,0]:='女散';
comadd(brownewjz.gzno,2,'select zhanghao,dwname from zhdb');
q1.Active :=false;
q1.sql.Clear ;
q1.sql.add('select * from mode');
q1.Prepare;
q1.open;
jzfsname.Items.Clear;
jzfs.Items.Clear;
while not q1.Eof do
begin
jzfs.Items.Add(q1.FieldByName('Code').asstring);
jzfsname.Items.Add(q1.FieldByName('name').asstring);
q1.Next;
end;
q1.Close;
q1.UnPrepare;
xfhdno.Text :='';
kh.Text:='';
formini;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -