?? xgyhsdffrm.pas
字號:
unit xgyhsdffrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Mask, DBCtrls, DBCtrlsEh, ExtCtrls, Buttons;
type
Txgyhsdf = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label6: TLabel;
Label9: TLabel;
Label8: TLabel;
Label5: TLabel;
Label11: TLabel;
Label10: TLabel;
Label7: TLabel;
Label12: TLabel;
Panel1: TPanel;
DBNumberEditEh1: TDBNumberEditEh;
DBNumberEditEh2: TDBNumberEditEh;
DBNumberEditEh3: TDBNumberEditEh;
DBNumberEditEh4: TDBNumberEditEh;
DBNumberEditEh5: TDBNumberEditEh;
DBNumberEditEh6: TDBNumberEditEh;
Panel2: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
DBNumberEditEh7: TDBNumberEditEh;
DBNumberEditEh9: TDBNumberEditEh;
DBNumberEditEh10: TDBNumberEditEh;
DBNumberEditEh11: TDBNumberEditEh;
DBNumberEditEh12: TDBNumberEditEh;
DBEditEh1: TDBEditEh;
procedure FormActivate(Sender: TObject);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
private
{ Private declarations }
procedure showdata;
public
{ Public declarations }
end;
var
xgyhsdf: Txgyhsdf;
implementation
uses datafrm,yhsdffrm,sdyhdwfrm;
{$R *.dfm}
procedure Txgyhsdf.FormActivate(Sender: TObject);
begin
yfgldata.sdf.Filter:='年度='+floattostr(yhsdf.DBNumberEditEh1.Value)+' and 月份='+floattostr(yhsdf.DBNumberEditEh2.Value);
yfgldata.sdf.Filtered:=true;
yfgldata.sdf.FindFirst;
xgyhsdf.DBNumberEditEh7.Value:=yfgldata.sdf.FieldByName('序號').AsInteger;
xgyhsdf.DBEditEh1.Text:=yfgldata.sdf.FieldByName('姓名').AsString;
xgyhsdf.DBNumberEditEh1.Value:=yfgldata.sdf.FieldByName('用氣量').AsFloat;
xgyhsdf.DBNumberEditEh9.Value:=yfgldata.sdf.FieldByName('煤氣費').AsFloat;
xgyhsdf.DBNumberEditEh2.Value:=yfgldata.sdf.FieldByName('用水量').AsFloat;
xgyhsdf.DBNumberEditEh4.Value:=yfgldata.sdf.FieldByName('用水補助').AsFloat;
xgyhsdf.DBNumberEditEh10.Value:=yfgldata.sdf.FieldByName('水費').AsFloat;
xgyhsdf.DBNumberEditEh3.Value:=yfgldata.sdf.FieldByName('用電量').AsFloat;
xgyhsdf.DBNumberEditEh5.Value:=yfgldata.sdf.FieldByName('用電補助').AsFloat;
xgyhsdf.DBNumberEditEh11.Value:=yfgldata.sdf.FieldByName('電費').AsFloat;
xgyhsdf.DBNumberEditEh6.Value:=yfgldata.sdf.FieldByName('房租').AsFloat;
xgyhsdf.DBNumberEditEh12.Value:=yfgldata.sdf.FieldByName('合計').AsFloat;
xgyhsdf.showdata;
end;
procedure txgyhsdf.showdata;
begin
xgyhsdf.SpeedButton1.Enabled:=(yfgldata.sdf.RecNo<>1) and (yfgldata.sdf.RecordCount>0);
xgyhsdf.SpeedButton2.Enabled:=(yfgldata.sdf.RecNo<>1) and (yfgldata.sdf.RecordCount>0);
xgyhsdf.SpeedButton3.Enabled:=(yfgldata.sdf.RecNo<>yfgldata.sdf.RecordCount) and (yfgldata.sdf.RecordCount>0);
xgyhsdf.SpeedButton4.Enabled:=(yfgldata.sdf.RecNo<>yfgldata.sdf.RecordCount) and (yfgldata.sdf.RecordCount>0);
end;
procedure Txgyhsdf.SpeedButton5Click(Sender: TObject);
begin
yfgldata.sdf.Filtered:=false;
yfgldata.sdf.FindFirst;
if yfgldata.qyhsdf.Active then
yfgldata.qyhsdf.Active:=false;
yfgldata.qyhsdf.Params[0].AsInteger:=yhsdf.DBNumberEditEh1.Value;
yfgldata.qyhsdf.Params[1].AsInteger:=yhsdf.DBNumberEditEh2.Value;
yfgldata.qyhsdf.Active:=true;
yhsdf.showyhsdf;
close;
end;
procedure Txgyhsdf.SpeedButton1Click(Sender: TObject);
begin
yfgldata.sdf.FindFirst;
xgyhsdf.DBNumberEditEh7.Value:=yfgldata.sdf.FieldByName('序號').AsInteger;
xgyhsdf.DBEditEh1.Text:=yfgldata.sdf.FieldByName('姓名').AsString;
xgyhsdf.DBNumberEditEh1.Value:=yfgldata.sdf.FieldByName('用氣量').AsFloat;
xgyhsdf.DBNumberEditEh9.Value:=yfgldata.sdf.FieldByName('煤氣費').AsFloat;
xgyhsdf.DBNumberEditEh2.Value:=yfgldata.sdf.FieldByName('用水量').AsFloat;
xgyhsdf.DBNumberEditEh4.Value:=yfgldata.sdf.FieldByName('用水補助').AsFloat;
xgyhsdf.DBNumberEditEh10.Value:=yfgldata.sdf.FieldByName('水費').AsFloat;
xgyhsdf.DBNumberEditEh3.Value:=yfgldata.sdf.FieldByName('用電量').AsFloat;
xgyhsdf.DBNumberEditEh5.Value:=yfgldata.sdf.FieldByName('用電補助').AsFloat;
xgyhsdf.DBNumberEditEh11.Value:=yfgldata.sdf.FieldByName('電費').AsFloat;
xgyhsdf.DBNumberEditEh6.Value:=yfgldata.sdf.FieldByName('房租').AsFloat;
xgyhsdf.DBNumberEditEh12.Value:=yfgldata.sdf.FieldByName('合計').AsFloat;
xgyhsdf.showdata;
end;
procedure Txgyhsdf.SpeedButton2Click(Sender: TObject);
begin
yfgldata.sdf.FindPrior;
xgyhsdf.DBNumberEditEh7.Value:=yfgldata.sdf.FieldByName('序號').AsInteger;
xgyhsdf.DBEditEh1.Text:=yfgldata.sdf.FieldByName('姓名').AsString;
xgyhsdf.DBNumberEditEh1.Value:=yfgldata.sdf.FieldByName('用氣量').AsFloat;
xgyhsdf.DBNumberEditEh9.Value:=yfgldata.sdf.FieldByName('煤氣費').AsFloat;
xgyhsdf.DBNumberEditEh2.Value:=yfgldata.sdf.FieldByName('用水量').AsFloat;
xgyhsdf.DBNumberEditEh4.Value:=yfgldata.sdf.FieldByName('用水補助').AsFloat;
xgyhsdf.DBNumberEditEh10.Value:=yfgldata.sdf.FieldByName('水費').AsFloat;
xgyhsdf.DBNumberEditEh3.Value:=yfgldata.sdf.FieldByName('用電量').AsFloat;
xgyhsdf.DBNumberEditEh5.Value:=yfgldata.sdf.FieldByName('用電補助').AsFloat;
xgyhsdf.DBNumberEditEh11.Value:=yfgldata.sdf.FieldByName('電費').AsFloat;
xgyhsdf.DBNumberEditEh6.Value:=yfgldata.sdf.FieldByName('房租').AsFloat;
xgyhsdf.DBNumberEditEh12.Value:=yfgldata.sdf.FieldByName('合計').AsFloat;
xgyhsdf.showdata;
end;
procedure Txgyhsdf.SpeedButton3Click(Sender: TObject);
begin
yfgldata.sdf.FindNext;
xgyhsdf.DBNumberEditEh7.Value:=yfgldata.sdf.FieldByName('序號').AsInteger;
xgyhsdf.DBEditEh1.Text:=yfgldata.sdf.FieldByName('姓名').AsString;
xgyhsdf.DBNumberEditEh1.Value:=yfgldata.sdf.FieldByName('用氣量').AsFloat;
xgyhsdf.DBNumberEditEh9.Value:=yfgldata.sdf.FieldByName('煤氣費').AsFloat;
xgyhsdf.DBNumberEditEh2.Value:=yfgldata.sdf.FieldByName('用水量').AsFloat;
xgyhsdf.DBNumberEditEh4.Value:=yfgldata.sdf.FieldByName('用水補助').AsFloat;
xgyhsdf.DBNumberEditEh10.Value:=yfgldata.sdf.FieldByName('水費').AsFloat;
xgyhsdf.DBNumberEditEh3.Value:=yfgldata.sdf.FieldByName('用電量').AsFloat;
xgyhsdf.DBNumberEditEh5.Value:=yfgldata.sdf.FieldByName('用電補助').AsFloat;
xgyhsdf.DBNumberEditEh11.Value:=yfgldata.sdf.FieldByName('電費').AsFloat;
xgyhsdf.DBNumberEditEh6.Value:=yfgldata.sdf.FieldByName('房租').AsFloat;
xgyhsdf.DBNumberEditEh12.Value:=yfgldata.sdf.FieldByName('合計').AsFloat;
xgyhsdf.showdata;
end;
procedure Txgyhsdf.SpeedButton4Click(Sender: TObject);
begin
yfgldata.sdf.FindLast;
xgyhsdf.DBNumberEditEh7.Value:=yfgldata.sdf.FieldByName('序號').AsInteger;
xgyhsdf.DBEditEh1.Text:=yfgldata.sdf.FieldByName('姓名').AsString;
xgyhsdf.DBNumberEditEh1.Value:=yfgldata.sdf.FieldByName('用氣量').AsFloat;
xgyhsdf.DBNumberEditEh9.Value:=yfgldata.sdf.FieldByName('煤氣費').AsFloat;
xgyhsdf.DBNumberEditEh2.Value:=yfgldata.sdf.FieldByName('用水量').AsFloat;
xgyhsdf.DBNumberEditEh4.Value:=yfgldata.sdf.FieldByName('用水補助').AsFloat;
xgyhsdf.DBNumberEditEh10.Value:=yfgldata.sdf.FieldByName('水費').AsFloat;
xgyhsdf.DBNumberEditEh3.Value:=yfgldata.sdf.FieldByName('用電量').AsFloat;
xgyhsdf.DBNumberEditEh5.Value:=yfgldata.sdf.FieldByName('用電補助').AsFloat;
xgyhsdf.DBNumberEditEh11.Value:=yfgldata.sdf.FieldByName('電費').AsFloat;
xgyhsdf.DBNumberEditEh6.Value:=yfgldata.sdf.FieldByName('房租').AsFloat;
xgyhsdf.DBNumberEditEh12.Value:=yfgldata.sdf.FieldByName('合計').AsFloat;
xgyhsdf.showdata;
end;
procedure Txgyhsdf.SpeedButton6Click(Sender: TObject);
begin
application.CreateForm(tsdyhdw,sdyhdw);
try
sdyhdw.ShowModal;
finally
sdyhdw.Free;
end;
end;
procedure Txgyhsdf.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
begin
yfgldata.sdf.Edit;
yfgldata.sdf.FieldByName('用氣量').AsFloat:=xgyhsdf.DBNumberEditEh1.Value;
yfgldata.sdf.FieldByName('煤氣費').AsFloat:=xgyhsdf.DBNumberEditEh1.Value*yfgldata.sdjg.FieldByName('煤氣價').AsFloat;
if xgyhsdf.DBNumberEditEh2.Value>xgyhsdf.DBNumberEditEh4.Value then
xgyhsdf.DBNumberEditEh10.Value:=(xgyhsdf.DBNumberEditEh2.Value-xgyhsdf.DBNumberEditEh4.Value)*yfgldata.sdjg.FieldValues['水價']
else
xgyhsdf.DBNumberEditEh10.Value:=0;
yfgldata.sdf.FieldByName('用水量').AsFloat:=xgyhsdf.DBNumberEditEh2.Value;
yfgldata.sdf.FieldByName('用水補助').AsFloat:=xgyhsdf.DBNumberEditEh4.Value;
yfgldata.sdf.FieldByName('水費').AsFloat:=xgyhsdf.DBNumberEditEh10.Value;
if xgyhsdf.DBNumberEditEh3.Value>xgyhsdf.DBNumberEditEh5.Value then
xgyhsdf.DBNumberEditEh11.Value:=(xgyhsdf.DBNumberEditEh3.Value-xgyhsdf.DBNumberEditEh5.Value)*yfgldata.sdjg.FieldByName('電價').AsFloat
else
xgyhsdf.DBNumberEditEh11.Value:=0;
yfgldata.sdf.edit;
yfgldata.sdf.FieldByName('用電量').AsFloat:=xgyhsdf.DBNumberEditEh3.Value;
yfgldata.sdf.FieldByName('用電補助').AsFloat:=xgyhsdf.DBNumberEditEh5.Value;
yfgldata.sdf.FieldByName('電費').AsFloat:=xgyhsdf.DBNumberEditEh11.Value;
yfgldata.sdf.FieldByName('房租').AsFloat:=xgyhsdf.DBNumberEditEh6.Value;
yfgldata.sdf.FieldByName('合計').AsFloat:=xgyhsdf.DBNumberEditEh6.Value+xgyhsdf.DBNumberEditEh9.Value+xgyhsdf.DBNumberEditEh10.Value+xgyhsdf.DBNumberEditEh11.Value;
yfgldata.sdf.Post;
xgyhsdf.DBNumberEditEh9.Value:=yfgldata.sdf.FieldByName('煤氣費').AsFloat;
xgyhsdf.DBNumberEditEh12.Value:=yfgldata.sdf.FieldByName('合計').AsFloat;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -