📄 ufzrep.pas
字号:
unit ufzrep;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ubasereport, DBClient, DB, DBTables, Grids, wwdblook,comobj, Excel2000,
wwdbdatetimepicker, StdCtrls, Mask, wwdbedit, Buttons, ExtCtrls,common,MDIbaseinfo,
ADODB, DBGridEh;
type
Tfrmfzrep = class(Tfrmbasereport)
StringGrid1: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure spbtnprintClick(Sender: TObject);
procedure spbtnpriorClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmfzrep: Tfrmfzrep;
implementation
uses global;
{$R *.dfm}
procedure Tfrmfzrep.FormCreate(Sender: TObject);
begin
inherited;
stringgrid1.ColCount:=33;
StringGrid1.Cells[0,0]:='批号';
StringGrid1.Cells[1,0]:='仓库';
StringGrid1.Cells[2,0]:='负责人';
StringGrid1.Cells[3,0]:='供应商';
StringGrid1.Cells[4,0]:='备注';
StringGrid1.Cells[5,0]:='交货日期';
StringGrid1.Cells[6,0]:='创建人';
StringGrid1.Cells[7,0]:='发制日期';
///////////////////////////////////////////以上是头
StringGrid1.Cells[8,0]:='物料代码';
StringGrid1.Cells[9,0]:='成分';
StringGrid1.Cells[10,0]:='支数';
StringGrid1.Cells[11,0]:='色号';
StringGrid1.Cells[12,0]:='颜色';
StringGrid1.Cells[13,0]:='缸号';
StringGrid1.Cells[14,0]:='单位';
StringGrid1.Cells[15,0]:='类型';
StringGrid1.Cells[16,0]:='重量';
StringGrid1.Cells[17,0]:='备注';
StringGrid1.Cells[18,0]:='发制编号';
StringGrid1.Cells[19,0]:='码数';
StringGrid1.Cells[20,0]:='码数';
StringGrid1.Cells[21,0]:='码数';
StringGrid1.Cells[22,0]:='码数';
StringGrid1.Cells[23,0]:='码数';
StringGrid1.Cells[24,0]:='码数';
StringGrid1.Cells[25,0]:='码数';
StringGrid1.Cells[26,0]:='码数';
StringGrid1.Cells[27,0]:='码数';
StringGrid1.Cells[28,0]:='码数';
StringGrid1.Cells[29,0]:='码数';
StringGrid1.Cells[30,0]:='码数';
StringGrid1.Cells[31,0]:='重量';
StringGrid1.Cells[32,0]:='件数';
end;
procedure Tfrmfzrep.spbtnprintClick(Sender: TObject);
var
i:integer;
begin
inherited;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select a.fitemid,a.fqty,a.fprice,a.total,a.fnote,b.fpurno,b.fprovider,b.fpurer,b.fpurstore,');
adoquery1.SQL.add(' b.frefno,b.fdelivdate,b.fnote as note2,b.fcreauser,b.pno,b.fprice as price2,');
adoquery1.SQL.add(' b.ss1,b.s2 ss2,b.s3 ss3,b.s4 ss4,b.s5 ss5 ,b.s6 ss6,b.s7 ss7,b.s8 ss8,b.s9 ss9,b.s10 ss10,b.s11 ss11,b.s12 ss12,');
adoquery1.SQL.add(' a.s1,a.s2,a.s3,a.s4,a.s5,a.s6,a.s7,a.s8,a.s9,a.s10,a.s11,a.s12,');
adoquery1.SQL.add(' a.sw1,a.sw2,a.sw3,a.sw4,a.sw5,a.sw6,a.sw7,a.sw8,a.sw9,a.sw10,a.sw11,a.sw12,');
adoquery1.SQL.add(' c.fid,c.fcode,c.fname,c.zs,c.funit,c.ftype,a.colorno,a.color,a.gno from Tfzsub a,Tfz b ,titem c');
adoquery1.SQL.add(' where a.fresid=b.fresid and c.fid=a.fitemid');
if refno.text<>'' then
begin
adoquery1.SQL.add(' and b.frefno =:frefno');
adoquery1.Parameters.ParamByName('frefno').Value:=refno.Text;
end;
if billno.Text<>'' then
begin
adoquery1.SQL.add(' and b.pno =:pno');
adoquery1.Parameters.ParamByName('pno').Value:=billno.Text;
end;
if edit1.text<>'' then
begin
adoquery1.SQL.add(' and c.fcode =:fcode');
adoquery1.Parameters.ParamByName('fcode').Value:=edit1.text;
end;
if edit2.text<>'' then
begin
adoquery1.SQL.add(' and c.fname like :fname');
adoquery1.Parameters.ParamByName('fname').Value:='%' + edit2.text+ '%';
end;
if edit3.text<>'' then
begin
adoquery1.SQL.add(' and a.color like :color');
adoquery1.Parameters.ParamByName('color').value:='%'+edit3.text+'%';
end;
if edit4.text<>'' then
begin
adoquery1.SQL.add(' and a.colorno =:colorno');
adoquery1.Parameters.ParamByName('colorno').Value:=edit4.text;
end;
if edit5.text<>'' then
begin
adoquery1.SQL.add(' and c.zs =:zs');
adoquery1.Parameters.ParamByName('zs').Value:=edit5.text;
end;
if edit6.text<>'' then
begin
adoquery1.SQL.add(' and a.gno =:gno');
adoquery1.Parameters.ParamByName('gno').Value:=edit6.text;
end;
adoquery1.SQL.Add(' order by pno');
adoquery1.Open;
for i:=0 to dbgrideh1.Columns.Count-1 do
dbgrideh1.Columns[i].Width:=64;
adoquery1.First;
if adoquery1.RecordCount>0 then
begin
stringgrid1.Rowcount:=adoquery1.RecordCount+1;
StringGrid1.Cells[19,0]:=adoquery1.fieldbyname('ss1').AsString;
StringGrid1.Cells[20,0]:=adoquery1.fieldbyname('ss2').AsString;
StringGrid1.Cells[21,0]:=adoquery1.fieldbyname('ss3').AsString;
StringGrid1.Cells[22,0]:=adoquery1.fieldbyname('ss4').AsString;
StringGrid1.Cells[23,0]:=adoquery1.fieldbyname('ss5').AsString;
StringGrid1.Cells[24,0]:=adoquery1.fieldbyname('ss6').AsString;
StringGrid1.Cells[25,0]:=adoquery1.fieldbyname('ss7').AsString;
StringGrid1.Cells[26,0]:=adoquery1.fieldbyname('ss8').AsString;
StringGrid1.Cells[27,0]:=adoquery1.fieldbyname('ss9').AsString;
StringGrid1.Cells[28,0]:=adoquery1.fieldbyname('ss10').AsString;
StringGrid1.Cells[29,0]:=adoquery1.fieldbyname('ss11').AsString;
StringGrid1.Cells[30,0]:=adoquery1.fieldbyname('ss12').AsString;
end
else
begin
stringgrid1.RowCount:=2;
for i:=0 to 18 do
stringgrid1.Cells[i,1]:='';
end;
i:=1;
adoquery1.DisableControls;
while not adoquery1.Eof do
begin
// stringgrid1.Rowcount:=stringgrid1.RowCount+1;
StringGrid1.Cells[0,i]:=adoquery1.fieldbyname('pno').asstring;//'批号'
/////////////////////////////批号不同加一行标题 //////////////////////////////////////////////////////////////////////
if StringGrid1.Cells[0,i]<>StringGrid1.Cells[0,i-1] then
begin
// StringGrid1.Cells[0,i]:='批号';
StringGrid1.Cells[18,i]:='货编号';
StringGrid1.Cells[1,i]:='仓库';
StringGrid1.Cells[2,i]:='负责人';
StringGrid1.Cells[3,i]:='供应商';
StringGrid1.Cells[4,i]:='备注';
StringGrid1.Cells[5,i]:='交货日期';
StringGrid1.Cells[6,i]:='创建人';
StringGrid1.Cells[7,i]:='订货日期';
///////////////////////////////////////////以上是头
StringGrid1.Cells[8,i]:='物料代码';
StringGrid1.Cells[9,i]:='成分';
StringGrid1.Cells[10,i]:='支数';
StringGrid1.Cells[14,i]:='单位';
StringGrid1.Cells[15,i]:='类型';
StringGrid1.Cells[11,i]:='色号';
StringGrid1.Cells[12,i]:='颜色';
StringGrid1.Cells[13,i]:='缸号';
StringGrid1.Cells[16,i]:='重量';
StringGrid1.Cells[17,i]:='备注';
StringGrid1.Cells[18,0]:='发制编号';
StringGrid1.Cells[19,i]:=adoquery1.fieldbyname('ss1').AsString;
StringGrid1.Cells[20,i]:=adoquery1.fieldbyname('ss2').AsString;
StringGrid1.Cells[21,i]:=adoquery1.fieldbyname('ss3').AsString;
StringGrid1.Cells[22,i]:=adoquery1.fieldbyname('ss4').AsString;
StringGrid1.Cells[23,i]:=adoquery1.fieldbyname('ss5').AsString;
StringGrid1.Cells[24,i]:=adoquery1.fieldbyname('ss6').AsString;
StringGrid1.Cells[25,i]:=adoquery1.fieldbyname('ss7').AsString;
StringGrid1.Cells[26,i]:=adoquery1.fieldbyname('ss8').AsString;
StringGrid1.Cells[27,i]:=adoquery1.fieldbyname('ss9').AsString;
StringGrid1.Cells[28,i]:=adoquery1.fieldbyname('ss10').AsString;
StringGrid1.Cells[29,i]:=adoquery1.fieldbyname('ss11').AsString;
StringGrid1.Cells[30,i]:=adoquery1.fieldbyname('ss12').AsString;
StringGrid1.Cells[31,i]:='重量';//CDSselectsub['s12'];//
StringGrid1.Cells[32,i]:='件数';//CDSselectsub['s12'];//
i:=i+1;
stringgrid1.RowCount:=stringgrid1.RowCount+1;
StringGrid1.Cells[0,i]:=adoquery1.fieldbyname('pno').asstring;//'批号'
GetsqlData(CDSselectsub,'Vfz','frefno','frefno='+vartosql(adoquery1.fieldbyname('frefno').asstring),1);
if cdsselectsub.RecordCount>0 then
begin
if CDSselectsub['frefno']<>NULL then
StringGrid1.Cells[18,i]:=CDSselectsub['frefno'];//searq.fieldbyname('fpurstore').asstring;//'货编号';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -