xgyhsdffrm.pas

来自「本人编写的有关军队营房工作的管理系统」· PAS 代码 · 共 219 行

PAS
219
字号
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 + =
减小字号Ctrl + -
显示快捷键?