📄 vcdhz.pas
字号:
else
begin
e_yj.Text:=formatfloat('0.00',dm.ADO_czdt.fieldbyname('押金').Asfloat);
dm.adoq_czbtmp.Close;
dm.adoq_czbtmp.SQL.Clear;
sqlz:='insert into czbtmp select * from czb where 证号='+'"'+e_yjid.text+'"';
dm.adoq_czbtmp.SQL.Add(sqlz);
dm.adoq_czbtmp.ExecSQL;
dm.ADO_czbtmp.close;
dm.ADO_czbtmp.Open;
dm.ado_qk.open;
dm.ado_qk.first;
if dm.ado_qk.locate('证号',e_yjid.Text,[]) then
e_qk.Text:=formatfloat('0.00',dm.ado_qk.fieldbyname('金额').asfloat);
dm.ado_qk.Close;
e_vcdid.SetFocus();
end;
end;
procedure TF_vcdhz.e_vcdidExit(Sender: TObject);
begin
temptext:=e_vcdid.Text;
if e_vcdid.Text='' then exit;
case group_zlr.ItemIndex of
0:if e_hyid.Text='' then hylzcx;
1:if e_yjid.Text='' then hylzcx;
end;
if not dm.ADO_czbtmp.Locate('编号',e_vcdid.Text,[]) then
begin
Application.MessageBox(PChar('用户未租借此图书(影碟),请检查!')
, PChar('提示'),MB_ICONEXCLAMATION);
e_vcdid.Text:='';
e_vcdid.SetFocus();
exit;
end
else
begin
dm.ADO_czbtmp.Edit;
dm.ADO_czbtmp.FieldByName('状态').AsString:='已还';
dm.ADO_czbtmp.Post;
end;
ysje;
e_vcdid.Text:='';
e_vcdid.SetFocus();
end;
procedure TF_vcdhz.e_ssExit(Sender: TObject);
begin
if e_ss.text='' then e_ss.Text:='0.00';
e_ss.Text:=formatfloat('0.00',strtofloat(e_ss.text));
end;
procedure TF_vcdhz.e_ssKeyPress(Sender: TObject; var Key: Char);
begin
if not ( Key in ['0'..'9',#13,#8,'.']) then Key := #0;
end;
procedure TF_vcdhz.e_thyjExit(Sender: TObject);
begin
if e_thyj.text='' then e_thyj.Text:='0.00';
e_thyj.Text:=formatfloat('0.00',strtofloat(e_thyj.text));
end;
procedure TF_vcdhz.e_thyjKeyPress(Sender: TObject; var Key: Char);
begin
if not ( Key in ['0'..'9',#13,#8,'.']) then Key := #0;
end;
procedure TF_vcdhz.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if dm.ADO_czbtmp.FieldByName('状态').AsString='已还' then
DBGrid1.Canvas.Font.Color := clred;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
procedure TF_vcdhz.b_okClick(Sender: TObject);
begin
if (dm.ADO_czbtmp.IsEmpty) or not dm.ADO_czbtmp.Locate('状态','已还',[]) then
begin
application.MessageBox(pchar('无图书、影碟的还租资料,不能结算!')
,pchar('提示'),MB_ICONEXCLAMATION);
exit;
end;
if group_zlr.ItemIndex=1 then
begin
if strtofloat(e_thyj.text)>strtofloat(e_yj.Text) then
begin
application.MessageBox(pchar('退还押金大于原预收押金,请检查!')
,pchar('提示'),MB_ICONEXCLAMATION);
exit;
end;
end;
//恢复tsvcd库中已租记录
dm.ADO_czbtmp.First;
while not dm.ADO_czbtmp.eof do
begin
if dm.ADO_czbtmp.FieldByName('状态').AsString='已还' then
begin
dm.ADO_vcd.Open;
dm.ADO_vcd.Locate('编号',dm.ADO_czbtmp.fieldbyname('编号').AsString,[]);
dm.ADO_vcd.Edit;
dm.ado_vcd.FieldByName('状态').AsString:='未租';
dm.ADO_vcd.Post;
dm.ADO_vcd.Close;
end;
dm.ADO_czbtmp.Next;
end;
//删除czb中多余记录
case group_zlr.ItemIndex of
0: begin
dm.ADOQ_czbtmp.Close;
dm.ADOQ_czbtmp.SQL.Clear;
dm.ADOQ_czbtmp.SQL.Add('delete from czb where 证号='+'"'+e_hyid.Text+'"');
dm.adoq_czbtmp.ExecSQL;
dm.ADOQ_czbtmp.Close;
end;
1:begin
dm.ADOQ_czbtmp.Close;
dm.ADOQ_czbtmp.SQL.Clear;
dm.ADOQ_czbtmp.SQL.Add('delete from czb where 证号='+'"'+e_yjid.Text+'"');
dm.adoq_czbtmp.ExecSQL;
dm.ADOQ_czbtmp.Close;
end;
2:begin
dm.ADOQ_czbtmp.Close;
dm.ADOQ_czbtmp.SQL.Clear;
dm.ADOQ_czbtmp.SQL.Add('delete from czb where 证号='+'"'+'亲朋'+'"');
dm.adoq_czbtmp.ExecSQL;
dm.ADOQ_czbtmp.Close;
end;
end;
//添加记录
dm.ADOQ_czbtmp.Close;
dm.ADOQ_czbtmp.SQL.Clear;
dm.ADOQ_czbtmp.SQL.Add('insert into czb select * from czbtmp where 状态='+'"'+'未还'+'"');
dm.adoq_czbtmp.ExecSQL;
dm.ADOQ_czbtmp.Close;
//判断能否删除czdt记录
dm.ADO_czbtmp.First;
if dm.ADO_czbtmp.Locate('状态','未还',[]) then
else
begin
case group_zlr.ItemIndex of
0:begin
dm.ADOQ_czbtmp.Close;
dm.ADOQ_czbtmp.SQL.Clear;
dm.ADOQ_czbtmp.SQL.Add('delete from czdt where 证号='+'"'+e_hyid.Text+'"');
dm.adoq_czbtmp.ExecSQL;
dm.ADOQ_czbtmp.Close;
end;
1:begin
if strtofloat(e_thyj.Text)=strtofloat(e_yj.Text) then
begin
dm.ADOQ_czbtmp.Close;
dm.ADOQ_czbtmp.SQL.Clear;
dm.ADOQ_czbtmp.SQL.Add('delete from czdt where 证号='+'"'+e_yjid.Text+'"');
dm.adoq_czbtmp.ExecSQL;
dm.ADOQ_czbtmp.Close;
end;
end;
end;
end;
//欠款及现金库写入
case group_zlr.ItemIndex of
0:hylzbh:=e_hyid.Text;
1:hylzbh:=e_yjid.Text;
2:exit;
end;
dm.ADO_qk.Open;
if (strtofloat(e_ys.Text)+ strtofloat(e_qk.Text)-strtofloat(e_ss.Text)>0)
or (strtofloat(e_ys.Text)+ strtofloat(e_qk.Text)-strtofloat(e_ss.Text)<0) then
begin
if not dm.ADO_qk.Locate('证号',hylzbh,[]) then
dm.ADO_qk.AppendRecord([hylzbh,(strtofloat(e_ys.Text)+ strtofloat(e_qk.Text)-strtofloat(e_ss.Text))])
else
begin
dm.ADO_qk.Edit;
dm.ADO_qk.FieldByName('金额').AsFloat:=strtofloat(e_ys.Text)+ strtofloat(e_qk.Text)-strtofloat(e_ss.Text);
dm.ADO_qk.Post;
end;
end
else
begin
if dm.ADO_qk.Locate('证号',hylzbh,[]) then
begin
//dm.ADO_qk.Edit;
dm.ADO_qk.Delete;
//dm.ADO_qk.Post;
end;
end;
dm.ADO_qk.Close;
if e_ss.text<>'0.00' then
begin
dm.ADO_cash.Open;
dm.ADO_cash.AppendRecord([hylzbh,date(),'收租金',e_ss.text]);
dm.ADO_cash.Close;
end;
//退押金
if group_zlr.ItemIndex=1 then
begin
if strtofloat(e_thyj.text)<strtofloat(e_yj.Text) then
begin
dm.ADO_czdt.Open;
dm.ADO_czdt.First;
dm.ADO_czdt.Locate('证号',hylzbh,[]);
dm.ADO_czdt.Edit;
dm.ADO_czdt.fieldbyname('押金').asfloat:=strtofloat(e_yj.Text)-strtofloat(e_thyj.text);
dm.ado_czdt.Post;
dm.ado_czdt.Close;
end;
if e_thyj.Text<>'0.00' then
begin
dm.ADO_cash.Open;
dm.ADO_cash.AppendRecord([hylzbh,date(),'退零租押金','0.00',e_thyj.text]);
dm.ADO_cash.Close;
end;
end;
e_hyid.Text:='';
e_yjid.Text:='';
e_yj.Text:='0.00';
e_zlname.Text:='';
e_zlsex.Text:='';
e_zlzlx.Text:='';
e_zlyj.Text:='';
e_zltel.Text:='';
e_qk.Text:='0.00';
e_ys.Text:='0.00';
e_ss.Text:='0.00';
e_thyj.Text:='0.00';
//删除临时记录
if group_zlr.ItemIndex<>2 then// or group_zlr.ItemIndex=1) then
begin
dm.ADOQ_czbtmp.SQL.Clear;
dm.ADOQ_czbtmp.SQL.Add('delete from czbtmp');
dm.adoq_czbtmp.ExecSQL;
dm.ADO_czbtmp.Close;
e_vcdid.SetFocus();
end
else
begin
dm.ADOQ_czbtmp.SQL.Clear;
dm.ADOQ_czbtmp.SQL.Add('delete from czbtmp where 编号='+'"'+temptext+'"');
dm.adoq_czbtmp.ExecSQL;
dm.ADO_czbtmp.Close;
dm.ADOQ_czbtmp.Open;
e_vcdid.SetFocus();
end;
end;
procedure TF_vcdhz.FormClose(Sender: TObject; var Action: TCloseAction);
begin
dm.adoq_czbtmp.SQL.Clear;
dm.ADOQ_czbtmp.SQL.Add('delete from czbtmp');
dm.ADOQ_czbtmp.ExecSQL;
dm.adoq_czbtmp.Close;
dm.ADO_czbtmp.Close;
dm.ADO_czb.Close;
dm.ADO_czdt.Close;
dm.ADO_qk.Close;
dm.ADO_cash.Close;
dm.ADO_vip.Close;
dm.ADO_vcd.Close;
release;
end;
procedure TF_vcdhz.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then
begin
key:=#0;
perform(wm_nextdlgctl,0,0);
end;
end;
procedure TF_vcdhz.FormActivate(Sender: TObject);
begin
ztl.Panels[1].Text:=' 当前日期:'+datetostr(date());
end;
procedure TF_vcdhz.FormShow(Sender: TObject);
begin
e_hyid.SetFocus();
e_ys.Text:='0.00';
e_ss.Text:='0.00';
e_thyj.Enabled:=false;
e_thyj.Color:=cl3dlight;
e_thyj.Text:='0.00';
end;
procedure TF_vcdhz.FormCreate(Sender: TObject);
begin
dm.adoq_czbtmp.SQL.Clear;
dm.ADOQ_czbtmp.SQL.Add('delete from czbtmp');
dm.ADOQ_czbtmp.ExecSQL;
dm.adoq_czbtmp.Close;
dm.ADO_czbtmp.Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -