?? dwyjhzfrm.pas
字號(hào):
unit dwyjhzfrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, db,dbtables,Grids, DBGridEh, Buttons, StdCtrls,
te_controls,ksthemeedits, PrnDbgeh;
type
Tdwyjhz = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
DBGridEh1: TDBGridEh;
SpeedButton3: TSpeedButton;
SpeedButton1: TSpeedButton;
TeThemeEdit1: TTeThemeEdit;
CheckBox1: TCheckBox;
PrintDBGridEh1: TPrintDBGridEh;
procedure SpeedButton3Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
dwyjhz: Tdwyjhz;
implementation
uses datafrm;
{$R *.dfm}
procedure Tdwyjhz.SpeedButton3Click(Sender: TObject);
begin
close;
end;
procedure Tdwyjhz.FormShow(Sender: TObject);
var
i:integer;
begin
yfgldata.yjtemp.Active:=false;
dwyjhz.DBGridEh1.Columns.Clear;
dwyjhz.DBGridEh1.SumList.Active:=false;
with yfgldata.yjtemp do
begin
with fielddefs do
begin
clear;
with addfielddef do
begin
name:='單位代碼';
datatype:=ftstring;
size:=20;
end;
dwyjhz.DBGridEh1.Columns.Add;
dwyjhz.DBGridEh1.Columns[0].FieldName:='單位代碼';
dwyjhz.DBGridEh1.Columns[0].Title.caption:='單位代碼';
with addfielddef do
begin
name:='單位名稱';
datatype:=ftstring;
size:=50;
end;
dwyjhz.DBGridEh1.Columns.Add;
dwyjhz.DBGridEh1.Columns[1].FieldName:='單位名稱';
dwyjhz.DBGridEh1.Columns[1].Title.caption:='單位名稱';
dwyjhz.DBGridEh1.Columns[1].Footers.add;
dwyjhz.DBGridEh1.Columns[1].Footers[0].FieldName:='單位名稱';
dwyjhz.DBGridEh1.Columns[1].Footers[0].Value:='總 計(jì)';
dwyjhz.DBGridEh1.Columns[1].Footers[0].Alignment:=tacenter;
dwyjhz.DBGridEh1.Columns[1].Footers[0].ValueType:=fvtstatictext;
yfgldata.yjzl.First;
for i:=1 to yfgldata.yjzl.RecordCount do
begin
with addfielddef do
begin
name:=yfgldata.yjzl.fieldbyname('營(yíng)具代碼').AsString;
datatype:=ftinteger;
end;
dwyjhz.DBGridEh1.Columns.Add;
dwyjhz.DBGridEh1.Columns[i+1].FieldName:=yfgldata.yjzl.fieldbyname('營(yíng)具代碼').AsString;
dwyjhz.DBGridEh1.Columns[i+1].Title.caption:=yfgldata.yjzl.fieldbyname('營(yíng)具名稱').AsString+'||'+yfgldata.yjzl.fieldbyname('單位').AsString;
dwyjhz.DBGridEh1.Columns[i+1].Footers.add;
dwyjhz.DBGridEh1.Columns[i+1].Footers[0].FieldName:=yfgldata.yjzl.fieldbyname('營(yíng)具代碼').AsString;
dwyjhz.DBGridEh1.Columns[i+1].Footers[0].Alignment:=tarightjustify;
dwyjhz.DBGridEh1.Columns[i+1].Footers[0].ValueType:=fvtsum;
yfgldata.yjzl.Next;
end;
end;
createtable;
active:=true;
end;
yfgldata.dw.First;
for i:=1 to yfgldata.dw.RecordCount do
begin
if yfgldata.dw.FieldByName('上級(jí)代碼').AsString<>'' then
begin
yfgldata.yjtemp.Append;
yfgldata.yjtemp.FieldByName('單位代碼').AsString:=yfgldata.dw.FieldByName('單位代碼').AsString;
yfgldata.yjtemp.FieldByName('單位名稱').AsString:=yfgldata.dw.FieldByName('單位名稱').AsString;
yfgldata.yjtemp.Post;
end;
yfgldata.dw.Next;
end;
yfgldata.dwyj1.First;
for i:=1 to yfgldata.dwyj1.RecordCount do
begin
if yfgldata.yjtemp.Locate('單位代碼',yfgldata.dwyj1.fieldbyname('使用單位').AsString,[loCaseInsensitive]) then
begin
yfgldata.yjtemp.Edit;
yfgldata.yjtemp.FieldByName(yfgldata.dwyj1.fieldbyname('代碼').AsString).AsInteger:=yfgldata.dwyj1.fieldbyname('數(shù)量').AsInteger;
yfgldata.yjtemp.Post;
end;
yfgldata.dwyj1.Next;
end;
dwyjhz.DBGridEh1.FrozenCols:=2;
dwyjhz.DBGridEh1.SumList.Active:=true;
end;
procedure Tdwyjhz.CheckBox1Click(Sender: TObject);
begin
dwyjhz.DBGridEh1.Columns[0].Visible:=dwyjhz.CheckBox1.Checked;
end;
procedure Tdwyjhz.SpeedButton1Click(Sender: TObject);
begin
if dwyjhz.TeThemeEdit1.Text<>'' then
begin
dwyjhz.PrintDBGridEh1.PageHeader.CenterText.Clear;
dwyjhz.PrintDBGridEh1.PageHeader.CenterText.Add(dwyjhz.TeThemeEdit1.Text);
dwyjhz.PrintDBGridEh1.Preview;
end
else
messagebox(dwyjhz.handle,'請(qǐng)?jiān)趫?bào)表上側(cè)輸入報(bào)表標(biāo)題。','營(yíng)房工作管理系統(tǒng)',16);
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -