📄 xfdprintunit.pas
字号:
unit xfdprintUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Qrctrls, QuickRpt, ExtCtrls, Db, DBTables;
type
Tjyxfdprint = class(TForm)
QuickRep1: TQuickRep;
QRBand1: TQRBand;
QRLabel1: TQRLabel;
QRSysData1: TQRSysData;
QRLabel2: TQRLabel;
QRLabel3: TQRLabel;
QRImage1: TQRImage;
QRImage2: TQRImage;
QRImage3: TQRImage;
QRImage4: TQRImage;
QRImage5: TQRImage;
QRImage6: TQRImage;
QRImage7: TQRImage;
QRImage8: TQRImage;
QRLabel4: TQRLabel;
QRImage9: TQRImage;
QRLabel5: TQRLabel;
QRImage10: TQRImage;
QRLabel6: TQRLabel;
QRLabel7: TQRLabel;
QRLabel8: TQRLabel;
QRImage11: TQRImage;
QRImage12: TQRImage;
QRImage13: TQRImage;
QRLabel9: TQRLabel;
QRLabel10: TQRLabel;
QRLabel11: TQRLabel;
QRSubDetail1: TQRSubDetail;
QRImage14: TQRImage;
QRImage15: TQRImage;
QRImage16: TQRImage;
QRImage17: TQRImage;
QRImage18: TQRImage;
QRImage19: TQRImage;
QRDBText1: TQRDBText;
QRDBText2: TQRDBText;
QRDBText3: TQRDBText;
fh: TQRLabel;
rs: TQRLabel;
rzsj: TQRLabel;
ldsj: TQRLabel;
QRImage28: TQRImage;
QRImage29: TQRImage;
QRImage30: TQRImage;
Query1: TQuery;
Query2: TQuery;
QRImage31: TQRImage;
QRImage32: TQRImage;
QRImage33: TQRImage;
QRLabel16: TQRLabel;
ysff: TQRLabel;
ssff: TQRLabel;
Query3: TQuery;
ChildBand1: TQRChildBand;
QRLabel18: TQRLabel;
yjmoney: TQRLabel;
QRLabel20: TQRLabel;
ssmoney: TQRLabel;
QRLabel22: TQRLabel;
QRLabel23: TQRLabel;
jzfs: TQRLabel;
QRImage34: TQRImage;
QRImage25: TQRImage;
QRImage21: TQRImage;
QRImage26: TQRImage;
QRImage27: TQRImage;
QRImage22: TQRImage;
QRImage23: TQRImage;
QRImage24: TQRImage;
QRLabel17: TQRLabel;
QRImage20: TQRImage;
QRLabel12: TQRLabel;
QRImage35: TQRImage;
QRImage36: TQRImage;
ysh: TQRLabel;
ssh: TQRLabel;
hykh: TQRLabel;
QRLabel13: TQRLabel;
procedure FormCreate(Sender: TObject);
procedure QRSubDetail1AfterPrint(Sender: TQRCustomBand;
BandPrinted: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
jyxfdprint: Tjyxfdprint;
b:integer;
implementation
{$R *.DFM}
uses dataproc,newjzform;
procedure Tjyxfdprint.FormCreate(Sender: TObject);
begin
b:=0;
fh.Caption:='';
query1.close;
query1.sql.clear;
query1.sql.add('Select UnitName from syssetup');
query1.open;
hykh.Caption:=newjz.kh.Text;
QRLabel1.Caption:=trim(unpassname(query1.Fields[0].asstring))+'消费单';
query1.Active :=false;
query1.sql.clear;
query1.sql.add('select handno,s.sexname,begtime,acctime,endtime,money,csmoney from nowin,lssex s where ((accno=:paccno) and (nowin.sex=s.sex)) ');
query1.sql.add('union (select handno,s.sexname,begtime,acctime,endtime,money,csmoney from changeroom,lssex s where ((accno=:pac) and (changeroom.sex=s.sex)) )');
query1.ParamByName ('paccno').asstring:=paccount;
query1.ParamByName ('pac').asstring:=paccount;
query1.Prepare;
query1.Open;
rzsj.Caption:=query1.fieldbyname('begtime').asstring;
ldsj.Caption:=query1.fieldbyname('endtime').asstring;
hykh.Caption:=newjz.kh.Text;
jzfs.Caption:=newjz.jzfsname.Text;
if newjz.mfj.Checked=true then
ssff.Caption:='0'
else
ssff.Caption:=floattostr(strtofloat(newjz.rm.Text)+strtofloat(newjz.rcsm.Text)+strtofloat(newjz.sm.Text)+strtofloat(newjz.scsm.Text));
query1.active:=false;
query1.sql.clear;
query1.sql.add('select roommoney=sum(money)+sum(csmoney) from nowin where accno=:pacc ');
query1.parambyname('pacc').asstring:=paccount;
query1.open;
ysff.Caption:= query1.fieldbyname('roommoney').asstring;
query3.Active:=false;
query3.SQL.Clear;
query3.SQL.Add('select sum(num) as rs from nowin where accno=:paccno');
query3.ParamByName ('paccno').asstring:=paccount;
query3.Prepare;
query3.Open;
rs.Caption:=query3.fieldbyname('rs').asstring;
query3.Active:=false;
query3.SQL.Clear; //and(newjz.mxf.Checked=false)
query3.SQL.Add('select isnull(sum(cusprice*cusnum),0) as yshj,isnull(sum(money),0) as sshj from custom where accno=:paccno');
query3.ParamByName ('paccno').asstring:=paccount;
query3.Prepare;
query3.Open;
ysh.Caption:=floattostr(strtofloat(ysff.Caption)+query3.fieldbyname('yshj').asfloat);
if (newjz.mxf.Checked=true)and(newjz.mfj.Checked=true)
then ssh.Caption:='0';
if (newjz.mxf.Checked=true)and(newjz.mfj.Checked=false)
then ssh.Caption:=floattostr(int(strtofloat(ssff.Caption)));
if (newjz.mxf.Checked=false)and(newjz.mfj.Checked=true)
then ssh.Caption:=floattostr(int(query3.fieldbyname('sshj').asfloat));
if (newjz.mxf.Checked=false)and(newjz.mfj.Checked=false)
then ssh.Caption:=floattostr(int(strtofloat(ssff.Caption)+query3.fieldbyname('sshj').asfloat));
yjmoney.Caption:=newjz.yjm.Text;
ssmoney.Caption:=rmb(strtofloat(ssh.Caption));
query3.Active:=false;
query3.SQL.Clear;
query3.SQL.Add('select roomno from nowin where accno=:paccno');
query3.ParamByName ('paccno').asstring:=paccount;
query3.Prepare;
query3.Open;
query3.First;
while not query3.Eof do
begin
if trim(fh.Caption)='' then fh.Caption:=query3.fieldByName ('roomno').asstring+','
else
fh.Caption:=fh.Caption+','+query3.fieldByName ('roomno').asstring;
query3.Next;
end;
query2.Active :=false;
query2.sql.clear;
query2.SQL.Add('select distinct custype,cusname,');
if newjz.mxf.Checked=true then
begin
query2.SQL.Add('(select isnull(sum(cusprice*cusnum),0) from custom where substring(custom.custype,1,2)=cusdtype.custype and accno=:paccno) as ymoney,0 as smoney ');
end
else
begin
query2.SQL.Add('(select isnull(sum(cusprice*cusnum),0) from custom where substring(custom.custype,1,2)=cusdtype.custype and accno=:paccno) as ymoney,');
query2.SQL.Add('(select isnull(sum(money),0) from custom where substring(custom.custype,1,2)=cusdtype.custype and accno=:paccno) as smoney ');
end;
query2.SQL.Add(' from cusdtype');
query2.ParamByName ('paccno').asstring:=paccount;
query2.Prepare;
query2.Open;
end;
procedure Tjyxfdprint.QRSubDetail1AfterPrint(Sender: TQRCustomBand;
BandPrinted: Boolean);
begin
b:=b+1;
if b=Query2.RecordCount then
begin
ChildBand1.Enabled:=true;
end
else
ChildBand1.Enabled:=false;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -