📄 uhmrep.pas
字号:
unit uhmrep;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ubasereport, DBClient, DB, DBTables, Grids, wwdblook,
wwdbdatetimepicker, StdCtrls, Mask, wwdbedit, Buttons, ExtCtrls,common,MDIbaseinfo,
ADODB, DBGridEh;
type
Tfrmhmrep = class(Tfrmbasereport)
procedure spbtnprintClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmhmrep: Tfrmhmrep;
implementation
uses global;
{$R *.dfm}
procedure Tfrmhmrep.spbtnprintClick(Sender: TObject);
var
i:integer;
begin
inherited;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select b.pno,b.fpurstore,b.fpurer,b.fprovider,b.fnote as note2,b.fdelivdate,b.fcreauser,b.fcreadate,');
adoquery1.sql.add('c.fcode,c.fname,c.zs,a.colorno,a.color,a.gno,c.funit,c.ftype,a.fqty,a.fnote,b.frefno');
adoquery1.SQL.add(' from Thmsub a,Thm 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.Open;
for i:=0 to dbgrideh1.Columns.Count-1 do
dbgrideh1.Columns[i].Width:=64;
{ searq.Open;
searq.First;
if searq.RecordCount>0 then
stringgrid1.Rowcount:=searq.RecordCount+1
else
begin
stringgrid1.RowCount:=2;
for i:=0 to 18 do
stringgrid1.Cells[i,1]:='';
end;
i:=1;
while not searq.Eof do
begin
StringGrid1.Cells[0,i]:=searq.fieldbyname('pno').asstring;//'批号'
GetsqlData(CDSselectsub,'Vhm','frefno','frefno='+vartosql(searq.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;//'进货编号';
if CDSselectsub['fpurstore']<>NULL then
StringGrid1.Cells[1,i]:=CDSselectsub['fpurstore'];//searq.fieldbyname('fpurstore').asstring;//'仓库';
if CDSselectsub['fpurer']<>NULL then
StringGrid1.Cells[2,i]:=CDSselectsub['fpurer'];//searq.fieldbyname('fpurer').asstring;//'负责人';
if CDSselectsub['fprovider']<>null then
StringGrid1.Cells[3,i]:=CDSselectsub['fprovider'];//searq.fieldbyname('fprovider').asstring;//'供应商';
if CDSselectsub['fnote']<>null then
StringGrid1.Cells[4,i]:=CDSselectsub['fnote'];//searq.fieldbyname('fnote').asstring;//'备注';
if CDSselectsub['fdelivdate']<>null then
StringGrid1.Cells[5,i]:=CDSselectsub['fdelivdate'];//searq.fieldbyname('fdelivdate').asstring;//'交货日期';
if CDSselectsub['fcreauser']<>null then
StringGrid1.Cells[6,i]:=CDSselectsub['fcreauser'];//searq.fieldbyname('fcreauser').asstring;//'创建人';
if CDSselectsub['fcreadate'] <>null then
StringGrid1.Cells[7,i]:=CDSselectsub['fcreadate'];//searq.fieldbyname('fcreadate').asstring;//'订货日期';
end;
///////////////////////////////////////////以上是头
GetsqlData(CDSselectsub,'Vitem','fcode','fcode='+vartosql(searq.fieldbyname('fcode').asstring),1);
if cdsselectsub.RecordCount>0 then
begin
StringGrid1.Cells[8,i]:=CDSselectsub['fcode'];//searq.fieldbyname('fcode').asstring;//'物料代码';
if CDSselectsub['fname']<>null then
StringGrid1.Cells[9,i]:=CDSselectsub['fname'];//searq.fieldbyname('fname').asstring;//'成分';
if CDSselectsub['zs']<>null then
StringGrid1.Cells[10,i]:=CDSselectsub['zs'];//searq.fieldbyname('zs').asstring;//'支数';
if CDSselectsub['funit']<>null then
StringGrid1.Cells[14,i]:=CDSselectsub['funit'];//searq.fieldbyname('funit').asstring;//'单位';
if CDSselectsub['ftype']<>null then
StringGrid1.Cells[15,i]:=CDSselectsub['ftype'];//searq.fieldbyname('ftype').asstring;//'类型';
end;
GetsqlData(CDSselectsub,'Vhmsub','colorno','colorno='+vartosql(searq.fieldbyname('colorno').asstring),1);
if cdsselectsub.RecordCount>0 then
begin
StringGrid1.Cells[11,i]:=CDSselectsub['colorno'] ;//searq.fieldbyname('colorno').asstring;//'色号';
if CDSselectsub['color']<>NULL then
StringGrid1.Cells[12,i]:=CDSselectsub['color'];//searq.fieldbyname('color').asstring;//'颜色';
StringGrid1.Cells[13,i]:=searq.fieldbyname('gno').asstring;//'缸号';
StringGrid1.Cells[16,i]:=searq.fieldbyname('fqty').asstring;//'重量';
StringGrid1.Cells[17,i]:=searq.fieldbyname('fnote').asstring;//'备注';
end;
searq.Next;
i:=i+1;
end;}
end;
procedure Tfrmhmrep.FormCreate(Sender: TObject);
begin
inherited;
{ stringgrid1.ColCount:=19;
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]:='回毛编号';}
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -