📄 jb1.pas
字号:
sbqmf.Text:=q1.Fields[5].asstring;
i:=0;
for j:=0 to 5 do
i:=i+q1.Fields[bz].asfloat;
sbqhj.text:=floattostr(i);
bbjxj.Text:=q1.Fields[6].asstring;
bbjhy.Text:=q1.Fields[7].asstring;
bbjzp.Text:=q1.Fields[8].asstring;
bbjcard.Text:=q1.Fields[9].asstring;
bbjgz.Text:=q1.Fields[10].asstring;
bbjmf.Text:=q1.Fields[11].asstring;
i:=0;
for j:=0 to 5 do
i:=i+q1.Fields[bz+6].asfloat;
bbjhj.text:=floattostr(i);
end;
jxbxj.Text:=floattostr(strtofloat(xjjz.Text)+q1.Fields[0].asfloat-q1.Fields[6].asfloat);
jxbhy.Text:=floattostr(strtofloat(hyjz.Text)+q1.Fields[1].asfloat-q1.Fields[7].asfloat);
jxbzp.Text:=floattostr(strtofloat(zpjz.Text)+q1.Fields[2].asfloat-q1.Fields[8].asfloat);
jxbcard.Text:=floattostr(strtofloat(cardjz.Text)+q1.Fields[3].asfloat-q1.Fields[9].asfloat);
jxbgz.Text:=floattostr(strtofloat(gzjz.Text)+q1.Fields[4].asfloat-q1.Fields[10].asfloat);
jxbmf.Text:=floattostr(strtofloat(mfjz.Text)+q1.Fields[5].asfloat-q1.Fields[11].asfloat);
jxbhj.Text:=floattostr(strtofloat(hej.Text)+strtofloat(sbqhj.Text)-strtofloat(bbjhj.Text));
q1.Close;
q1.Active :=false;
q1.sql.Clear ;
end;
end;
procedure TJBForm1.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if key=112 then
begin
if xt=0 then help(25);
end;
if key=13 then
perform(cm_dialogkey,vk_tab,0);
if key=27 then
if klk.Visible then klk.Visible:=false
else
close;
end;
procedure TJBForm1.FormCreate(Sender: TObject);
//var
// ed:Ttime;
begin
shortdateformat:='yyyy-mm-dd';
q1.Active :=false;
q1.sql.Clear ;
q1.sql.add('select GiveTime,NewBc,name,NewRegid from changebc,stuff where GiveTime=(select max(GiveTime) from changebc) and changebc.NewRegid=stuff.code');
q1.Open;
if not q1.Eof then
begin
bgtime.Text :=q1.fields[0].asstring;
curbc.Text:=copy(trim(q1.fields[0].asstring),1,10)+':'+q1.fields[1].asstring;
curname.Text:=q1.fields[2].asstring;
Regid1.text:=q1.fields[3].asstring;
end
else
begin
bgtime.Text :=datetimetostr(now-1);
curbc.Text:=copy(trim(bgtime.Text),1,10)+':'+trim(curper.curbc);
curname.Text:=curper.name;
Regid1.text:=curper.code;
end;
q1.Close;
klk.Visible:=false;
edtime.text:=datetimetostr(now);
s1.Prepare;
s1.ParamByName ('@lsbegtime').asstring:=trim(bgtime.text);
s1.ParamByName ('@lsendtime').asstring:=trim(edtime.text);
s1.Prepare;
s1.ExecProc ;
nextname.Text :='';
xj.Text :='';
zp.Lines.Clear ;
card.Lines.Clear ;
gz.lines.clear;
mf.lines.clear;
xjjz.Text :='0';
zpjz.text:='0';
cardjz.text:='0';
gzjz.text:='0';
mfjz.text:='0';
hej.text:='0';
getdata;
zp.SelStart :=0;
card.SelStart :=0;
gz.SelStart :=0;
mf.SelStart :=0;
if trim(curper.curbc)='早' then nextbc.Text:=copy(trim(edtime.Text),1,10)+':'+'晚'
else
if trim(curper.curbc)='晚' then nextbc.Text:=copy(trim(edtime.Text),1,10)+':'+'早';
end;
procedure TJBForm1.bgtimeExit(Sender: TObject);
var
rq:Tdatetime;
begin
try
rq:=strtodatetime(trim(bgtime.text));
getdata;
except
showmessage('时间错误');
bgtime.SetFocus ;
end;
end;
procedure TJBForm1.edtimeExit(Sender: TObject);
var
rq:Tdatetime;
begin
try
rq:=strtodatetime(trim(edtime.text));
getdata;
except
showmessage('时间错误');
edtime.SetFocus ;
end;
end;
procedure Cal;
begin
with jbform1 do
begin
hej.Text :=floattostr(strtofloat(trim(xjjz.text))+strtofloat(trim(zpjz.text))+strtofloat(trim(cardjz.text))+strtofloat(trim(gzjz.text))+strtofloat(trim(mfjz.text)));
end;
end;
procedure TJBForm1.xjjzExit(Sender: TObject);
begin
if (sender is Tedit) then
if length(trim((sender as tedit).text))=0 then
(sender as Tedit).text:='0';
cal;
end;
procedure TJBForm1.xjjzKeyPress(Sender: TObject; var Key: Char);
begin
if ((key<'0') or (key>'9'))then
if (key<>char(8)) and (key<>'.') then
key:=char(0);
end;
procedure TJBForm1.Button2Click(Sender: TObject);
begin
// ischange:=false;
close;
end;
procedure TJBForm1.Button1Click(Sender: TObject);
begin
if Button1.Caption='显示班报表' then
begin
application.CreateForm(Tsrbbptform,srbbptform);
srbbptform.QRLabel23.Caption:=copy(trim(JBForm1.curbc.text),1,4)+'年'+copy(trim(JBForm1.curbc.Text),6,2)+'月'+copy(trim(JBForm1.curbc.Text),9,2)+'日 '
+trim(copy(trim(JBForm1.curbc.text),12,4))+'班';
srbbptform.hide;
srbbptform.qr1.preview;
srbbptform.Close;
srbbptform.free;
end
else
begin
if messagedlg('交班单是否打印成功?',mtInformation, [mbYes, mbNo], 0) = mrno then
exit;
klk.Visible:=true;
klk.Caption:='请输入交班人口令';
pass.SetFocus;
bz:=3;
end;
end;
procedure TJBForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
q1.free;
action:=cafree;
end;
procedure TJBForm1.nextnameExit(Sender: TObject);
begin
if (trim(nextname.Text)<>'') then
begin
klk.Visible:=true;
klk.Caption:='请输入接班人口令';
pass.SetFocus;
bz:=2;
end
else klk.Visible:=false;
end;
procedure TJBForm1.passExit(Sender: TObject);
var ls:TEdit;
begin
if bz=1 then ls:=curname;
if bz=2 then ls:=nextname;
if bz=3 then ls:=curname;
q1.Active :=false;
q1.sql.clear;
q1.sql.add('select name,code from stuff where (code='''+trim(ls.Text)+''' or name='''+trim(ls.Text)+''') and pass='''+passzh(trim(pass.text))+'''');
q1.open;
if (q1.eof) then
begin
pass.text:='****';
showmessage('输入有误!');
Button1.Enabled:=false;
if bz<>3 then
begin
ls.text:='';
JBForm1.ActiveControl:=ls;
end;
end
else
begin
pass.text:='****';
ls.text:=q1.fields[0].asstring;
Button1.Enabled:=true;
if bz=1 then
begin
nextbc.SetFocus;
Regid1.text:=q1.fields[1].asstring;
end;
if bz=2 then
begin
Button1.SetFocus;
Regid2.text:=q1.fields[1].asstring;
end;
if bz=3 then
begin
Regid1.text:=q1.fields[1].asstring;
jb;
end;
end;
klk.Visible:=false;
//curper.name:=
// q1.close;
// q1.sql.clear;
end;
procedure TJBForm1.Button3Click(Sender: TObject);
begin
application.CreateForm(Tsrbbptform,srbbptform);
srbbptform.QRLabel1.Caption:=curper.sydw+'桑拿部营业收入班报表';
srbbptform.QRLabel23.Caption:=copy(trim(JBForm1.curbc.text),1,4)+'年'+copy(trim(JBForm1.curbc.Text),6,2)+'月'+copy(trim(JBForm1.curbc.Text),9,2)+'日'
+trim(copy(trim(JBForm1.curbc.text),12,4))+'班';
srbbptform.hide;
if dy.Checked then
srbbptform.qr1.print
else
srbbptform.qr1.Preview;
srbbptform.Close;
srbbptform.free;
end;
procedure TJBForm1.nextbcExit(Sender: TObject);
begin
if length(trim(nextbc.text))<12 then
nextbc.text:=copy(trim(edtime.Text),1,10)+':'+nextbc.text;
end;
procedure TJBForm1.nextbcDblClick(Sender: TObject);
begin
if trim(copy(nextbc.Text,12,2))='早' then
nextbc.Text:=copy(nextbc.Text,1,11)+'晚'
else
if trim(copy(nextbc.Text,12,2))='晚' then
nextbc.Text:=copy(nextbc.Text,1,11)+'早';
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -