procedure TFrmSelField.CreateReport;
procedure CreateDbText(componentname,fieldname:string;left,top,width,height:single;LblCap:string);
var ppText:TppDbText;
ppLabel:TppLabel;
begin
//生成数据
ppText:=TppDbText.Create(self);
ppText.Band:=ppreport1.DetailBand;
pptext.DataPipeline:=ppDBPipeline1;
ppText.DataField:=fieldname;
pptext.name:=componentname;
if componentname='ppDbText1' then
pptext.OnGetText:=ppDBText1GetText ;
if componentname='ppDbText2' then
pptext.OnGetText:=ppDBText2GetText;
pptext.Font.Color:=clnavy;
pptext.Width:=width;
pptext.Left:=left;
pptext.Top:=top;
pptext.Height:=height;
ppText.Visible:=True;
//生成标题
ppLabel:=TppLabel.Create(self);
ppLabel.Band:=ppreport1.HeaderBand;
ppLabel.Caption:=LblCap;
ppLabel.Font.Color:=clnavy;
ppLabel.Width:=width;
ppLabel.Height:=0.22;
ppLabel.Top:=0.3958;
ppLabel.Left:=Left;
end;
begin
//初始化数组
InitTextWidth;
//计算间隔
CalculateGap;
//创建报表
psition:=Gap;
if chkembcode.Checked then
begin
CreateDbtext('ppDbText1','emb_code',Psition,0.1,TextWidth[1],0.2,'胎胚型号');
Psition:=Psition+TextWidth[1]+gap;
end;
if chkbrand.Checked then
begin
CreateDbText('ppDbText2','brand',psition,0.1,TextWidth[2],0.2,'品牌');
psition:=psition+TextWidth[2]+gap;
end;
if chkmadeyear.Checked then
begin
CreateDbText('ppDbText3','made_year',psition,0.1,TextWidth[3],0.2,'制造年份');
psition:=psition+TextWidth[3]+gap;
end;
if chkmademonth.Checked then
begin
CreateDbText('ppDbText4','made_month',psition,0.1,TextWidth[4],0.2,'制造月份');
psition:=psition+TextWidth[4]+gap;
end;
if chkbcmc.Checked then
begin
CreateDbText('ppDbText5','bcmc',psition,0.1,TextWidth[5],0.2,'病疵名称');
psition:=psition+TextWidth[5]+gap;
end;
if chkmoucode.Checked then
begin
CreateDbText('ppDbText6','mou_code',psition,0.1,TextWidth[6],0.2,'成型机台');
psition:=psition+TextWidth[6]+gap;
end;
if chksulfcode.Checked then
begin
CreateDbText('ppDbText7','sulf_code',psition,0.1,TextWidth[7],0.2,'硫化机台');
psition:=psition+TextWidth[7]+gap;
end;
if chkMoushift.Checked then
begin
CreateDbText('ppDbText8','mou_team',psition,0.1,TextWidth[8],0.2,'成型班组');
psition:=psition+TextWidth[8]+gap;
end;
if chkSulfShift.Checked then
begin
CreateDbText('ppDbText9','sulf_team',psition,0.1,TextWidth[9],0.2,'硫化班组');
psition:=psition+TextWidth[9]+gap;
end;
if chkdistrict.Checked then
begin
CreateDbText('ppDbText10','dq',psition,0.1,TextWidth[10],0.2,'地区');
psition:=psition+TextWidth[10]+gap;
end;
ppreport1.Print;
end;